summaryrefslogtreecommitdiffstats
path: root/account.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2021-09-07 12:55:23 -0700
committerKevin McCarthy <kevin@8t8.us>2021-09-16 14:24:18 -0700
commit960afab461d1f72f64f322fe42738a91a066cc38 (patch)
tree14af33486aaf49d5380515df9b8d2e72ece78418 /account.c
parent8bb11afe4094d7f87267d7823b399c2f828034e4 (diff)
Generate URLs with user/password as parsed.
This helps ensure they match for browser sticky-cursor, sidebar, and a few other places where a path is compared against something (e.g. $trash). Add two flags that track if the user/password came from the parsed URL. If they were instead added to the account via $imap_user or $imap_pass, don't include those when generating a URL string as output. Change LSUB to also include the password, if present in the original connection URL.
Diffstat (limited to 'account.c')
-rw-r--r--account.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/account.c b/account.c
index 7ef484f5..9fa13577 100644
--- a/account.c
+++ b/account.c
@@ -75,11 +75,13 @@ int mutt_account_fromurl (ACCOUNT* account, ciss_url_t* url)
{
strfcpy (account->user, url->user, sizeof (account->user));
account->flags |= MUTT_ACCT_USER;
+ account->flags |= MUTT_ACCT_USER_FROM_URL;
}
if (url->pass)
{
strfcpy (account->pass, url->pass, sizeof (account->pass));
account->flags |= MUTT_ACCT_PASS;
+ account->flags |= MUTT_ACCT_PASS_FROM_URL;
}
if (url->port)
{
@@ -134,10 +136,16 @@ 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)
+ if ((account->flags & MUTT_ACCT_USER) &&
+ (account->flags & MUTT_ACCT_USER_FROM_URL))
+ {
url->user = account->user;
- if (account->flags & MUTT_ACCT_PASS)
+ }
+ if ((account->flags & MUTT_ACCT_PASS) &&
+ (account->flags & MUTT_ACCT_PASS_FROM_URL))
+ {
url->pass = account->pass;
+ }
}
/* mutt_account_getuser: retrieve username into ACCOUNT, if necessary */
@@ -253,6 +261,7 @@ int mutt_account_getpass (ACCOUNT *account)
void mutt_account_unsetpass (ACCOUNT* account)
{
account->flags &= ~MUTT_ACCT_PASS;
+ account->flags &= ~MUTT_ACCT_PASS_FROM_URL;
}
/* mutt_account_getoauthbearer: call external command to generate the