diff options
-rw-r--r-- | commands.c | 10 | ||||
-rw-r--r-- | hook.c | 22 | ||||
-rw-r--r-- | init.h | 4 | ||||
-rw-r--r-- | mutt.h | 3 | ||||
-rw-r--r-- | protos.h | 2 | ||||
-rw-r--r-- | send.c | 2 |
6 files changed, 20 insertions, 23 deletions
@@ -42,14 +42,6 @@ - - - - - - - - #include <errno.h> #include <unistd.h> #include <stdlib.h> @@ -115,6 +107,8 @@ int mutt_display_message (HEADER *cur) return (0); } + mutt_message_hook (cur, M_DISPLAYHOOK); + if (!Pager || mutt_strcmp (Pager, "builtin") == 0) builtin = 1; else @@ -115,11 +115,11 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) ptr->rx.not == not && !mutt_strcmp (pattern.data, ptr->rx.pattern)) { - if (data & (M_FOLDERHOOK | M_SENDHOOK)) + if (data & (M_FOLDERHOOK | M_SENDHOOK | M_DISPLAYHOOK)) { - /* folder-hook and send-hook allow multiple commands with the same - pattern, so if we've already seen this pattern/command pair, just - ignore it instead of creating a duplicate */ + /* these hooks allow multiple commands with the same + * pattern, so if we've already seen this pattern/command pair, just + * ignore it instead of creating a duplicate */ if (!mutt_strcmp (ptr->command, command.data)) { FREE (&command.data); @@ -130,10 +130,10 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) else { /* other hooks only allow one command per pattern, so update the - entry with the new command. this currently does not change the - order of execution of the hooks, which i think is desirable since - a common action to perform is to change the default (.) entry - based upon some other information. */ + * entry with the new command. this currently does not change the + * order of execution of the hooks, which i think is desirable since + * a common action to perform is to change the default (.) entry + * based upon some other information. */ FREE (&ptr->command); ptr->command = command.data; FREE (&pattern.data); @@ -144,7 +144,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) break; } - if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK)) + if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK | M_DISPLAYHOOK)) { if ((pat = mutt_pattern_comp (pattern.data, (data & (M_SENDHOOK | M_FCCHOOK)) ? 0 : M_FULL_MSG, err)) == NULL) goto error; @@ -292,7 +292,7 @@ char *mutt_find_hook (int type, const char *pat) return (NULL); } -void mutt_send_hook (HEADER *hdr) +void mutt_message_hook (HEADER *hdr, int type) { BUFFER err, token; HOOK *hook; @@ -306,7 +306,7 @@ void mutt_send_hook (HEADER *hdr) if(!hook->command) continue; - if (hook->type & M_SENDHOOK) + if (hook->type & type) if ((mutt_pattern_exec (hook->pattern, 0, NULL, hdr) > 0) ^ hook->rx.not) if (mutt_parse_rc_line (hook->command, &token, &err) != 0) { @@ -345,7 +345,8 @@ struct option_t MuttVars[] = { { "default_hook", DT_STR, R_NONE, UL &DefaultHook, UL "~f %s !~P | (~P ~C %s)" }, /* ** .pp - ** This variable controls how send-hooks, save-hooks, and fcc-hooks will + ** This variable controls how send-hooks, display-hooks, save-hooks, + ** and fcc-hooks will ** be interpreted if they are specified with only a simple regexp, ** instead of a matching pattern. The hooks are expanded when they are ** declared, so a hook will be interpreted according to the value of this @@ -2231,6 +2232,7 @@ struct command_t Commands[] = { { "color", mutt_parse_color, 0 }, { "uncolor", mutt_parse_uncolor, 0 }, #endif + { "display-hook", mutt_parse_hook, M_DISPLAYHOOK }, { "exec", mutt_parse_exec, 0 }, { "fcc-hook", mutt_parse_hook, M_FCCHOOK }, { "fcc-save-hook", mutt_parse_hook, M_FCCHOOK | M_SAVEHOOK }, @@ -129,8 +129,9 @@ typedef enum #define M_FCCHOOK (1<<3) #define M_SAVEHOOK (1<<4) #define M_CHARSETHOOK (1<<5) +#define M_DISPLAYHOOK (1<<6) #ifdef HAVE_PGP -#define M_PGPHOOK (1<<6) +#define M_PGPHOOK (1<<7) #endif /* tree characters for linearize_tree and print_enriched_string */ @@ -197,7 +197,7 @@ void mutt_score_message (CONTEXT *, HEADER *, int); void mutt_select_fcc (char *, size_t, HEADER *); #define mutt_select_file(A,B,C) _mutt_select_file(A,B,C,0,NULL,NULL) void _mutt_select_file (char *, size_t, int, int, char ***, int *); -void mutt_send_hook (HEADER *); +void mutt_message_hook (HEADER *, int); void _mutt_set_flag (CONTEXT *, HEADER *, int, int, int); #define mutt_set_flag(a,b,c,d) _mutt_set_flag(a,b,c,d,1) void mutt_set_followup_to (ENVELOPE *); @@ -1148,7 +1148,7 @@ ci_send_message (int flags, /* send mode */ /* change settings based upon recipients */ - mutt_send_hook (msg); + mutt_message_hook (msg, M_SENDHOOK); if (killfrom) { |