summaryrefslogtreecommitdiffstats
path: root/account.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2000-08-25 06:28:22 +0000
committerThomas Roessler <roessler@does-not-exist.org>2000-08-25 06:28:22 +0000
commitd915b258fa0b8996331499e60068f04596a843e4 (patch)
tree7b88aec7f0b051b8b961254534db59affba02ccd /account.c
parentd42280540776cbbc02233dfbd1d45beba99396e9 (diff)
patch-bac.imapurl-2, with small modifications.
Diffstat (limited to 'account.c')
-rw-r--r--account.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/account.c b/account.c
index 2853d254..22a60a73 100644
--- a/account.c
+++ b/account.c
@@ -18,8 +18,9 @@
/* remote host account manipulation (POP/IMAP) */
-#include "account.h"
#include "mutt.h"
+#include "account.h"
+#include "url.h"
/* mutt_account_match: compare account info (host/port/user) */
int mutt_account_match (const ACCOUNT* a1, const ACCOUNT* a2)
@@ -53,6 +54,34 @@ int mutt_account_match (const ACCOUNT* a1, const ACCOUNT* a2)
return 1;
}
+/* mutt_account_fromurl: fill account with information from url. */
+int mutt_account_fromurl (ACCOUNT* account, ciss_url_t* url)
+{
+ /* must be present */
+ if (url->host)
+ strfcpy (account->host, url->host, sizeof (account->host));
+ else
+ return -1;
+
+ if (url->user)
+ {
+ strfcpy (account->user, url->user, sizeof (account->user));
+ account->flags |= M_ACCT_USER;
+ }
+ if (url->pass)
+ {
+ strfcpy (account->pass, url->pass, sizeof (account->pass));
+ account->flags |= M_ACCT_PASS;
+ }
+ if (url->port)
+ {
+ account->port = url->port;
+ account->flags |= M_ACCT_PORT;
+ }
+
+ return 0;
+}
+
/* mutt_account_getuser: retrieve username into ACCOUNT, if neccessary */
int mutt_account_getuser (ACCOUNT* account)
{