about summary refs log tree commit diff stats
path: root/src/xmpp/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmpp/connection.c')
-rw-r--r--src/xmpp/connection.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index d7ed95af..7a8df6bd 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -99,13 +99,17 @@ jabber_init(const int disable_tls)
 jabber_conn_status_t
 jabber_connect_with_account(ProfAccount *account, const char * const passwd)
 {
+    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);
 
-    log_info("Connecting using account: %s", account->name);
     char *fulljid = create_fulljid(account->jid, account->resource);
     jabber_conn_status_t result = _jabber_connect(fulljid, passwd, account->server);
-
     free(fulljid);
 
     return result;
@@ -151,7 +155,7 @@ jabber_disconnect(void)
         }
         connection_free_resources();
     }
-    
+
     jabber_conn.conn_status = JABBER_STARTED;
     jabber_conn.presence_type = PRESENCE_OFFLINE;
     FREE_SET_NULL(jabber_conn.presence_message);
@@ -314,6 +318,9 @@ static jabber_conn_status_t
 _jabber_connect(const char * const fulljid, const char * const passwd,
     const char * const altdomain)
 {
+    assert(fulljid != NULL);
+    assert(passwd != NULL);
+
     Jid *jid = jid_create(fulljid);
 
     if (jid == NULL) {