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

Re: [PATCH] compose to sender



In message <20080229053503.GC1539@xxxxxxx>,
        Brian Medley (bpm-lists-mutt-dev@xxxxxxxxxxx) wrote:
> 
> 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.

Great idea.

> Suggestions/Thoughts/Criticism are welcome.

I didn't compile without warnings for me, so I fixed that and also made
a few white space changes to match the usual Mutt style.


Cheers,
       Nick.
-- 

--- OPS 2007-05-07~
+++ OPS 2008-02-28
@@ -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"
--- PATCHES~
+++ PATCHES
@@ -0,0 +1 @@
+patch-1.5.17.bpm.compose_sender.20080218.txt
--- curs_main.c~
+++ curs_main.c
@@ -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.
         */
--- doc/manual.xml.head~
+++ doc/manual.xml.head
@@ -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>
--- functions.h~
+++ functions.h
@@ -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" },
--- pager.c~
+++ pager.c
@@ -2236,6 +2236,11 @@
         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))
--- protos.h~
+++ protos.h
@@ -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);
--- send.c~
+++ send.c
@@ -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 (0, msg, NULL, NULL, NULL);
+}
+
 int mutt_resend_message (FILE *fp, CONTEXT *ctx, HEADER *cur)
 {
   HEADER *msg = mutt_new_header ();