[telepathy-gabble/master] Dispatch pubsub events according to the 'node' attribute
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Wed Sep 16 06:31:55 PDT 2009
The right way to get the 'node' associated with an event is to look at
the 'node' attribute of the 'items' node.
---
src/wocky-pubsub.c | 24 +++++-------------------
1 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/src/wocky-pubsub.c b/src/wocky-pubsub.c
index 89876a1..297ca1d 100644
--- a/src/wocky-pubsub.c
+++ b/src/wocky-pubsub.c
@@ -186,23 +186,15 @@ static gboolean
gabble_pubsub_event_handler (WockyPubsub *self,
WockyXmppStanza *msg,
const gchar *from,
- WockyXmppNode *item_node)
+ WockyXmppNode *items_node)
{
WockyPubsubPrivate *priv = WOCKY_PUBSUB_GET_PRIVATE (self);
- const gchar *event_ns;
+ const gchar *node;
GSList *l;
- if (node_iter (item_node) == NULL)
- {
- return FALSE;
- }
+ node = wocky_xmpp_node_get_attribute (items_node, "node");
- /*
- * the namespace of the item is that of the first child of the <item> node
- */
- event_ns = wocky_xmpp_node_get_ns (node_iter_data (node_iter (item_node)));
-
- if (event_ns == NULL)
+ if (node == NULL)
{
return FALSE;
}
@@ -211,7 +203,7 @@ gabble_pubsub_event_handler (WockyPubsub *self,
{
PubsubEventHandler *handler = l->data;
- if (!wocky_strdiff (handler->node, event_ns))
+ if (!wocky_strdiff (handler->node, node))
{
handler->handle_function (self, msg, from, handler->user_data);
return TRUE;
@@ -359,12 +351,6 @@ pubsub_msg_event_cb (WockyPorter *porter,
return TRUE;
}
- node = wocky_xmpp_node_get_child (node, "item");
- if (node == NULL)
- {
- return TRUE;
- }
-
gabble_pubsub_event_handler (self, message, from, node);
return TRUE;
--
1.5.6.5
More information about the telepathy-commits
mailing list