#include "mutt.h"
#include "enter.h"
#include "mutt_curses.h"
-#include "rfc2047.h"
#include "rfc3676.h"
#include "keymap.h"
#include "copy.h"
for (; t; t = t->next) {
if (mutt_is_mail_list (t) && !t->group) {
if (top) {
- ptr->next = rfc822_cpy_adr_real (t);
+ ptr->next = address_dup (t);
ptr = ptr->next;
}
else
- ptr = top = rfc822_cpy_adr_real (t);
+ ptr = top = address_dup (t);
}
}
}
return (-1);
}
- str_replace (&en->subject, buf);
+ m_strreplace(&en->subject, buf);
return 0;
}
env->reply_to = rfc822_parse_adrlist (env->reply_to, uh->data + 9);
}
else if (ascii_strncasecmp ("message-id:", uh->data, 11) == 0)
- str_replace (&env->message_id, uh->data + 11);
+ m_strreplace(&env->message_id, uh->data + 11);
else if (ascii_strncasecmp ("to:", uh->data, 3) != 0 &&
ascii_strncasecmp ("cc:", uh->data, 3) != 0 &&
ascii_strncasecmp ("bcc:", uh->data, 4) != 0 &&
static int default_to (address_t ** to, ENVELOPE * env, int flags, int hmfupto)
{
char prompt[STRING];
- address_t *tmp;
if (flags && env->mail_followup_to && hmfupto == M_YES) {
- rfc822_append (to, env->mail_followup_to);
+ address_list_append(to, address_list_dup(env->mail_followup_to));
return 0;
}
_("Message came from a mailing list. List-reply to mailing list?")))
{
case M_YES:
- tmp = find_mailing_lists (env->to, env->cc);
- rfc822_append (to, tmp);
- address_delete (&tmp);
+ address_list_append(to, find_mailing_lists (env->to, env->cc));
return 0;
case -1:
return -1; /* abort */
if (!option (OPTREPLYSELF) && mutt_addr_is_user (env->from)) {
/* mail is from the user, assume replying to recipients */
- rfc822_append (to, env->to);
+ address_list_append(to, address_list_dup(env->to));
}
else if (env->reply_to) {
if ((mutt_addrcmp (env->from, env->reply_to) && !env->reply_to->next) ||
* in his From header.
*
*/
- rfc822_append (to, env->from);
+ address_list_append(to, address_list_dup(env->from));
}
else if (!(mutt_addrcmp (env->from, env->reply_to) &&
!env->reply_to->next) && quadoption (OPT_REPLYTO) != M_YES) {
env->reply_to->mailbox, env->reply_to->next ? ",..." : "");
switch (query_quadoption (OPT_REPLYTO, prompt)) {
case M_YES:
- rfc822_append (to, env->reply_to);
+ address_list_append(to, address_list_dup(env->reply_to));
break;
case M_NO:
- rfc822_append (to, env->from);
+ address_list_append(to, address_list_dup(env->from));
break;
default:
}
}
else
- rfc822_append (to, env->reply_to);
+ address_list_append(to, address_list_dup(env->reply_to));
}
else
- rfc822_append (to, env->from);
+ address_list_append(to, address_list_dup(env->from));
return (0);
}
int mutt_fetch_recips (ENVELOPE * out, ENVELOPE * in, int flags)
{
char prompt[STRING];
- address_t *tmp;
int hmfupto = -1;
if ((flags & (SENDLISTREPLY | SENDGROUPREPLY)) && in->mail_followup_to) {
}
if (flags & SENDLISTREPLY) {
- tmp = find_mailing_lists (in->to, in->cc);
- rfc822_append (&out->to, tmp);
- address_delete (&tmp);
+ address_list_append(&out->to, find_mailing_lists(in->to, in->cc));
if (in->mail_followup_to && hmfupto == M_YES &&
default_to (&out->cc, in, flags & SENDLISTREPLY, hmfupto) == -1)
return (-1); /* abort */
if ((flags & SENDGROUPREPLY)
- && (!in->mail_followup_to || hmfupto != M_YES)) {
- /* if(!mutt_addr_is_user(in->to)) */
- rfc822_append (&out->cc, in->to);
- rfc822_append (&out->cc, in->cc);
+ && (!in->mail_followup_to || hmfupto != M_YES))
+ {
+ address_t **tmp = address_list_append(&out->cc, address_list_dup(in->to));
+ address_list_append(tmp, address_list_dup(in->cc));
}
}
return 0;
/* set the default subject for the message. */
mutt_make_string (buffer, sizeof (buffer), NONULL (ForwFmt), ctx, cur);
- str_replace (&env->subject, buffer);
+ m_strreplace(&env->subject, buffer);
}
void mutt_make_misc_reply_headers (ENVELOPE * env, CONTEXT * ctx,
void mutt_set_followup_to (ENVELOPE * e)
{
- address_t *t = NULL;
address_t *from;
/*
if (!e->mail_followup_to) {
if (mutt_is_list_cc (0, e->to, e->cc)) {
+ address_t **tmp;
/*
* this message goes to known mailing lists, so create a proper
* mail-followup-to header
*/
- t = rfc822_append (&e->mail_followup_to, e->to);
- rfc822_append (&t, e->cc);
+ tmp = address_list_append(&e->mail_followup_to, address_list_dup(e->to));
+ address_list_append(tmp, address_list_dup(e->cc));
}
/* remove ourselves from the mail-followup-to header */
if (e->mail_followup_to && !mutt_is_list_recipient (0, e->to, e->cc)) {
if (e->reply_to)
- from = rfc822_cpy_adr (e->reply_to);
+ from = address_list_dup (e->reply_to);
else if (e->from)
- from = rfc822_cpy_adr (e->from);
+ from = address_list_dup (e->from);
else
from = mutt_default_from ();
if (from) {
- /* Normally, this loop will not even be entered. */
- for (t = from; t && t->next; t = t->next);
-
- t->next = e->mail_followup_to; /* t cannot be NULL at this point. */
+ address_list_append(&from->next, e->mail_followup_to);
e->mail_followup_to = from;
}
}
- e->mail_followup_to = mutt_remove_duplicates (e->mail_followup_to);
+ e->mail_followup_to = mutt_remove_duplicates(e->mail_followup_to);
}
}
if (!tmp && mutt_addr_is_user (env->from))
tmp = env->from;
if (tmp) {
- tmp = rfc822_cpy_adr_real (tmp);
+ tmp = address_dup (tmp);
if (!option (OPTREVREAL))
p_delete(&tmp->personal);
if (!tmp->personal)
*/
if (From)
- adr = rfc822_cpy_adr_real (From);
+ adr = address_dup (From);
else if (option (OPTUSEDOMAIN)) {
adr = address_new ();
adr->mailbox = p_new(char, m_strlen(Username) + m_strlen(fqdn) + 2);