]> granicus.if.org Git - mutt/commitdiff
Factor out rfc2047_decode_envelope().
authorKevin McCarthy <kevin@8t8.us>
Mon, 10 Dec 2018 03:52:21 +0000 (19:52 -0800)
committerKevin McCarthy <kevin@8t8.us>
Mon, 17 Dec 2018 21:29:58 +0000 (13:29 -0800)
parse.c
rfc2047.c
rfc2047.h
sendlib.c
url.c

diff --git a/parse.c b/parse.c
index 75254958f008495cab876a1db68d202adbb5129e..af3911d990415cd0f3315b0032719932e65d5864 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1471,23 +1471,12 @@ ENVELOPE *mutt_read_rfc822_header (FILE *f, HEADER *hdr, short user_hdrs,
     hdr->content->hdr_offset = hdr->offset;
     hdr->content->offset = ftello (f);
 
-    /* do RFC2047 decoding */
-    rfc2047_decode_adrlist (e->from);
-    rfc2047_decode_adrlist (e->to);
-    rfc2047_decode_adrlist (e->cc);
-    rfc2047_decode_adrlist (e->bcc);
-    rfc2047_decode_adrlist (e->reply_to);
-    rfc2047_decode_adrlist (e->mail_followup_to);
-    rfc2047_decode_adrlist (e->return_path);
-    rfc2047_decode_adrlist (e->sender);
-    rfc2047_decode (&e->x_label);
+    rfc2047_decode_envelope (e);
 
     if (e->subject)
     {
       regmatch_t pmatch[1];
 
-      rfc2047_decode (&e->subject);
-
       if (regexec (ReplyRegexp.rx, e->subject, 1, pmatch, 0) == 0)
        e->real_subj = e->subject + pmatch[0].rm_eo;
       else
index ff5dc977b64559d7fc82714000002817cb51d1ec..a19e01b358333109d2d83e4ffbe04f5d0258505e 100644 (file)
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -948,3 +948,17 @@ void rfc2047_decode_adrlist (ADDRESS *a)
     a = a->next;
   }
 }
+
+void rfc2047_decode_envelope (ENVELOPE *e)
+{
+  rfc2047_decode_adrlist (e->from);
+  rfc2047_decode_adrlist (e->to);
+  rfc2047_decode_adrlist (e->cc);
+  rfc2047_decode_adrlist (e->bcc);
+  rfc2047_decode_adrlist (e->reply_to);
+  rfc2047_decode_adrlist (e->mail_followup_to);
+  rfc2047_decode_adrlist (e->return_path);
+  rfc2047_decode_adrlist (e->sender);
+  rfc2047_decode (&e->x_label);
+  rfc2047_decode (&e->subject);
+}
index 9e15d2f21927671d69f2acd4365465a64e97d21b..b61ab09e5f34f271c178e1a284b9b3f0d615858e 100644 (file)
--- a/rfc2047.h
+++ b/rfc2047.h
@@ -27,3 +27,4 @@ void rfc2047_encode_adrlist (ADDRESS *, const char *);
 
 void rfc2047_decode (char **);
 void rfc2047_decode_adrlist (ADDRESS *);
+void rfc2047_decode_envelope (ENVELOPE *);
index 2128c94efaf0dae0c2e49880e40219284a65e0bb..a0a4c21b5608faed9993c4eac909fb7ea4c7e969 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -2574,13 +2574,7 @@ void mutt_unprepare_envelope (ENVELOPE *env)
   rfc822_free_address (&env->mail_followup_to);
 
   /* back conversions */
-  rfc2047_decode_adrlist (env->to);
-  rfc2047_decode_adrlist (env->cc);
-  rfc2047_decode_adrlist (env->bcc);
-  rfc2047_decode_adrlist (env->from);
-  rfc2047_decode_adrlist (env->reply_to);
-  rfc2047_decode (&env->subject);
-  rfc2047_decode (&env->x_label);
+  rfc2047_decode_envelope (env);
 }
 
 static int _mutt_bounce_message (FILE *fp, HEADER *h, ADDRESS *to, const char *resent_from,
diff --git a/url.c b/url.c
index d61e8d16606be6c6b9dc0708b0ac780630bbf96b..2d7c0b41a256ecc7a36cdbaa8e24df13ab9399e4 100644 (file)
--- a/url.c
+++ b/url.c
@@ -338,16 +338,7 @@ int url_parse_mailto (ENVELOPE *e, char **body, const char *src)
   }
 
   /* RFC2047 decode after the RFC822 parsing */
-  rfc2047_decode_adrlist (e->from);
-  rfc2047_decode_adrlist (e->to);
-  rfc2047_decode_adrlist (e->cc);
-  rfc2047_decode_adrlist (e->bcc);
-  rfc2047_decode_adrlist (e->reply_to);
-  rfc2047_decode_adrlist (e->mail_followup_to);
-  rfc2047_decode_adrlist (e->return_path);
-  rfc2047_decode_adrlist (e->sender);
-  rfc2047_decode (&e->x_label);
-  rfc2047_decode (&e->subject);
+  rfc2047_decode_envelope (e);
 
   rc = 0;