X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=send.c;h=7b4b9bc4da068f0cbf55f5e637929b7c66a1073f;hp=ef1ef49bb725421e0c0b0be8d8d2abf1b6adad62;hb=b2ae7c03f2b772f2663768931ef51ff7aa1caf33;hpb=c88f8ebd5e7542e4ee2ac2c24dfd5f358dbb4235 diff --git a/send.c b/send.c index ef1ef49..7b4b9bc 100644 --- a/send.c +++ b/send.c @@ -22,7 +22,6 @@ #include "mutt.h" #include "enter.h" #include "mutt_curses.h" -#include "rfc2047.h" #include "rfc3676.h" #include "keymap.h" #include "copy.h" @@ -111,13 +110,13 @@ static address_t *mutt_remove_xrefs (address_t * a, address_t * b) if (prev) { prev->next = b->next; b->next = NULL; - rfc822_free_address (&b); + address_delete (&b); b = prev; } else { top = top->next; b->next = NULL; - rfc822_free_address (&b); + address_delete (&b); b = top; } } @@ -153,7 +152,7 @@ static address_t *remove_user (address_t * a, int leave_only) a = a->next; if (!leave_only || a || last) { tmp->next = NULL; - rfc822_free_address (&tmp); + address_delete (&tmp); } else last = top = tmp; @@ -170,11 +169,11 @@ static address_t *find_mailing_lists (address_t * t, address_t * c) 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); } } } @@ -193,7 +192,7 @@ static int edit_address (address_t ** a, const char *field) rfc822_write_address (buf, sizeof (buf), *a, 0); if (mutt_get_field (field, buf, sizeof (buf), M_ALIAS) != 0) return (-1); - rfc822_free_address (a); + address_delete (a); *a = mutt_expand_aliases (mutt_parse_adrlist (NULL, buf)); if ((idna_ok = mutt_addrlist_to_idna (*a, &err)) != 0) { mutt_error (_("Error: '%s' is a bad IDN."), err); @@ -297,7 +296,7 @@ static int edit_envelope (ENVELOPE * en, int flags) return (-1); } - str_replace (&en->subject, buf); + m_strreplace(&en->subject, buf); return 0; } @@ -343,15 +342,15 @@ static void process_user_header (ENVELOPE * env) for (; uh; uh = uh->next) { if (ascii_strncasecmp ("from:", uh->data, 5) == 0) { /* User has specified a default From: address. Remove default address */ - rfc822_free_address (&env->from); + address_delete (&env->from); env->from = rfc822_parse_adrlist (env->from, uh->data + 5); } else if (ascii_strncasecmp ("reply-to:", uh->data, 9) == 0) { - rfc822_free_address (&env->reply_to); + address_delete (&env->reply_to); 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 && @@ -473,10 +472,9 @@ static int include_reply (CONTEXT * ctx, HEADER * cur, FILE * out) 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; } @@ -494,9 +492,7 @@ static int default_to (address_t ** to, ENVELOPE * env, int flags, int hmfupto) _("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); - rfc822_free_address (&tmp); + address_list_append(to, find_mailing_lists (env->to, env->cc)); return 0; case -1: return -1; /* abort */ @@ -505,7 +501,7 @@ static int default_to (address_t ** to, ENVELOPE * env, int flags, int hmfupto) 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) || @@ -521,7 +517,7 @@ static int default_to (address_t ** to, ENVELOPE * env, int flags, int hmfupto) * 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) { @@ -534,11 +530,11 @@ static int default_to (address_t ** to, ENVELOPE * env, int flags, int hmfupto) 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: @@ -546,10 +542,10 @@ static int default_to (address_t ** to, ENVELOPE * env, int flags, int hmfupto) } } 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); } @@ -557,7 +553,6 @@ static int default_to (address_t ** to, ENVELOPE * env, int flags, int hmfupto) 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) { @@ -570,9 +565,7 @@ int mutt_fetch_recips (ENVELOPE * out, ENVELOPE * in, int flags) } if (flags & SENDLISTREPLY) { - tmp = find_mailing_lists (in->to, in->cc); - rfc822_append (&out->to, tmp); - rfc822_free_address (&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) @@ -583,10 +576,10 @@ int mutt_fetch_recips (ENVELOPE * out, ENVELOPE * in, int flags) 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; @@ -640,7 +633,7 @@ void mutt_make_forward_subject (ENVELOPE * env, CONTEXT * ctx, HEADER * cur) /* 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, @@ -881,7 +874,6 @@ static int generate_body (FILE * tempfp, /* stream for outgoing message * void mutt_set_followup_to (ENVELOPE * e) { - address_t *t = NULL; address_t *from; /* @@ -901,13 +893,14 @@ void mutt_set_followup_to (ENVELOPE * e) 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 */ @@ -922,22 +915,19 @@ void mutt_set_followup_to (ENVELOPE * e) 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); } } @@ -963,7 +953,7 @@ static address_t *set_reverse_name (ENVELOPE * env) 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) @@ -983,14 +973,14 @@ address_t *mutt_default_from (void) */ if (From) - adr = rfc822_cpy_adr_real (From); + adr = address_dup (From); else if (option (OPTUSEDOMAIN)) { - adr = rfc822_new_address (); + adr = address_new (); adr->mailbox = p_new(char, m_strlen(Username) + m_strlen(fqdn) + 2); sprintf (adr->mailbox, "%s@%s", NONULL (Username), NONULL (fqdn)); /* __SPRINTF_CHECKED__ */ } else { - adr = rfc822_new_address (); + adr = address_new (); adr->mailbox = m_strdup(NONULL (Username)); } @@ -1186,7 +1176,7 @@ int ci_send_message (int flags, /* send mode */ /* Use any list-post header as a template */ url_parse_mailto (msg->env, NULL, cur->env->list_post); /* We don't let them set the sender's address. */ - rfc822_free_address (&msg->env->from); + address_delete (&msg->env->from); } if (!(flags & (SENDKEY | SENDPOSTPONED | SENDRESEND))) { @@ -1315,7 +1305,7 @@ int ci_send_message (int flags, /* send mode */ msg->replied = 0; if (killfrom) { - rfc822_free_address (&msg->env->from); + address_delete (&msg->env->from); killfrom = 0; } @@ -1502,7 +1492,7 @@ int ci_send_message (int flags, /* send mode */ } mutt_select_fcc (fcc, sizeof (fcc), msg); if (killfrom) { - rfc822_free_address (&msg->env->from); + address_delete (&msg->env->from); killfrom = 0; } }