]> granicus.if.org Git - mutt/commitdiff
reply-hook. Documentation still needed.
authorMichael Elkins <me@sigpipe.org>
Wed, 24 Jul 2002 09:20:21 +0000 (09:20 +0000)
committerMichael Elkins <me@sigpipe.org>
Wed, 24 Jul 2002 09:20:21 +0000 (09:20 +0000)
hook.c
init.h
mutt.h
send.c

diff --git a/hook.c b/hook.c
index e31b3c0938d5faf721d2c0af2d5fb5e3904eb3c3..dbb62d8f74cb9aa8f14e04b258016d9d0bf366d9 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -1,5 +1,5 @@
 /* 
- * Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>, and others
+ * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>, and others
  *
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -65,7 +65,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
     goto error;
   }
 
-  mutt_extract_token (&command, s, (data & (M_FOLDERHOOK | M_SENDHOOK | M_ACCOUNTHOOK)) ?  M_TOKEN_SPACE : 0);
+  mutt_extract_token (&command, s, (data & (M_FOLDERHOOK | M_SENDHOOK | M_ACCOUNTHOOK | M_REPLYHOOK)) ?  M_TOKEN_SPACE : 0);
 
   if (!command.data)
   {
@@ -118,7 +118,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_MESSAGEHOOK | M_ACCOUNTHOOK))
+      if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK | M_REPLYHOOK))
       {
        /* these hooks allow multiple commands with the same
         * pattern, so if we've already seen this pattern/command pair, just
@@ -147,10 +147,10 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
       break;
   }
 
-  if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK | M_MESSAGEHOOK))
+  if (data & (M_SENDHOOK | M_SAVEHOOK | M_FCCHOOK | M_MESSAGEHOOK | M_REPLYHOOK))
   {
     if ((pat = mutt_pattern_comp (pattern.data,
-          (data & (M_SENDHOOK | M_FCCHOOK)) ? 0 : M_FULL_MSG,
+          (data & (M_SENDHOOK | M_REPLYHOOK | M_FCCHOOK)) ? 0 : M_FULL_MSG,
                                  err)) == NULL)
       goto error;
   }
diff --git a/init.h b/init.h
index 7aa0c053a9a241ed3982d8f7b776e07a74080624..a259880df518358d43f1758f77006ac584d89f53 100644 (file)
--- a/init.h
+++ b/init.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
+ * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
  * 
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -2690,6 +2690,7 @@ struct command_t Commands[] = {
   { "crypt-hook",      mutt_parse_hook,        M_CRYPTHOOK },
 #endif /* HAVE_PGP */
   { "push",            mutt_parse_push,        0 },
+  { "reply-hook",      mutt_parse_hook,        M_REPLYHOOK },
   { "reset",           parse_set,              M_SET_RESET },
   { "save-hook",       mutt_parse_hook,        M_SAVEHOOK },
   { "score",           mutt_parse_score,       0 },
diff --git a/mutt.h b/mutt.h
index 0381225cb9ae60ce19cce3d70755b2ddfd9bf520..abdcf613529c5bcc2be7d543f917dfe000ad821b 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
+ * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
  * 
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -144,6 +144,7 @@ typedef enum
 #define M_CRYPTHOOK    (1<<8)
 #endif
 #define M_ACCOUNTHOOK  (1<<9)
+#define M_REPLYHOOK    (1<<10)
 
 /* tree characters for linearize_tree and print_enriched_string */
 #define M_TREE_LLCORNER                1
diff --git a/send.c b/send.c
index d905304d32ea782755c39c4691f704f4730db356..f44aebb099d7bb1498a34a95ac0b3ab36f458cf1 100644 (file)
--- a/send.c
+++ b/send.c
@@ -1192,6 +1192,19 @@ ci_send_message (int flags,              /* send mode */
       killfrom = 1;
     }
 
+    if ((flags & SENDREPLY) && cur)
+    {
+      /* change setting based upon message we are replying to */
+      mutt_message_hook (NULL, cur, M_REPLYHOOK);
+
+      /*
+       * 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
+       * being used.
+       */
+      msg->replied = 1;
+    }
+
     /* change settings based upon recipients */
     
     mutt_message_hook (NULL, msg, M_SENDHOOK);