From: Kevin McCarthy Date: Wed, 6 Feb 2019 22:29:42 +0000 (-0800) Subject: Create function. X-Git-Tag: mutt-1-12-rel~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d97bbddfeb0167fd0cf1ba5a20bd7913c6577ce6;p=mutt Create function. This function differs from only in that it preserves To recipients in the original email as To recipients in the reply. The merits of this function aren't without controversy; therefore it is left unbound by default. Those who care about such things are free to bind it. Combine reply operation handlers in the pager and curs_main, since the code was the same with the exception of the flags used. --- diff --git a/OPS b/OPS index 87f643e4..2fad8f12 100644 --- a/OPS +++ b/OPS @@ -92,6 +92,7 @@ OP_FIRST_ENTRY "move to the first entry" OP_FLAG_MESSAGE "toggle a message's 'important' flag" OP_FORWARD_MESSAGE "forward a message with comments" OP_GENERIC_SELECT_ENTRY "select the current entry" +OP_GROUP_CHAT_REPLY "reply to all recipients preserving To/Cc" OP_GROUP_REPLY "reply to all recipients" OP_HALF_DOWN "scroll down 1/2 page" OP_HALF_UP "scroll up 1/2 page" diff --git a/curs_main.c b/curs_main.c index d3176f3d..00e01d06 100644 --- a/curs_main.c +++ b/curs_main.c @@ -2197,17 +2197,6 @@ int mutt_index_menu (void) crypt_forget_passphrase (); break; - case OP_GROUP_REPLY: - - CHECK_MSGCOUNT; - CHECK_VISIBLE; - CHECK_ATTACH; - if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) - mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); - ci_send_message (SENDREPLY|SENDGROUPREPLY, NULL, NULL, Context, tag ? NULL : CURHDR); - menu->redraw = REDRAW_FULL; - break; - case OP_EDIT_LABEL: CHECK_MSGCOUNT; @@ -2230,17 +2219,6 @@ int mutt_index_menu (void) } break; - case OP_LIST_REPLY: - - CHECK_ATTACH; - CHECK_MSGCOUNT; - CHECK_VISIBLE; - if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) - mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); - ci_send_message (SENDREPLY|SENDLISTREPLY, NULL, NULL, Context, tag ? NULL : CURHDR); - menu->redraw = REDRAW_FULL; - break; - case OP_MAIL: CHECK_ATTACH; @@ -2413,15 +2391,27 @@ int mutt_index_menu (void) break; case OP_REPLY: + case OP_GROUP_REPLY: + case OP_GROUP_CHAT_REPLY: + case OP_LIST_REPLY: + { + int replyflags; CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; + + replyflags = SENDREPLY | + (op == OP_GROUP_REPLY ? SENDGROUPREPLY : 0) | + (op == OP_GROUP_CHAT_REPLY ? SENDGROUPCHATREPLY : 0) | + (op == OP_LIST_REPLY ? SENDLISTREPLY : 0); + if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); - ci_send_message (SENDREPLY, NULL, NULL, Context, tag ? NULL : CURHDR); + ci_send_message (replyflags, NULL, NULL, Context, tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; break; + } case OP_SHELL_ESCAPE: diff --git a/doc/manual.xml.head b/doc/manual.xml.head index e3da882a..105eb585 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -1233,6 +1233,7 @@ new message. m<compose>compose a new message r<reply>reply to sender g<group-reply>reply to all recipients +<group-chat-reply>reply to all recipients preserving To/Cc L<list-reply>reply to mailing list address f<forward>forward message b<bounce>bounce (remail) message @@ -1283,8 +1284,20 @@ Reply to the author directly. Group reply -Reply to the author as well to all recipients except you; this consults -alternates. +Reply to the author; cc all other recipients; consults +alternates +and excludes you. + + + + +Group Chat reply + + +Reply to the author and other recipients in the To list; +cc other recipients in the Cc list; consults +alternates +and excludes you. diff --git a/functions.h b/functions.h index d3ac06b7..081f1487 100644 --- a/functions.h +++ b/functions.h @@ -106,6 +106,7 @@ const struct binding_t OpMain[] = { /* map: index */ { "edit-type", OP_EDIT_TYPE, "\005" }, { "forward-message", OP_FORWARD_MESSAGE, "f" }, { "flag-message", OP_FLAG_MESSAGE, "F" }, + { "group-chat-reply", OP_GROUP_CHAT_REPLY, NULL }, { "group-reply", OP_GROUP_REPLY, "g" }, #ifdef USE_POP { "fetch-mail", OP_MAIN_FETCH_MAIL, "G" }, @@ -209,6 +210,7 @@ const struct binding_t OpPager[] = { /* map: pager */ { "edit-type", OP_EDIT_TYPE, "\005" }, { "forward-message", OP_FORWARD_MESSAGE, "f" }, { "flag-message", OP_FLAG_MESSAGE, "F" }, + { "group-chat-reply", OP_GROUP_CHAT_REPLY, NULL }, { "group-reply", OP_GROUP_REPLY, "g" }, #ifdef USE_IMAP { "imap-fetch-mail", OP_MAIN_IMAP_FETCH, NULL }, @@ -320,6 +322,7 @@ const struct binding_t OpAttach[] = { /* map: attachment */ { "view-mailcap", OP_ATTACH_VIEW_MAILCAP, "m" }, { "reply", OP_REPLY, "r" }, { "resend-message", OP_RESEND, "\033e" }, + { "group-chat-reply", OP_GROUP_CHAT_REPLY, NULL }, { "group-reply", OP_GROUP_REPLY, "g" }, { "list-reply", OP_LIST_REPLY, "L" }, { "forward-message", OP_FORWARD_MESSAGE, "f" }, diff --git a/mutt.h b/mutt.h index 004f4b48..08933c05 100644 --- a/mutt.h +++ b/mutt.h @@ -346,7 +346,8 @@ enum #define SENDPOSTPONEDFCC (1<<9) /* used by mutt_get_postponed() to signal that the x-mutt-fcc header field was present */ #define SENDNOFREEHEADER (1<<10) /* Used by the -E flag */ #define SENDDRAFTFILE (1<<11) /* Used by the -H flag */ -#define SENDTOSENDER (1<<12) +#define SENDTOSENDER (1<<12) +#define SENDGROUPCHATREPLY (1<<13) /* flags for mutt_compose_menu() */ #define MUTT_COMPOSE_NOFREEHEADER (1<<0) diff --git a/pager.c b/pager.c index fb821305..4d8f3161 100644 --- a/pager.c +++ b/pager.c @@ -2652,15 +2652,28 @@ search_next: break; case OP_REPLY: + case OP_GROUP_REPLY: + case OP_GROUP_CHAT_REPLY: + case OP_LIST_REPLY: + { + int replyflags; + CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; + + replyflags = SENDREPLY | + (ch == OP_GROUP_REPLY ? SENDGROUPREPLY : 0) | + (ch == OP_GROUP_CHAT_REPLY ? SENDGROUPCHATREPLY : 0) | + (ch == OP_LIST_REPLY ? SENDLISTREPLY : 0); + if (IsMsgAttach (extra)) mutt_attach_reply (extra->fp, extra->hdr, extra->actx, - extra->bdy, SENDREPLY); + extra->bdy, replyflags); else - ci_send_message (SENDREPLY, NULL, NULL, extra->ctx, extra->hdr); + ci_send_message (replyflags, NULL, NULL, extra->ctx, extra->hdr); pager_menu->redraw = REDRAW_FULL; break; + } case OP_RECALL_MESSAGE: CHECK_MODE(IsHeader (extra) && !IsAttach(extra)); @@ -2669,28 +2682,6 @@ search_next: pager_menu->redraw = REDRAW_FULL; break; - case OP_GROUP_REPLY: - CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); - CHECK_ATTACH; - if (IsMsgAttach (extra)) - mutt_attach_reply (extra->fp, extra->hdr, extra->actx, - extra->bdy, SENDREPLY|SENDGROUPREPLY); - else - ci_send_message (SENDREPLY | SENDGROUPREPLY, NULL, NULL, extra->ctx, extra->hdr); - pager_menu->redraw = REDRAW_FULL; - break; - - case OP_LIST_REPLY: - CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); - CHECK_ATTACH; - if (IsMsgAttach (extra)) - mutt_attach_reply (extra->fp, extra->hdr, extra->actx, - extra->bdy, SENDREPLY|SENDLISTREPLY); - else - ci_send_message (SENDREPLY | SENDLISTREPLY, NULL, NULL, extra->ctx, extra->hdr); - pager_menu->redraw = REDRAW_FULL; - break; - case OP_FORWARD_MESSAGE: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; diff --git a/recvattach.c b/recvattach.c index efc832ce..cc083ce1 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1333,12 +1333,14 @@ void mutt_view_attachments (HEADER *hdr) case OP_REPLY: case OP_GROUP_REPLY: + case OP_GROUP_CHAT_REPLY: case OP_LIST_REPLY: CHECK_ATTACH; flags = SENDREPLY | (op == OP_GROUP_REPLY ? SENDGROUPREPLY : 0) | + (op == OP_GROUP_CHAT_REPLY ? SENDGROUPCHATREPLY : 0) | (op == OP_LIST_REPLY ? SENDLISTREPLY : 0); mutt_attach_reply (CURATTACH->fp, hdr, actx, menu->tagprefix ? NULL : CURATTACH->content, flags); diff --git a/send.c b/send.c index e855cf9a..137d0153 100644 --- a/send.c +++ b/send.c @@ -530,7 +530,8 @@ int mutt_fetch_recips (ENVELOPE *out, ENVELOPE *in, int flags) ADDRESS *tmp; int hmfupto = -1; - if ((flags & (SENDLISTREPLY|SENDGROUPREPLY)) && in->mail_followup_to) + if ((flags & (SENDLISTREPLY|SENDGROUPREPLY|SENDGROUPCHATREPLY)) && + in->mail_followup_to) { snprintf (prompt, sizeof (prompt), _("Follow-up to %s%s?"), in->mail_followup_to->mailbox, @@ -554,13 +555,18 @@ int mutt_fetch_recips (ENVELOPE *out, ENVELOPE *in, int flags) rfc822_append (&out->to, in->from, 0); else { - if (default_to (&out->to, in, flags & SENDGROUPREPLY, hmfupto) == -1) + if (default_to (&out->to, in, flags & (SENDGROUPREPLY|SENDGROUPCHATREPLY), + hmfupto) == -1) return (-1); /* abort */ - if ((flags & SENDGROUPREPLY) && (!in->mail_followup_to || hmfupto != MUTT_YES)) + if ((flags & (SENDGROUPREPLY|SENDGROUPCHATREPLY)) && + (!in->mail_followup_to || hmfupto != MUTT_YES)) { /* if (!mutt_addr_is_user(in->to)) */ - rfc822_append (&out->cc, in->to, 1); + if (flags & SENDGROUPREPLY) + rfc822_append (&out->cc, in->to, 1); + else + rfc822_append (&out->to, in->to, 1); rfc822_append (&out->cc, in->cc, 1); } }