diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2000-06-15 21:37:05 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2000-06-15 21:37:05 +0000 |
commit | 6c36896967b523504e54947c5a7dc1094026ca47 (patch) | |
tree | 8b2fb82e1dbbf88e5279196e101192f5cc76a42e | |
parent | 3d88d49b459d14003c476d71f94396752043f11a (diff) |
patch-1.3.3.tlr.message_hook.1
-rw-r--r-- | commands.c | 2 | ||||
-rw-r--r-- | doc/manual.sgml.head | 4 | ||||
-rw-r--r-- | doc/muttrc.man.head | 9 | ||||
-rw-r--r-- | hook.c | 6 | ||||
-rw-r--r-- | init.h | 4 | ||||
-rw-r--r-- | mutt.h | 2 | ||||
-rw-r--r-- | recvcmd.c | 4 | ||||
-rw-r--r-- | send.c | 3 |
8 files changed, 21 insertions, 13 deletions
@@ -113,7 +113,7 @@ int mutt_display_message (HEADER *cur) return (0); } - mutt_message_hook (cur, M_DISPLAYHOOK); + mutt_message_hook (cur, M_MESSAGEHOOK); if (DisplayFilter && *DisplayFilter) { diff --git a/doc/manual.sgml.head b/doc/manual.sgml.head index cd130cf7..d043e701 100644 --- a/doc/manual.sgml.head +++ b/doc/manual.sgml.head @@ -1290,12 +1290,12 @@ my_hdr commands which modify recipient headers, or the message's subject, don't have any effect on the current message when executed from a send-hook. -<sect1>Change settings before wieving a message<label id="display-hook"> +<sect1>Change settings before formatting a message<label id="message-hook"> <p> Usage: <tt/display-hook/ [!]<em/pattern/ <em/command/ This command can be used to execute arbitrary configuration commands -before viewing a message based upon information about the message. +before viewing or formatting a message based upon information about the message. <em/command/ is executed if the <em/pattern/ matches the message to be displayed. When multiple matches occur, commands are executed in the order they are specified in the muttrc. diff --git a/doc/muttrc.man.head b/doc/muttrc.man.head index 3c7350df..a6f7a34b 100644 --- a/doc/muttrc.man.head +++ b/doc/muttrc.man.head @@ -111,10 +111,11 @@ This command defines an alias for a character set. This is useful to properly display messages which are tagged with a character set name not known to mutt. .TP -\fBdisplay-hook\fP [\fB!\fP]\fIpattern\fP \fIcommand\fP -Before mutt displays a message which matches the given \fIpattern\fP -(or, when it is preceded by an exclamation mark, does not match the -\fIpattern\fP), the given \fIcommand\fP is executed. When multiple +\fBmessage-hook\fP [\fB!\fP]\fIpattern\fP \fIcommand\fP +Before mutt displays (or formats for replying or forwarding) a +message which matches the given \fIpattern\fP (or, when it is +preceded by an exclamation mark, does not match the \fIpattern\fP), +the given \fIcommand\fP is executed. When multiple \fBdisplay-hook\fPs match, they are executed in the order in which they occur in the configuration file. .TP @@ -115,7 +115,7 @@ 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 | M_DISPLAYHOOK)) + if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK)) { /* these hooks allow multiple commands with the same * pattern, so if we've already seen this pattern/command pair, just @@ -144,10 +144,10 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) break; } - if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK | M_DISPLAYHOOK)) + if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK | M_MESSAGEHOOK)) { if ((pat = mutt_pattern_comp (pattern.data, - (data & (M_SENDHOOK | M_FCCHOOK | M_DISPLAYHOOK)) ? 0 : M_FULL_MSG, + (data & (M_SENDHOOK | M_FCCHOOK | M_MESSAGEHOOK)) ? 0 : M_FULL_MSG, err)) == NULL) goto error; } @@ -341,7 +341,7 @@ 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, display-hooks, save-hooks, + ** This variable controls how send-hooks, message-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 @@ -2231,7 +2231,6 @@ 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 }, @@ -2241,6 +2240,7 @@ struct command_t Commands[] = { { "lists", parse_list, UL &MailLists }, { "macro", mutt_parse_macro, 0 }, { "mailboxes", mutt_parse_mailboxes, 0 }, + { "message-hook", mutt_parse_hook, M_MESSAGEHOOK }, { "mbox-hook", mutt_parse_hook, M_MBOXHOOK }, { "mono", mutt_parse_mono, 0 }, { "my_hdr", parse_my_hdr, 0 }, @@ -130,7 +130,7 @@ typedef enum #define M_FCCHOOK (1<<3) #define M_SAVEHOOK (1<<4) #define M_CHARSETHOOK (1<<5) -#define M_DISPLAYHOOK (1<<6) +#define M_MESSAGEHOOK (1<<6) #ifdef HAVE_PGP #define M_PGPHOOK (1<<7) #endif @@ -566,6 +566,7 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, if (cur) { + mutt_message_hook (cur->hdr, M_MESSAGEHOOK); mutt_forward_intro (tmpfp, cur->hdr); _mutt_copy_message (tmpfp, fp, cur->hdr, cur->hdr->content, cmflags, chflags); mutt_forward_trailer (tmpfp); @@ -576,6 +577,7 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, { if (idx[i]->content->tagged) { + mutt_message_hook (idx[i]->content->hdr, M_MESSAGEHOOK); mutt_forward_intro (tmpfp, idx[i]->content->hdr); _mutt_copy_message (tmpfp, fp, idx[i]->content->hdr, idx[i]->content->hdr->content, cmflags, chflags); @@ -731,6 +733,8 @@ static void attach_include_reply (FILE *fp, FILE *tmpfp, HEADER *cur, int flags) int cmflags = M_CM_PREFIX | M_CM_DECODE | M_CM_CHARCONV; int chflags = CH_DECODE; + mutt_message_hook (cur, M_MESSAGEHOOK); + mutt_make_attribution (Context, cur, tmpfp); if (!option (OPTHEADER)) @@ -337,6 +337,7 @@ static int include_forward (CONTEXT *ctx, HEADER *cur, FILE *out) { int chflags = CH_DECODE, cmflags = 0; + mutt_message_hook (cur, M_MESSAGEHOOK); #ifdef HAVE_PGP if ((cur->pgp & PGPENCRYPT) && option (OPTFORWDECODE)) @@ -403,6 +404,8 @@ static int include_reply (CONTEXT *ctx, HEADER *cur, FILE *out) } #endif /* HAVE_PGP */ + mutt_message_hook (cur, M_MESSAGEHOOK); + mutt_make_attribution (ctx, cur, out); if (!option (OPTHEADER)) |