Added resource handling in account module

Handle old accounts on load
This commit is contained in:
James Booth
2013-01-27 00:02:28 +00:00
parent 43841ee9ee
commit 1a30ee15e0
3 changed files with 45 additions and 17 deletions

View File

@@ -1135,9 +1135,18 @@ _cmd_account(gchar **args, struct cmd_help_t help)
cons_show("");
} else {
if (strcmp(property, "jid") == 0) {
accounts_set_jid(account_name, value);
cons_show("Updated jid for account %s: %s", account_name, value);
cons_show("");
Jid *jid = jid_create(args[3]);
if (jid == NULL) {
cons_show("Malformed jid: %s", value);
} else {
accounts_set_jid(account_name, jid->barejid);
cons_show("Updated jid for account %s: %s", account_name, jid->barejid);
if (jid->resourcepart != NULL) {
cons_show("Updated resource for account %s: %s", account_name, jid->resourcepart);
}
cons_show("");
}
jid_destroy(jid);
} else if (strcmp(property, "server") == 0) {
accounts_set_server(account_name, value);
cons_show("Updated server for account %s: %s", account_name, value);