new->addr->personal = m_strdup(buf);
buf[0] = '\0';
- rfc822_write_address(buf, sizeof(buf), new->addr, 1);
+ rfc822_addrcat(buf, sizeof(buf), new->addr, 1);
snprintf(prompt, sizeof(prompt), _("[%s = %s] Accept?"), new->name, buf);
if (mutt_yesorno(prompt, M_YES) != M_YES) {
alias_list_wipe(&new);
}
buf[0] = '\0';
- rfc822_write_address(buf, sizeof(buf), new->addr, 0);
+ rfc822_addrcat(buf, sizeof(buf), new->addr, 0);
write_safe_address(rc, buf);
m_fclose(&rc);
mutt_message _("Alias added.");
break;
case 'r':
adr[0] = '\0';
- rfc822_write_address(adr, sizeof(adr), alias->addr, 1);
+ rfc822_addrcat(adr, sizeof(adr), alias->addr, 1);
snprintf(tmp, sizeof(tmp), "%%%ss", fmt);
snprintf(dest, destlen, tmp, adr);
break;
for (i = 0; i < menu->max; i++) {
if (AliasTable[i]->tagged) {
mutt_addrlist_to_local (AliasTable[i]->addr);
- rfc822_write_address (buf, buflen, AliasTable[i]->addr, 0);
+ rfc822_addrcat(buf, buflen, AliasTable[i]->addr, 0);
t = -1;
}
}
if (t != -1) {
mutt_addrlist_to_local (AliasTable[t]->addr);
- rfc822_write_address (buf, buflen, AliasTable[t]->addr, 0);
+ rfc822_addrcat(buf, buflen, AliasTable[t]->addr, 0);
}
mutt_menuDestroy (&menu);
}
buf[0] = 0;
- rfc822_write_address (buf, sizeof (buf), adr, 1);
+ rfc822_addrcat(buf, sizeof (buf), adr, 1);
#define extra_space (15 + 7 + 2)
snprintf (prompt, sizeof (prompt),
*/
buf[0] = 0;
- rfc822_write_address (buf, sizeof (buf), adr, 0);
+ rfc822_addrcat(buf, sizeof (buf), adr, 0);
mutt_message ("%s: %s", pfx, buf);
}
char buf[STRING];
buf[0] = 0;
- rfc822_write_address (buf, sizeof (buf), addr, 1);
+ rfc822_addrcat(buf, sizeof (buf), addr, 1);
mvprintw (line, SW, TITLE_FMT, Prompts[line - 1]);
mutt_paddstr (W, buf);
}
char *err = NULL;
mutt_addrlist_to_local (*addr);
- rfc822_write_address (buf, sizeof (buf), *addr, 0);
+ rfc822_addrcat(buf, sizeof (buf), *addr, 0);
if (mutt_get_field (Prompts[line - 1], buf, sizeof (buf), M_ALIAS) == 0) {
address_list_wipe(addr);
*addr = mutt_parse_adrlist (*addr, buf);
/* redraw the expanded list so the user can see the result */
buf[0] = 0;
- rfc822_write_address (buf, sizeof (buf), *addr, 1);
+ rfc822_addrcat(buf, sizeof (buf), *addr, 1);
move (line, HDR_XOFFSET + SW);
mutt_paddstr (W, buf);
a->next = NULL;
*buf = *cbuf = *c2buf = '\0';
- rfc822_write_address (buf, sizeof (buf), a, 0);
+ rfc822_addrcat(buf, sizeof (buf), a, 0);
a->next = tmp;
l = m_strlen(buf);
struct option_t* option) {
char s[HUGE_STRING];
s[0] = '\0';
- rfc822_write_address (s, sizeof(s), *((address_t**) option->data), 0);
+ rfc822_addrcat(s, sizeof(s), *((address_t**) option->data), 0);
snprintf (dst, dstlen, "%s=\"%s\"", option->option, NONULL (s));
}
mutt_pretty_mailbox (tmp);
}
else if (DTYPE (option->type) == DT_ADDR) {
- rfc822_write_address (tmp, sizeof(tmp),
- *((address_t **) option->data), 0);
+ rfc822_addrcat(tmp, sizeof(tmp), *((address_t **) option->data), 0);
}
else if (DTYPE (option->type) == DT_QUAD)
m_strcpy(tmp, sizeof(tmp), vals[quadoption(option->data)]);
personal = addr->personal;
addr->personal = NULL;
- *tmp = '\0';
- mutt_addrlist_to_local (addr);
- rfc822_write_address_single (tmp, sizeof (tmp), addr, 0);
- mutt_quote_filename (buff, sizeof (buff), tmp);
+ mutt_addrlist_to_local(addr);
+ rfc822_addrcpy(tmp, sizeof(tmp), addr, 0);
+ mutt_quote_filename(buff, sizeof(buff), tmp);
addr->personal = personal;
#define STRING 256
#define SHORT_STRING 128
-#define NONULL(x) (x?x:"")
-#define ISSPACE(c) isspace((unsigned char)c)
+#define NONULL(x) (x?x:"")
+#define ISSPACE(c) isspace((unsigned char)c)
extern unsigned char const __m_strdigits[128];
extern signed char const __m_b64digits[128];
}
static inline int m_strncmp(const char *a, const char *b, ssize_t n) {
- return strncmp (NONULL(a), NONULL(b), n);
+ return strncmp(NONULL(a), NONULL(b), n);
}
static inline int m_strncasecmp(const char *a, const char *b, ssize_t n) {
address_t *rfc822_parse_adrlist(address_t *, const char *s);
-ssize_t rfc822_write_address(char *, ssize_t, address_t *, int);
-ssize_t rfc822_write_address_single(char *, ssize_t, address_t *, int);
+ssize_t rfc822_addrcat(char *, ssize_t, address_t *, int);
+ssize_t rfc822_addrcpy(char *, ssize_t, address_t *, int);
ssize_t rfc822_strcpy(char *, ssize_t, const char *, const char *);
/****************************************************************************/
}
}
-ssize_t rfc822_write_address_single(char *buf, ssize_t buflen,
- address_t *addr, int display)
+ssize_t
+rfc822_addrcpy(char *buf, ssize_t buflen, address_t *addr, int display)
{
ssize_t pos = 0;
}
if (addr->mailbox) {
- if (!display) {
- pos += m_strcpy(buf + pos, buflen - pos, addr->mailbox);
- } else {
- pos += m_strcpy(buf + pos, buflen - pos, mutt_addr_for_display(addr));
- }
+ pos += m_strcpy(buf + pos, buflen - pos,
+ display ? mutt_addr_for_display(addr) : addr->mailbox);
if (addr->personal) {
pos += m_strputc(buf + pos, buflen - pos, '>');
/* note: it is assumed that `buf' is nul terminated! */
ssize_t
-rfc822_write_address(char *buf, ssize_t buflen, address_t *addr, int display)
+rfc822_addrcat(char *buf, ssize_t buflen, address_t *addr, int display)
{
- ssize_t pos;
+ ssize_t pos = m_strnlen(buf, buflen);
- pos = m_strnlen(buf, buflen);
-
- if (pos) {
+ if (pos)
pos += m_strcpy(buf + pos, buflen - pos, ", ");
- }
for (; addr; addr = addr->next) {
- pos += rfc822_write_address_single(buf + pos, buflen - pos,
- addr, display);
+ pos += rfc822_addrcpy(buf + pos, buflen - pos, addr, display);
if (!addr->group && addr->next && addr->next->mailbox) {
/* if there is another address, and its not a group mailbox name or
case 'f':
buf2[0] = 0;
- rfc822_write_address (buf2, sizeof (buf2), hdr->env->from, 1);
+ rfc822_addrcat(buf2, sizeof (buf2), hdr->env->from, 1);
mutt_format_s (dest, destlen, prefix, buf2);
break;
SecondColumn = QUERY_MIN_COLUMN_LENGHT;
}
- rfc822_write_address (buf, sizeof (buf), table[num].data->addr, 1);
+ rfc822_addrcat(buf, sizeof (buf), table[num].data->addr, 1);
mutt_format_string (buf2, sizeof (buf2),
FirstColumn + 2, FirstColumn + 2,
tmpa = result_to_addr (results);
mutt_addrlist_to_local (tmpa);
buf[0] = '\0';
- rfc822_write_address (buf, buflen, tmpa, 0);
+ rfc822_addrcat(buf, buflen, tmpa, 0);
address_list_wipe(&tmpa);
mutt_clear_error ();
return (0);
mutt_addrlist_to_local (tmpa);
tagged = 1;
- rfc822_write_address (buf, buflen, tmpa, 0);
+ rfc822_addrcat(buf, buflen, tmpa, 0);
curpos = m_strlen(buf);
address_list_wipe(&tmpa);
}
mutt_addrlist_to_local (tmpa);
m_strcat(buf, buflen, ", ");
- rfc822_write_address ((char *) buf + curpos + 1,
- buflen - curpos - 1, tmpa, 0);
+ rfc822_addrcat(buf + curpos + 1, buflen - curpos - 1, tmpa, 0);
curpos = m_strlen(buf);
address_list_wipe(&tmpa);
}
address_t *tmpa = result_to_addr (QueryTable[menu->current].data);
mutt_addrlist_to_local (tmpa);
- rfc822_write_address (buf, buflen, tmpa, 0);
+ rfc822_addrcat(buf, buflen, tmpa, 0);
address_list_wipe(&tmpa);
}
if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->article_num != prev) {
h = ctx->hdrs[i];
addr[0] = 0;
- rfc822_write_address (addr, sizeof (addr), h->env->from, 0);
+ rfc822_addrcat(addr, sizeof(addr), h->env->from, 0);
tm = gmtime (&h->date_sent);
snprintf (buf, sizeof (buf),
"%d\t%s\t%s\t%d %s %d %02d:%02d:%02d GMT\t%s\t",
}
buf[0] = 0;
- rfc822_write_address (buf, sizeof (buf), adr, 1);
+ rfc822_addrcat(buf, sizeof(buf), adr, 1);
#define extra_space (15+7+2)
/*
do {
buf[0] = 0;
mutt_addrlist_to_local (*a);
- rfc822_write_address (buf, sizeof (buf), *a, 0);
+ rfc822_addrcat(buf, sizeof(buf), *a, 0);
if (mutt_get_field (field, buf, sizeof (buf), M_ALIAS) != 0)
return (-1);
address_list_wipe(a);
fputs ("----- Forwarded message from ", fp);
buffer[0] = 0;
- rfc822_write_address (buffer, sizeof (buffer), cur->env->from, 1);
+ rfc822_addrcat(buffer, sizeof(buffer), cur->env->from, 1);
fputs (buffer, fp);
fputs (" -----\n\n", fp);
}
while (addr) {
char buf[LONG_STRING];
- int len;
-
- len = rfc822_write_address_single(buf, ssizeof(buf), addr, display);
+ int len = rfc822_addrcpy(buf, ssizeof(buf), addr, display);
if (!first) {
if (linelen + len > 74) {
*/
if (env->from && !privacy) {
buffer[0] = 0;
- rfc822_write_address (buffer, sizeof (buffer), env->from, 0);
+ rfc822_addrcat(buffer, sizeof(buffer), env->from, 0);
fprintf (fp, "From: %s\n", buffer);
}
p++;
/* sanity check: don't hide the host if
- * the fqdn is something like detebe.org.
- */
+ the fqdn is something like detebe.org. */
if (!p || !(q = strchr (p, '.')))
p = Fqdn;
/* redirect stderr to *tempfile too */
if (dup (1) < 0)
_exit (S_ERR);
- }
- else {
+ } else {
if (open ("/dev/null", O_WRONLY | O_APPEND) < 0) /* stdout */
_exit (S_ERR);
if (open ("/dev/null", O_RDWR | O_APPEND) < 0) /* stderr */
unlink (*tempfile); /* no longer needed */
p_delete(tempfile);
}
- }
- else {
+ } else {
st = (SendmailWait > 0 && errno == EINTR && SigAlrm) ? S_BKG : S_ERR;
if (SendmailWait > 0) {
unlink (*tempfile);
void mutt_unprepare_envelope (ENVELOPE * env)
{
- string_list_t *item;
+ string_list_t *item;
- for (item = env->userhdrs; item; item = item->next)
- rfc2047_decode (&item->data);
+ for (item = env->userhdrs; item; item = item->next)
+ rfc2047_decode(&item->data);
- address_list_wipe(&env->mail_followup_to);
+ address_list_wipe(&env->mail_followup_to);
- /* back conversions */
- rfc2047_decode_adrlist (env->to);
- rfc2047_decode_adrlist (env->cc);
- rfc2047_decode_adrlist (env->bcc);
- rfc2047_decode_adrlist (env->from);
- rfc2047_decode_adrlist (env->reply_to);
- rfc2047_decode (&env->subject);
+ /* back conversions */
+ rfc2047_decode_adrlist(env->to);
+ rfc2047_decode_adrlist(env->cc);
+ rfc2047_decode_adrlist(env->bcc);
+ rfc2047_decode_adrlist(env->from);
+ rfc2047_decode_adrlist(env->reply_to);
+ rfc2047_decode(&env->subject);
}
static int _mutt_bounce_message (FILE * fp, HEADER * h, address_t * to,
rfc822_qualify(from, mutt_fqdn(1));
- rfc2047_encode_adrlist (from, "Resent-From");
+ rfc2047_encode_adrlist(from, "Resent-From");
if (mutt_addrlist_to_idna (from, &err)) {
mutt_error (_("Bad IDN %s while preparing resent-from."), err);
return -1;
}
- rfc822_write_address (resent_from, sizeof (resent_from), from, 0);
+ rfc822_addrcat(resent_from, sizeof(resent_from), from, 0);
#ifdef USE_NNTP
unset_option (OPTNEWSSEND);