changeset 1365:c7e709719c43

Small code cleanup
author Mikael Berthe <mikael@lilotux.net>
date Mon, 12 Nov 2007 19:27:55 +0100
parents ff1f6facdc0c
children 01e558748379
files mcabber/src/commands.c mcabber/src/jab_iq.c mcabber/src/jabglue.c
diffstat 3 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/commands.c	Sun Nov 11 23:13:35 2007 +0100
+++ b/mcabber/src/commands.c	Mon Nov 12 19:27:55 2007 +0100
@@ -363,6 +363,9 @@
   char *xpline;
   cmd *curcmd;
 
+  if (!line)
+    return 0;
+
   // We do alias expansion here
   if (iscmd || scr_get_multimode() != 2)
     xpline = expandalias(line);
--- a/mcabber/src/jab_iq.c	Sun Nov 11 23:13:35 2007 +0100
+++ b/mcabber/src/jab_iq.c	Mon Nov 12 19:27:55 2007 +0100
@@ -338,11 +338,9 @@
   x = xmlnode_get_tag(xml_result, "query");
   if (!x)
     return -1;
+
   ns = xmlnode_get_attrib(x, "xmlns");
-  if (!ns)
-    return -1;
-
-  if (!strcmp(ns, NS_ROSTER))   // The check is probably useless...
+  if (ns && !strcmp(ns, NS_ROSTER))
     handle_iq_roster(x);
 
   // Post-login stuff
--- a/mcabber/src/jabglue.c	Sun Nov 11 23:13:35 2007 +0100
+++ b/mcabber/src/jabglue.c	Mon Nov 12 19:27:55 2007 +0100
@@ -505,10 +505,8 @@
       room_presence.msg = msg;
       foreach_buddy(ROSTER_TYPE_ROOM, &roompresence, &room_presence);
     }
-  }
-
-  if (online) {
-    // We'll need to update the roster if we switch to/from offline because
+
+    // We'll have to update the roster if we switch to/from offline because
     // we don't know the presences of buddies when offline...
     if (mystatus == offline || st == offline)
       update_roster = TRUE;
@@ -516,8 +514,10 @@
     hk_mystatuschange(0, mystatus, st, (st != invisible ? msg : ""));
     mystatus = st;
   }
+
   if (st)
     mywantedstatus = st;
+
   if (msg != mystatusmsg) {
     g_free(mystatusmsg);
     if (*msg)