summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2018-06-26 15:47:38 -0600
committerEduardo Chappa <chappa@washington.edu>2018-06-26 15:47:38 -0600
commit7346da5899d868cf83eb535a71d067007a1e1e47 (patch)
treee35aa08c127ba83eaf3ae35aa5978d1fc475208b
parenta4596ef9de75a309535e00c1da775c9b39dc3769 (diff)
downloadalpine-7346da5899d868cf83eb535a71d067007a1e1e47.tar.xz
* When a message is of type multipart/mixed, and its first part is
multipart/signed, Alpine will include the text of the original message in a reply message, instead of including a multipart attachment. Suggested by Barry Landy.
-rw-r--r--doc/tech-notes/tech-notes.txt2
-rw-r--r--pith/pine.hlp7
-rw-r--r--pith/reply.c78
3 files changed, 85 insertions, 2 deletions
diff --git a/doc/tech-notes/tech-notes.txt b/doc/tech-notes/tech-notes.txt
index 129f5fd8..9c1bc7d6 100644
--- a/doc/tech-notes/tech-notes.txt
+++ b/doc/tech-notes/tech-notes.txt
@@ -1,7 +1,7 @@
Alpine Technical Notes
- Version 2.21.999, February 2018
+ Version 2.21.9999, June 2018
Table of Contents
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 87ac8032..2eacb0e9 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any
reasonable place to be called from.
Dummy change to get revision in pine.hlp
============= h_revision =================
-Alpine Commit 287 2018-06-16 17:37:20
+Alpine Commit 290 2018-06-26 15:47:31
============= h_news =================
<HTML>
<HEAD>
@@ -206,6 +206,11 @@ a connection that is having problems being kept alive after the number
of seconds configured in this variable, if the connection has not
recovered. The default is 0, which means to keep the connection alive
and wait for the connection to recover.
+
+<LI> When a message is of type multipart/mixed, and its first part is
+multipart/signed, Alpine will include the text of the original message
+in a reply message, instead of including a multipart attachment.
+Suggested by Barry Landy.
</UL>
<P>
diff --git a/pith/reply.c b/pith/reply.c
index dbeccc20..97b8c19f 100644
--- a/pith/reply.c
+++ b/pith/reply.c
@@ -1081,6 +1081,84 @@ reply_body(MAILSTREAM *stream, ENVELOPE *env, struct mail_bodystruct *orig_body,
plustext, role, 0, redraft_pos);
}
else if(orig_body->subtype
+ && !strucmp(orig_body->subtype, "mixed")
+ && orig_body->nested.part
+ && orig_body->nested.part->body.type == TYPEMULTIPART
+ && orig_body->nested.part->body.subtype
+ && !strucmp(orig_body->nested.part->body.subtype, "signed")){
+ /* we can call reply_body as in the call above with section
+ * equal to "1", but that adds the multipart text to the
+ * list of attachments. We do not want that, so we redo this
+ * manually.
+ */
+ body = copy_body(NULL, orig_body);
+
+ /*
+ * whatever subtype it is, demote it
+ * to plain old MIXED.
+ */
+ if(body->subtype)
+ fs_give((void **) &body->subtype);
+
+ body->subtype = cpystr("Mixed");
+
+ if(reply_body_text(&orig_body->nested.part->body.nested.part->body,
+ &tmp_body)){
+ int partnum;
+
+ reply_delimiter(env, role, pc);
+ if(ps_global->reply.include_header)
+ reply_forward_header(stream, msgno, sect_prefix,
+ env, pc, prefix);
+ /* SECTBUFLEN = sizeof(sect_buf) */
+ snprintf(sect_buf, sizeof(sect_buf), "%.*s%s%.*s",
+ SECTBUFLEN/2-2,
+ sect_prefix ? sect_prefix : "",
+ sect_prefix ? "." : "",
+ SECTBUFLEN/2-2,
+ p = partno(orig_body, tmp_body));
+ sect_buf[sizeof(sect_buf)-1] = '\0';
+ fs_give((void **) &p);
+ get_body_part_text(stream, tmp_body, msgno,
+ sect_buf, 0L, pc, prefix,
+ NULL, GBPT_NONE);
+
+ part = body->nested.part->next;
+ body->nested.part->next = NULL;
+ mail_free_body_part(&body->nested.part);
+ body->nested.part = mail_newbody_part();
+ body->nested.part->body.type = TYPETEXT;
+ body->nested.part->body.subtype = cpystr("Plain");
+ body->nested.part->body.contents.text.data = msgtext;
+ body->nested.part->next = part;
+ /* SECTBUFLEN = sizeof(sect_buf) */
+ for(partnum = 2; part != NULL; part = part->next){
+ snprintf(sect_buf, sizeof(sect_buf), "%.*s%s%d",
+ SECTBUFLEN/2,
+ sect_prefix ? sect_prefix : "",
+ sect_prefix ? "." : "", partnum++);
+ sect_buf[sizeof(sect_buf)-1] = '\0';
+
+ if(!fetch_contents(stream, msgno,
+ sect_buf, &part->body)){
+ break;
+ }
+ }
+ }
+ else {
+ /*--- Fetch the original pieces ---*/
+ if(!fetch_contents(stream, msgno, sect_prefix, body))
+ q_status_message(SM_ORDER | SM_DING, 3, 4,
+ _("Error including all message parts"));
+
+ /*--- No text part, create a blank one ---*/
+ part = mail_newbody_part();
+ part->next = body->nested.part;
+ body->nested.part = part;
+ part->body.contents.text.data = msgtext;
+ }
+ }
+ else if(orig_body->subtype
&& !strucmp(orig_body->subtype, "alternative")
&& orig_body->nested.part
&& orig_body->nested.part->next->body.type == TYPEMULTIPART