#include <lib-ui/enter.h>
#include <lib-ui/menu.h>
-#include "mutt.h"
#include "mutt_idna.h"
#include "sort.h"
+char *AliasFmt;
+char *AliasFile;
+alias_t *Aliases;
+rx_t GecosMask;
+
#define RSORT(x) (SortAlias & SORT_REVERSE) ? -x : x
static struct mapping_t AliasHelp[] = {
{NULL, OP_NULL}
};
-const address_t *alias_lookup(const alias_t *list, const char *s)
+const address_t *alias_lookup(const char *s)
{
- while (list) {
+ alias_t *list;
+
+ for (list = Aliases; list; list = list->next) {
if (!m_strcasecmp(s, list->name))
return list->addr;
- list = list->next;
}
return NULL;
/* This routine looks to see if the user has an alias defined for the given
address. */
-const address_t *alias_reverse_lookup(const alias_t *list, const address_t *a)
+const address_t *alias_reverse_lookup(const address_t *a)
{
+ alias_t *list;
+
if (!a || !a->mailbox)
return NULL;
- for (; list; list = list->next) {
+ for (list = Aliases; list; list = list->next) {
address_t *ap;
/* cycle through all addresses if this is a group alias */
return;
/* check to see if the user already has an alias defined */
- if (alias_lookup(Aliases, buf)) {
+ if (alias_lookup(buf)) {
mutt_error _("You already have an alias defined with that name!");
return;
}
if (!pop->group && !pop->personal
&& pop->mailbox && !strchr(pop->mailbox, '@'))
{
- const address_t *t = alias_lookup(Aliases, pop->mailbox);
+ const address_t *t = alias_lookup(pop->mailbox);
if (t) {
string_list_t *u;
mutt_menuDestroy (&menu);
p_delete(&AliasTable);
-
}
short num;
} alias_t;
+extern char *AliasFmt;
+extern char *AliasFile;
+extern alias_t *Aliases;
+extern rx_t GecosMask;
+
DO_INIT(alias_t, alias);
static inline void alias_wipe(alias_t *a) {
address_list_wipe(&a->addr);
}
-
DO_NEW(alias_t, alias);
DO_DELETE(alias_t, alias);
DO_SLIST(alias_t, alias, alias_delete);
-const address_t *alias_lookup(const alias_t *list, const char *s);
-const address_t *alias_reverse_lookup(const alias_t *list, const address_t *);
+const address_t *alias_lookup(const char *s);
+const address_t *alias_reverse_lookup(const address_t *);
int mutt_addr_is_user(address_t *);
address_t *mutt_get_address(ENVELOPE *, const char **);
WHERE address_t *EnvFrom;
WHERE address_t *From;
-WHERE char *AliasFile;
-WHERE char *AliasFmt;
WHERE char *AssumedCharset;
WHERE char *AttachSep;
WHERE char *Attribution;
WHERE rx_t QuoteRegexp;
WHERE rx_t ReplyRegexp;
WHERE rx_t Smileys;
-WHERE rx_t GecosMask;
WHERE rx_t StripWasRegexp;
WHERE char *Preconnect INITVAL (NULL);
WHERE int CurrentMenu;
-WHERE alias_t *Aliases INITVAL (0);
WHERE string_list_t *UserHeader INITVAL (0);
/*-- formerly in pgp.h --*/
address_t *a;
for (; alias_queries; alias_queries = alias_queries->next) {
- if ((a = alias_lookup(Aliases, alias_queries->data))) {
+ if ((a = alias_lookup(alias_queries->data))) {
/* output in machine-readable form */
mutt_addrlist_to_idna (a, NULL);
mutt_write_address_list (a, stdout, 0, 0);
HEADER *h;
address_t *alias;
- if ((alias = alias_lookup(Aliases, s + 1))) {
+ if ((alias = alias_lookup(s + 1))) {
h = header_new();
h->env = envelope_new();
h->env->from = h->env->to = alias;
*/
return (h->env && h->env->from
&& (mutt_addr_is_user(h->env->from)
- || alias_reverse_lookup(Aliases, h->env->from)
+ || alias_reverse_lookup(h->env->from)
|| (h->env->from->personal
&& valid_realname(h->env-> from->personal)
&& h->env->from->mailbox)
const char *name = "";
if (a) {
- if (option (OPTREVALIAS) && (ali = alias_reverse_lookup(Aliases, a))
+ if (option (OPTREVALIAS) && (ali = alias_reverse_lookup(a))
&& ali->personal)
name = ali->personal;
else if (a->personal)