From: Emanuele Giaquinta Date: Wed, 29 Oct 2008 23:47:50 +0000 (+0100) Subject: Add imap_account_match wrapper over mutt_account_match that canonicalizes X-Git-Tag: neomutt-20160307~893 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=68260e219876878cfaeb7b4ac209d44ca28ccfe0;p=neomutt Add imap_account_match wrapper over mutt_account_match that canonicalizes accounts with imap_conn_find so that username comparison always work as expected. --- diff --git a/imap/command.c b/imap/command.c index c041336ea..0eef1f577 100644 --- a/imap/command.c +++ b/imap/command.c @@ -948,7 +948,7 @@ static void cmd_parse_status (IMAP_DATA* idata, char* s) } /* dprint (2, (debugfile, "Buffy entry: [%s] mbox: [%s]\n", inc->path, NONULL(mx.mbox))); */ - if (mutt_account_match (&idata->conn->account, &mx.account)) + if (imap_account_match (&idata->conn->account, &mx.account)) { if (mx.mbox) { diff --git a/imap/imap.h b/imap/imap.h index ed59566bc..d9883dcb0 100644 --- a/imap/imap.h +++ b/imap/imap.h @@ -70,4 +70,6 @@ void imap_pretty_mailbox (char* path); int imap_wait_keepalive (pid_t pid); void imap_keepalive (void); +int imap_account_match (const ACCOUNT* a1, const ACCOUNT* a2); + #endif diff --git a/imap/util.c b/imap/util.c index 9a6cfc033..ef56ddec9 100644 --- a/imap/util.c +++ b/imap/util.c @@ -790,3 +790,12 @@ void imap_disallow_reopen (CONTEXT *ctx) if (ctx && ctx->magic == M_IMAP && CTX_DATA->ctx == ctx) CTX_DATA->reopen &= ~IMAP_REOPEN_ALLOW; } + +int imap_account_match (const ACCOUNT* a1, const ACCOUNT* a2) +{ + IMAP_DATA* a1_idata = imap_conn_find (a1, M_IMAP_CONN_NONEW); + IMAP_DATA* a2_idata = imap_conn_find (a2, M_IMAP_CONN_NONEW); + const ACCOUNT* a1_canon = a1_idata == NULL ? a1 : &a1_idata->conn->account; + const ACCOUNT* a2_canon = a2_idata == NULL ? a2 : &a2_idata->conn->account; + return mutt_account_match (a1_canon, a2_canon); +}