the “I found my first real bug” commit.
[apps/madmutt.git] / rfc2047.c
index 50304c6..d4e7d6a 100644 (file)
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -17,6 +17,7 @@
 #include "mime.h"
 #include "charset.h"
 #include "rfc2047.h"
+#include "thread.h"
 
 #include "lib/mem.h"
 #include "lib/str.h"
 
 extern char RFC822Specials[];
 
-typedef size_t (*encoder_t) (char *, ICONV_CONST char *, size_t,
+typedef size_t (*encoder_t) (char *, const char *, size_t,
                              const char *);
 
-static size_t convert_string (ICONV_CONST char *f, size_t flen,
+static size_t convert_string (const char *f, size_t flen,
                               const char *from, const char *to,
                               char **t, size_t * tlen)
 {
@@ -142,7 +143,7 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets,
   return tocode;
 }
 
-static size_t b_encoder (char *s, ICONV_CONST char *d, size_t dlen,
+static size_t b_encoder (char *s, const char *d, size_t dlen,
                          const char *tocode)
 {
   char *s0 = s;
@@ -179,7 +180,7 @@ static size_t b_encoder (char *s, ICONV_CONST char *d, size_t dlen,
   return s - s0;
 }
 
-static size_t q_encoder (char *s, ICONV_CONST char *d, size_t dlen,
+static size_t q_encoder (char *s, const char *d, size_t dlen,
                          const char *tocode)
 {
   char hex[] = "0123456789ABCDEF";
@@ -214,13 +215,13 @@ static size_t q_encoder (char *s, ICONV_CONST char *d, size_t dlen,
  * tocode, unless fromcode is 0, in which case the data is assumed to
  * be already in tocode, which should be 8-bit and stateless.
  */
-static size_t try_block (ICONV_CONST char *d, size_t dlen,
+static size_t try_block (const char *d, size_t dlen,
                          const char *fromcode, const char *tocode,
                          encoder_t * encoder, size_t * wlen)
 {
   char buf1[ENCWORD_LEN_MAX - ENCWORD_LEN_MIN + 1];
   iconv_t cd;
-  ICONV_CONST char *ib;
+  const char *ib;
   char *ob, *p;
   size_t ibl, obl;
   int count, len, len_b, len_q;
@@ -287,7 +288,7 @@ static size_t encode_block (char *s, char *d, size_t dlen,
 {
   char buf1[ENCWORD_LEN_MAX - ENCWORD_LEN_MIN + 1];
   iconv_t cd;
-  ICONV_CONST char *ib;
+  const char *ib;
   char *ob;
   size_t ibl, obl, n1, n2;
 
@@ -343,7 +344,7 @@ static size_t choose_block (char *d, size_t dlen, int col,
  * The input data is assumed to be a single line starting at column col;
  * if col is non-zero, the preceding character was a space.
  */
-static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col,
+static int rfc2047_encode (const char *d, size_t dlen, int col,
                            const char *fromcode, const char *charsets,
                            char **e, size_t * elen, char *specials)
 {
@@ -818,13 +819,7 @@ void rfc2047_decode_envelope (ENVELOPE* e) {
   rfc2047_decode_adrlist (e->sender);
 
   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
-      e->real_subj = e->subject;
+    mutt_adjust_subject (e);
   }
 }