<<< Date Index >>>     <<< Thread Index >>>

[PATCH] compose to sender



Hi,

I have created a patch that starts a new message to the sender of
the currently selected message.  In addition, I think I updated
The Manual correctly.

Suggestions/Thoughts/Criticism are welcome.

-- 
Brian Medley
diff -r -u mutt-1.5.17/OPS mutt-1.5.17-compose/OPS
--- mutt-1.5.17/OPS     2007-05-07 13:46:12.000000000 -0500
+++ mutt-1.5.17-compose/OPS     2008-02-28 14:57:43.000000000 -0600
@@ -37,6 +37,7 @@
 OP_COMPOSE_TOGGLE_RECODE "toggle recoding of this attachment"
 OP_COMPOSE_POSTPONE_MESSAGE "save this message to send later"
 OP_COMPOSE_RENAME_FILE "rename/move an attached file"
+OP_COMPOSE_SENDER "compose new message to sender"
 OP_COMPOSE_SEND_MESSAGE "send the message"
 OP_COMPOSE_TOGGLE_DISPOSITION "toggle disposition between inline/attachment"
 OP_COMPOSE_TOGGLE_UNLINK "toggle whether to delete file after sending it"
diff -r -u mutt-1.5.17/PATCHES mutt-1.5.17-compose/PATCHES
--- mutt-1.5.17/PATCHES 2007-03-21 13:26:38.000000000 -0500
+++ mutt-1.5.17-compose/PATCHES 2008-02-28 23:09:27.000000000 -0600
@@ -0,0 +1 @@
+patch-1.5.17.bpm.compose_sender.20080218.txt
diff -r -u mutt-1.5.17/curs_main.c mutt-1.5.17-compose/curs_main.c
--- mutt-1.5.17/curs_main.c     2007-05-28 18:19:50.000000000 -0500
+++ mutt-1.5.17-compose/curs_main.c     2008-02-28 19:28:29.000000000 -0600
@@ -986,6 +986,12 @@
          menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
        break;
 
+       case OP_COMPOSE_SENDER:
+
+       mutt_compose_sender(CURHDR);
+       menu->redraw = REDRAW_FULL;
+       break;
+
        /* --------------------------------------------------------------------
         * The following operations can be performed inside of the pager.
         */
diff -r -u mutt-1.5.17/doc/manual.xml.head 
mutt-1.5.17-compose/doc/manual.xml.head
--- mutt-1.5.17/doc/manual.xml.head     2007-11-01 14:02:58.000000000 -0500
+++ mutt-1.5.17-compose/doc/manual.xml.head     2008-02-28 22:52:09.000000000 
-0600
@@ -772,6 +772,16 @@
 </para>
 
 <para>
+<emphasis role="bold">compose-sender</emphasis><anchor id="compose-sender"/> 
(default: not bound)
+
+</para>
+
+<para>
+This starts a new message with the "To" field defaulted to the sender
+of the current message.
+</para>
+
+<para>
 <emphasis role="bold">display-toggle-weed</emphasis><anchor 
id="display-toggle-weed"/> (default: h)
 
 </para>
diff -r -u mutt-1.5.17/functions.h mutt-1.5.17-compose/functions.h
--- mutt-1.5.17/functions.h     2007-05-07 13:45:34.000000000 -0500
+++ mutt-1.5.17-compose/functions.h     2008-02-28 19:41:46.000000000 -0600
@@ -133,6 +133,7 @@
   { "read-thread",             OP_MAIN_READ_THREAD,            "\022" },
   { "read-subthread",          OP_MAIN_READ_SUBTHREAD,         "\033r" },
   { "resend-message",          OP_RESEND,                      "\033e" },
+  { "compose-sender",          OP_COMPOSE_SENDER,                      NULL },
   { "save-message",            OP_SAVE,                        "s" },
   { "tag-pattern",             OP_MAIN_TAG_PATTERN,            "T" },
   { "tag-subthread",           OP_TAG_SUBTHREAD,               NULL },
@@ -214,6 +215,7 @@
   { "read-thread",     OP_MAIN_READ_THREAD,            "\022" },
   { "read-subthread",  OP_MAIN_READ_SUBTHREAD,         "\033r" },
   { "resend-message",  OP_RESEND,                      "\033e" },
+  { "compose-sender",  OP_COMPOSE_SENDER,                      NULL },
   { "save-message",    OP_SAVE,                        "s" },
   { "skip-quoted",     OP_PAGER_SKIP_QUOTED,           "S" },
   { "decode-save",     OP_DECODE_SAVE,                 "\033s" },
diff -r -u mutt-1.5.17/pager.c mutt-1.5.17-compose/pager.c
--- mutt-1.5.17/pager.c 2007-09-05 13:28:05.000000000 -0500
+++ mutt-1.5.17-compose/pager.c 2008-02-28 19:43:12.000000000 -0600
@@ -2236,6 +2236,12 @@
         redraw = REDRAW_FULL;
         break;
 
+      case OP_COMPOSE_SENDER:
+        mutt_compose_sender(extra->hdr);
+        redraw = REDRAW_FULL;
+      break;
+
+
       case OP_CHECK_TRADITIONAL:
         CHECK_MODE (IsHeader (extra));
         if (!(WithCrypto & APPLICATION_PGP))
diff -r -u mutt-1.5.17/protos.h mutt-1.5.17-compose/protos.h
--- mutt-1.5.17/protos.h        2007-10-31 12:48:52.000000000 -0500
+++ mutt-1.5.17-compose/protos.h        2008-02-28 19:43:41.000000000 -0600
@@ -295,6 +295,7 @@
 int mutt_parent_message (CONTEXT *, HEADER *);
 int mutt_prepare_template(FILE*, CONTEXT *, HEADER *, HEADER *, short);
 int mutt_resend_message (FILE *, CONTEXT *, HEADER *);
+int mutt_compose_sender(HEADER *);
 #define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
 int _mutt_enter_fname (const char *, char *, size_t, int *, int, int, char 
***, int *);
 int  mutt_enter_string (char *buf, size_t buflen, int y, int x, int flags);
diff -r -u mutt-1.5.17/send.c mutt-1.5.17-compose/send.c
--- mutt-1.5.17/send.c  2007-07-26 14:43:39.000000000 -0500
+++ mutt-1.5.17-compose/send.c  2008-02-28 19:44:42.000000000 -0600
@@ -1065,6 +1065,16 @@
   safe_fclose (&fp);
 }
 
+int mutt_compose_sender (HEADER *cur)
+{
+  HEADER *msg = mutt_new_header ();
+  
+  msg->env = mutt_new_envelope ();
+  msg->env->to = rfc822_cpy_adr(cur->env->from);
+  
+  return ci_send_message (NULL, msg, NULL, NULL, NULL);
+}
+
 int mutt_resend_message (FILE *fp, CONTEXT *ctx, HEADER *cur)
 {
   HEADER *msg = mutt_new_header ();