diff options
author | James Booth <boothj5@gmail.com> | 2013-01-27 20:23:42 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-01-27 20:23:42 +0000 |
commit | 972ca34d4b45f8a34997d480dec9cdcd39bae811 (patch) | |
tree | 57abad987380c18a9ef67edf9bc87f3e98534663 /src/accounts.c | |
parent | b9361542992118393fe6c39a8e0a2ec916696485 (diff) | |
download | profani-tty-972ca34d4b45f8a34997d480dec9cdcd39bae811.tar.gz |
Refactored connecting, and reconnecting
The user either logs in with an account, in which case its name, and the password is kept for reconnects. Or the user can login with a jid (and server) which does not currently exist as a local account. On success an account is created, with the jid as the name.
Diffstat (limited to 'src/accounts.c')
-rw-r--r-- | src/accounts.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/accounts.c b/src/accounts.c index 7454dfaa..286f135b 100644 --- a/src/accounts.c +++ b/src/accounts.c @@ -270,9 +270,15 @@ accounts_account_exists(const char * const account_name) void accounts_set_jid(const char * const account_name, const char * const value) { - if (accounts_account_exists(account_name)) { - g_key_file_set_string(accounts, account_name, "jid", value); - _save_accounts(); + Jid *jid = jid_create(value); + if (jid != NULL) { + if (accounts_account_exists(account_name)) { + g_key_file_set_string(accounts, account_name, "jid", jid->barejid); + if (jid->resourcepart != NULL) { + g_key_file_set_string(accounts, account_name, "resource", jid->resourcepart); + } + _save_accounts(); + } } } |