about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-02-03 23:46:20 +0000
committerJames Booth <boothj5@gmail.com>2013-02-03 23:46:20 +0000
commit2cea2639174d37f3bfe430b204734773bfeb1512 (patch)
tree2a060d331cbee2dbfbefd59023f654b7ddf581b0 /src
parent3c9155be2c3fb7e2fab00335ac33791822ba9d18 (diff)
downloadprofani-tty-2cea2639174d37f3bfe430b204734773bfeb1512.tar.gz
Added asserts
Diffstat (limited to 'src')
-rw-r--r--src/config/accounts.c2
-rw-r--r--src/config/preferences.c2
-rw-r--r--src/jid.c4
-rw-r--r--src/ui/windows.c2
-rw-r--r--src/xmpp/connection.c13
-rw-r--r--src/xmpp/presence.c4
6 files changed, 17 insertions, 10 deletions
diff --git a/src/config/accounts.c b/src/config/accounts.c
index c51e01f5..e21fe1ad 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -428,7 +428,7 @@ accounts_get_priority_for_presence_type(const char * const account_name,
             result = 0;
             break;
     }
-    
+
     if (result < JABBER_PRIORITY_MIN || result > JABBER_PRIORITY_MAX)
         result = 0;
 
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 276e0841..0371ead3 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -133,7 +133,7 @@ prefs_get_string(preference_t pref)
     if (!g_key_file_has_key(prefs, group, key, NULL)) {
         return def;
     }
-    
+
     char *result = g_key_file_get_string(prefs, group, key, NULL);
 
     if (result == NULL) {
diff --git a/src/jid.c b/src/jid.c
index 7a62e141..6347f083 100644
--- a/src/jid.c
+++ b/src/jid.c
@@ -154,8 +154,8 @@ parse_room_jid(const char * const full_room_jid, char **room, char **nick)
 }
 
 /*
- * Given a room name, and a nick name create and return a full JID of the form
- * room@server/nick
+ * Given a barejid, and resourcepart, create and return a full JID of the form
+ * barejid/resourcepart
  * Will return a newly created string that must be freed by the caller
  */
 char *
diff --git a/src/ui/windows.c b/src/ui/windows.c
index 21ebcdc7..88d34ad2 100644
--- a/src/ui/windows.c
+++ b/src/ui/windows.c
@@ -505,7 +505,7 @@ ui_disconnected(void)
             }
         }
     }
-    
+
     title_bar_set_status(PRESENCE_OFFLINE);
     status_bar_clear_message();
     status_bar_refresh();
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) {
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index f0510b95..d8425cd7 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -161,7 +161,7 @@ presence_join_room(Jid *jid)
     xmpp_conn_t *conn = connection_get_conn();
     jabber_presence_t presence_type = jabber_get_presence_type();
     const char *show = stanza_get_presence_string_from_type(presence_type);
-    char *status = jabber_get_presence_message(); 
+    char *status = jabber_get_presence_message();
     int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(),
         presence_type);
 
@@ -302,7 +302,7 @@ _handle_presence_caps(xmpp_stanza_t * const stanza)
                 log_debug("Hash type supported.");
                 node = stanza_get_caps_str(stanza);
                 caps_key = node;
-                
+
                 if (node != NULL) {
                     log_debug("Node string: %s.", node);
                     if (!caps_contains(caps_key)) {