about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-01-27 02:24:02 +0000
committerJames Booth <boothj5@gmail.com>2013-01-27 02:24:02 +0000
commit20d0df4c34dcba5dd50e84612788d6aec4afeada (patch)
tree72fbc7c1949d57d7542b242798a16b09f29c3724
parent235339e5a5f3c5891b3ceb6d1dc10f3bc4780a71 (diff)
downloadprofani-tty-20d0df4c34dcba5dd50e84612788d6aec4afeada.tar.gz
Added cons output when logging in.
Fixed issue with creating a new account on reconnect
-rw-r--r--src/command.c18
-rw-r--r--src/connection.c5
2 files changed, 10 insertions, 13 deletions
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);
     }