summaryrefslogtreecommitdiffstats
path: root/account.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2022-02-17 14:38:04 -0800
committerKevin McCarthy <kevin@8t8.us>2022-02-17 15:24:28 -0800
commit30d182341115b5ba43effa53f9b3bf18bc7ea359 (patch)
tree3aec3bb595d54712a81eb3cacc46dcf29d96b4ae /account.c
parent6457ac67aa10c4f877d846547ddb96b765ac4e33 (diff)
Make sure username is included in header and body cache paths.
Commit 960afab4 changed URL generation to preserve the data originally in the mailbox URL, to fix some internal comparison problems. Unfortunately, it also affected header and body cache generation. Since those could easily be shared across multi-muttrc situations, it's important the username be part of the pathname. Thanks to exg on the #mutt IRC channel for reporting the regression!
Diffstat (limited to 'account.c')
-rw-r--r--account.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/account.c b/account.c
index 9fa13577..9b01aa79 100644
--- a/account.c
+++ b/account.c
@@ -92,11 +92,20 @@ int mutt_account_fromurl (ACCOUNT* account, ciss_url_t* url)
return 0;
}
-/* mutt_account_tourl: fill URL with info from account. The URL information
- * is a set of pointers into account - don't free or edit account until
- * you've finished with url (make a copy of account if you need it for
- * a while). */
-void mutt_account_tourl (ACCOUNT* account, ciss_url_t* url)
+/* Fill URL with info from account. The URL information
+ * is a set of pointers into account - don't free or edit account until
+ * you've finished with url (make a copy of account if you need it for
+ * a while).
+ *
+ * By default "url" will be populated with the same data that was in
+ * the URL which "account" was parsed from. That is, user and
+ * password won't be assigned unless they were in the URL too.
+ *
+ * However, for header and body cache, we always want to include the username
+ * to prevent cross-muttrc name collisions. For that case, pass 1 to
+ * force_users
+ */
+void mutt_account_tourl (ACCOUNT* account, ciss_url_t* url, int force_user)
{
url->scheme = U_UNKNOWN;
url->user = NULL;
@@ -136,10 +145,10 @@ void mutt_account_tourl (ACCOUNT* account, ciss_url_t* url)
url->host = account->host;
if (account->flags & MUTT_ACCT_PORT)
url->port = account->port;
- if ((account->flags & MUTT_ACCT_USER) &&
- (account->flags & MUTT_ACCT_USER_FROM_URL))
+ if (account->flags & MUTT_ACCT_USER)
{
- url->user = account->user;
+ if (force_user || (account->flags & MUTT_ACCT_USER_FROM_URL))
+ url->user = account->user;
}
if ((account->flags & MUTT_ACCT_PASS) &&
(account->flags & MUTT_ACCT_PASS_FROM_URL))