]> granicus.if.org Git - neomutt/commitdiff
rename hook constants
authorRichard Russon <rich@flatcap.org>
Thu, 12 Jul 2018 16:05:01 +0000 (17:05 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 16 Jul 2018 22:38:22 +0000 (23:38 +0100)
commands.c
compose.c
compress.c
curs_main.c
hook.c
hook.h
init.h
main.c
mx.c
recvattach.c
send.c

index 21db2d6856b552623deed9ca9317ca93570b342b..dbab43a1ee0dcfd0fe7a55bf26048d0fa490d7e9 100644 (file)
@@ -99,7 +99,7 @@ int mutt_display_message(struct Header *cur)
   snprintf(buf, sizeof(buf), "%s/%s", TYPE(cur->content), cur->content->subtype);
 
   mutt_parse_mime_message(Context, cur);
-  mutt_message_hook(Context, cur, MUTT_MESSAGEHOOK);
+  mutt_message_hook(Context, cur, MUTT_MESSAGE_HOOK);
 
   /* see if crypto is needed for this message.  if so, we should exit curses */
   if ((WithCrypto != 0) && cur->security)
@@ -420,7 +420,7 @@ static int pipe_message(struct Header *h, char *cmd, int decode, int print,
 
   if (h)
   {
-    mutt_message_hook(Context, h, MUTT_MESSAGEHOOK);
+    mutt_message_hook(Context, h, MUTT_MESSAGE_HOOK);
 
     if ((WithCrypto != 0) && decode)
     {
@@ -453,7 +453,7 @@ static int pipe_message(struct Header *h, char *cmd, int decode, int print,
         if (!message_is_tagged(Context, i))
           continue;
 
-        mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGEHOOK);
+        mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGE_HOOK);
         mutt_parse_mime_message(Context, Context->hdrs[i]);
         if (Context->hdrs[i]->security & ENCRYPT &&
             !crypt_valid_passphrase(Context->hdrs[i]->security))
@@ -470,7 +470,7 @@ static int pipe_message(struct Header *h, char *cmd, int decode, int print,
         if (!message_is_tagged(Context, i))
           continue;
 
-        mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGEHOOK);
+        mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGE_HOOK);
         mutt_endwin();
         thepid = mutt_create_filter(cmd, &fpout, NULL, NULL);
         if (thepid < 0)
@@ -504,7 +504,7 @@ static int pipe_message(struct Header *h, char *cmd, int decode, int print,
         if (!message_is_tagged(Context, i))
           continue;
 
-        mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGEHOOK);
+        mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGE_HOOK);
         pipe_msg(Context->hdrs[i], fpout, decode, print);
         /* add the message separator */
         if (sep)
@@ -835,7 +835,7 @@ int mutt_save_message(struct Header *h, int delete, int decode, int decrypt)
       need_passphrase = (h->security & ENCRYPT);
       app = h->security;
     }
-    mutt_message_hook(Context, h, MUTT_MESSAGEHOOK);
+    mutt_message_hook(Context, h, MUTT_MESSAGE_HOOK);
     mutt_default_save(buf, sizeof(buf), h);
   }
   else
@@ -852,7 +852,7 @@ int mutt_save_message(struct Header *h, int delete, int decode, int decrypt)
 
     if (h)
     {
-      mutt_message_hook(Context, h, MUTT_MESSAGEHOOK);
+      mutt_message_hook(Context, h, MUTT_MESSAGE_HOOK);
       mutt_default_save(buf, sizeof(buf), h);
       if (WithCrypto)
       {
@@ -959,7 +959,7 @@ int mutt_save_message(struct Header *h, int delete, int decode, int decrypt)
         if (!message_is_tagged(Context, i))
           continue;
 
-        mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGEHOOK);
+        mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGE_HOOK);
         rc = mutt_save_message_ctx(Context->hdrs[i], delete, decode, decrypt, &ctx);
         if (rc != 0)
           break;
index b15c835b23ae560573aa567780ebf2b52f34d963..e18e4369e7de5cb890f76eb1d4f9f58fa6e856c5 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -883,7 +883,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
     {
       case OP_COMPOSE_EDIT_FROM:
         edit_address_list(HDR_FROM, &msg->env->from);
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
       case OP_COMPOSE_EDIT_TO:
 #ifdef USE_NNTP
@@ -896,7 +896,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           crypt_opportunistic_encrypt(msg);
           redraw_crypt_lines(msg);
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
       case OP_COMPOSE_EDIT_BCC:
 #ifdef USE_NNTP
@@ -909,7 +909,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           crypt_opportunistic_encrypt(msg);
           redraw_crypt_lines(msg);
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
       case OP_COMPOSE_EDIT_CC:
 #ifdef USE_NNTP
@@ -922,7 +922,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           crypt_opportunistic_encrypt(msg);
           redraw_crypt_lines(msg);
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 #ifdef USE_NNTP
       case OP_COMPOSE_EDIT_NEWSGROUPS:
@@ -994,11 +994,11 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           else
             mutt_window_clrtoeol(MuttIndexWindow);
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
       case OP_COMPOSE_EDIT_REPLY_TO:
         edit_address_list(HDR_REPLYTO, &msg->env->reply_to);
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
       case OP_COMPOSE_EDIT_FCC:
         mutt_str_strfcpy(buf, fcc, sizeof(buf));
@@ -1010,7 +1010,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           mutt_paddstr(W, fcc);
           fcc_set = 1;
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
       case OP_COMPOSE_EDIT_MESSAGE:
         if (Editor && (mutt_str_strcmp("builtin", Editor) != 0) && !EditHeaders)
@@ -1018,7 +1018,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           mutt_edit_file(Editor, msg->content->filename);
           mutt_update_encoding(msg->content);
           menu->redraw = REDRAW_FULL;
-          mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+          mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
           break;
         }
       /* fallthrough */
