-#include "mutt.h"
-#include "mailbox.h"
-#include "mutt_crypt.h"
-
-#include <limits.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <unistd.h>
-
-typedef struct hook
-{
- int type; /* hook type */
- REGEXP rx; /* regular expression */
- char *command; /* filename, command or pattern to execute */
- pattern_t *pattern; /* used for fcc,save,send-hook */
- struct hook *next;
-} HOOK;
-
-static HOOK *Hooks = NULL;
+#include <lib-lib/lib-lib.h>
+#include <lib-lua/lib-lua.h>
+#include <lib-ui/curses.h>
+#include <lib-mx/mx.h>
+#include <lib-mx/compress.h>
+#include <lib-crypt/crypt.h>
+
+#include "alias.h"
+#include "pattern.h"
+
+typedef struct hook_t {
+ int type; /* hook type */
+ rx_t rx; /* regular expression */
+ char *command; /* filename, command or pattern to execute */
+ pattern_t *pattern; /* used for fcc,save,send-hook */
+ struct hook_t *next;
+} hook_t;
+
+DO_INIT(hook_t, hook);
+static inline void hook_wipe(hook_t *hk) {
+ p_delete(&hk->command);
+ pattern_list_wipe(&hk->pattern);
+}
+DO_NEW(hook_t, hook);
+DO_DELETE(hook_t, hook);
+DO_SLIST(hook_t, hook, hook_delete);