Skip to content

Commit

Permalink
rename params/args/vars: adr -> addr
Browse files Browse the repository at this point in the history
  • Loading branch information
flatcap committed Jan 1, 2018
1 parent 2b66c2c commit d3ec5a6
Show file tree
Hide file tree
Showing 24 changed files with 131 additions and 131 deletions.
8 changes: 4 additions & 4 deletions addrbook.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static const char *alias_format_str(char *buf, size_t buflen, size_t col, int co
const char *if_str, const char *else_str,
unsigned long data, enum FormatFlag flags)
{
char fmt[SHORT_STRING], adr[SHORT_STRING];
char fmt[SHORT_STRING], addr[SHORT_STRING];
struct Alias *alias = (struct Alias *) data;

switch (op)
Expand All @@ -93,10 +93,10 @@ static const char *alias_format_str(char *buf, size_t buflen, size_t col, int co
snprintf(buf, buflen, fmt, alias->num + 1);
break;
case 'r':
adr[0] = '\0';
mutt_addr_write(adr, sizeof(adr), alias->addr, true);
addr[0] = '\0';
mutt_addr_write(addr, sizeof(addr), alias->addr, true);
snprintf(fmt, sizeof(fmt), "%%%ss", prec);
snprintf(buf, buflen, fmt, adr);
snprintf(buf, buflen, fmt, addr);
break;
case 't':
buf[0] = alias->tagged ? '*' : ' ';
Expand Down
38 changes: 19 additions & 19 deletions alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,37 +186,37 @@ static void write_safe_address(FILE *fp, char *s)

struct Address *mutt_get_address(struct Envelope *env, char **pfxp)
{
struct Address *adr = NULL;
struct Address *addr = NULL;
char *pfx = NULL;

if (mutt_addr_is_user(env->from))
{
if (env->to && !mutt_is_mail_list(env->to))
{
pfx = "To";
adr = env->to;
addr = env->to;
}
else
{
pfx = "Cc";
adr = env->cc;
addr = env->cc;
}
}
else if (env->reply_to && !mutt_is_mail_list(env->reply_to))
{
pfx = "Reply-To";
adr = env->reply_to;
addr = env->reply_to;
}
else
{
adr = env->from;
addr = env->from;
pfx = "From";
}

if (pfxp)
*pfxp = pfx;

return adr;
return addr;
}

static void recode_buf(char *buf, size_t buflen)
Expand Down Expand Up @@ -279,27 +279,27 @@ int check_alias_name(const char *s, char *dest, size_t destlen)
return rc;
}

void mutt_create_alias(struct Envelope *cur, struct Address *iadr)
void mutt_create_alias(struct Envelope *cur, struct Address *iaddr)
{
struct Alias *new = NULL, *t = NULL;
char buf[LONG_STRING], tmp[LONG_STRING], prompt[SHORT_STRING], *pc = NULL;
char *err = NULL;
char fixed[LONG_STRING];
FILE *rc = NULL;
struct Address *adr = NULL;
struct Address *addr = NULL;

if (cur)
{
adr = mutt_get_address(cur, NULL);
addr = mutt_get_address(cur, NULL);
}
else if (iadr)
else if (iaddr)
{
adr = iadr;
addr = iaddr;
}

if (adr && adr->mailbox)
if (addr && addr->mailbox)
{
mutt_str_strfcpy(tmp, adr->mailbox, sizeof(tmp));
mutt_str_strfcpy(tmp, addr->mailbox, sizeof(tmp));
pc = strchr(tmp, '@');
if (pc)
*pc = '\0';
Expand Down Expand Up @@ -337,14 +337,14 @@ void mutt_create_alias(struct Envelope *cur, struct Address *iadr)
new = mutt_mem_calloc(1, sizeof(struct Alias));
new->name = mutt_str_strdup(buf);

mutt_addrlist_to_local(adr);
mutt_addrlist_to_local(addr);

if (adr && adr->mailbox)
mutt_str_strfcpy(buf, adr->mailbox, sizeof(buf));
if (addr && addr->mailbox)
mutt_str_strfcpy(buf, addr->mailbox, sizeof(buf));
else
buf[0] = '\0';

mutt_addrlist_to_intl(adr, NULL);
mutt_addrlist_to_intl(addr, NULL);

do
{
Expand All @@ -365,8 +365,8 @@ void mutt_create_alias(struct Envelope *cur, struct Address *iadr)
}
} while (!new->addr);

if (adr && adr->personal && !mutt_is_mail_list(adr))
mutt_str_strfcpy(buf, adr->personal, sizeof(buf));
if (addr && addr->personal && !mutt_is_mail_list(addr))
mutt_str_strfcpy(buf, addr->personal, sizeof(buf));
else
buf[0] = '\0';

Expand Down
2 changes: 1 addition & 1 deletion alias.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct Address *mutt_lookup_alias(const char *s);
struct Address *mutt_expand_aliases(struct Address *a);
void mutt_expand_aliases_env(struct Envelope *env);
struct Address *mutt_get_address(struct Envelope *env, char **pfxp);
void mutt_create_alias(struct Envelope *cur, struct Address *iadr);
void mutt_create_alias(struct Envelope *cur, struct Address *iaddr);
void mutt_free_alias(struct Alias **p);

#endif /* _MUTT_ALIAS_H */
28 changes: 14 additions & 14 deletions commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void ci_bounce_message(struct Header *h)
char prompt[SHORT_STRING];
char scratch[SHORT_STRING];
char buf[HUGE_STRING] = { 0 };
struct Address *adr = NULL;
struct Address *addr = NULL;
char *err = NULL;
int rc;

Expand Down Expand Up @@ -298,25 +298,25 @@ void ci_bounce_message(struct Header *h)
if (rc || !buf[0])
return;

adr = mutt_addr_parse_list2(adr, buf);
if (!adr)
addr = mutt_addr_parse_list2(addr, buf);
if (!addr)
{
mutt_error(_("Error parsing address!"));
return;
}

adr = mutt_expand_aliases(adr);
addr = mutt_expand_aliases(addr);

if (mutt_addrlist_to_intl(adr, &err) < 0)
if (mutt_addrlist_to_intl(addr, &err) < 0)
{
mutt_error(_("Bad IDN: '%s'"), err);
FREE(&err);
mutt_addr_free(&adr);
mutt_addr_free(&addr);
return;
}

buf[0] = '\0';
mutt_addr_write(buf, sizeof(buf), adr, true);
mutt_addr_write(buf, sizeof(buf), addr, true);

#define EXTRA_SPACE (15 + 7 + 2)
snprintf(scratch, sizeof(scratch),
Expand All @@ -333,16 +333,16 @@ void ci_bounce_message(struct Header *h)

if (query_quadoption(Bounce, prompt) != MUTT_YES)
{
mutt_addr_free(&adr);
mutt_addr_free(&addr);
mutt_window_clearline(MuttMessageWindow, 0);
mutt_message(h ? _("Message not bounced.") : _("Messages not bounced."));
return;
}

mutt_window_clearline(MuttMessageWindow, 0);

rc = mutt_bounce_message(NULL, h, adr);
mutt_addr_free(&adr);
rc = mutt_bounce_message(NULL, h, addr);
mutt_addr_free(&addr);
/* If no error, or background, display message. */
if ((rc == 0) || (rc == S_BKG))
mutt_message(h ? _("Message bounced.") : _("Messages bounced."));
Expand Down Expand Up @@ -669,11 +669,11 @@ void mutt_display_address(struct Envelope *env)
{
char *pfx = NULL;
char buf[SHORT_STRING];
struct Address *adr = NULL;
struct Address *addr = NULL;

adr = mutt_get_address(env, &pfx);
addr = mutt_get_address(env, &pfx);

if (!adr)
if (!addr)
return;

/*
Expand All @@ -684,7 +684,7 @@ void mutt_display_address(struct Envelope *env)
*/

buf[0] = '\0';
mutt_addr_write(buf, sizeof(buf), adr, false);
mutt_addr_write(buf, sizeof(buf), addr, false);
mutt_message("%s: %s", pfx, buf);
}

Expand Down
20 changes: 10 additions & 10 deletions hdrline.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,24 @@ bool mutt_is_subscribed_list(struct Address *addr)

/**
* check_for_mailing_list - Search list of addresses for a mailing list
* @param adr List of addreses to search
* @param addr List of addreses to search
* @param pfx Prefix string
* @param buf Buffer to store results
* @param buflen Buffer length
* @retval 1 Mailing list found
* @retval 0 No list found
*
* Search for a mailing list in the list of addresses pointed to by adr.
* Search for a mailing list in the list of addresses pointed to by addr.
* If one is found, print pfx and the name of the list into buf.
*/
static bool check_for_mailing_list(struct Address *adr, const char *pfx, char *buf, int buflen)
static bool check_for_mailing_list(struct Address *addr, const char *pfx, char *buf, int buflen)
{
for (; adr; adr = adr->next)
for (; addr; addr = addr->next)
{
if (mutt_is_subscribed_list(adr))
if (mutt_is_subscribed_list(addr))
{
if (pfx && buf && buflen)
snprintf(buf, buflen, "%s%s", pfx, mutt_get_name(adr));
snprintf(buf, buflen, "%s%s", pfx, mutt_get_name(addr));
return true;
}
}
Expand All @@ -118,14 +118,14 @@ static bool check_for_mailing_list(struct Address *adr, const char *pfx, char *b
* If one is found, print the address of the list into buf, then return 1.
* Otherwise, simply return 0.
*/
static bool check_for_mailing_list_addr(struct Address *adr, char *buf, int buflen)
static bool check_for_mailing_list_addr(struct Address *addr, char *buf, int buflen)
{
for (; adr; adr = adr->next)
for (; addr; addr = addr->next)
{
if (mutt_is_subscribed_list(adr))
if (mutt_is_subscribed_list(addr))
{
if (buf && buflen)
snprintf(buf, buflen, "%s", adr->mailbox);
snprintf(buf, buflen, "%s", addr->mailbox);
return true;
}
}
Expand Down
26 changes: 13 additions & 13 deletions hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,40 +477,40 @@ void mutt_default_save(char *path, size_t pathlen, struct Header *hdr)
if (addr_hook(path, pathlen, MUTT_SAVEHOOK, Context, hdr) != 0)
{
char tmp[_POSIX_PATH_MAX];
struct Address *adr = NULL;
struct Address *addr = NULL;
struct Envelope *env = hdr->env;
bool from_me = mutt_addr_is_user(env->from);

if (!from_me && env->reply_to && env->reply_to->mailbox)
adr = env->reply_to;
addr = env->reply_to;
else if (!from_me && env->from && env->from->mailbox)
adr = env->from;
addr = env->from;
else if (env->to && env->to->mailbox)
adr = env->to;
addr = env->to;
else if (env->cc && env->cc->mailbox)
adr = env->cc;
addr = env->cc;
else
adr = NULL;
if (adr)
addr = NULL;
if (addr)
{
mutt_safe_path(tmp, sizeof(tmp), adr);
mutt_safe_path(tmp, sizeof(tmp), addr);
snprintf(path, pathlen, "=%s", tmp);
}
}
}

void mutt_select_fcc(char *path, size_t pathlen, struct Header *hdr)
{
struct Address *adr = NULL;
struct Address *addr = NULL;
char buf[_POSIX_PATH_MAX];
struct Envelope *env = hdr->env;

if (addr_hook(path, pathlen, MUTT_FCCHOOK, NULL, hdr) != 0)
{
if ((SaveName || ForceName) && (env->to || env->cc || env->bcc))
{
adr = env->to ? env->to : (env->cc ? env->cc : env->bcc);
mutt_safe_path(buf, sizeof(buf), adr);
addr = env->to ? env->to : (env->cc ? env->cc : env->bcc);
mutt_safe_path(buf, sizeof(buf), addr);
mutt_file_concat_path(path, NONULL(Folder), buf, pathlen);
if (!ForceName && mx_access(path, W_OK) != 0)
mutt_str_strfcpy(path, NONULL(Record), pathlen);
Expand All @@ -533,9 +533,9 @@ static void list_hook(struct ListHead *matches, const char *match, int hook)
}
}

void mutt_crypt_hook(struct ListHead *list, struct Address *adr)
void mutt_crypt_hook(struct ListHead *list, struct Address *addr)
{
list_hook(list, adr->mailbox, MUTT_CRYPTHOOK);
list_hook(list, addr->mailbox, MUTT_CRYPTHOOK);
}

#ifdef USE_SOCKET
Expand Down
Loading

0 comments on commit d3ec5a6

Please sign in to comment.