/*
+ * Copyright notice from original mutt:
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
*/
#if HAVE_CONFIG_H
#endif
#include "mutt.h"
-#include "mutt_regex.h"
-#include "mailbox.h"
+#include "mx.h"
#include "mime.h"
#include "rfc2047.h"
#include "rfc2231.h"
#include "mutt_crypt.h"
#include "url.h"
+#include "lib/mem.h"
+#include "lib/intl.h"
+#include "lib/str.h"
+#include "lib/rx.h"
+
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
return (line);
}
- buf += strlen (buf) - 1;
+ buf += safe_strlen (buf) - 1;
if (*buf == '\n') {
/* we did get a full line. remove trailing space */
while (ISSPACE (*buf))
new = NULL;
if (*s == '<') {
- n = strlen (s);
+ n = safe_strlen (s);
if (s[n - 1] != '>') {
o = s;
s = NULL;
new = safe_strdup (s);
}
else if (o) {
- m = strlen (s);
+ m = safe_strlen (s);
if (s[m - 1] == '>') {
new = safe_malloc (sizeof (char) * (n + m + 1));
strcpy (new, o); /* __STRCPY_CHECKED__ */
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);
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");
}
}
return (NULL);
}
- blen = mutt_strlen (boundary);
+ blen = safe_strlen (boundary);
while (ftell (fp) < end_off && fgets (buffer, LONG_STRING, fp) != NULL) {
- len = mutt_strlen (buffer);
+ len = safe_strlen (buffer);
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)
buffer[i] = 0;
/* Check for the end boundary */
- if (mutt_strcmp (buffer + blen + 2, "--") == 0) {
+ if (safe_strcmp (buffer + blen + 2, "--") == 0) {
final = 1;
break; /* done parsing */
}
}
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));
/* 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));
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;
/* Keep track of the user-defined headers */
if (!matched && user_hdrs) {
/* restore the original line */
- line[strlen (line)] = ':';
+ line[safe_strlen (line)] = ':';
if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore)
&& !mutt_matches_ignore (line, UnIgnore))
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! */
*buf = '\0';
if (mutt_match_spam_list (line, SpamList, buf, sizeof (buf))) {
- if (!mutt_match_rx_list (line, NoSpamList)) {
+ if (!rx_list_match (NoSpamList, line)) {
/* if spam tag already exists, figure out how to amend it */
if (e->spam && *buf) {