simplify charset and things in the sockets API.
[apps/madmutt.git] / lib-mime / rfc822parse.c
index 9643aee..40da94d 100644 (file)
 #include <lib-lib/macros.h>
 #include <lib-lib/buffer.h>
 #include <lib-lib/date.h>
-#include <lib-lib/debug.h>
 #include <lib-lib/url.h>
 
 #include "recvattach.h"
 
+#include "charset.h"
 #include "mime.h"
 
 /* Reads an arbitrarily long header field, and looks ahead for continuation
@@ -402,7 +402,6 @@ BODY *mutt_read_mime_header(FILE *fp, int digest)
             if (!*p)
                 continue;
         } else {
-            debug_print (1, ("bogus MIME header: %s\n", line));
             break;
         }
 
@@ -616,62 +615,6 @@ uncomment_timezone(char *buf, size_t buflen, const char *tz)
     return buf;
 }
 
-static struct tz_t {
-    char tzname[5];
-    unsigned char zhours;
-    unsigned char zminutes;
-    unsigned char zoccident;      /* west of UTC? */
-} TimeZones[] = {
-    {"aat", 1, 0, 1},             /* Atlantic Africa Time */
-    {"adt", 4, 0, 0},             /* Arabia DST */
-    {"ast", 3, 0, 0},             /* Arabia */
-    /*{ "ast",   4,  0, 1 }, *//* Atlantic */
-    {"bst", 1, 0, 0},             /* British DST */
-    {"cat", 1, 0, 0},             /* Central Africa */
-    {"cdt", 5, 0, 1},
-    {"cest", 2, 0, 0},            /* Central Europe DST */
-    {"cet", 1, 0, 0},             /* Central Europe */
-    {"cst", 6, 0, 1},
-    /*{ "cst",   8,  0, 0 }, *//* China */
-    /*{ "cst",   9, 30, 0 }, *//* Australian Central Standard Time */
-    {"eat", 3, 0, 0},             /* East Africa */
-    {"edt", 4, 0, 1},
-    {"eest", 3, 0, 0},            /* Eastern Europe DST */
-    {"eet", 2, 0, 0},             /* Eastern Europe */
-    {"egst", 0, 0, 0},            /* Eastern Greenland DST */
-    {"egt", 1, 0, 1},             /* Eastern Greenland */
-    {"est", 5, 0, 1},
-    {"gmt", 0, 0, 0},
-    {"gst", 4, 0, 0},             /* Presian Gulf */
-    {"hkt", 8, 0, 0},             /* Hong Kong */
-    {"ict", 7, 0, 0},             /* Indochina */
-    {"idt", 3, 0, 0},             /* Israel DST */
-    {"ist", 2, 0, 0},             /* Israel */
-    /*{ "ist",   5, 30, 0 }, *//* India */
-    {"jst", 9, 0, 0},             /* Japan */
-    {"kst", 9, 0, 0},             /* Korea */
-    {"mdt", 6, 0, 1},
-    {"met", 1, 0, 0},             /* this is now officially CET */
-    {"msd", 4, 0, 0},             /* Moscow DST */
-    {"msk", 3, 0, 0},             /* Moscow */
-    {"mst", 7, 0, 1},
-    {"nzdt", 13, 0, 0},           /* New Zealand DST */
-    {"nzst", 12, 0, 0},           /* New Zealand */
-    {"pdt", 7, 0, 1},
-    {"pst", 8, 0, 1},
-    {"sat", 2, 0, 0},             /* South Africa */
-    {"smt", 4, 0, 0},             /* Seychelles */
-    {"sst", 11, 0, 1},            /* Samoa */
-    /*{ "sst",   8,  0, 0 }, *//* Singapore */
-    {"utc", 0, 0, 0},
-    {"wat", 0, 0, 0},             /* West Africa */
-    {"west", 1, 0, 0},            /* Western Europe DST */
-    {"wet", 0, 0, 0},             /* Western Europe */
-    {"wgst", 2, 0, 1},            /* Western Greenland DST */
-    {"wgt", 3, 0, 1},             /* Western Greenland */
-    {"wst", 8, 0, 0},             /* Western Australia */
-};
-
 /* parses a date string in RFC822 format:
  *
  * Date: [ weekday , ] day-of-month month year hour:minute:second timezone
@@ -753,26 +696,6 @@ time_t mutt_parse_date(const char *s, HEADER *h)
                     zhours    = (ptz[1] - '0') * 10 + (ptz[2] - '0');
                     zminutes  = (ptz[3] - '0') * 10 + (ptz[4] - '0');
                 }
-            } else {
-                struct tz_t *tz;
-
-                /* This is safe to do: A pointer to a struct equals a pointer to its
-                 * first element*/
-                tz = bsearch(ptz, TimeZones, countof(TimeZones), sizeof(TimeZones[0]),
-                             (int (*)(const void *, const void *))ascii_strcasecmp);
-
-                if (tz) {
-                    zhours = tz->zhours;
-                    zminutes = tz->zminutes;
-                    zoccident = tz->zoccident;
-                }
-
-                /* ad hoc support for the European MET (now officially CET) TZ */
-                if (ascii_strcasecmp(p, "MET") == 0) {
-                    if ((p = strtok (NULL, " \t")) && !ascii_strcasecmp(p, "DST")) {
-                        zhours++;
-                    }
-                }
             }
             break;
         }
@@ -781,7 +704,6 @@ time_t mutt_parse_date(const char *s, HEADER *h)
     }
 
     if (count < 4) {  /* don't check for missing timezone */
-        debug_print (1, ("error parsing date format, using received time\n"));
         return -1;
     }
 
@@ -1175,8 +1097,6 @@ mutt_read_rfc822_header(FILE *f, HEADER *hdr, short user_hdrs, short weed)
         rfc2047_decode_envelope(e);
         /* check for missing or invalid date */
         if (hdr->date_sent <= 0) {
-            debug_print(1, ("no date found, using received "
-                            "time from msg separator\n"));
             hdr->date_sent = hdr->received;
         }
     }