#endif
#include "mutt.h"
-#include "mailbox.h"
+#include "mx.h"
#include "mime.h"
#include "rfc2047.h"
#include "rfc2231.h"
#include "lib/intl.h"
#include "lib/str.h"
#include "lib/rx.h"
+#include "lib/debug.h"
#include <string.h>
#include <ctype.h>
const char *p;
size_t i;
- dprint (2, (debugfile, "parse_parameters: `%s'\n", s));
+ debug_print (2, ("`%s'\n", s));
while (*s) {
if ((p = strpbrk (s, "=;")) == NULL) {
- dprint (1,
- (debugfile, "parse_parameters: malformed parameter: %s\n", s));
+ debug_print (1, ("malformed parameter: %s\n", s));
goto bail;
}
new->value = safe_strdup (buffer);
- dprint (2, (debugfile, "parse_parameter: `%s' = `%s'\n",
- new->attribute ? new->attribute : "",
+ debug_print (2, ("`%s' = `%s'\n", new->attribute ? new->attribute : "",
new->value ? new->value : ""));
/* Add this parameter to the list */
head = cur = new;
}
else {
- dprint (1,
- (debugfile, "parse_parameters(): parameter with no value: %s\n",
- s));
+ debug_print (1, ("parameter with no value: %s\n", s));
s = p;
}
if ((s =
mutt_get_parameter ("filename",
(parms = parse_parameters (s)))) != 0)
- mutt_str_replace (&ct->filename, s);
+ str_replace (&ct->filename, s);
if ((s = mutt_get_parameter ("name", parms)) != 0)
ct->form_name = safe_strdup (s);
mutt_free_parameter (&parms);
c++;
SKIPWS (c);
if (!*c) {
- dprint (1,
- (debugfile,
- "mutt_read_mime_header(): skipping empty header field: %s\n",
- line));
+ debug_print (1, ("skipping empty header field: %s\n", line));
continue;
}
}
else {
- dprint (1,
- (debugfile, "read_mime_header: bogus MIME header: %s\n", line));
+ debug_print (1, ("bogus MIME header: %s\n", line));
break;
}
else if (!ascii_strcasecmp ("disposition", line + 8))
parse_content_disposition (c, p);
else if (!ascii_strcasecmp ("description", line + 8)) {
- mutt_str_replace (&p->description, c);
+ str_replace (&p->description, c);
rfc2047_decode (&p->description);
}
}
else if (!ascii_strcasecmp ("content-lines", line + 6))
mutt_set_parameter ("content-lines", c, &(p->parameter));
else if (!ascii_strcasecmp ("data-description", line + 6)) {
- mutt_str_replace (&p->description, c);
+ str_replace (&p->description, c);
rfc2047_decode (&p->description);
}
}
/* try to recover from parsing error */
if (!b->parts) {
b->type = TYPETEXT;
- mutt_str_replace (&b->subtype, "plain");
+ str_replace (&b->subtype, "plain");
}
}
crlf = (len > 1 && buffer[len - 2] == '\r') ? 1 : 0;
if (buffer[0] == '-' && buffer[1] == '-' &&
- mutt_strncmp (buffer + 2, boundary, blen) == 0) {
+ safe_strncmp (buffer + 2, boundary, blen) == 0) {
if (last) {
last->length = ftell (fp) - last->offset - len - 1 - crlf;
if (last->parts && last->parts->length == 0)
else if (sscanf (t, "%d:%d", &hour, &min) == 2)
sec = 0;
else {
- dprint (1,
- (debugfile, "parse_date: could not process time format: %s\n",
- t));
+ debug_print (1, ("could not process time format: %s\n", t));
return (-1);
}
tm.tm_hour = hour;
}
if (count < 4) { /* don't check for missing timezone */
- dprint (1,
- (debugfile,
- "parse_date(): error parsing date format, using received time\n"));
+ debug_print (1, ("error parsing date format, using received time\n"));
return (-1);
}
}
else if (ascii_strcasecmp (line + 8, "description") == 0) {
if (hdr) {
- mutt_str_replace (&hdr->content->description, p);
+ str_replace (&hdr->content->description, p);
rfc2047_decode (&hdr->content->description);
}
matched = 1;
case 'd':
if (!ascii_strcasecmp ("ate", line + 1)) {
- mutt_str_replace (&e->date, p);
+ str_replace (&e->date, p);
if (hdr)
hdr->date_sent = mutt_parse_date (p, hdr);
matched = 1;
matched = 1;
}
#ifdef USE_NNTP
- else if (!mutt_strcasecmp (line + 1, "ollowup-to")) {
+ else if (!safe_strcasecmp (line + 1, "ollowup-to")) {
if (!e->followup_to) {
- mutt_remove_trailing_ws (p);
- e->followup_to = safe_strdup (mutt_skip_whitespace (p));
+ str_skip_trailws (p);
+ e->followup_to = safe_strdup (str_skip_initws (p));
}
matched = 1;
}
/* Take the first mailto URL */
if (url_check_scheme (beg) == U_MAILTO) {
FREE (&e->list_post);
- e->list_post = mutt_substrdup (beg, end);
+ e->list_post = str_substrdup (beg, end);
break;
}
}
#ifdef USE_NNTP
case 'n':
- if (!mutt_strcasecmp (line + 1, "ewsgroups")) {
+ if (!safe_strcasecmp (line + 1, "ewsgroups")) {
FREE (&e->newsgroups);
- mutt_remove_trailing_ws (p);
- e->newsgroups = safe_strdup (mutt_skip_whitespace (p));
+ str_skip_trailws (p);
+ e->newsgroups = safe_strdup (str_skip_initws (p));
matched = 1;
}
break;
case 'o':
/* field `Organization:' saves only for pager! */
- if (!mutt_strcasecmp (line + 1, "rganization")) {
- if (!e->organization && mutt_strcasecmp (p, "unknown"))
+ if (!safe_strcasecmp (line + 1, "rganization")) {
+ if (!e->organization && safe_strcasecmp (p, "unknown"))
e->organization = safe_strdup (p);
}
break;
matched = 1;
}
#ifdef USE_NNTP
- else if (!mutt_strcasecmp (line + 1, "-comment-to")) {
+ else if (!safe_strcasecmp (line + 1, "-comment-to")) {
if (!e->x_comment_to)
e->x_comment_to = safe_strdup (p);
matched = 1;
}
- else if (!mutt_strcasecmp (line + 1, "ref")) {
+ else if (!safe_strcasecmp (line + 1, "ref")) {
if (!e->xref)
e->xref = safe_strdup (p);
matched = 1;
time_t t;
/* some bogus MTAs will quote the original "From " line */
- if (mutt_strncmp (">From ", line, 6) == 0)
+ if (safe_strncmp (">From ", line, 6) == 0)
continue; /* just ignore */
else if (is_from (line, return_path, sizeof (return_path), &t)) {
/* MH somtimes has the From_ line in the middle of the header! */
}
if (e->spam && e->spam->data)
- dprint (5, (debugfile, "p822: spam = %s\n", e->spam->data));
+ debug_print (5, ("spam = %s\n", e->spam->data));
}
}
/* check for missing or invalid date */
if (hdr->date_sent <= 0) {
- dprint (1,
- (debugfile,
- "read_rfc822_header(): no date found, using received time from msg separator\n"));
+ debug_print (1, ("no date found, using received time from msg separator\n"));
hdr->date_sent = hdr->received;
}
}