#include <lib-lib/buffer.h>
#include <lib-lib/date.h>
-#include <lib-crypt/crypt.h>
-
#include "recvattach.h"
-#include "mx.h"
#include "url.h"
#include "lib/debug.h"
*/
time_t mutt_parse_date(const char *s, HEADER *h)
{
- int count = 0;
- char *p;
- struct tm tm;
- int tz_offset = 0;
int zhours = 0, zminutes = 0, zoccident = 0;
- const char *ptz;
- char tzstr[SHORT_STRING];
char scratch[SHORT_STRING];
+ struct tm tm;
+ int count = 0;
+ char *p;
/* Don't modify our argument. Fixed-size buffer is ok here since
the date format imposes a natural limit. */
p_clear(&tm, 1);
while ((p = strtok (p, " \t")) != NULL) {
+ char tzstr[SHORT_STRING];
+ const char *ptz;
+
switch (count) {
case 0: /* day of the month */
if (!isdigit((unsigned char)*p))
}
}
}
-
- tz_offset = zhours * 3600 + zminutes * 60;
- if (!zoccident)
- tz_offset = -tz_offset;
break;
}
count++;
h->zoccident = zoccident;
}
- return mutt_mktime(&tm, 0) + tz_offset;
+ return mutt_mktime(&tm, 0) + (zoccident ? 1 : -1) * (zhours * 3600 + zminutes * 60);
}
/*** XXX: MC READ MARK ***/
-/* extract the first substring that looks like a message-id */
-static char *extract_message_id(const char *s)
-{
- const char *p;
-
- if ((s = strchr(s, '<')) == NULL || (p = strchr(s, '>')) == NULL)
- return NULL;
- return p_dupstr(s, (p - s) + 1);
-}
-
-void mutt_parse_mime_message (CONTEXT * ctx, HEADER * cur)
-{
- MESSAGE *msg;
- int flags = 0;
-
- do {
- if (cur->content->type != TYPEMESSAGE
- && cur->content->type != TYPEMULTIPART)
- break; /* nothing to do */
-
- if (cur->content->parts)
- break; /* The message was parsed earlier. */
-
- if ((msg = mx_open_message (ctx, cur->msgno))) {
- mutt_parse_part (msg->fp, cur->content);
-
- cur->security = crypt_query (cur->content);
-
- mx_close_message (&msg);
- }
- } while (0);
- mutt_count_body_parts (cur, flags | M_PARTS_RECOUNT);
-}
-
int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
short user_hdrs, short weed, short do_2047,
LIST ** lastp)
matched = 1;
}
else if (!ascii_strcasecmp (line + 1, "essage-id")) {
+ const char *beg, *end;
+
/* We add a new "Message-ID:" when building a message */
p_delete(&e->message_id);
- e->message_id = extract_message_id (p);
+
+ if ((beg = strchr(p, '<')) && (end = strchr(beg, '>')))
+ e->message_id = p_dupstr(beg, (end - beg) + 1);
matched = 1;
}
else if (!ascii_strncasecmp (line + 1, "ail-", 4)) {
return (0);
#endif
}
+
+void mutt_parse_mime_message (CONTEXT * ctx, HEADER * cur)
+{
+ MESSAGE *msg;
+ int flags = 0;
+
+ do {
+ if (cur->content->type != TYPEMESSAGE
+ && cur->content->type != TYPEMULTIPART)
+ break; /* nothing to do */
+
+ if (cur->content->parts)
+ break; /* The message was parsed earlier. */
+
+ if ((msg = mx_open_message (ctx, cur->msgno))) {
+ mutt_parse_part (msg->fp, cur->content);
+
+ cur->security = crypt_query (cur->content);
+
+ mx_close_message (&msg);
+ }
+ } while (0);
+ mutt_count_body_parts (cur, flags | M_PARTS_RECOUNT);
+}