#endif
#include "mutt.h"
+#include "buffer.h"
+#include "enter.h"
+#include "ascii.h"
+#include "recvattach.h"
#include "mx.h"
#include "mime.h"
#include "rfc2047.h"
if (*linelen < offset + STRING) {
/* grow the buffer */
*linelen += STRING;
- safe_realloc (&line, *linelen);
+ mem_realloc (&line, *linelen);
buf = line + offset;
}
}
else if (o) {
m = str_len (s);
if (s[m - 1] == '>') {
- new = safe_malloc (sizeof (char) * (n + m + 1));
+ new = mem_malloc (sizeof (char) * (n + m + 1));
strcpy (new, o); /* __STRCPY_CHECKED__ */
strcpy (new + n, s); /* __STRCPY_CHECKED__ */
}
*/
if (!(at = strchr (new, '@')) || strchr (at + 1, '@')
|| (in_reply_to && at - new <= 8))
- FREE (&new);
+ mem_free (&new);
else {
- t = (LIST *) safe_malloc (sizeof (LIST));
+ t = (LIST *) mem_malloc (sizeof (LIST));
t->data = new;
t->next = lst;
lst = t;
new = mutt_new_parameter ();
- new->attribute = safe_malloc (i + 1);
+ new->attribute = mem_malloc (i + 1);
memcpy (new->attribute, s, i);
new->attribute[i] = 0;
char *pc;
char *subtype;
- FREE (&ct->subtype);
+ mem_free (&ct->subtype);
mutt_free_parameter (&ct->parameter);
/* First extract any existing parameters */
{
BODY *p = mutt_new_body ();
char *c;
- char *line = safe_malloc (LONG_STRING);
+ char *line = mem_malloc (LONG_STRING);
size_t linelen = LONG_STRING;
p->hdr_offset = ftell (fp);
else if (p->type == TYPEMESSAGE && !p->subtype)
p->subtype = str_dup ("rfc822");
- FREE (&line);
+ mem_free (&line);
return (p);
}
if ((s = strchr (s, '<')) == NULL || (p = strchr (s, '>')) == NULL)
return (NULL);
l = (size_t) (p - s) + 1;
- r = safe_malloc (l + 1);
+ r = mem_malloc (l + 1);
memcpy (r, s, l);
r[l] = 0;
return (r);
* bothered me for _years_ */
if (!e->from) {
e->from = rfc822_new_address ();
- e->from->personal = str_dup (line + 6);
+ e->from->personal = str_dup (p);
}
matched = 1;
}
/* Take the first mailto URL */
if (url_check_scheme (beg) == U_MAILTO) {
- FREE (&e->list_post);
+ mem_free (&e->list_post);
e->list_post = str_substrdup (beg, end);
break;
}
}
else if (!ascii_strcasecmp (line + 1, "essage-id")) {
/* We add a new "Message-Id:" when building a message */
- FREE (&e->message_id);
+ mem_free (&e->message_id);
e->message_id = extract_message_id (p);
matched = 1;
}
#ifdef USE_NNTP
case 'n':
if (!str_casecmp (line + 1, "ewsgroups")) {
- FREE (&e->newsgroups);
+ mem_free (&e->newsgroups);
str_skip_trailws (p);
e->newsgroups = str_dup (str_skip_initws (p));
matched = 1;
{
ENVELOPE *e = mutt_new_envelope ();
LIST *last = NULL;
- char *line = safe_malloc (LONG_STRING);
+ char *line = mem_malloc (LONG_STRING);
char *p;
long loc;
int matched;
}
- FREE (&line);
+ mem_free (&line);
if (hdr) {
hdr->content->hdr_offset = hdr->offset;
hdr->content->offset = ftell (f);
-
- /* do RFC2047 decoding */
- rfc2047_decode_adrlist (e->from);
- rfc2047_decode_adrlist (e->to);
- rfc2047_decode_adrlist (e->cc);
- rfc2047_decode_adrlist (e->bcc);
- rfc2047_decode_adrlist (e->reply_to);
- rfc2047_decode_adrlist (e->mail_followup_to);
- rfc2047_decode_adrlist (e->return_path);
- rfc2047_decode_adrlist (e->sender);
-
- if (e->subject) {
- regmatch_t pmatch[1];
-
- rfc2047_decode (&e->subject);
-
- if (regexec (ReplyRegexp.rx, e->subject, 1, pmatch, 0) == 0)
- e->real_subj = e->subject + pmatch[0].rm_eo;
- else
- e->real_subj = e->subject;
- }
-
+ 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"));
+ debug_print (1, ("no date found, using received "
+ "time from msg separator\n"));
hdr->date_sent = hdr->received;
}
}