"bad route in <>", "bad address in <>", "bad address spec",
};
-/**
- * free_address - Free a single Address
- * @param[out] a Address to free
- *
- * @note This doesn't alter the links if the Address is in a list.
- */
-static void free_address(struct Address **a)
-{
- if (!a || !*a)
- return;
- FREE(&(*a)->personal);
- FREE(&(*a)->mailbox);
- FREE(a);
-}
-
/**
* parse_comment - Extract a comment (parenthesised string)
* @param[in] s String, just after the opening parenthesis
if (!parse_addr_spec(phrase, comment, commentlen, commentmax, cur))
{
- free_address(&cur);
+ mutt_addr_free(&cur);
return;
}
* mutt_addr_new - Create a new Address
* @retval ptr Newly allocated Address
*
- * Free the result with free_address() or mutt_addr_free()
+ * Free the result with mutt_addr_free()
*/
struct Address *mutt_addr_new(void)
{
}
/**
- * mutt_addr_free - Free a list of Addresses
- * @param[out] p Top of the list
+ * mutt_addr_free - Free a single Addresses
+ * @param[out] a Address to free
*/
-void mutt_addr_free(struct Address **p)
+void mutt_addr_free(struct Address **a)
{
- if (!p)
+ if (!a || !*a)
return;
-
- struct AddressList *al = mutt_addr_to_addresslist(*p);
- mutt_addresslist_free(&al);
+ FREE(&(*a)->personal);
+ FREE(&(*a)->mailbox);
+ FREE(a);
}
/**
if (!s)
{
mutt_addresslist_free_all(al);
- free_address(&a);
+ mutt_addr_free(&a);
return 0;
}
mutt_addresslist_append(al, a);
}
/**
- * mutt_addr_parse_list2 - Parse a list of email addresses
- * @param p Add to this List of Addresses
+ * mutt_addresslist_parse - Parse a list of email addresses
+ * @param al Add to this List of Addresses
* @param s String to parse
- * @retval ptr Head of the list of addresses
+ * @retval int Number of parsed addresses
*
* The email addresses can be separated by whitespace or commas.
*/
return parsed;
}
-struct Address *mutt_addr_parse_list2(struct Address *p, const char *s)
-{
- if (!s)
- return NULL;
-
- struct AddressList *al = mutt_addr_to_addresslist(p);
- mutt_addresslist_parse2(al, s);
- p = mutt_addresslist_to_addr(al);
- FREE(&al);
- return p;
-}
-
/**
* mutt_addr_qualify - Expand local names in an Address list using a hostname
* @param addr Address list
void mutt_addresslist_free_one(struct AddressList *al, struct AddressNode *an)
{
TAILQ_REMOVE(al, an, entries);
- free_address(&an->addr);
+ mutt_addr_free(&an->addr);
FREE(&an);
}
while (np)
{
next = TAILQ_NEXT(np, entries);
- free_address(&np->addr);
+ mutt_addr_free(&np->addr);
FREE(&np);
np = next;
}
void mutt_addr_cat(char *buf, size_t buflen, const char *value, const char *specials);
bool mutt_addr_cmp(const struct Address *a, const struct Address *b);
-
-
-
struct Address *mutt_addr_copy(const struct Address *addr);
const char * mutt_addr_for_display(const struct Address *a);
-void mutt_addr_free(struct Address **p);
+void mutt_addr_free(struct Address **a);
+
bool mutt_addr_is_intl(const struct Address *a);
bool mutt_addr_is_local(const struct Address *a);
int mutt_addr_mbox_to_udomain(const char *mbox, char **user, char **domain);
struct Address *mutt_addr_new(void);
-struct Address *mutt_addr_parse_list2(struct Address *p, const char *s);
void mutt_addr_qualify(struct Address *addr, const char *host);
int mutt_addr_remove_from_list(struct AddressList *a, const char *mailbox);
void mutt_addr_remove_xrefs(const struct AddressList *a, struct AddressList *b);
{
mutt_error(_("Bad IDN %s while preparing resent-from"), err);
FREE(&err);
- mutt_addr_free(&from);
+ mutt_addresslist_free_all(&from_list);
return -1;
}
mutt_addresslist_write(resent_from, sizeof(resent_from), &from_list, false);
rfc2047_encode_addrlist(&resent_to, "Resent-To");
int rc = bounce_message(fp, e, &resent_to, resent_from, &from_list);
mutt_addresslist_free_all(&resent_to);
- mutt_addr_free(&from);
+ mutt_addresslist_free_all(&from_list);
return rc;
}
test/address/mutt_addr_is_intl.o \
test/address/mutt_addr_is_local.o \
test/address/mutt_addresslist_equal.o \
+ test/address/mutt_addresslist_parse2.o \
+ test/address/mutt_addresslist_parse.o \
test/address/mutt_addrlist_dedupe.o \
test/address/mutt_addrlist_to_intl.o \
test/address/mutt_addrlist_to_local.o \
test/address/mutt_addr_mbox_to_udomain.o \
test/address/mutt_addr_new.o \
- test/address/mutt_addr_parse_list2.o \
- test/address/mutt_addr_parse_list.o \
test/address/mutt_addr_qualify.o \
test/address/mutt_addr_remove_from_list.o \
test/address/mutt_addr_remove_xrefs.o \
/**
* @file
- * Test code for mutt_addr_parse_list()
+ * Test code for mutt_addresslist_parse()
*
* @authors
* Copyright (C) 2019 Richard Russon <rich@flatcap.org>
#include "mutt/mutt.h"
#include "address/lib.h"
-void test_mutt_addr_parse_list(void)
+void test_mutt_addresslist_parse(void)
{
- // struct Address *mutt_addr_parse_list(struct Address *top, const char *s);
+ // void mutt_addresslist_parse(struct AddressList *top, const char *s);
{
struct AddressList alist = TAILQ_HEAD_INITIALIZER(alist);
/**
* @file
- * Test code for mutt_addr_parse_list2()
+ * Test code for mutt_addresslist_parse2()
*
* @authors
* Copyright (C) 2019 Richard Russon <rich@flatcap.org>
#include "mutt/mutt.h"
#include "address/lib.h"
-void test_mutt_addr_parse_list2(void)
+void test_mutt_addresslist_parse2(void)
{
- // struct Address *mutt_addr_parse_list2(struct Address *p, const char *s);
-
+ // struct Address *mutt_addresslist_parse2(struct Address *p, const char *s);
{
- struct Address *addr = NULL;
- TEST_CHECK((addr = mutt_addr_parse_list2(NULL, "apple")) != NULL);
- mutt_addr_free(&addr);
+ struct AddressList alist = TAILQ_HEAD_INITIALIZER(alist);
+ mutt_addresslist_parse(&alist, "apple");
+ TEST_CHECK(mutt_addresslist_first(&alist) != NULL);
+ mutt_addresslist_free_all(&alist);
}
{
- struct Address addr = { 0 };
- TEST_CHECK(!mutt_addr_parse_list2(&addr, NULL));
+ struct AddressList alist = TAILQ_HEAD_INITIALIZER(alist);
+ mutt_addresslist_parse(&alist, NULL);
+ TEST_CHECK(mutt_addresslist_first(&alist) == NULL);
}
-
+
mutt_buffer_pool_free();
}
NEOMUTT_TEST_ITEM(test_mutt_addr_is_local) \
NEOMUTT_TEST_ITEM(test_mutt_addr_mbox_to_udomain) \
NEOMUTT_TEST_ITEM(test_mutt_addr_new) \
- NEOMUTT_TEST_ITEM(test_mutt_addr_parse_list) \
- NEOMUTT_TEST_ITEM(test_mutt_addr_parse_list2) \
NEOMUTT_TEST_ITEM(test_mutt_addr_qualify) \
NEOMUTT_TEST_ITEM(test_mutt_addr_remove_from_list) \
NEOMUTT_TEST_ITEM(test_mutt_addr_remove_xrefs) \
NEOMUTT_TEST_ITEM(test_mutt_addr_write) \
NEOMUTT_TEST_ITEM(test_mutt_addr_write_single) \
NEOMUTT_TEST_ITEM(test_mutt_addresslist_equal) \
+ NEOMUTT_TEST_ITEM(test_mutt_addresslist_parse) \
+ NEOMUTT_TEST_ITEM(test_mutt_addresslist_parse2) \
NEOMUTT_TEST_ITEM(test_mutt_addrlist_to_intl) \
NEOMUTT_TEST_ITEM(test_mutt_addrlist_to_local) \
NEOMUTT_TEST_ITEM(test_mutt_actx_add_attach) \