summaryrefslogtreecommitdiffstats
path: root/imap/util.c
diff options
context:
space:
mode:
authorEmanuele Giaquinta <e.giaquinta@glauco.it>2008-10-30 00:47:50 +0100
committerEmanuele Giaquinta <e.giaquinta@glauco.it>2008-10-30 00:47:50 +0100
commitc7f360b03223cfd35570778cd796531adbe25517 (patch)
tree4e07037dd2e879140605364ce932cd42ae52ad56 /imap/util.c
parent85e3a1a488f7ec8be70626f7418074ffde5591e1 (diff)
Add imap_account_match wrapper over mutt_account_match that canonicalizes
accounts with imap_conn_find so that username comparison always work as expected.
Diffstat (limited to 'imap/util.c')
-rw-r--r--imap/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/imap/util.c b/imap/util.c
index 9a6cfc03..ef56ddec 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);
+}