From 5e728496c219a2dccbcf855cc811e0c55386c1fe Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Thu, 23 May 2019 14:45:39 +0000 Subject: [PATCH] Associate imap_user to an IMAP connection This allows to distinguish between two connection to the same host using different usernames, when the username is not encoded in the URL. Issue #1664 --- imap/imap.c | 2 ++ imap/util.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/imap/imap.c b/imap/imap.c index b3f746eb8..9a99fae65 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1815,6 +1815,8 @@ struct Account *imap_ac_find(struct Account *a, const char *path) return NULL; struct Url *url = url_parse(path); + if (!url->user && C_ImapUser) + url->user = C_ImapUser; struct ImapAccountData *adata = a->adata; struct ConnAccount *ac = &adata->conn_account; diff --git a/imap/util.c b/imap/util.c index 34cd7d5f8..f6f79ce88 100644 --- a/imap/util.c +++ b/imap/util.c @@ -641,6 +641,12 @@ int imap_parse_path(const char *path, struct ConnAccount *account, char *mailbox if (url->scheme == U_IMAPS) account->flags |= MUTT_ACCT_SSL; + if (C_ImapUser) + { + mutt_str_strfcpy(account->user, C_ImapUser, sizeof(account->user)); + account->flags |= MUTT_ACCT_USER; + } + mutt_str_strfcpy(mailbox, url->path, mailboxlen); url_free(&url); -- 2.49.0