]> granicus.if.org Git - neomutt/commitdiff
patch-1.3.3.tlr.message_hook.1
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 15 Jun 2000 21:37:05 +0000 (21:37 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 15 Jun 2000 21:37:05 +0000 (21:37 +0000)
commands.c
doc/manual.sgml.head
doc/muttrc.man.head
hook.c
init.h
mutt.h
recvcmd.c
send.c

index c03f1486c5775b681d8f7cbf4870002becf12f17..1469a4fcd1ee60d728f8d042c3f4131976e35dff 100644 (file)
@@ -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) 
   {
index cd130cf781108e8804ed8d424e42cf75010003a2..d043e701d2dc19729aae9a254445876ffc96cbab 100644 (file)
@@ -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/ &lsqb;!&rsqb;<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.
index 3c7350df64f198a078479dfc1d3c74510fb23810..a6f7a34b8efe909684c42184afaf43c56d2fbc38 100644 (file)
@@ -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
diff --git a/hook.c b/hook.c
index e5148cf09184db5db21638e22d31fb77d3d1be11..5972fcf11da40cdd1ca3a08be68dd73a5eeafcb7 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -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;
   }
diff --git a/init.h b/init.h
index d31fc97091e8b817388773cb99276fcace3efa07..94c9a046a5b30c3a217d92607d8a981b83202710 100644 (file)
--- a/init.h
+++ b/init.h
@@ -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 },
diff --git a/mutt.h b/mutt.h
index 698578878899d1474581ed543dad9134bac95368..f214dcba3ae273a873dba8833187db503eda4f10 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -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
index 05c537fce491a209bdb0c7fe6b6ddd63e9414b01..59def2d02e1222aeb41d06c8e3f621b60b0ded5c 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -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))
diff --git a/send.c b/send.c
index 1ac7bdcfabc9d8e066be8ef5abfe6fe27e432598..326928fc7587eaffe330fd5b01c8746216ebb4fd 100644 (file)
--- a/send.c
+++ b/send.c
@@ -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))