Use passwords from the accounts file

This commit makes it so that if the password in an account in the
accounts file is present, then use it. Otherwise ask for the password to
the user.
This commit is contained in:
Tomás Senart
2013-10-14 20:15:51 +02:00
parent 3cc080b06a
commit 480589f0ae
6 changed files with 41 additions and 15 deletions

View File

@@ -109,21 +109,20 @@ jabber_init(const int disable_tls)
}
jabber_conn_status_t
jabber_connect_with_account(const ProfAccount * const account,
const char * const passwd)
jabber_connect_with_account(const ProfAccount * const account)
{
assert(account != NULL);
assert(passwd != NULL);
log_info("Connecting using account: %s", account->name);
// save account name and password for reconnect
saved_account.name = strdup(account->name);
saved_account.passwd = strdup(passwd);
saved_account.passwd = strdup(account->password);
// connect with fulljid
Jid *jidp = jid_create_from_bare_and_resource(account->jid, account->resource);
jabber_conn_status_t result = _jabber_connect(jidp->fulljid, passwd, account->server);
jabber_conn_status_t result =
_jabber_connect(jidp->fulljid, account->password, account->server);
jid_destroy(jidp);
return result;

View File

@@ -78,8 +78,7 @@ typedef struct disco_identity_t {
void jabber_init(const int disable_tls);
jabber_conn_status_t jabber_connect_with_details(const char * const jid,
const char * const passwd, const char * const altdomain);
jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account,
const char * const passwd);
jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account);
void jabber_disconnect(void);
void jabber_shutdown(void);
void jabber_process_events(void);