diff --git a/src/command.c b/src/command.c index a45f9564..4c05b47e 100644 --- a/src/command.c +++ b/src/command.c @@ -1011,22 +1011,24 @@ _cmd_connect(gchar **args, struct cmd_help_t help) ProfAccount *account = accounts_get_account(lower); if (account != NULL) { - jid = strdup(account->jid); - log_debug("Connecting as %s", jid); + if (account->resource != NULL) { + jid = create_fulljid(account->jid, account->resource); + } else { + jid = strdup(account->jid); + } + cons_show("Connecting with account %s as %s", account->name, jid); + log_debug("Connecting with account %s as %s", account->name, jid); conn_status = jabber_connect_with_account(account, passwd); } else { jid = strdup(lower); + cons_show("Connecting as %s", jid); log_debug("Connecting as %s", jid); conn_status = jabber_connect(jid, passwd, altdomain); } - if (conn_status == JABBER_CONNECTING) { - cons_show("Connecting..."); - log_debug("Connecting..."); - } if (conn_status == JABBER_DISCONNECTED) { - cons_bad_show("Connection to server failed."); - log_debug("Connection for %s failed", jid); + cons_bad_show("Connection attempt for %s failed.", jid); + log_debug("Connection attempt for %s failed", jid); } accounts_free_account(account); diff --git a/src/connection.c b/src/connection.c index 66551184..2b87aa92 100644 --- a/src/connection.c +++ b/src/connection.c @@ -130,11 +130,6 @@ jabber_conn_status_t jabber_connect(const char * const jid, const char * const passwd, const char * const altdomain) { - if (saved_user.account != NULL) { - free(saved_user.account); - saved_user.account = NULL; - } - if (saved_user.jid == NULL) { saved_user.jid = strdup(jid); }