move rfc822.c as well
[apps/madmutt.git] / sendlib.c
index 7ec942c..208b434 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 
+#include <lib-mime/mime.h>
+
 #include "mutt.h"
 #include "handler.h"
 #include "recvattach.h"
 #include "mutt_curses.h"
 #include "rfc2047.h"
-#include "rfc2231.h"
 #include "mx.h"
-#include "mime.h"
 #include "copy.h"
 #include "pager.h"
 #include "charset.h"
 #include <assert.h>
 #endif
 
-extern char RFC822Specials[];
-
 #define DISPOSITION(X) X==DISPATTACH?"attachment":"inline"
 
-const char MimeSpecials[] = "@.,;:<>[]\\\"()?/= \t";
-
-char B64Chars[64] = {
-  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
-  'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
-  'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
-  't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
-  '8', '9', '+', '/'
-};
-
 static char MsgIdPfx = 'A';
 
 static void transform_to_7bit (BODY * a, FILE * fpin);
@@ -223,19 +211,19 @@ static void b64_flush (FILE * fout)
   for (i = b64_num; i < 3; i++)
     b64_buffer[i] = '\0';
 
-  fputc (B64Chars[(b64_buffer[0] >> 2) & 0x3f], fout);
+  fputc(__m_b64chars[(b64_buffer[0] >> 2) & 0x3f], fout);
   b64_linelen++;
-  fputc (B64Chars
+  fputc(__m_b64chars
          [((b64_buffer[0] & 0x3) << 4) | ((b64_buffer[1] >> 4) & 0xf)], fout);
   b64_linelen++;
 
   if (b64_num > 1) {
-    fputc (B64Chars
+    fputc (__m_b64chars
            [((b64_buffer[1] & 0xf) << 2) | ((b64_buffer[2] >> 6) & 0x3)],
            fout);
     b64_linelen++;
     if (b64_num > 2) {
-      fputc (B64Chars[b64_buffer[2] & 0x3f], fout);
+      fputc (__m_b64chars[b64_buffer[2] & 0x3f], fout);
       b64_linelen++;
     }
   }
@@ -457,7 +445,7 @@ void mutt_generate_boundary (PARAMETER ** parm)
 
   rs[BOUNDARYLEN] = 0;
   for (i = 0; i < BOUNDARYLEN; i++)
-    *p++ = B64Chars[LRAND () % sizeof (B64Chars)];
+    *p++ = __m_b64chars[LRAND() % sizeof(__m_b64chars)];
   *p = 0;
 
   mutt_set_parameter ("boundary", rs, parm);
@@ -937,13 +925,9 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
           sze = m_strlen(p);
           if ((sze > cur_sze) && (szf >= sze) &&
               (m_strcasecmp(path + szf - sze, p) == 0
-               || ascii_strcasecmp (path + szf - sze, p) == 0) && (szf == sze
-                                                                   || path[szf
-                                                                           -
-                                                                           sze
-                                                                           -
-                                                                           1]
-                                                                   == '.')) {
+               || ascii_strcasecmp (path + szf - sze, p) == 0)
+              && (szf == sze || path[szf - sze - 1] == '.'))
+          {
             /* get the content-type */
 
             if ((p = strchr (ct, '/')) == NULL) {