[Telepathy-commits] [telepathy-gabble/master] muc-factory: discard muc presence without item node

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Oct 24 06:11:17 PDT 2008


---
 src/muc-factory.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/muc-factory.c b/src/muc-factory.c
index 84e749f..6ed246d 100644
--- a/src/muc-factory.c
+++ b/src/muc-factory.c
@@ -901,6 +901,7 @@ muc_factory_presence_cb (LmMessageHandler *handler,
         {
           TpHandle handle;
           LmMessageNode *item_node;
+          const gchar *owner_jid;
 
           handle = tp_handle_ensure (contact_repo, from,
               GUINT_TO_POINTER (GABBLE_JID_ROOM_MEMBER), NULL);
@@ -912,19 +913,20 @@ muc_factory_presence_cb (LmMessageHandler *handler,
             }
 
           item_node = lm_message_node_get_child (x_node, "item");
-          if (item_node != NULL)
+          if (item_node == NULL)
             {
-              const gchar *owner_jid;
-
-              owner_jid = lm_message_node_get_attribute (item_node, "jid");
-              /* We drop OLPC Gadget's inspector presence as activities
-               * doesn't have to see it as a member of the room and the
-               * presence cache should ignore it as well. */
-              if (owner_jid != NULL &&
-                  !tp_strdiff (owner_jid, priv->conn->olpc_gadget_activity))
-                {
-                  return LM_HANDLER_RESULT_REMOVE_MESSAGE;
-                }
+              DEBUG ("node missing 'item' child, ignoring");
+              return LM_HANDLER_RESULT_REMOVE_MESSAGE;
+            }
+
+          owner_jid = lm_message_node_get_attribute (item_node, "jid");
+          /* We drop OLPC Gadget's inspector presence as activities
+           * doesn't have to see it as a member of the room and the
+           * presence cache should ignore it as well. */
+          if (owner_jid != NULL &&
+              !tp_strdiff (owner_jid, priv->conn->olpc_gadget_activity))
+            {
+              return LM_HANDLER_RESULT_REMOVE_MESSAGE;
             }
 
           _gabble_muc_channel_member_presence_updated (muc_chan, handle,
-- 
1.5.6.5




More information about the Telepathy-commits mailing list