about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-02-19 19:56:03 +0000
committerJames Booth <boothj5@gmail.com>2012-02-19 19:56:03 +0000
commitae1e037d0c6f5df403cda7e1167860d726983339 (patch)
tree2d3160f23abcae291c3ad21e88a788f3c9d0af9a
parent5a421b011e9ff817c118d55ee8f4e9db98364df9 (diff)
downloadprofani-tty-ae1e037d0c6f5df403cda7e1167860d726983339.tar.gz
Tidy up roster loop
-rw-r--r--jabber.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/jabber.c b/jabber.c
index a0774c31..d55b56fd 100644
--- a/jabber.c
+++ b/jabber.c
@@ -193,10 +193,11 @@ static int _roster_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
         query = xmpp_stanza_get_child_by_name(stanza, "query");
         cons_highlight_show("Roster:");
 
-        for (item = xmpp_stanza_get_children(query); item; 
-                item = xmpp_stanza_get_next(item)) {
+        item = xmpp_stanza_get_children(query);
+        while (item != NULL) {
             name = xmpp_stanza_get_attribute(item, "name");
             jid = xmpp_stanza_get_attribute(item, "jid");
+
             if (name != NULL) {
                 char line[2 + strlen(name) + 2 + strlen(jid) + 1 + 1];
                 sprintf(line, "  %s (%s)", name, jid);
@@ -207,6 +208,8 @@ static int _roster_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
                 sprintf(line, "  %s", jid);
                 cons_show(line);
             }
+        
+            item = xmpp_stanza_get_next(item);
         }
     }