@@ -1055,7 +1055,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         }
 
         menu->redraw = REDRAW_FULL;
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_ATTACH_KEY:
@@ -1073,7 +1073,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
 
         menu->redraw |= REDRAW_STATUS;
 
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_MOVE_UP:
@@ -1330,7 +1330,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
 
         menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
       }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_ATTACH_MESSAGE:
@@ -1455,7 +1455,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         Sort = old_sort;
         SortAux = old_sort_aux;
       }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_DELETE:
@@ -1468,7 +1468,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         if (menu->current == 0)
           msg->content = actx->idx[0]->content;
 
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_TOGGLE_RECODE:
@@ -1485,7 +1485,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         else
           mutt_message(_("The current attachment will be converted."));
         menu->redraw = REDRAW_CURRENT;
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
       }
 
@@ -1500,7 +1500,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           mutt_str_replace(&CURATTACH->content->description, buf);
           menu->redraw = REDRAW_CURRENT;
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_UPDATE_ENCODING:
@@ -1520,7 +1520,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           mutt_update_encoding(CURATTACH->content);
           menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_TOGGLE_DISPOSITION:
@@ -1540,7 +1540,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
 
           menu->redraw = REDRAW_CURRENT;
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_EDIT_LANGUAGE:
@@ -1556,7 +1556,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         }
         else
           mutt_warning(_("Empty Content-Language"));
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_EDIT_ENCODING:
@@ -1574,7 +1574,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           else
             mutt_error(_("Invalid encoding."));
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_SEND_MESSAGE:
@@ -1612,7 +1612,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         mutt_edit_file(NONULL(Editor), CURATTACH->content->filename);
         mutt_update_encoding(CURATTACH->content);
         menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_TOGGLE_UNLINK:
@@ -1690,7 +1690,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           if (CURATTACH->content->stamp >= st.st_mtime)
             mutt_stamp_attachment(CURATTACH->content);
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_NEW_MIME:
@@ -1758,7 +1758,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           menu->redraw = REDRAW_FULL;
         }
       }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_COMPOSE_EDIT_MIME:
@@ -1768,7 +1768,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
           mutt_update_encoding(CURATTACH->content);
           menu->redraw = REDRAW_FULL;
         }
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_VIEW_ATTACH:
@@ -1800,7 +1800,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         if (op == OP_FILTER) /* cte might have changed */
           menu->redraw = menu->tagprefix ? REDRAW_FULL : REDRAW_CURRENT;
         menu->redraw |= REDRAW_STATUS;
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_EXIT:
@@ -1906,7 +1906,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         }
         msg->security = crypt_pgp_send_menu(msg);
         redraw_crypt_lines(msg);
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
       case OP_FORGET_PASSPHRASE:
@@ -1940,14 +1940,14 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
         }
         msg->security = crypt_smime_send_menu(msg);
         redraw_crypt_lines(msg);
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 
 #ifdef MIXMASTER
       case OP_COMPOSE_MIX:
 
         mix_make_chain(&msg->chain);
-        mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+        mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
         break;
 #endif
     }
