*/
int mutt_addr_remove_from_list(struct Address **a, const char *mailbox)
{
+ if (!a)
+ return -1;
+ if (!mailbox)
+ return 0;
+
int rc = -1;
struct Address *p = *a;
*/
void mutt_addr_free(struct Address **p)
{
+ if (!p)
+ return;
+
struct Address *t = NULL;
while (*p)
*/
struct Address *mutt_addr_parse_list(struct Address *top, const char *s)
{
+ if (!s)
+ return NULL;
+
int ws_pending;
const char *ps = NULL;
char comment[1024], phrase[1024];
*/
struct Address *mutt_addr_parse_list2(struct Address *p, const char *s)
{
+ if (!s)
+ return NULL;
+
/* check for a simple whitespace separated list of addresses */
const char *q = strpbrk(s, "\"<>():;,\\");
if (!q)
*/
void mutt_addr_cat(char *buf, size_t buflen, const char *value, const char *specials)
{
+ if (!buf || !value || !specials)
+ return;
+
if (strpbrk(value, specials))
{
char tmp[256], *pc = tmp;
*/
struct Address *mutt_addr_copy(struct Address *addr)
{
+ if (!addr)
+ return NULL;
+
struct Address *p = mutt_addr_new();
p->personal = mutt_str_strdup(addr->personal);
*/
struct Address *mutt_addr_append(struct Address **a, struct Address *b, bool prune)
{
+ if (!a)
+ return NULL;
+
struct Address *tmp = *a;
while (tmp && tmp->next)
*/
bool mutt_addr_cmp(struct Address *a, struct Address *b)
{
+ if (!a || !b)
+ return false;
if (!a->mailbox || !b->mailbox)
return false;
if (mutt_str_strcasecmp(a->mailbox, b->mailbox) != 0)
*/
bool mutt_addr_is_intl(struct Address *a)
{
+ if (!a)
+ return false;
return a->intl_checked && a->is_intl;
}
*/
bool mutt_addr_is_local(struct Address *a)
{
+ if (!a)
+ return false;
return a->intl_checked && !a->is_intl;
}
*/
int mutt_addr_mbox_to_udomain(const char *mbox, char **user, char **domain)
{
+ if (!mbox || !user || !domain)
+ return -1;
+
char *ptr = strchr(mbox, '@');
/* Fail if '@' is missing, at the start, or at the end */
*/
void mutt_addr_set_intl(struct Address *a, char *intl_mailbox)
{
+ if (!a)
+ return;
+
FREE(&a->mailbox);
a->mailbox = intl_mailbox;
a->intl_checked = true;
*/
void mutt_addr_set_local(struct Address *a, char *local_mailbox)
{
+ if (!a)
+ return;
+
FREE(&a->mailbox);
a->mailbox = local_mailbox;
a->intl_checked = true;
*/
const char *mutt_addr_for_display(struct Address *a)
{
+ if (!a)
+ return NULL;
+
char *user = NULL, *domain = NULL;
static char *buf = NULL;
- char *local_mailbox = NULL;
if (!a->mailbox || mutt_addr_is_local(a))
return a->mailbox;
if (mutt_addr_mbox_to_udomain(a->mailbox, &user, &domain) == -1)
return a->mailbox;
- local_mailbox = mutt_idna_intl_to_local(user, domain, MI_MAY_BE_IRREVERSIBLE);
+ char *local_mailbox = mutt_idna_intl_to_local(user, domain, MI_MAY_BE_IRREVERSIBLE);
FREE(&user);
FREE(&domain);
if (!local_mailbox)
- {
return a->mailbox;
- }
mutt_str_replace(&buf, local_mailbox);
FREE(&local_mailbox);
*/
void mutt_addr_write_single(char *buf, size_t buflen, struct Address *addr, bool display)
{
+ if (!buf || !addr)
+ return;
+
size_t len;
char *pbuf = buf;
char *pc = NULL;
- if (!addr)
- return;
-
buflen--; /* save room for the terminal nul */
if (addr->personal)
*/
size_t mutt_addr_write(char *buf, size_t buflen, struct Address *addr, bool display)
{
+ if (!buf || !addr)
+ return 0;
+
char *pbuf = buf;
size_t len = mutt_str_strlen(buf);
*/
struct Address *mutt_addr_remove_xrefs(struct Address *a, struct Address *b)
{
+ if (!a || !b)
+ return NULL;
+
struct Address *p = NULL, *prev = NULL;
struct Address *top = b;