+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Copyright © 2006 Pierre Habouzit
+ */
/*
* Copyright notice from original mutt:
* Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
#include <lib-lib/file.h>
#include <lib-lib/macros.h>
#include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
#include <lib-lib/rx.h>
#include <lib-sys/unix.h>
#include <lib-ui/enter.h>
#include <lib-ui/menu.h>
-#include "mutt.h"
+#include "alias.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);
-
}