index 9a9d9dc67dacf6a4322957cad09a313ec33acaa8..bf6a7b43b34f14875a5e6b6c47b386c1c6582070 100644 (file)
@@ -213,7 +213,7 @@ static void store_size(const struct Context *ctx)
 
 /**
  * find_hook - Find a hook to match a path
- * @param type Type of hook, e.g. #MUTT_CLOSEHOOK
+ * @param type Type of hook, e.g. #MUTT_CLOSE_HOOK
  * @param path Filename to test
  * @retval ptr  Matching hook command
  * @retval NULL No matches
@@ -225,7 +225,7 @@ static void store_size(const struct Context *ctx)
  *      open-hook '\.gz$' "gzip -cd '%f' > '%t'"
  *
  * Call:
- *      find_hook (#MUTT_OPENHOOK, "myfile.gz");
+ *      find_hook (#MUTT_OPEN_HOOK, "myfile.gz");
  */
 static const char *find_hook(int type, const char *path)
 {
@@ -256,12 +256,12 @@ static struct CompressInfo *set_compress_info(struct Context *ctx)
     return ctx->compress_info;
 
   /* Open is compulsory */
-  const char *o = find_hook(MUTT_OPENHOOK, ctx->path);
+  const char *o = find_hook(MUTT_OPEN_HOOK, ctx->path);
   if (!o)
     return NULL;
 
-  const char *c = find_hook(MUTT_CLOSEHOOK, ctx->path);
-  const char *a = find_hook(MUTT_APPENDHOOK, ctx->path);
+  const char *c = find_hook(MUTT_CLOSE_HOOK, ctx->path);
+  const char *a = find_hook(MUTT_APPEND_HOOK, ctx->path);
 
   struct CompressInfo *ci = mutt_mem_calloc(1, sizeof(struct CompressInfo));
   ctx->compress_info = ci;
@@ -829,7 +829,7 @@ bool mutt_comp_can_read(const char *path)
   if (!path)
     return false;
 
-  if (find_hook(MUTT_OPENHOOK, path))
+  if (find_hook(MUTT_OPEN_HOOK, path))
     return true;
   else
     return false;
index 17c9ec24b2344a655e717027a1d64973c9859b35..aab9176543e62a77cd9a21894507786756bda355 100644 (file)
@@ -1538,7 +1538,7 @@ int mutt_index_menu(void)
 
           oldcount = Context ? Context->msgcount : 0;
 
-          mutt_startup_shutdown_hook(MUTT_SHUTDOWNHOOK);
+          mutt_startup_shutdown_hook(MUTT_SHUTDOWN_HOOK);
 
           if (!Context || (check = mx_mbox_close(Context, &index_hint)) == 0)
             done = true;
diff --git a/hook.c b/hook.c
index 7540e14206339bc230a17d328803c568780c76d0..dc65fa9379d2bd916f1eb30b8e3d763bb2b28abb 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -97,7 +97,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
   mutt_buffer_init(&pattern);
   mutt_buffer_init(&command);
 
-  if (~data & MUTT_GLOBALHOOK) /* NOT a global hook */
+  if (~data & MUTT_GLOBAL_HOOK) /* NOT a global hook */
   {
     if (*s->dptr == '!')
     {
@@ -116,8 +116,8 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
   }
 
   mutt_extract_token(&command, s,
-                     (data & (MUTT_FOLDERHOOK | MUTT_SENDHOOK | MUTT_SEND2HOOK |
-                              MUTT_ACCOUNTHOOK | MUTT_REPLYHOOK)) ?
+                     (data & (MUTT_FOLDER_HOOK | MUTT_SEND_HOOK | MUTT_SEND2_HOOK |
+                              MUTT_ACCOUNT_HOOK | MUTT_REPLY_HOOK)) ?
                          MUTT_TOKEN_SPACE :
                          0);
 
@@ -133,7 +133,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
     goto error;
   }
 
-  if (data & (MUTT_FOLDERHOOK | MUTT_MBOXHOOK))
+  if (data & (MUTT_FOLDER_HOOK | MUTT_MBOX_HOOK))
   {
     /* Accidentally using the ^ mailbox shortcut in the .neomuttrc is a
      * common mistake */
@@ -159,7 +159,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
     pattern.data = mutt_str_strdup(path);
   }
 #ifdef USE_COMPRESSED
-  else if (data & (MUTT_APPENDHOOK | MUTT_OPENHOOK | MUTT_CLOSEHOOK))
+  else if (data & (MUTT_APPEND_HOOK | MUTT_OPEN_HOOK | MUTT_CLOSE_HOOK))
   {
     if (mutt_comp_valid_command(command.data) == 0)
     {
@@ -168,9 +168,9 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
     }
   }
 #endif
-  else if (DefaultHook && (~data & MUTT_GLOBALHOOK) &&
-           !(data & (MUTT_CHARSETHOOK | MUTT_ICONVHOOK | MUTT_ACCOUNTHOOK)) &&
-           (!WithCrypto || !(data & MUTT_CRYPTHOOK)))
+  else if (DefaultHook && (~data & MUTT_GLOBAL_HOOK) &&
+           !(data & (MUTT_CHARSET_HOOK | MUTT_ICONV_HOOK | MUTT_ACCOUNT_HOOK)) &&
+           (!WithCrypto || !(data & MUTT_CRYPT_HOOK)))
   {
     char tmp[HUGE_STRING];
 
@@ -185,7 +185,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
     pattern.data = mutt_str_strdup(tmp);
   }
 
-  if (data & (MUTT_MBOXHOOK | MUTT_SAVEHOOK | MUTT_FCCHOOK))
+  if (data & (MUTT_MBOX_HOOK | MUTT_SAVE_HOOK | MUTT_FCC_HOOK))
   {
     mutt_str_strfcpy(path, command.data, sizeof(path));
     mutt_expand_path(path, sizeof(path));
@@ -197,7 +197,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
   /* check to make sure that a matching hook doesn't already exist */
   TAILQ_FOREACH(ptr, &Hooks, entries)
   {
-    if (data & MUTT_GLOBALHOOK)
+    if (data & MUTT_GLOBAL_HOOK)
     {
       /* Ignore duplicate global hooks */
       if (mutt_str_strcmp(ptr->command, command.data) == 0)
@@ -209,9 +209,9 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
     else if (ptr->type == data &&
              ptr->regex.not == not&&(mutt_str_strcmp(pattern.data, ptr->regex.pattern) == 0))
     {
-      if (data & (MUTT_FOLDERHOOK | MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_MESSAGEHOOK |
-                  MUTT_ACCOUNTHOOK | MUTT_REPLYHOOK | MUTT_CRYPTHOOK |
-                  MUTT_TIMEOUTHOOK | MUTT_STARTUPHOOK | MUTT_SHUTDOWNHOOK))
+      if (data & (MUTT_FOLDER_HOOK | MUTT_SEND_HOOK | MUTT_SEND2_HOOK | MUTT_MESSAGE_HOOK |
+                  MUTT_ACCOUNT_HOOK | MUTT_REPLY_HOOK | MUTT_CRYPT_HOOK |
+                  MUTT_TIMEOUT_HOOK | MUTT_STARTUP_HOOK | MUTT_SHUTDOWN_HOOK))
       {
         /* these hooks allow multiple commands with the same
          * pattern, so if we've already seen this pattern/command pair, just
@@ -238,30 +238,30 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
     }
   }
 
-  if (data & (MUTT_CHARSETHOOK | MUTT_ICONVHOOK))
+  if (data & (MUTT_CHARSET_HOOK | MUTT_ICONV_HOOK))
   {
     /* These are managed separately by the charset code */
-    enum LookupType type = (data & MUTT_CHARSETHOOK) ? MUTT_LOOKUP_CHARSET : MUTT_LOOKUP_ICONV;
+    enum LookupType type = (data & MUTT_CHARSET_HOOK) ? MUTT_LOOKUP_CHARSET : MUTT_LOOKUP_ICONV;
     if (!mutt_ch_lookup_add(type, pattern.data, command.data, err))
       goto error;
     FREE(&pattern.data);
     FREE(&command.data);
     return 0;
   }
-  else if (data & (MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_SAVEHOOK |
-                   MUTT_FCCHOOK | MUTT_MESSAGEHOOK | MUTT_REPLYHOOK))
+  else if (data & (MUTT_SEND_HOOK | MUTT_SEND2_HOOK | MUTT_SAVE_HOOK |
+                   MUTT_FCC_HOOK | MUTT_MESSAGE_HOOK | MUTT_REPLY_HOOK))
   {
     pat = mutt_pattern_comp(
         pattern.data,
-        (data & (MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_FCCHOOK)) ? 0 : MUTT_FULL_MSG, err);
+        (data & (MUTT_SEND_HOOK | MUTT_SEND2_HOOK | MUTT_FCC_HOOK)) ? 0 : MUTT_FULL_MSG, err);
     if (!pat)
       goto error;
   }
-  else if (~data & MUTT_GLOBALHOOK) /* NOT a global hook */
+  else if (~data & MUTT_GLOBAL_HOOK) /* NOT a global hook */
   {
     /* Hooks not allowing full patterns: Check syntax of regex */
     rx = mutt_mem_malloc(sizeof(regex_t));
-    rc = REGCOMP(rx, NONULL(pattern.data), ((data & MUTT_CRYPTHOOK) ? REG_ICASE : 0));
+    rc = REGCOMP(rx, NONULL(pattern.data), ((data & MUTT_CRYPT_HOOK) ? REG_ICASE : 0));
     if (rc != 0)
     {
       regerror(rc, rx, err->data, err->dsize);
@@ -281,7 +281,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
   return 0;
 
 error:
-  if (~data & MUTT_GLOBALHOOK) /* NOT a global hook */
+  if (~data & MUTT_GLOBAL_HOOK) /* NOT a global hook */
     FREE(&pattern.data);
   FREE(&command.data);
   return -1;
@@ -305,7 +305,7 @@ static void delete_hook(struct Hook *h)
 
 /**
  * mutt_delete_hooks - Delete matching hooks
- * @param type Hook type to delete, e.g. #MUTT_SENDHOOK
+ * @param type Hook type to delete, e.g. #MUTT_SEND_HOOK
  *
  * If 0 is passed, all the hooks will be deleted.
  */
@@ -358,7 +358,7 @@ int mutt_parse_unhook(struct Buffer *buf, struct Buffer *s, unsigned long data,
         mutt_buffer_printf(err, _("unhook: unknown hook type: %s"), buf->data);
         return -1;
       }
-      if (type & (MUTT_CHARSETHOOK | MUTT_ICONVHOOK))
+      if (type & (MUTT_CHARSET_HOOK | MUTT_ICONV_HOOK))
       {
         mutt_ch_lookup_remove();
         return 0;
@@ -384,7 +384,7 @@ void mutt_folder_hook(const char *path)
   struct Hook *tmp = NULL;
   struct Buffer err, token;
 
-  current_hook_type = MUTT_FOLDERHOOK;
+  current_hook_type = MUTT_FOLDER_HOOK;
 
   mutt_buffer_init(&err);
   err.dsize = STRING;
@@ -395,7 +395,7 @@ void mutt_folder_hook(const char *path)
     if (!tmp->command)
       continue;
 
-    if (tmp->type & MUTT_FOLDERHOOK)
+    if (tmp->type & MUTT_FOLDER_HOOK)
     {
       if ((regexec(tmp->regex.regex, path, 0, NULL, 0) == 0) ^ tmp->regex.not)
       {
@@ -419,7 +419,7 @@ void mutt_folder_hook(const char *path)
 
 /**
  * mutt_find_hook - Find a matching hook
- * @param type Type, e.g. #MUTT_FOLDERHOOK
+ * @param type Type, e.g. #MUTT_FOLDER_HOOK
  * @param pat  Pattern to match
  * @retval ptr Command string
  *
@@ -444,7 +444,7 @@ char *mutt_find_hook(int type, const char *pat)
  * mutt_message_hook - Perform a message hook
  * @param ctx Mailbox Context
  * @param hdr Email Header
- * @param type Hook type, e.g. #MUTT_MESSAGEHOOK
+ * @param type Hook type, e.g. #MUTT_MESSAGE_HOOK
  */
 void mutt_message_hook(struct Context *ctx, struct Header *hdr, int type)
 {
@@ -493,7 +493,7 @@ void mutt_message_hook(struct Context *ctx, struct Header *hdr, int type)
  * addr_hook - Perform an address hook (get a path)
  * @param path    Buffer for path
  * @param pathlen Length of buffer
- * @param type    Type e.g. #MUTT_FCCHOOK
+ * @param type    Type e.g. #MUTT_FCC_HOOK
  * @param ctx     Mailbox Context
  * @param hdr     Email Header
  * @retval  0 Success
@@ -534,7 +534,7 @@ static int addr_hook(char *path, size_t pathlen, int type, struct Context *ctx,
 void mutt_default_save(char *path, size_t pathlen, struct Header *hdr)
 {
   *path = '\0';
-  if (addr_hook(path, pathlen, MUTT_SAVEHOOK, Context, hdr) == 0)
+  if (addr_hook(path, pathlen, MUTT_SAVE_HOOK, Context, hdr) == 0)
     return;
 
   struct Address *addr = NULL;
@@ -567,7 +567,7 @@ void mutt_default_save(char *path, size_t pathlen, struct Header *hdr)
  */
 void mutt_select_fcc(char *path, size_t pathlen, struct Header *hdr)
 {
-  if (addr_hook(path, pathlen, MUTT_FCCHOOK, NULL, hdr) != 0)
+  if (addr_hook(path, pathlen, MUTT_FCC_HOOK, NULL, hdr) != 0)
   {
     struct Envelope *env = hdr->env;
     if ((SaveName || ForceName) && (env->to || env->cc || env->bcc))
@@ -589,7 +589,7 @@ void mutt_select_fcc(char *path, size_t pathlen, struct Header *hdr)
  * list_hook - Find hook strings matching
  * @param[out] matches List of hook strings
  * @param[in]  match   String to match
- * @param[in]  hook    Hook type, e.g. #MUTT_CRYPTHOOK
+ * @param[in]  hook    Hook type, e.g. #MUTT_CRYPT_HOOK
  */
 static void list_hook(struct ListHead *matches, const char *match, int hook)
 {
@@ -614,7 +614,7 @@ static void list_hook(struct ListHead *matches, const char *match, int hook)
  */
 void mutt_crypt_hook(struct ListHead *list, struct Address *addr)
 {
-  list_hook(list, addr->mailbox, MUTT_CRYPTHOOK);
+  list_hook(list, addr->mailbox, MUTT_CRYPT_HOOK);
 }
 
 #ifdef USE_SOCKET
@@ -643,7 +643,7 @@ void mutt_account_hook(const char *url)
 
   TAILQ_FOREACH(hook, &Hooks, entries)
   {
-    if (!(hook->command && (hook->type & MUTT_ACCOUNTHOOK)))
+    if (!(hook->command && (hook->type & MUTT_ACCOUNT_HOOK)))
       continue;
 
     if ((regexec(hook->regex.regex, url, 0, NULL, 0) == 0) ^ hook->regex.not)
@@ -689,7 +689,7 @@ void mutt_timeout_hook(void)
 
   TAILQ_FOREACH(hook, &Hooks, entries)
   {
-    if (!(hook->command && (hook->type & MUTT_TIMEOUTHOOK)))
+    if (!(hook->command && (hook->type & MUTT_TIMEOUT_HOOK)))
       continue;
 
     if (mutt_parse_rc_line(hook->command, &token, &err) == -1)
@@ -706,7 +706,7 @@ void mutt_timeout_hook(void)
 
 /**
  * mutt_startup_shutdown_hook - Execute any startup/shutdown hooks
- * @param type Hook type: MUTT_STARTUPHOOK or MUTT_SHUTDOWNHOOK
+ * @param type Hook type: MUTT_STARTUP_HOOK or MUTT_SHUTDOWN_HOOK
  *
  * The user can configure hooks to be run on startup/shutdown.
  * This function finds all the matching hooks and executes them.
diff --git a/hook.h b/hook.h
index d6e616be9c6cd706e881eaeddd7dcc797b58dd88..1a82e5b101b110567de764fdc9d461d8faccb93f 100644 (file)
--- a/hook.h
+++ b/hook.h
@@ -38,27 +38,27 @@ extern bool  ForceName;
 extern bool  SaveName;
 
 /* types for mutt_parse_hook() */
-#define MUTT_FOLDERHOOK   (1 << 0)
-#define MUTT_MBOXHOOK     (1 << 1)
-#define MUTT_SENDHOOK     (1 << 2)
-#define MUTT_FCCHOOK      (1 << 3)
-#define MUTT_SAVEHOOK     (1 << 4)
-#define MUTT_CHARSETHOOK  (1 << 5)
-#define MUTT_ICONVHOOK    (1 << 6)
-#define MUTT_MESSAGEHOOK  (1 << 7)
-#define MUTT_CRYPTHOOK    (1 << 8)
-#define MUTT_ACCOUNTHOOK  (1 << 9)
-#define MUTT_REPLYHOOK    (1 << 10)
-#define MUTT_SEND2HOOK    (1 << 11)
+#define MUTT_FOLDER_HOOK   (1 << 0)
+#define MUTT_MBOX_HOOK     (1 << 1)
+#define MUTT_SEND_HOOK     (1 << 2)
+#define MUTT_FCC_HOOK      (1 << 3)
+#define MUTT_SAVE_HOOK     (1 << 4)
+#define MUTT_CHARSET_HOOK  (1 << 5)
+#define MUTT_ICONV_HOOK    (1 << 6)
+#define MUTT_MESSAGE_HOOK  (1 << 7)
+#define MUTT_CRYPT_HOOK    (1 << 8)
+#define MUTT_ACCOUNT_HOOK  (1 << 9)
+#define MUTT_REPLY_HOOK    (1 << 10)
+#define MUTT_SEND2_HOOK    (1 << 11)
 #ifdef USE_COMPRESSED
-#define MUTT_OPENHOOK     (1 << 12)
-#define MUTT_APPENDHOOK   (1 << 13)
-#define MUTT_CLOSEHOOK    (1 << 14)
+#define MUTT_OPEN_HOOK     (1 << 12)
+#define MUTT_APPEND_HOOK   (1 << 13)
+#define MUTT_CLOSE_HOOK    (1 << 14)
 #endif
-#define MUTT_TIMEOUTHOOK  (1 << 15)
-#define MUTT_STARTUPHOOK  (1 << 16)
-#define MUTT_SHUTDOWNHOOK (1 << 17)
-#define MUTT_GLOBALHOOK   (1 << 18)
+#define MUTT_TIMEOUT_HOOK  (1 << 15)
+#define MUTT_STARTUP_HOOK  (1 << 16)
+#define MUTT_SHUTDOWN_HOOK (1 << 17)
+#define MUTT_GLOBAL_HOOK   (1 << 18)
 
 void  mutt_account_hook(const char *url);
 void  mutt_crypt_hook(struct ListHead *list, struct Address *addr);
diff --git a/init.h b/init.h
index 8c8ccef349cde65cdab5aa2a5f8ce823ae32cda0..d055c710b654c1999755cba253b2dd8ea0545b83 100644 (file)
--- a/init.h
+++ b/init.h
@@ -4669,34 +4669,34 @@ static int parse_group_context   (struct GroupContext **ctx,
 
 const struct Command Commands[] = {
 #ifdef USE_SOCKET
-  { "account-hook",        mutt_parse_hook,        MUTT_ACCOUNTHOOK },
+  { "account-hook",        mutt_parse_hook,        MUTT_ACCOUNT_HOOK },
 #endif
   { "alias",               parse_alias,            0 },
   { "alternates",          parse_alternates,       0 },
   { "alternative_order",   parse_stailq,           UL &AlternativeOrderList },
 #ifdef USE_COMPRESSED
-  { "append-hook",         mutt_parse_hook,        MUTT_APPENDHOOK },
+  { "append-hook",         mutt_parse_hook,        MUTT_APPEND_HOOK },
 #endif
   { "attachments",         parse_attachments,      0 },
   { "auto_view",           parse_stailq,           UL &AutoViewList },
   { "bind",                mutt_parse_bind,        0 },
-  { "charset-hook",        mutt_parse_hook,        MUTT_CHARSETHOOK },
+  { "charset-hook",        mutt_parse_hook,        MUTT_CHARSET_HOOK },
 #ifdef USE_COMPRESSED
-  { "close-hook",          mutt_parse_hook,        MUTT_CLOSEHOOK },
+  { "close-hook",          mutt_parse_hook,        MUTT_CLOSE_HOOK },
 #endif
 #ifdef HAVE_COLOR
   { "color",               mutt_parse_color,       0 },
 #endif
-  { "crypt-hook",          mutt_parse_hook,        MUTT_CRYPTHOOK },
+  { "crypt-hook",          mutt_parse_hook,        MUTT_CRYPT_HOOK },
   { "echo",                parse_echo,             0 },
   { "exec",                mutt_parse_exec,        0 },
-  { "fcc-hook",            mutt_parse_hook,        MUTT_FCCHOOK },
-  { "fcc-save-hook",       mutt_parse_hook,        MUTT_FCCHOOK | MUTT_SAVEHOOK },
+  { "fcc-hook",            mutt_parse_hook,        MUTT_FCC_HOOK },
+  { "fcc-save-hook",       mutt_parse_hook,        MUTT_FCC_HOOK | MUTT_SAVE_HOOK },
   { "finish",              parse_finish,           0 },
-  { "folder-hook",         mutt_parse_hook,        MUTT_FOLDERHOOK },
+  { "folder-hook",         mutt_parse_hook,        MUTT_FOLDER_HOOK },
   { "group",               parse_group,            MUTT_GROUP },
   { "hdr_order",           parse_stailq,           UL &HeaderOrderList },
-  { "iconv-hook",          mutt_parse_hook,        MUTT_ICONVHOOK },
+  { "iconv-hook",          mutt_parse_hook,        MUTT_ICONV_HOOK },
   { "ifdef",               parse_ifdef,            0 },
   { "ifndef",              parse_ifdef,            1 },
   { "ignore",              parse_ignore,           0 },
@@ -4708,32 +4708,32 @@ const struct Command Commands[] = {
   { "macro",               mutt_parse_macro,       0 },
   { "mailboxes",           mutt_parse_mailboxes,   0 },
   { "mailto_allow",        parse_stailq,           UL &MailToAllow },
-  { "mbox-hook",           mutt_parse_hook,        MUTT_MBOXHOOK },
-  { "message-hook",        mutt_parse_hook,        MUTT_MESSAGEHOOK },
+  { "mbox-hook",           mutt_parse_hook,        MUTT_MBOX_HOOK },
+  { "message-hook",        mutt_parse_hook,        MUTT_MESSAGE_HOOK },
   { "mime_lookup",         parse_stailq,           UL &MimeLookupList },
   { "mono",                mutt_parse_mono,        0 },
   { "my_hdr",              parse_my_hdr,           0 },
   { "nospam",              parse_spam_list,        MUTT_NOSPAM },
 #ifdef USE_COMPRESSED
-  { "open-hook",           mutt_parse_hook,        MUTT_OPENHOOK },
+  { "open-hook",           mutt_parse_hook,        MUTT_OPEN_HOOK },
 #endif
-  { "pgp-hook",            mutt_parse_hook,        MUTT_CRYPTHOOK },
+  { "pgp-hook",            mutt_parse_hook,        MUTT_CRYPT_HOOK },
   { "push",                mutt_parse_push,        0 },
-  { "reply-hook",          mutt_parse_hook,        MUTT_REPLYHOOK },
+  { "reply-hook",          mutt_parse_hook,        MUTT_REPLY_HOOK },
   { "reset",               parse_set,              MUTT_SET_RESET },
-  { "save-hook",           mutt_parse_hook,        MUTT_SAVEHOOK },
+  { "save-hook",           mutt_parse_hook,        MUTT_SAVE_HOOK },
   { "score",               mutt_parse_score,       0 },
-  { "send-hook",           mutt_parse_hook,        MUTT_SENDHOOK },
-  { "send2-hook",          mutt_parse_hook,        MUTT_SEND2HOOK },
+  { "send-hook",           mutt_parse_hook,        MUTT_SEND_HOOK },
+  { "send2-hook",          mutt_parse_hook,        MUTT_SEND2_HOOK },
   { "set",                 parse_set,              MUTT_SET_SET },
   { "setenv",              parse_setenv,           MUTT_SET_SET },
-  { "shutdown-hook",       mutt_parse_hook,        MUTT_SHUTDOWNHOOK | MUTT_GLOBALHOOK },
+  { "shutdown-hook",       mutt_parse_hook,        MUTT_SHUTDOWN_HOOK | MUTT_GLOBAL_HOOK },
 #ifdef USE_SIDEBAR
   { "sidebar_whitelist",   parse_path_list,        UL &SidebarWhitelist },
 #endif
   { "source",              parse_source,           0 },
   { "spam",                parse_spam_list,        MUTT_SPAM },
-  { "startup-hook",        mutt_parse_hook,        MUTT_STARTUPHOOK | MUTT_GLOBALHOOK },
+  { "startup-hook",        mutt_parse_hook,        MUTT_STARTUP_HOOK | MUTT_GLOBAL_HOOK },
   { "subjectrx",           parse_subjectrx_list,   UL &SubjectRegexList },
   { "subscribe",           parse_subscribe,        0 },
 #ifdef USE_IMAP
@@ -4741,7 +4741,7 @@ const struct Command Commands[] = {
 #endif
   { "tag-formats",         parse_tag_formats,      0 },
   { "tag-transforms",      parse_tag_transforms,   0 },
-  { "timeout-hook",        mutt_parse_hook,        MUTT_TIMEOUTHOOK | MUTT_GLOBALHOOK },
+  { "timeout-hook",        mutt_parse_hook,        MUTT_TIMEOUT_HOOK | MUTT_GLOBAL_HOOK },
   { "toggle",              parse_set,              MUTT_SET_INV },
   { "unalias",             parse_unalias,          0 },
   { "unalternates",        parse_unalternates,     0 },
diff --git a/main.c b/main.c
index ab1b0045fa51a7843342c20745ac748ac93de0c6..a5754e6024c00b14bd6052e806e50ba8af5d2a24 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1079,7 +1079,7 @@ int main(int argc, char *argv[], char *envp[])
     }
 
     mutt_folder_hook(folder);
-    mutt_startup_shutdown_hook(MUTT_STARTUPHOOK);
+    mutt_startup_shutdown_hook(MUTT_STARTUP_HOOK);
 
     repeat_error = true;
     Context = mx_mbox_open(folder, ((flags & MUTT_RO) || ReadOnly) ? MUTT_READONLY : 0, NULL);
diff --git a/mx.c b/mx.c
index 37a5d9574a1ae1c5c54722478fa7bf107de470cf..61c13c8e0bdfb06c0ec5a0c18950ec621baa8f99 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -765,7 +765,7 @@ int mx_mbox_close(struct Context *ctx, int *index_hint)
   if (read_msgs && Move != MUTT_NO)
   {
     int is_spool;
-    char *p = mutt_find_hook(MUTT_MBOXHOOK, ctx->path);
+    char *p = mutt_find_hook(MUTT_MBOX_HOOK, ctx->path);
     if (p)
     {
       is_spool = 1;
index 9bf317c2926ae01249da458cd8cf8214f26b7792..0af6fbc3fa82149da511b6eae7793c3d4c417793 100644 (file)
@@ -1330,7 +1330,7 @@ void mutt_view_attachments(struct Header *hdr)
   /* make sure we have parsed this message */
   mutt_parse_mime_message(Context, hdr);
 
-  mutt_message_hook(Context, hdr, MUTT_MESSAGEHOOK);
+  mutt_message_hook(Context, hdr, MUTT_MESSAGE_HOOK);
 
   struct Message *msg = mx_msg_open(Context, hdr->msgno);
   if (!msg)
diff --git a/send.c b/send.c
index 7e83d73938d34550509bd52901effb6c11686e1f..b9cdb0a7ca112f4049b831aff78e51e8a9b2783b 100644 (file)
--- a/send.c
+++ b/send.c
@@ -484,7 +484,7 @@ static int include_forward(struct Context *ctx, struct Header *cur, FILE *out)
   int chflags = CH_DECODE, cmflags = 0;
 
   mutt_parse_mime_message(ctx, cur);
-  mutt_message_hook(ctx, cur, MUTT_MESSAGEHOOK);
+  mutt_message_hook(ctx, cur, MUTT_MESSAGE_HOOK);
 
   if ((WithCrypto != 0) && (cur->security & ENCRYPT) && ForwardDecode)
   {
@@ -553,7 +553,7 @@ static int include_reply(struct Context *ctx, struct Header *cur, FILE *out)
   }
 
   mutt_parse_mime_message(ctx, cur);
-  mutt_message_hook(ctx, cur, MUTT_MESSAGEHOOK);
+  mutt_message_hook(ctx, cur, MUTT_MESSAGE_HOOK);
 
   mutt_make_attribution(ctx, cur, out);
 
@@ -1628,7 +1628,7 @@ int ci_send_message(int flags, struct Header *msg, char *tempfile,
     if ((flags & SENDREPLY) && cur)
     {
       /* change setting based upon message we are replying to */
-      mutt_message_hook(ctx, cur, MUTT_REPLYHOOK);
+      mutt_message_hook(ctx, cur, MUTT_REPLY_HOOK);
 
       /* set the replied flag for the message we are generating so that the
        * user can use ~Q in a send-hook to know when reply-hook's are also
@@ -1639,7 +1639,7 @@ int ci_send_message(int flags, struct Header *msg, char *tempfile,
 
     /* change settings based upon recipients */
 
-    mutt_message_hook(NULL, msg, MUTT_SENDHOOK);
+    mutt_message_hook(NULL, msg, MUTT_SEND_HOOK);
 
     /* Unset the replied flag from the message we are composing since it is
      * no longer required.  This is done here because the FCC'd copy of
@@ -1696,7 +1696,7 @@ int ci_send_message(int flags, struct Header *msg, char *tempfile,
    * used for setting the editor, the sendmail path, or the
    * envelope sender.
    */
-  mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+  mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
 
   /* wait until now to set the real name portion of our return address so
      that $realname can be set in a send-hook */
@@ -1770,7 +1770,7 @@ int ci_send_message(int flags, struct Header *msg, char *tempfile,
           rfc3676_space_stuff(msg);
       }
 
-      mutt_message_hook(NULL, msg, MUTT_SEND2HOOK);
+      mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
     }
 
     if (!(flags & (SENDPOSTPONED | SENDFORWARD | SENDKEY | SENDRESEND | SENDDRAFTFILE)))