summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-01-30 14:58:32 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2012-01-31 17:40:44 +0000
commit3403ab38582559b2293feb17f69f2df90e6ed229 (patch)
tree120b9733ff1afd772c3a0617ca54bbbdebf03c70
parent603aeb65562002ca1aa6273acf8580f88486e345 (diff)
tubes: stop using lm_message_node_get_child_with_namespace
These cases weren't completely obvious to me, being unfamiliar with the tubes protocol. But they all wanted to be wocky_node_get_child_ns() too, really.
-rw-r--r--src/private-tubes-factory.c18
-rw-r--r--src/tubes-channel.c24
2 files changed, 21 insertions, 21 deletions
diff --git a/src/private-tubes-factory.c b/src/private-tubes-factory.c
index 5b366a46b..b0611eb08 100644
--- a/src/private-tubes-factory.c
+++ b/src/private-tubes-factory.c
@@ -82,6 +82,7 @@ struct _GabblePrivateTubesFactoryPrivate
GabbleConnection *conn;
gulong status_changed_id;
guint msg_tube_cb;
+ guint msg_close_cb;
GHashTable *tubes_channels;
@@ -134,8 +135,14 @@ porter_available_cb (
WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE,
WOCKY_PORTER_HANDLER_PRIORITY_MAX,
private_tubes_factory_msg_tube_cb, self,
- /* FIXME: pattern-match at least a little bit… */
- NULL);
+ '(', "tube", ':', NS_TUBES,
+ ')', NULL);
+ priv->msg_close_cb = wocky_porter_register_handler_from_anyone (porter,
+ WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE,
+ WOCKY_PORTER_HANDLER_PRIORITY_MAX,
+ private_tubes_factory_msg_tube_cb, self,
+ '(', "close", ':', NS_TUBES,
+ ')', NULL);
}
static void
@@ -381,6 +388,8 @@ gabble_private_tubes_factory_close_all (GabblePrivateTubesFactory *fac)
wocky_porter_unregister_handler (porter, priv->msg_tube_cb);
priv->msg_tube_cb = 0;
+ wocky_porter_unregister_handler (porter, priv->msg_close_cb);
+ priv->msg_close_cb = 0;
}
/* Use a temporary variable (the macro does this) because we don't want
@@ -752,13 +761,12 @@ private_tubes_factory_msg_tube_cb (
const gchar *from;
TpHandle handle;
- tube_node = lm_message_node_get_child_with_namespace (
+ tube_node = wocky_node_get_child_ns (
wocky_stanza_get_top_node (msg), "tube", NS_TUBES);
close_node = wocky_node_get_child_ns (
wocky_stanza_get_top_node (msg), "close", NS_TUBES);
- if (tube_node == NULL && close_node == NULL)
- return FALSE;
+ g_return_val_if_fail (tube_node != NULL || close_node != NULL, FALSE);
from = wocky_node_get_attribute (
wocky_stanza_get_top_node (msg), "from");
diff --git a/src/tubes-channel.c b/src/tubes-channel.c
index 2d3525540..1afd4c213 100644
--- a/src/tubes-channel.c
+++ b/src/tubes-channel.c
@@ -837,8 +837,7 @@ gabble_tubes_channel_presence_updated (GabbleTubesChannel *self,
return;
}
- tubes_node = lm_message_node_get_child_with_namespace (pnode,
- "tubes", NS_TUBES);
+ tubes_node = wocky_node_get_child_ns (pnode, "tubes", NS_TUBES);
if (tubes_node == NULL)
return;
@@ -1355,22 +1354,19 @@ send_tube_close_msg (GabbleTubesChannel *self,
static void
tube_msg_offered (GabbleTubesChannel *self,
- WockyStanza *msg)
+ WockyStanza *msg,
+ WockyNode *tube_node)
{
GabbleTubesChannelPrivate *priv = self->priv;
const gchar *service;
GHashTable *parameters;
TpTubeType type;
- WockyNode *tube_node;
guint tube_id;
GabbleTubeIface *tube;
WockyStanzaType stanza_type;
wocky_stanza_get_type_info (msg, &stanza_type, NULL);
g_return_if_fail (stanza_type == WOCKY_STANZA_TYPE_MESSAGE);
- tube_node = lm_message_node_get_child_with_namespace (
- wocky_stanza_get_top_node (msg), "tube", NS_TUBES);
- g_return_if_fail (tube_node != NULL);
if (!extract_tube_information (self, tube_node, NULL, NULL,
NULL, NULL, &tube_id))
@@ -1416,20 +1412,16 @@ tube_msg_offered (GabbleTubesChannel *self,
static void
tube_msg_close (GabbleTubesChannel *self,
- WockyStanza *msg)
+ WockyStanza *msg,
+ WockyNode *close_node)
{
GabbleTubesChannelPrivate *priv = self->priv;
- WockyNode *close_node;
guint tube_id;
const gchar *tmp;
gchar *endptr;
GabbleTubeIface *tube;
TpTubeType type;
- close_node = wocky_node_get_child_ns (
- wocky_stanza_get_top_node (msg), "close", NS_TUBES);
- g_assert (close_node != NULL);
-
tmp = wocky_node_get_attribute (close_node, "tube");
if (tmp == NULL)
{
@@ -1468,11 +1460,11 @@ gabble_tubes_channel_tube_msg (GabbleTubesChannel *self,
{
WockyNode *node;
- node = lm_message_node_get_child_with_namespace (
+ node = wocky_node_get_child_ns (
wocky_stanza_get_top_node (msg), "tube", NS_TUBES);
if (node != NULL)
{
- tube_msg_offered (self, msg);
+ tube_msg_offered (self, msg, node);
return;
}
@@ -1480,7 +1472,7 @@ gabble_tubes_channel_tube_msg (GabbleTubesChannel *self,
wocky_stanza_get_top_node (msg), "close", NS_TUBES);
if (node != NULL)
{
- tube_msg_close (self, msg);
+ tube_msg_close (self, msg, node);
return;
}
}