summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-04-20 12:36:50 +0100
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-04-20 12:36:50 +0100
commit1689ff96955211f553b524be0e062a88dbdc0206 (patch)
treecfe92c4c1cfe8bdb7390a4a0819e516689ef8633
parent8f265fadcec1ee261c0783e08e24b54227193b1a (diff)
parent30eafcc8eed22bf3913b642de9e31c4844b939e0 (diff)
Merge branch 'wocky-node-tree'
m---------lib/ext/wocky0
-rw-r--r--lib/loudmouth/lm-connection.c4
-rw-r--r--lib/loudmouth/lm-connection.h2
-rw-r--r--lib/loudmouth/lm-message-node.c52
-rw-r--r--lib/loudmouth/lm-message-node.h4
-rw-r--r--lib/loudmouth/lm-message.c10
-rw-r--r--lib/loudmouth/lm-message.h4
-rw-r--r--plugins/gateways.c23
-rw-r--r--plugins/test.c8
-rw-r--r--src/bytestream-factory.c90
-rw-r--r--src/bytestream-ibb.c12
-rw-r--r--src/bytestream-muc.c10
-rw-r--r--src/bytestream-multiple.c3
-rw-r--r--src/bytestream-socks5.c20
-rw-r--r--src/conn-aliasing.c34
-rw-r--r--src/conn-contact-info.c34
-rw-r--r--src/conn-location.c14
-rw-r--r--src/conn-mail-notif.c57
-rw-r--r--src/conn-olpc.c116
-rw-r--r--src/connection.c15
-rw-r--r--src/debug.h3
-rw-r--r--src/disco.c6
-rw-r--r--src/error.c4
-rw-r--r--src/ft-channel.c5
-rw-r--r--src/ft-manager.c3
-rw-r--r--src/im-factory.c2
-rw-r--r--src/jingle-factory.c10
-rw-r--r--src/message-util.c54
-rw-r--r--src/muc-channel.c88
-rw-r--r--src/muc-factory.c22
-rw-r--r--src/olpc-activity-view.c4
-rw-r--r--src/olpc-buddy-view.c3
-rw-r--r--src/presence-cache.c11
-rw-r--r--src/presence.c21
-rw-r--r--src/presence.h2
-rw-r--r--src/private-tubes-factory.c13
-rw-r--r--src/roster.c8
-rw-r--r--src/search-channel.c14
-rw-r--r--src/tube-dbus.c4
-rw-r--r--src/tube-stream.c3
-rw-r--r--src/tubes-channel.c27
-rw-r--r--src/util.c19
-rw-r--r--src/vcard-manager.c27
-rw-r--r--tests/test-caps-hash.c9
44 files changed, 491 insertions, 383 deletions
diff --git a/lib/ext/wocky b/lib/ext/wocky
-Subproject 2e47a76da94cc4945fc32fc6b8c2c56b99a156c
+Subproject 4829c453b09a295d634bfff2bf152dbf0c1bca5
diff --git a/lib/loudmouth/lm-connection.c b/lib/loudmouth/lm-connection.c
index 6bde8bb4d..44eb3f5c4 100644
--- a/lib/loudmouth/lm-connection.c
+++ b/lib/loudmouth/lm-connection.c
@@ -23,7 +23,7 @@
static gboolean
stanza_cb (WockyPorter *self,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
gpointer user_data)
{
LmMessageHandler *handler = (LmMessageHandler *) user_data;
@@ -144,7 +144,7 @@ iq_reply_cb (GObject *source,
gpointer user_data)
{
LmMessageHandler *handler = (LmMessageHandler *) user_data;
- WockyXmppStanza *reply;
+ WockyStanza *reply;
GError *error = NULL;
reply = wocky_porter_send_iq_finish (WOCKY_PORTER (source), res, &error);
diff --git a/lib/loudmouth/lm-connection.h b/lib/loudmouth/lm-connection.h
index 988dbe84a..4dd0435d6 100644
--- a/lib/loudmouth/lm-connection.h
+++ b/lib/loudmouth/lm-connection.h
@@ -21,7 +21,7 @@
#ifndef __LM_CONNECTION_H__
#define __LM_CONNECTION_H__
-#include <wocky/wocky-xmpp-stanza.h>
+#include <wocky/wocky-stanza.h>
#include <wocky/wocky-porter.h>
#include "lm-types.h"
diff --git a/lib/loudmouth/lm-message-node.c b/lib/loudmouth/lm-message-node.c
index 7659b1ac7..5149b7a84 100644
--- a/lib/loudmouth/lm-message-node.c
+++ b/lib/loudmouth/lm-message-node.c
@@ -29,28 +29,28 @@ copy_attribute (const gchar *key,
const gchar *ns,
gpointer user_data)
{
- WockyXmppNode *copy = (WockyXmppNode *) user_data;
+ WockyNode *copy = (WockyNode *) user_data;
- wocky_xmpp_node_set_attribute_ns (copy, key, value, ns);
+ wocky_node_set_attribute_ns (copy, key, value, ns);
return TRUE;
}
-static WockyXmppNode *
-copy_node (WockyXmppNode *node)
+static WockyNode *
+copy_node (WockyNode *node)
{
- WockyXmppNode *copy;
+ WockyNode *copy;
GSList *l;
- copy = wocky_xmpp_node_new (node->name);
- wocky_xmpp_node_set_content (copy, node->content);
- wocky_xmpp_node_set_language (copy, wocky_xmpp_node_get_language (node));
- wocky_xmpp_node_set_ns (copy, wocky_xmpp_node_get_ns (node));
+ copy = wocky_node_new (node->name, NULL);
+ wocky_node_set_content (copy, node->content);
+ wocky_node_set_language (copy, wocky_node_get_language (node));
+ wocky_node_set_ns (copy, wocky_node_get_ns (node));
- wocky_xmpp_node_each_attribute (node, copy_attribute, copy);
+ wocky_node_each_attribute (node, copy_attribute, copy);
for (l = node->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *child = l->data;
+ WockyNode *child = l->data;
copy->children = g_slist_prepend (copy->children, copy_node (child));
}
@@ -62,14 +62,14 @@ copy_node (WockyXmppNode *node)
LmMessageNode *
lm_message_node_ref (LmMessageNode *node)
{
- /* WockyXmppNode is not ref counted. Return a copy of the node */
+ /* WockyNode is not ref counted. Return a copy of the node */
return copy_node (node);
}
void
lm_message_node_unref (LmMessageNode *node)
{
- wocky_xmpp_node_free (node);
+ wocky_node_free (node);
}
void
@@ -78,11 +78,11 @@ lm_message_node_set_attribute (LmMessageNode *node,
const gchar *value)
{
if (!wocky_strdiff (name, "xmlns"))
- wocky_xmpp_node_set_ns (node, value);
+ wocky_node_set_ns (node, value);
else if (!wocky_strdiff (name, "xml:lang"))
- wocky_xmpp_node_set_language (node, value);
+ wocky_node_set_language (node, value);
else
- wocky_xmpp_node_set_attribute (node, name, value);
+ wocky_node_set_attribute (node, name, value);
}
const gchar *
@@ -90,11 +90,11 @@ lm_message_node_get_attribute (LmMessageNode *node,
const gchar *name)
{
if (!wocky_strdiff (name, "xmlns"))
- return wocky_xmpp_node_get_ns (node);
+ return wocky_node_get_ns (node);
else if (!wocky_strdiff (name, "xml:lang"))
- return wocky_xmpp_node_get_language (node);
+ return wocky_node_get_language (node);
- return wocky_xmpp_node_get_attribute (node, name);
+ return wocky_node_get_attribute (node, name);
}
void
@@ -124,30 +124,30 @@ lm_message_node_add_child (LmMessageNode *node,
const gchar *name,
const gchar *value)
{
- return wocky_xmpp_node_add_child_with_content (node, name, value);
+ return wocky_node_add_child_with_content (node, name, value);
}
LmMessageNode *
lm_message_node_get_child (LmMessageNode *node,
const gchar *child_name)
{
- return wocky_xmpp_node_get_child (node, child_name);
+ return wocky_node_get_child (node, child_name);
}
LmMessageNode *
lm_message_node_find_child (LmMessageNode *node,
const gchar *child_name)
{
- WockyXmppNode *found;
+ WockyNode *found;
GSList *l;
- found = wocky_xmpp_node_get_child (node, child_name);
+ found = wocky_node_get_child (node, child_name);
if (found != NULL)
return found;
for (l = node->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *child = l->data;
+ WockyNode *child = l->data;
found = lm_message_node_find_child (child, child_name);
if (found != NULL)
@@ -167,11 +167,11 @@ void
lm_message_node_set_value (LmMessageNode *node,
const gchar *value)
{
- wocky_xmpp_node_set_content (node, value);
+ wocky_node_set_content (node, value);
}
gchar *
lm_message_node_to_string (LmMessageNode *node)
{
- return wocky_xmpp_node_to_string (node);
+ return wocky_node_to_string (node);
}
diff --git a/lib/loudmouth/lm-message-node.h b/lib/loudmouth/lm-message-node.h
index 79e61ace3..1ea8b734d 100644
--- a/lib/loudmouth/lm-message-node.h
+++ b/lib/loudmouth/lm-message-node.h
@@ -21,11 +21,11 @@
#ifndef __LM_MESSAGE_NODE_H__
#define __LM_MESSAGE_NODE_H__
-#include <wocky/wocky-xmpp-node.h>
+#include <wocky/wocky-node.h>
G_BEGIN_DECLS
-typedef WockyXmppNode LmMessageNode;
+typedef WockyNode LmMessageNode;
LmMessageNode * lm_message_node_ref (LmMessageNode *node)
G_GNUC_WARN_UNUSED_RESULT;
diff --git a/lib/loudmouth/lm-message.c b/lib/loudmouth/lm-message.c
index f87123e20..d6a0c7925 100644
--- a/lib/loudmouth/lm-message.c
+++ b/lib/loudmouth/lm-message.c
@@ -24,7 +24,7 @@ LmMessage *
lm_message_new (const gchar *to,
LmMessageType type)
{
- return wocky_xmpp_stanza_build (type, WOCKY_STANZA_SUB_TYPE_NONE,
+ return wocky_stanza_build (type, WOCKY_STANZA_SUB_TYPE_NONE,
NULL, to, NULL);
}
@@ -33,7 +33,7 @@ lm_message_new_with_sub_type (const gchar *to,
LmMessageType type,
LmMessageSubType sub_type)
{
- return wocky_xmpp_stanza_build (type, sub_type,
+ return wocky_stanza_build (type, sub_type,
NULL, to, NULL);
}
@@ -54,7 +54,7 @@ lm_message_get_type (LmMessage *message)
{
WockyStanzaType type;
- wocky_xmpp_stanza_get_type_info (message, &type, NULL);
+ wocky_stanza_get_type_info (message, &type, NULL);
return type;
}
@@ -63,12 +63,12 @@ lm_message_get_sub_type (LmMessage *message)
{
WockyStanzaSubType sub_type;
- wocky_xmpp_stanza_get_type_info (message, NULL, &sub_type);
+ wocky_stanza_get_type_info (message, NULL, &sub_type);
return sub_type;
}
LmMessageNode *
lm_message_get_node (LmMessage *message)
{
- return message->node;
+ return wocky_stanza_get_top_node (message);
}
diff --git a/lib/loudmouth/lm-message.h b/lib/loudmouth/lm-message.h
index 0545ad30c..c1df07056 100644
--- a/lib/loudmouth/lm-message.h
+++ b/lib/loudmouth/lm-message.h
@@ -21,13 +21,13 @@
#ifndef __LM_MESSAGE_H__
#define __LM_MESSAGE_H__
-#include <wocky/wocky-xmpp-stanza.h>
+#include <wocky/wocky-stanza.h>
#include "lm-message-node.h"
G_BEGIN_DECLS
-typedef WockyXmppStanza LmMessage;
+typedef WockyStanza LmMessage;
typedef WockyStanzaType LmMessageType;
diff --git a/plugins/gateways.c b/plugins/gateways.c
index bd5c20b87..808fd38c3 100644
--- a/plugins/gateways.c
+++ b/plugins/gateways.c
@@ -236,7 +236,7 @@ gabble_gateway_sidecar_dispose (GObject *object)
static gboolean
presence_cb (WockyPorter *porter,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
gpointer user_data)
{
GabbleGatewaySidecar *self = GABBLE_GATEWAY_SIDECAR (user_data);
@@ -245,7 +245,7 @@ presence_cb (WockyPorter *porter,
gboolean ret = FALSE;
WockyStanzaSubType subtype;
- wocky_xmpp_stanza_get_type_info (stanza, NULL, &subtype);
+ wocky_stanza_get_type_info (stanza, NULL, &subtype);
switch (subtype)
{
@@ -261,7 +261,8 @@ presence_cb (WockyPorter *porter,
g_return_val_if_reached (FALSE);
}
- from = wocky_xmpp_node_get_attribute (stanza->node, "from");
+ from = wocky_node_get_attribute (
+ wocky_stanza_get_top_node (stanza), "from");
if (from == NULL || strchr (from, '@') != NULL || strchr (from, '/') != NULL)
goto finally;
@@ -273,12 +274,12 @@ presence_cb (WockyPorter *porter,
if (subtype == WOCKY_STANZA_SUB_TYPE_SUBSCRIBE)
{
- WockyXmppStanza *reply;
+ WockyStanza *reply;
/* It's a gateway we've registered with during this session, and they
* want to subscribe to us. OK, let them. */
DEBUG ("Allowing gateway '%s' to subscribe to us", normalized);
- reply = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_PRESENCE,
+ reply = wocky_stanza_build (WOCKY_STANZA_TYPE_PRESENCE,
WOCKY_STANZA_SUB_TYPE_SUBSCRIBED, NULL, normalized,
NULL);
wocky_porter_send (porter, reply);
@@ -393,13 +394,13 @@ register_cb (GObject *source,
{
WockyPorter *porter = WOCKY_PORTER (source);
PendingRegistration *pr = user_data;
- WockyXmppStanza *reply;
+ WockyStanza *reply;
GError *error = NULL;
reply = wocky_porter_send_iq_finish (porter, result, &error);
if (reply == NULL ||
- wocky_xmpp_stanza_extract_errors (reply, NULL, &error, NULL, NULL))
+ wocky_stanza_extract_errors (reply, NULL, &error, NULL, NULL))
{
GError *tp_error = NULL;
@@ -439,13 +440,13 @@ register_cb (GObject *source,
}
else
{
- WockyXmppStanza *request;
+ WockyStanza *request;
DEBUG ("Registered with '%s', exchanging presence...", pr->gateway);
/* attempt to subscribe to the gateway's presence (FIXME: is this
* harmless if we're already subscribed to it?) */
- request = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_PRESENCE,
+ request = wocky_stanza_build (WOCKY_STANZA_TYPE_PRESENCE,
WOCKY_STANZA_SUB_TYPE_SUBSCRIBE, NULL, pr->gateway,
NULL);
wocky_porter_send (porter, request);
@@ -471,7 +472,7 @@ gateways_register (
{
GabbleGatewaySidecar *self = GABBLE_GATEWAY_SIDECAR (sidecar);
WockyPorter *porter = wocky_session_get_porter (self->priv->session);
- WockyXmppStanza *stanza;
+ WockyStanza *stanza;
gchar *normalized_gateway;
GError *error = NULL;
@@ -520,7 +521,7 @@ gateways_register (
* method Service.Release() [distributed refcounting]
*/
- stanza = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_IQ,
+ stanza = wocky_stanza_build (WOCKY_STANZA_TYPE_IQ,
WOCKY_STANZA_SUB_TYPE_SET,
NULL, normalized_gateway,
'(', "query", ':', WOCKY_XEP77_NS_REGISTER,
diff --git a/plugins/test.c b/plugins/test.c
index 6e36565ef..9712a39fb 100644
--- a/plugins/test.c
+++ b/plugins/test.c
@@ -331,7 +331,7 @@ iq_cb (
{
GSimpleAsyncResult *result = user_data;
GError *error = NULL;
- WockyXmppStanza *reply;
+ WockyStanza *reply;
reply = wocky_porter_send_iq_finish (WOCKY_PORTER (source),
nested_result, &error);
@@ -345,7 +345,7 @@ iq_cb (
{
WockyStanzaSubType t;
- wocky_xmpp_stanza_get_type_info (reply, NULL, &t);
+ wocky_stanza_get_type_info (reply, NULL, &t);
if (t == WOCKY_STANZA_SUB_TYPE_RESULT)
g_simple_async_result_set_op_res_gboolean (result, TRUE);
@@ -371,9 +371,9 @@ sidecar_iq_init_async (
GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (self),
callback, user_data, sidecar_iq_init_async);
WockyPorter *porter = wocky_session_get_porter (self->session);
- WockyXmppStanza *iq;
+ WockyStanza *iq;
- iq = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_IQ,
+ iq = wocky_stanza_build (WOCKY_STANZA_TYPE_IQ,
WOCKY_STANZA_SUB_TYPE_GET, NULL, "sidecar.example.com",
'(', "query",
':', "http://example.com/sidecar",
diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c
index ca25abb93..12088b379 100644
--- a/src/bytestream-factory.c
+++ b/src/bytestream-factory.c
@@ -311,15 +311,16 @@ socks5_proxy_query_reply_cb (GabbleConnection *conn,
gboolean fallback = GPOINTER_TO_INT (user_data);
GSList *found = NULL;
- from = lm_message_node_get_attribute (reply_msg->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (reply_msg), "from");
if (from == NULL)
goto fail;
if (lm_message_get_sub_type (reply_msg) != LM_MESSAGE_SUB_TYPE_RESULT)
goto fail;
- query = lm_message_node_get_child_with_namespace (reply_msg->node, "query",
- NS_BYTESTREAMS);
+ query = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (reply_msg), "query", NS_BYTESTREAMS);
if (query == NULL)
goto fail;
@@ -840,16 +841,16 @@ streaminit_parse_request (LmMessage *message,
GSList **stream_methods,
gboolean *multiple)
{
- LmMessageNode *iq = message->node;
+ LmMessageNode *iq = wocky_stanza_get_top_node (message);
LmMessageNode *feature, *x, *si_multiple;
NodeIter i, j;
*stream_init_id = lm_message_node_get_attribute (iq, "id");
- *from = lm_message_node_get_attribute (message->node, "from");
+ *from = lm_message_node_get_attribute (iq, "from");
if (*from == NULL)
{
- NODE_DEBUG (message->node, "got a message without a from field");
+ STANZA_DEBUG (message, "got a message without a from field");
return FALSE;
}
@@ -858,7 +859,7 @@ streaminit_parse_request (LmMessage *message,
*stream_id = lm_message_node_get_attribute (si, "id");
if (*stream_id == NULL)
{
- NODE_DEBUG (message->node, "got a SI request without a stream id field");
+ STANZA_DEBUG (message, "got a SI request without a stream id field");
return FALSE;
}
@@ -869,7 +870,7 @@ streaminit_parse_request (LmMessage *message,
*profile = lm_message_node_get_attribute (si, "profile");
if (*profile == NULL)
{
- NODE_DEBUG (message->node, "got a SI request without a profile field");
+ STANZA_DEBUG (message, "got a SI request without a profile field");
return FALSE;
}
@@ -878,14 +879,14 @@ streaminit_parse_request (LmMessage *message,
NS_FEATURENEG);
if (feature == NULL)
{
- NODE_DEBUG (message->node, "got a SI request without a feature field");
+ STANZA_DEBUG (message, "got a SI request without a feature field");
return FALSE;
}
x = lm_message_node_get_child_with_namespace (feature, "x", NS_X_DATA);
if (x == NULL)
{
- NODE_DEBUG (message->node, "got a SI request without a X data field");
+ STANZA_DEBUG (message, "got a SI request without a X data field");
return FALSE;
}
@@ -901,7 +902,7 @@ streaminit_parse_request (LmMessage *message,
if (tp_strdiff (lm_message_node_get_attribute (field, "type"),
"list-single"))
{
- NODE_DEBUG (message->node, "SI request's stream-method field was "
+ STANZA_DEBUG (message, "SI request's stream-method field was "
"not of type list-single");
return FALSE;
}
@@ -936,7 +937,7 @@ streaminit_parse_request (LmMessage *message,
if (*stream_methods == NULL)
{
- NODE_DEBUG (message->node,
+ STANZA_DEBUG (message,
"got a SI request without stream method proposed");
return FALSE;
}
@@ -1086,7 +1087,7 @@ si_tube_received (GabbleBytestreamFactory *self,
"<muc-stream>" };
/* Invalid tube SI request */
- NODE_DEBUG (msg->node, e.message);
+ STANZA_DEBUG (msg, e.message);
gabble_bytestream_iface_close (bytestream, &e);
}
}
@@ -1124,7 +1125,8 @@ bytestream_factory_iq_si_cb (LmMessageHandler *handler,
if (lm_message_get_sub_type (msg) != LM_MESSAGE_SUB_TYPE_SET)
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
- si = lm_message_node_get_child_with_namespace (msg->node, "si", NS_SI);
+ si = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
if (si == NULL)
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
@@ -1163,8 +1165,8 @@ bytestream_factory_iq_si_cb (LmMessageHandler *handler,
peer_handle = tp_handle_ensure (contact_repo, from, NULL, NULL);
/* we are not in a muc so our own jid is the one in the 'to' attribute */
- self_jid = g_strdup (lm_message_node_get_attribute (msg->node,
- "to"));
+ self_jid = g_strdup (lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (msg), "to"));
}
else
{
@@ -1307,12 +1309,13 @@ handle_ibb_open_iq (GabbleBytestreamFactory *self,
if (lm_message_get_sub_type (msg) != LM_MESSAGE_SUB_TYPE_SET)
return FALSE;
- open_node = lm_message_node_get_child_with_namespace (msg->node, "open",
- NS_IBB);
+ open_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "open", NS_IBB);
if (open_node == NULL)
return FALSE;
- bsid.jid = lm_message_node_get_attribute (msg->node, "from");
+ bsid.jid = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (msg), "from");
if (bsid.jid == NULL)
{
DEBUG ("got a message without a from field");
@@ -1381,12 +1384,13 @@ handle_ibb_close_iq (GabbleBytestreamFactory *self,
if (lm_message_get_sub_type (msg) != LM_MESSAGE_SUB_TYPE_SET)
return FALSE;
- close_node = lm_message_node_get_child_with_namespace (msg->node, "close",
- NS_IBB);
+ close_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "close", NS_IBB);
if (close_node == NULL)
return FALSE;
- bsid.jid = lm_message_node_get_attribute (msg->node, "from");
+ bsid.jid = lm_message_node_get_attribute (wocky_stanza_get_top_node (msg),
+ "from");
if (bsid.jid == NULL)
{
DEBUG ("got a message without a from field");
@@ -1439,11 +1443,13 @@ handle_ibb_data (GabbleBytestreamFactory *self,
if (is_iq && lm_message_get_sub_type (msg) != LM_MESSAGE_SUB_TYPE_SET)
return FALSE;
- data = lm_message_node_get_child_with_namespace (msg->node, "data", NS_IBB);
+ data = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "data", NS_IBB);
if (data == NULL)
return FALSE;
- bsid.jid = lm_message_node_get_attribute (msg->node, "from");
+ bsid.jid = lm_message_node_get_attribute (wocky_stanza_get_top_node (msg),
+ "from");
if (bsid.jid == NULL)
{
DEBUG ("got a message without a from field");
@@ -1494,12 +1500,13 @@ handle_muc_data (GabbleBytestreamFactory *self,
priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE (self);
- data = lm_message_node_get_child_with_namespace (msg->node, "data",
- NS_MUC_BYTESTREAM);
+ data = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "data", NS_MUC_BYTESTREAM);
if (data == NULL)
return FALSE;
- from = lm_message_node_get_attribute (msg->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (msg), "from");
if (from == NULL)
{
DEBUG ("got a message without a from field");
@@ -1596,12 +1603,13 @@ handle_socks5_query_iq (GabbleBytestreamFactory *self,
if (lm_message_get_sub_type (msg) != LM_MESSAGE_SUB_TYPE_SET)
return FALSE;
- query_node = lm_message_node_get_child_with_namespace (msg->node,
- "query", NS_BYTESTREAMS);
+ query_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "query", NS_BYTESTREAMS);
if (query_node == NULL)
return FALSE;
- bsid.jid = lm_message_node_get_attribute (msg->node, "from");
+ bsid.jid = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (msg), "from");
if (bsid.jid == NULL)
{
DEBUG ("got a message without a from field");
@@ -1948,15 +1956,14 @@ streaminit_get_bytestream (GabbleBytestreamFactory *self,
NS_FEATURENEG);
if (feature == NULL)
{
- NODE_DEBUG (reply_msg->node,
- "got a SI reply without a feature field");
+ STANZA_DEBUG (reply_msg, "got a SI reply without a feature field");
return NULL;
}
x = lm_message_node_get_child_with_namespace (feature, "x", NS_X_DATA);
if (x == NULL)
{
- NODE_DEBUG (reply_msg->node, "got a SI reply without a x field");
+ STANZA_DEBUG (reply_msg, "got a SI reply without a x field");
return NULL;
}
@@ -1972,7 +1979,7 @@ streaminit_get_bytestream (GabbleBytestreamFactory *self,
value = lm_message_node_get_child (field, "value");
if (value == NULL)
{
- NODE_DEBUG (reply_msg->node, "SI reply's stream-method field "
+ STANZA_DEBUG (reply_msg, "SI reply's stream-method field "
"doesn't contain stream-method value");
return NULL;
}
@@ -2056,10 +2063,11 @@ streaminit_reply_cb (GabbleConnection *conn,
/* stream accepted */
- from = lm_message_node_get_attribute (reply_msg->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (reply_msg), "from");
if (from == NULL)
{
- NODE_DEBUG (reply_msg->node, "got a message without a from field");
+ STANZA_DEBUG (reply_msg, "got a message without a from field");
goto END;
}
@@ -2083,8 +2091,8 @@ streaminit_reply_cb (GabbleConnection *conn,
}
/* we are not in a muc so our own jid is the one in the 'to' attribute */
- self_jid = g_strdup (lm_message_node_get_attribute (reply_msg->node,
- "to"));
+ self_jid = g_strdup (lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (reply_msg), "to"));
}
else
{
@@ -2103,11 +2111,11 @@ streaminit_reply_cb (GabbleConnection *conn,
g_object_get (muc, "self-jid", &self_jid, NULL);
}
- si = lm_message_node_get_child_with_namespace (reply_msg->node, "si",
- NS_SI);
+ si = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (reply_msg), "si", NS_SI);
if (si == NULL)
{
- NODE_DEBUG (reply_msg->node, "got a SI reply without a si field");
+ STANZA_DEBUG (reply_msg, "got a SI reply without a si field");
goto END;
}
diff --git a/src/bytestream-ibb.c b/src/bytestream-ibb.c
index 6d800b2ac..340ba9b62 100644
--- a/src/bytestream-ibb.c
+++ b/src/bytestream-ibb.c
@@ -619,7 +619,8 @@ gabble_bytestream_ibb_receive (GabbleBytestreamIBB *self,
/* caller must have checked for this in order to know which bytestream to
* route this packet to */
- data = lm_message_node_get_child_with_namespace (msg->node, "data", NS_IBB);
+ data = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "data", NS_IBB);
g_assert (data != NULL);
if (priv->state != GABBLE_BYTESTREAM_STATE_OPEN)
@@ -720,7 +721,8 @@ gabble_bytestream_ibb_accept (GabbleBytestreamIface *iface,
msg = gabble_bytestream_factory_make_accept_iq (priv->peer_jid,
priv->stream_init_id, NS_IBB);
- si = lm_message_node_get_child_with_namespace (msg->node, "si", NS_SI);
+ si = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
g_assert (si != NULL);
if (func != NULL)
@@ -755,11 +757,13 @@ gabble_bytestream_ibb_decline (GabbleBytestreamIBB *self,
if (error != NULL && error->domain == GABBLE_XMPP_ERROR)
{
- gabble_xmpp_error_to_node (error->code, msg->node, error->message);
+ gabble_xmpp_error_to_node (error->code,
+ wocky_stanza_get_top_node (msg), error->message);
}
else
{
- gabble_xmpp_error_to_node (XMPP_ERROR_FORBIDDEN, msg->node,
+ gabble_xmpp_error_to_node (XMPP_ERROR_FORBIDDEN,
+ wocky_stanza_get_top_node (msg),
"Offer Declined");
}
diff --git a/src/bytestream-muc.c b/src/bytestream-muc.c
index b52a9b6ad..88df2ef71 100644
--- a/src/bytestream-muc.c
+++ b/src/bytestream-muc.c
@@ -321,7 +321,8 @@ send_data_to (GabbleBytestreamMuc *self,
if (groupchat)
{
- lm_message_node_set_attribute (msg->node, "type", "groupchat");
+ lm_message_node_set_attribute (wocky_stanza_get_top_node (msg),
+ "type", "groupchat");
}
sent = 0;
@@ -427,8 +428,8 @@ gabble_bytestream_muc_receive (GabbleBytestreamMuc *self,
/* caller must have checked for this in order to know which bytestream to
* route this packet to */
- data = lm_message_node_get_child_with_namespace (msg->node, "data",
- NS_MUC_BYTESTREAM);
+ data = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "data", NS_MUC_BYTESTREAM);
g_assert (data != NULL);
if (priv->state != GABBLE_BYTESTREAM_STATE_OPEN)
@@ -438,7 +439,8 @@ gabble_bytestream_muc_receive (GabbleBytestreamMuc *self,
return;
}
- from = lm_message_node_get_attribute (msg->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (msg), "from");
g_return_if_fail (from != NULL);
sender = tp_handle_lookup (contact_repo, from,
GUINT_TO_POINTER (GABBLE_JID_ROOM_MEMBER), NULL);
diff --git a/src/bytestream-multiple.c b/src/bytestream-multiple.c
index cc4acd2f6..48e609710 100644
--- a/src/bytestream-multiple.c
+++ b/src/bytestream-multiple.c
@@ -413,7 +413,8 @@ gabble_bytestream_multiple_accept (GabbleBytestreamIface *iface,
g_free (current_method);
g_list_free (all_methods);
- si = lm_message_node_get_child_with_namespace (msg->node, "si", NS_SI);
+ si = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
g_assert (si != NULL);
if (func != NULL)
diff --git a/src/bytestream-socks5.c b/src/bytestream-socks5.c
index 09ae2ca6f..d496463bb 100644
--- a/src/bytestream-socks5.c
+++ b/src/bytestream-socks5.c
@@ -759,7 +759,8 @@ target_got_connect_reply (GabbleBytestreamSocks5 *self)
LmMessageNode *node;
Streamhost *current_streamhost;
- node = lm_message_node_add_child (iq_result->node, "query", "");
+ node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (iq_result), "query", "");
lm_message_node_set_attribute (node, "xmlns", NS_BYTESTREAMS);
/* streamhost-used informs the other end of the streamhost we
@@ -1429,7 +1430,8 @@ gabble_bytestream_socks5_accept (GabbleBytestreamIface *iface,
msg = gabble_bytestream_factory_make_accept_iq (priv->peer_jid,
priv->stream_init_id, NS_BYTESTREAMS);
- si = lm_message_node_get_child_with_namespace (msg->node, "si", NS_SI);
+ si = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
g_assert (si != NULL);
if (func != NULL)
@@ -1466,11 +1468,13 @@ gabble_bytestream_socks5_decline (GabbleBytestreamSocks5 *self,
if (error != NULL && error->domain == GABBLE_XMPP_ERROR)
{
- gabble_xmpp_error_to_node (error->code, msg->node, error->message);
+ gabble_xmpp_error_to_node (error->code,
+ wocky_stanza_get_top_node (msg), error->message);
}
else
{
- gabble_xmpp_error_to_node (XMPP_ERROR_FORBIDDEN, msg->node,
+ gabble_xmpp_error_to_node (XMPP_ERROR_FORBIDDEN,
+ wocky_stanza_get_top_node (msg),
"Offer Declined");
}
@@ -1576,8 +1580,8 @@ socks5_init_reply_cb (GabbleConnection *conn,
LmMessageNode *query, *streamhost = NULL;
const gchar *jid;
- query = lm_message_node_get_child_with_namespace (reply_msg->node,
- "query", NS_BYTESTREAMS);
+ query = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (reply_msg), "query", NS_BYTESTREAMS);
if (query != NULL)
streamhost = lm_message_node_get_child (query, "streamhost-used");
@@ -1877,7 +1881,7 @@ gabble_bytestream_socks5_initiate (GabbleBytestreamIface *iface)
for (ip = ips; ip != NULL; ip = g_slist_next (ip))
{
LmMessageNode *node;
- NodeIter i = node_iter (msg->node);
+ NodeIter i = node_iter (wocky_stanza_get_top_node (msg));
node = lm_message_node_add_child (node_iter_data (i),
"streamhost", "");
@@ -1906,7 +1910,7 @@ gabble_bytestream_socks5_initiate (GabbleBytestreamIface *iface)
LmMessageNode *node;
gchar *portstr;
GabbleSocks5Proxy *proxy = (GabbleSocks5Proxy *) l->data;
- NodeIter i = node_iter (msg->node);
+ NodeIter i = node_iter (wocky_stanza_get_top_node (msg));
node = lm_message_node_add_child (node_iter_data (i),
"streamhost", "");
diff --git a/src/conn-aliasing.c b/src/conn-aliasing.c
index f0a30d2c3..78bb841b1 100644
--- a/src/conn-aliasing.c
+++ b/src/conn-aliasing.c
@@ -228,7 +228,7 @@ aliases_request_cache_pep (GabbleConnection *self,
}
else if (lm_message_get_sub_type (msg) != LM_MESSAGE_SUB_TYPE_RESULT)
{
- NODE_DEBUG (msg->node, "Error getting alias from PEP");
+ STANZA_DEBUG (msg, "Error getting alias from PEP");
_cache_negatively (self, handle);
}
else
@@ -472,7 +472,8 @@ nick_publish_msg_reply_cb (GabbleConnection *conn,
{
LmMessageNode *error_node;
- error_node = lm_message_node_get_child (reply_msg->node, "error");
+ error_node = lm_message_node_get_child (
+ wocky_stanza_get_top_node (reply_msg), "error");
if (error_node != NULL)
{
@@ -536,11 +537,11 @@ setaliases_foreach (gpointer key, gpointer value, gpointer user_data)
{
/* Publish nick using PEP */
LmMessage *msg;
- WockyXmppNode *item;
+ WockyNode *item;
msg = wocky_pep_service_make_publish_stanza (data->conn->pep_nick,
&item);
- wocky_xmpp_node_add_child_with_content_ns (item, "nick",
+ wocky_node_add_child_with_content_ns (item, "nick",
alias, NS_NICK);
_gabble_connection_send_with_reply (data->conn, msg,
@@ -665,7 +666,7 @@ _grab_nickname (GabbleConnection *self,
static void
pep_nick_node_changed (WockyPepService *pep,
WockyBareContact *contact,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GabbleConnection *conn)
{
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
@@ -682,12 +683,13 @@ pep_nick_node_changed (WockyPepService *pep,
return;
}
- node = lm_message_node_find_child (stanza->node, "item");
+ node = lm_message_node_find_child (wocky_stanza_get_top_node (stanza),
+ "item");
if (NULL == node)
{
- NODE_DEBUG (stanza->node, "PEP event without item node, ignoring");
- return;
- }
+ STANZA_DEBUG (stanza, "PEP event without item node, ignoring");
+ return;
+ }
_grab_nickname (conn, handle, node);
}
@@ -702,22 +704,22 @@ gabble_conn_aliasing_pep_nick_reply_handler (GabbleConnection *conn,
gboolean found = FALSE;
NodeIter i;
- pubsub_node = lm_message_node_get_child_with_namespace (msg->node,
- "pubsub", NS_PUBSUB);
+ pubsub_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "pubsub", NS_PUBSUB);
if (pubsub_node == NULL)
{
- pubsub_node = lm_message_node_get_child_with_namespace (msg->node,
- "pubsub", NS_PUBSUB "#event");
+ pubsub_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "pubsub", NS_PUBSUB "#event");
if (pubsub_node == NULL)
{
- NODE_DEBUG (msg->node, "PEP reply with no <pubsub>, ignoring");
+ STANZA_DEBUG (msg, "PEP reply with no <pubsub>, ignoring");
_cache_negatively (conn, handle);
return;
}
else
{
- NODE_DEBUG (msg->node, "PEP reply from buggy server with #event "
+ STANZA_DEBUG (msg, "PEP reply from buggy server with #event "
"on <pubsub> namespace");
}
}
@@ -725,7 +727,7 @@ gabble_conn_aliasing_pep_nick_reply_handler (GabbleConnection *conn,
items_node = lm_message_node_get_child (pubsub_node, "items");
if (items_node == NULL)
{
- NODE_DEBUG (msg->node, "No items in PEP reply");
+ STANZA_DEBUG (msg, "No items in PEP reply");
_cache_negatively (conn, handle);
return;
}
diff --git a/src/conn-contact-info.c b/src/conn-contact-info.c
index 5c3d8d076..9835d1867 100644
--- a/src/conn-contact-info.c
+++ b/src/conn-contact-info.c
@@ -178,12 +178,12 @@ _insert_contact_field (GPtrArray *contact_info,
static void
_create_contact_field_extended (GPtrArray *contact_info,
- WockyXmppNode *node,
+ WockyNode *node,
const gchar * const *supported_types,
const gchar * const *mandatory_fields)
{
guint i;
- WockyXmppNode *child_node;
+ WockyNode *child_node;
GPtrArray *field_params = NULL;
gchar **field_values = NULL;
guint supported_types_size = 0;
@@ -210,7 +210,7 @@ _create_contact_field_extended (GPtrArray *contact_info,
child_name[j] = g_ascii_toupper (supported_types[i][j + 5]);
}
- child_node = wocky_xmpp_node_get_child (node, child_name);
+ child_node = wocky_node_get_child (node, child_name);
if (child_node != NULL)
g_ptr_array_add (field_params, (gchar *) supported_types[i]);
@@ -227,7 +227,7 @@ _create_contact_field_extended (GPtrArray *contact_info,
for (i = 0; i < mandatory_fields_size; ++i)
{
- child_node = wocky_xmpp_node_get_child (node, mandatory_fields[i]);
+ child_node = wocky_node_get_child (node, mandatory_fields[i]);
if (child_node != NULL)
field_values[i] = child_node->content;
@@ -247,7 +247,7 @@ _create_contact_field_extended (GPtrArray *contact_info,
}
static GPtrArray *
-_parse_vcard (WockyXmppNode *vcard_node,
+_parse_vcard (WockyNode *vcard_node,
GError **error)
{
GPtrArray *contact_info = dbus_g_type_specialized_construct (
@@ -256,7 +256,7 @@ _parse_vcard (WockyXmppNode *vcard_node,
for (i = node_iter (vcard_node); i; i = node_iter_next (i))
{
- WockyXmppNode *node = node_iter_data (i);
+ WockyNode *node = node_iter_data (i);
const VCardField *field;
if (node->name == NULL || !tp_strdiff (node->name, ""))
@@ -292,7 +292,7 @@ _parse_vcard (WockyXmppNode *vcard_node,
case FIELD_ORG:
{
- WockyXmppNode *orgname = wocky_xmpp_node_get_child (node,
+ WockyNode *orgname = wocky_node_get_child (node,
"ORGNAME");
NodeIter orgunit_iter;
GPtrArray *field_values;
@@ -317,7 +317,7 @@ _parse_vcard (WockyXmppNode *vcard_node,
orgunit_iter != NULL;
orgunit_iter = node_iter_next (orgunit_iter))
{
- WockyXmppNode *orgunit = node_iter_data (orgunit_iter);
+ WockyNode *orgunit = node_iter_data (orgunit_iter);
if (tp_strdiff (orgunit->name, "ORGUNIT"))
continue;
@@ -350,7 +350,7 @@ _parse_vcard (WockyXmppNode *vcard_node,
line_iter = node_iter_next (line_iter))
{
const gchar *line;
- WockyXmppNode *line_node = node_iter_data (line_iter);
+ WockyNode *line_node = node_iter_data (line_iter);
if (tp_strdiff (line_node->name, "LINE"))
continue;
@@ -386,7 +386,7 @@ _parse_vcard (WockyXmppNode *vcard_node,
static void
_emit_contact_info_changed (GabbleSvcConnectionInterfaceContactInfo *iface,
TpHandle contact,
- WockyXmppNode *vcard_node)
+ WockyNode *vcard_node)
{
GPtrArray *contact_info;
@@ -405,7 +405,7 @@ static void
_request_vcards_cb (GabbleVCardManager *manager,
GabbleVCardManagerRequest *request,
TpHandle handle,
- WockyXmppNode *vcard_node,
+ WockyNode *vcard_node,
GError *vcard_error,
gpointer user_data)
{
@@ -460,7 +460,7 @@ gabble_connection_get_contact_info (
for (i = 0; i < contacts->len; i++)
{
- WockyXmppNode *vcard_node;
+ WockyNode *vcard_node;
TpHandle contact = g_array_index (contacts, TpHandle, i);
if (gabble_vcard_manager_get_cached (self->vcard_manager,
@@ -488,7 +488,7 @@ gabble_connection_get_contact_info (
}
static void
-_return_from_request_contact_info (WockyXmppNode *vcard_node,
+_return_from_request_contact_info (WockyNode *vcard_node,
GError *vcard_error,
DBusGMethodInvocation *context)
{
@@ -539,7 +539,7 @@ static void
_request_vcard_cb (GabbleVCardManager *self,
GabbleVCardManagerRequest *request,
TpHandle handle,
- WockyXmppNode *vcard_node,
+ WockyNode *vcard_node,
GError *vcard_error,
gpointer user_data)
{
@@ -619,7 +619,7 @@ gabble_connection_request_contact_info (GabbleSvcConnectionInterfaceContactInfo
TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base,
TP_HANDLE_TYPE_CONTACT);
GError *err = NULL;
- WockyXmppNode *vcard_node;
+ WockyNode *vcard_node;
TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context);
@@ -705,7 +705,7 @@ conn_contact_info_new_edit (const VCardField *field,
static void
_set_contact_info_cb (GabbleVCardManager *vcard_manager,
GabbleVCardManagerEditRequest *request,
- WockyXmppNode *vcard_node,
+ WockyNode *vcard_node,
GError *vcard_error,
gpointer user_data)
{
@@ -946,7 +946,7 @@ _vcard_updated (GObject *object,
gpointer user_data)
{
GabbleConnection *conn = GABBLE_CONNECTION (user_data);
- WockyXmppNode *vcard_node;
+ WockyNode *vcard_node;
if (gabble_vcard_manager_get_cached (conn->vcard_manager,
contact, &vcard_node))
diff --git a/src/conn-location.c b/src/conn-location.c
index 4cbbb06c2..582965109 100644
--- a/src/conn-location.c
+++ b/src/conn-location.c
@@ -82,7 +82,7 @@ pep_reply_cb (GObject *source,
gpointer user_data)
{
GabbleConnection *conn = GABBLE_CONNECTION (user_data);
- WockyXmppStanza *reply_msg;
+ WockyStanza *reply_msg;
GError *error = NULL;
const gchar *from;
@@ -95,7 +95,8 @@ pep_reply_cb (GObject *source,
goto out;
}
- from = lm_message_node_get_attribute (reply_msg->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (reply_msg), "from");
if (from != NULL)
update_location_from_msg (conn, from, reply_msg);
@@ -272,7 +273,7 @@ location_set_location (TpSvcConnectionInterfaceLocation *iface,
GabbleConnection *conn = GABBLE_CONNECTION (iface);
LmMessage *msg;
LmMessageNode *geoloc;
- WockyXmppNode *item;
+ WockyNode *item;
GHashTableIter iter;
gpointer key, value;
GError *err = NULL;
@@ -292,7 +293,7 @@ location_set_location (TpSvcConnectionInterfaceLocation *iface,
gabble_connection_ensure_capabilities (conn,
gabble_capabilities_get_geoloc_notify ());
msg = wocky_pep_service_make_publish_stanza (conn->pep_location, &item);
- geoloc = wocky_xmpp_node_add_child_ns (item, "geoloc", NS_GEOLOC);
+ geoloc = wocky_node_add_child_ns (item, "geoloc", NS_GEOLOC);
DEBUG ("SetLocation to");
@@ -442,7 +443,8 @@ update_location_from_msg (GabbleConnection *conn,
TpHandle contact = tp_handle_lookup (contact_repo, from, NULL, NULL);
- node = lm_message_node_find_child (msg->node, "geoloc");
+ node = lm_message_node_find_child (wocky_stanza_get_top_node (msg),
+ "geoloc");
if (node == NULL)
return FALSE;
@@ -528,7 +530,7 @@ update_location_from_msg (GabbleConnection *conn,
static void
location_pep_node_changed (WockyPepService *pep,
WockyBareContact *contact,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GabbleConnection *conn)
{
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
diff --git a/src/conn-mail-notif.c b/src/conn-mail-notif.c
index 08485bca8..887e09930 100644
--- a/src/conn-mail-notif.c
+++ b/src/conn-mail-notif.c
@@ -279,19 +279,19 @@ gabble_mail_notification_request_mail_url (
static gboolean
-sender_each (WockyXmppNode *node,
+sender_each (WockyNode *node,
gpointer user_data)
{
GPtrArray *senders = user_data;
- if (!tp_strdiff ("1", wocky_xmpp_node_get_attribute (node, "unread")))
+ if (!tp_strdiff ("1", wocky_node_get_attribute (node, "unread")))
{
GValueArray *sender;
const gchar *name;
const gchar *address;
- name = wocky_xmpp_node_get_attribute (node, "name");
- address = wocky_xmpp_node_get_attribute (node, "address");
+ name = wocky_node_get_attribute (node, "name");
+ address = wocky_node_get_attribute (node, "address");
sender = tp_value_array_build (2,
G_TYPE_STRING, name ? name : "",
@@ -305,20 +305,20 @@ sender_each (WockyXmppNode *node,
static gboolean
-handle_senders (WockyXmppNode *parent_node,
+handle_senders (WockyNode *parent_node,
GHashTable *mail)
{
gboolean dirty = FALSE;
- WockyXmppNode *node;
+ WockyNode *node;
- node = wocky_xmpp_node_get_child (parent_node, "senders");
+ node = wocky_node_get_child (parent_node, "senders");
if (node != NULL)
{
GType addr_list_type = GABBLE_ARRAY_TYPE_MAIL_ADDRESS_LIST;
GPtrArray *senders, *old_senders;
senders = g_ptr_array_new ();
- wocky_xmpp_node_each_child (node, sender_each, senders);
+ wocky_node_each_child (node, sender_each, senders);
old_senders = tp_asv_get_boxed (mail, "senders", addr_list_type);
@@ -333,13 +333,13 @@ handle_senders (WockyXmppNode *parent_node,
static gboolean
-handle_subject (WockyXmppNode *parent_node,
+handle_subject (WockyNode *parent_node,
GHashTable *mail)
{
gboolean dirty = FALSE;
- WockyXmppNode *node;
+ WockyNode *node;
- node = wocky_xmpp_node_get_child (parent_node, "subject");
+ node = wocky_node_get_child (parent_node, "subject");
if (node != NULL)
{
if (tp_strdiff (node->content, tp_asv_get_string (mail, "subject")))
@@ -354,13 +354,13 @@ handle_subject (WockyXmppNode *parent_node,
static gboolean
-handle_snippet (WockyXmppNode *parent_node,
+handle_snippet (WockyNode *parent_node,
GHashTable *mail)
{
gboolean dirty = FALSE;
- WockyXmppNode *node;
+ WockyNode *node;
- node = wocky_xmpp_node_get_child (parent_node, "snippet");
+ node = wocky_node_get_child (parent_node, "snippet");
if (node != NULL)
{
if (tp_strdiff (node->content, tp_asv_get_string (mail, "content")))
@@ -386,7 +386,7 @@ typedef struct
} MailThreadCollector;
static gboolean
-mail_thread_info_each (WockyXmppNode *node,
+mail_thread_info_each (WockyNode *node,
gpointer user_data)
{
MailThreadCollector *collector = user_data;
@@ -398,7 +398,7 @@ mail_thread_info_each (WockyXmppNode *node,
gchar *tid;
gboolean dirty = FALSE;
- val_str = wocky_xmpp_node_get_attribute (node, "tid");
+ val_str = wocky_node_get_attribute (node, "tid");
/* We absolutly need an ID */
if (val_str == NULL)
@@ -420,7 +420,7 @@ mail_thread_info_each (WockyXmppNode *node,
dirty = TRUE;
}
- val_str = wocky_xmpp_node_get_attribute (node, "date");
+ val_str = wocky_node_get_attribute (node, "date");
if (val_str != NULL)
{
@@ -455,7 +455,7 @@ mail_thread_info_each (WockyXmppNode *node,
static void
store_unread_mails (GabbleConnection *conn,
- WockyXmppNode *mailbox)
+ WockyNode *mailbox)
{
GHashTableIter iter;
GPtrArray *mails_removed;
@@ -468,12 +468,12 @@ store_unread_mails (GabbleConnection *conn,
g_free, (GDestroyNotify) g_hash_table_unref);
collector.mails_added = g_ptr_array_new ();
- url = wocky_xmpp_node_get_attribute (mailbox, "url");
+ url = wocky_node_get_attribute (mailbox, "url");
g_free (conn->inbox_url);
conn->inbox_url = g_strdup (url);
/* Store new mails */
- wocky_xmpp_node_each_child (mailbox, mail_thread_info_each, &collector);
+ wocky_node_each_child (mailbox, mail_thread_info_each, &collector);
/* Generate the list of removed thread IDs */
mails_removed = g_ptr_array_new_with_free_func (g_free);
@@ -494,7 +494,7 @@ store_unread_mails (GabbleConnection *conn,
}
g_ptr_array_add (mails_removed, NULL);
- unread_count = wocky_xmpp_node_get_attribute (mailbox, "total-matched");
+ unread_count = wocky_node_get_attribute (mailbox, "total-matched");
if (unread_count != NULL)
conn->unread_mails_count = (guint)g_ascii_strtoll (unread_count, NULL, 0);
@@ -517,9 +517,9 @@ query_unread_mails_cb (GObject *source_object,
gpointer user_data)
{
GError *error = NULL;
- WockyXmppNode *node;
+ WockyNode *node;
WockyPorter *porter = WOCKY_PORTER (source_object);
- WockyXmppStanza *reply = wocky_porter_send_iq_finish (porter, res, &error);
+ WockyStanza *reply = wocky_porter_send_iq_finish (porter, res, &error);
if (error != NULL)
{
@@ -530,7 +530,7 @@ query_unread_mails_cb (GObject *source_object,
DEBUG ("Got unread mail details");
- node = wocky_xmpp_node_get_child (reply->node, "mailbox");
+ node = wocky_node_get_child (wocky_stanza_get_top_node (reply), "mailbox");
if (node != NULL)
{
@@ -547,25 +547,26 @@ end:
static void
update_unread_mails (GabbleConnection *conn)
{
- WockyXmppStanza *query;
+ WockyStanza *query;
WockyPorter *porter = wocky_session_get_porter (conn->session);
DEBUG ("Updating unread mails information");
- query = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_IQ,
+ query = wocky_stanza_build (WOCKY_STANZA_TYPE_IQ,
WOCKY_STANZA_SUB_TYPE_GET, NULL, NULL,
'(', "query",
':', NS_GOOGLE_MAIL_NOTIFY,
')',
NULL);
- wocky_porter_send_iq_async (porter, query, NULL, query_unread_mails_cb, conn);
+ wocky_porter_send_iq_async (porter, query, NULL,
+ query_unread_mails_cb, conn);
g_object_unref (query);
}
static gboolean
new_mail_handler (WockyPorter *porter,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
gpointer user_data)
{
GabbleConnection *conn = GABBLE_CONNECTION (user_data);
diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index 3a5f0621b..79eadbf14 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -179,7 +179,8 @@ check_publish_reply_msg (LmMessage *reply_msg,
LmMessageNode *error_node;
GError *error = NULL;
- error_node = lm_message_node_get_child (reply_msg->node, "error");
+ error_node = lm_message_node_get_child (
+ wocky_stanza_get_top_node (reply_msg), "error");
if (error_node != NULL)
{
GabbleXmppError xmpp_error = gabble_xmpp_error_from_node (
@@ -222,7 +223,8 @@ check_query_reply_msg (LmMessage *reply_msg,
if (context == NULL)
return FALSE;
- error_node = lm_message_node_get_child (reply_msg->node, "error");
+ error_node = lm_message_node_get_child (
+ wocky_stanza_get_top_node (reply_msg), "error");
if (error_node != NULL)
{
GabbleXmppError xmpp_error = gabble_xmpp_error_from_node (
@@ -261,14 +263,15 @@ get_buddy_properties_from_search_reply_cb (GabbleConnection *conn,
NodeIter i;
/* Which buddy are we requesting properties for ? */
- buddy = lm_message_node_find_child (sent_msg->node, "buddy");
+ buddy = lm_message_node_find_child (wocky_stanza_get_top_node (sent_msg),
+ "buddy");
g_assert (buddy != NULL);
buddy_jid = lm_message_node_get_attribute (buddy, "jid");
g_assert (buddy_jid != NULL);
/* Parse the reply */
- query = lm_message_node_get_child_with_namespace (reply_msg->node, "query",
- NS_OLPC_BUDDY);
+ query = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (reply_msg), "query", NS_OLPC_BUDDY);
if (query == NULL)
{
g_set_error (&error, TP_ERRORS, TP_ERROR_NETWORK_ERROR,
@@ -377,7 +380,7 @@ get_properties_reply_cb (GObject *source,
gpointer user_data)
{
pubsub_query_ctx *ctx = (pubsub_query_ctx *) user_data;
- WockyXmppStanza *reply_msg;
+ WockyStanza *reply_msg;
GError *error = NULL;
GHashTable *properties;
LmMessageNode *node;
@@ -400,7 +403,8 @@ get_properties_reply_cb (GObject *source,
{
const gchar *buddy;
- buddy = lm_message_node_get_attribute (reply_msg->node, "from");
+ buddy = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (reply_msg), "from");
g_assert (buddy != NULL);
DEBUG ("PEP query failed. Let's try to search this buddy.");
@@ -408,7 +412,8 @@ get_properties_reply_cb (GObject *source,
goto out;
}
- node = lm_message_node_find_child (reply_msg->node, "properties");
+ node = lm_message_node_find_child (
+ wocky_stanza_get_top_node (reply_msg), "properties");
properties = lm_message_node_extract_properties (node, "property");
gabble_svc_olpc_buddy_info_return_from_get_properties (ctx->context,
@@ -492,7 +497,7 @@ transmit_properties (GabbleConnection *conn,
DBusGMethodInvocation *context)
{
LmMessage *msg;
- WockyXmppNode *item, *props_node;
+ WockyNode *item, *props_node;
gabble_connection_ensure_capabilities (conn,
gabble_capabilities_get_olpc_notify ());
@@ -502,7 +507,7 @@ transmit_properties (GabbleConnection *conn,
msg = wocky_pep_service_make_publish_stanza (conn->pep_olpc_buddy_props,
&item);
- props_node = wocky_xmpp_node_add_child_ns (item, "properties",
+ props_node = wocky_node_add_child_ns (item, "properties",
NS_OLPC_BUDDY_PROPS);
lm_message_node_add_children_from_properties (props_node, properties,
@@ -605,7 +610,7 @@ olpc_buddy_info_set_properties (GabbleSvcOLPCBuddyInfo *iface,
static void
olpc_buddy_props_pep_node_changed (WockyPepService *pep,
WockyBareContact *contact,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GabbleConnection *conn)
{
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
@@ -628,7 +633,8 @@ olpc_buddy_props_pep_node_changed (WockyPepService *pep,
/* Ignore echoed pubsub notifications */
goto out;
- node = lm_message_node_find_child (stanza->node, "properties");
+ node = lm_message_node_find_child (
+ wocky_stanza_get_top_node (stanza), "properties");
properties = lm_message_node_extract_properties (node, "property");
gabble_svc_olpc_buddy_info_emit_properties_changed (conn, handle,
properties);
@@ -645,7 +651,7 @@ get_activity_properties_reply_cb (GObject *source,
{
GabbleConnection *conn = GABBLE_CONNECTION (user_data);
const gchar *from;
- WockyXmppStanza *reply_msg;
+ WockyStanza *reply_msg;
GError *error = NULL;
reply_msg = wocky_pep_service_get_finish (WOCKY_PEP_SERVICE (source), res,
@@ -658,7 +664,8 @@ get_activity_properties_reply_cb (GObject *source,
return;
}
- from = lm_message_node_get_attribute (reply_msg->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (reply_msg), "from");
update_activities_properties (conn, from, reply_msg);
g_object_unref (reply_msg);
}
@@ -786,7 +793,8 @@ extract_activities (GabbleConnection *conn,
(TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM);
NodeIter i;
- activities_node = lm_message_node_find_child (msg->node, "activities");
+ activities_node = lm_message_node_find_child (
+ wocky_stanza_get_top_node (msg), "activities");
activities_set = tp_handle_set_new (room_repo);
@@ -954,7 +962,7 @@ get_activities_reply_cb (GObject *source,
{
pubsub_query_ctx *ctx = (pubsub_query_ctx *) user_data;
- WockyXmppStanza *reply_msg;
+ WockyStanza *reply_msg;
GError *err = NULL;
GPtrArray *activities;
const gchar *from;
@@ -976,7 +984,8 @@ get_activities_reply_cb (GObject *source,
goto out;
}
- from = lm_message_node_get_attribute (reply_msg->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (reply_msg), "from");
if (from == NULL)
{
GError error = { TP_ERRORS, TP_ERROR_NETWORK_ERROR,
@@ -1060,7 +1069,7 @@ upload_activities_pep (GabbleConnection *conn,
GError **error)
{
TpBaseConnection *base = (TpBaseConnection *) conn;
- WockyXmppNode *item, *activities;
+ WockyNode *item, *activities;
LmMessage *msg;
TpHandleSet *my_activities = g_hash_table_lookup
(conn->olpc_pep_activities, GUINT_TO_POINTER (base->self_handle));
@@ -1069,7 +1078,7 @@ upload_activities_pep (GabbleConnection *conn,
msg = wocky_pep_service_make_publish_stanza (conn->pep_olpc_activities,
&item);
- activities = wocky_xmpp_node_add_child_ns (item, "activities",
+ activities = wocky_node_add_child_ns (item, "activities",
NS_OLPC_ACTIVITIES);
if (my_activities != NULL)
@@ -1265,7 +1274,7 @@ olpc_buddy_info_set_activities (GabbleSvcOLPCBuddyInfo *iface,
static void
olpc_activities_pep_node_changed (WockyPepService *pep,
WockyBareContact *contact,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GabbleConnection *conn)
{
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
@@ -1419,7 +1428,7 @@ get_current_activity_reply_cb (GObject *source,
gpointer user_data)
{
pubsub_query_ctx *ctx = (pubsub_query_ctx *) user_data;
- WockyXmppStanza *reply_msg;
+ WockyStanza *reply_msg;
GError *error = NULL;
LmMessageNode *node;
const gchar *from;
@@ -1449,8 +1458,10 @@ get_current_activity_reply_cb (GObject *source,
goto out;
}
- from = lm_message_node_get_attribute (reply_msg->node, "from");
- node = lm_message_node_find_child (reply_msg->node, "activity");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (reply_msg), "from");
+ node = lm_message_node_find_child (
+ wocky_stanza_get_top_node (reply_msg), "activity");
activity = extract_current_activity (ctx->conn, node, from, TRUE);
if (activity == NULL)
{
@@ -1573,7 +1584,7 @@ olpc_buddy_info_set_current_activity (GabbleSvcOLPCBuddyInfo *iface,
GabbleConnection *conn = GABBLE_CONNECTION (iface);
TpBaseConnection *base = (TpBaseConnection *) conn;
LmMessage *msg;
- WockyXmppNode *item, *publish;
+ WockyNode *item, *publish;
const gchar *room = "";
DEBUG ("called");
@@ -1603,7 +1614,7 @@ olpc_buddy_info_set_current_activity (GabbleSvcOLPCBuddyInfo *iface,
msg = wocky_pep_service_make_publish_stanza (conn->pep_olpc_current_act,
&item);
- publish = wocky_xmpp_node_add_child_ns (item, "activity",
+ publish = wocky_node_add_child_ns (item, "activity",
NS_OLPC_CURRENT_ACTIVITY);
lm_message_node_set_attributes (publish,
@@ -1626,7 +1637,7 @@ olpc_buddy_info_set_current_activity (GabbleSvcOLPCBuddyInfo *iface,
static void
olpc_current_act_pep_node_changed (WockyPepService *pep,
WockyBareContact *contact,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GabbleConnection *conn)
{
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
@@ -1649,7 +1660,8 @@ olpc_current_act_pep_node_changed (WockyPepService *pep,
/* Ignore echoed pubsub notifications */
goto out;
- node = lm_message_node_find_child (stanza->node, "activity");
+ node = lm_message_node_find_child (wocky_stanza_get_top_node (stanza),
+ "activity");
activity = extract_current_activity (conn, node, jid, TRUE);
if (activity != NULL)
@@ -1704,7 +1716,7 @@ upload_activity_properties_pep (GabbleConnection *conn,
GUINT_TO_POINTER (base->self_handle));
msg = wocky_pep_service_make_publish_stanza (conn->pep_olpc_act_props, &item);
- publish = wocky_xmpp_node_add_child_ns (item, "activities",
+ publish = wocky_node_add_child_ns (item, "activities",
NS_OLPC_ACTIVITY_PROPS);
if (my_activities != NULL)
@@ -1828,13 +1840,15 @@ refresh_invitations (GabbleConnection *conn,
TpIntSetIter iter = TP_INTSET_ITER_INIT (tp_handle_set_peek
(invitees));
- activity_info_contribute_properties (activity, msg->node, FALSE);
+ activity_info_contribute_properties (activity,
+ wocky_stanza_get_top_node (msg), FALSE);
while (tp_intset_iter_next (&iter))
{
const gchar *to = tp_handle_inspect (contact_repo, iter.element);
- lm_message_node_set_attribute (msg->node, "to", to);
+ lm_message_node_set_attribute (
+ wocky_stanza_get_top_node (msg), "to", to);
if (!_gabble_connection_send (conn, msg, error))
{
DEBUG ("Unable to re-send activity properties to invitee %s",
@@ -1933,8 +1947,10 @@ olpc_activity_properties_set_properties (GabbleSvcOLPCActivityProperties *iface,
is_visible = gabble_olpc_activity_is_visible (activity);
msg = lm_message_new (jid, LM_MESSAGE_TYPE_MESSAGE);
- lm_message_node_set_attribute (msg->node, "type", "groupchat");
- activity_info_contribute_properties (activity, msg->node, FALSE);
+ lm_message_node_set_attribute (
+ wocky_stanza_get_top_node (msg), "type", "groupchat");
+ activity_info_contribute_properties (activity,
+ wocky_stanza_get_top_node (msg), FALSE);
if (!_gabble_connection_send (conn, msg, NULL))
{
GError error = { TP_ERRORS, TP_ERROR_NETWORK_ERROR,
@@ -2184,7 +2200,8 @@ update_activities_properties (GabbleConnection *conn,
LmMessageNode *node;
NodeIter i;
- node = lm_message_node_find_child (msg->node, "activities");
+ node = lm_message_node_find_child (
+ wocky_stanza_get_top_node (msg), "activities");
if (node == NULL)
return FALSE;
@@ -2207,7 +2224,7 @@ update_activities_properties (GabbleConnection *conn,
static void
olpc_act_props_pep_node_changed (WockyPepService *pep,
WockyBareContact *contact,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GabbleConnection *conn)
{
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
@@ -2268,9 +2285,9 @@ pseudo_invite_reply_cb (GabbleConnection *conn,
{
if (!check_publish_reply_msg (reply_msg, NULL))
{
- NODE_DEBUG (reply_msg->node, "Failed to make PEP change in "
+ STANZA_DEBUG (reply_msg, "Failed to make PEP change in "
"response to pseudo-invitation message");
- NODE_DEBUG (sent_msg->node, "The failed request was");
+ STANZA_DEBUG (sent_msg, "The failed request was");
}
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
@@ -2285,8 +2302,8 @@ conn_olpc_process_activity_properties_message (GabbleConnection *conn,
TP_HANDLE_TYPE_CONTACT);
TpHandleRepoIface *room_repo = tp_base_connection_get_handles (base,
TP_HANDLE_TYPE_ROOM);
- LmMessageNode *node = lm_message_node_get_child_with_namespace (msg->node,
- "properties", NS_OLPC_ACTIVITY_PROPS);
+ LmMessageNode *node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "properties", NS_OLPC_ACTIVITY_PROPS);
const gchar *id;
TpHandle room_handle, contact_handle = 0;
GabbleOlpcActivity *activity;
@@ -2521,9 +2538,9 @@ closed_pep_reply_cb (GabbleConnection *conn,
{
if (!check_publish_reply_msg (reply_msg, NULL))
{
- NODE_DEBUG (reply_msg->node, "Failed to make PEP change in "
+ STANZA_DEBUG (reply_msg, "Failed to make PEP change in "
"response to channel closure");
- NODE_DEBUG (sent_msg->node, "The failed request was");
+ STANZA_DEBUG (sent_msg, "The failed request was");
}
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
@@ -2550,7 +2567,8 @@ revoke_invitations (GabbleConnection *conn,
(invitees));
LmMessageNode *uninvite_node;
- uninvite_node = lm_message_node_add_child (msg->node, "uninvite", "");
+ uninvite_node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "uninvite", "");
lm_message_node_set_attribute (uninvite_node, "xmlns",
NS_OLPC_ACTIVITY_PROPS);
lm_message_node_set_attribute (uninvite_node, "room",
@@ -2563,7 +2581,8 @@ revoke_invitations (GabbleConnection *conn,
{
const gchar *to = tp_handle_inspect (contact_repo, iter.element);
- lm_message_node_set_attribute (msg->node, "to", to);
+ lm_message_node_set_attribute (
+ wocky_stanza_get_top_node (msg), "to", to);
if (!_gabble_connection_send (conn, msg, error))
{
DEBUG ("Unable to send activity invitee revocation %s",
@@ -2593,8 +2612,8 @@ conn_olpc_process_activity_uninvite_message (GabbleConnection *conn,
TpHandle room_handle, from_handle;
TpHandleSet *rooms;
- node = lm_message_node_get_child_with_namespace (msg->node, "uninvite",
- NS_OLPC_ACTIVITY_PROPS);
+ node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "uninvite", NS_OLPC_ACTIVITY_PROPS);
/* if no <uninvite xmlns=...>, then not for us */
if (node == NULL)
@@ -2741,7 +2760,8 @@ muc_channel_pre_invite_cb (GabbleMucChannel *chan,
msg = lm_message_new (jid, LM_MESSAGE_TYPE_MESSAGE);
- if (activity_info_contribute_properties (activity, msg->node, FALSE))
+ if (activity_info_contribute_properties (activity,
+ wocky_stanza_get_top_node (msg), FALSE))
{
/* not much we can do about errors - but if this fails, the invitation
* will too, unless something extremely strange is going on */
@@ -3599,7 +3619,8 @@ conn_olpc_msg_cb (LmMessageHandler *handler,
const gchar *from;
NodeIter i;
- from = lm_message_node_get_attribute (message->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (message), "from");
if (from == NULL)
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
@@ -3610,7 +3631,8 @@ conn_olpc_msg_cb (LmMessageHandler *handler,
tp_strdiff (from, conn->olpc_gadget_activity))
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
- for (i = node_iter (message->node); i; i = node_iter_next (i))
+ for (i = node_iter (wocky_stanza_get_top_node (message));
+ i; i = node_iter_next (i))
{
LmMessageNode *node = node_iter_data (i);
const gchar *ns;
diff --git a/src/connection.c b/src/connection.c
index 1ceae4f63..6100e1f3a 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2358,11 +2358,12 @@ _gabble_connection_send_iq_error (GabbleConnection *conn,
msg = lm_message_new_with_sub_type (to, LM_MESSAGE_TYPE_IQ,
LM_MESSAGE_SUB_TYPE_ERROR);
- lm_message_node_set_attribute (msg->node, "id", id);
+ lm_message_node_set_attribute (wocky_stanza_get_top_node (msg), "id", id);
- lm_message_node_steal_children (msg->node, iq_node);
+ lm_message_node_steal_children (
+ wocky_stanza_get_top_node (msg), iq_node);
- gabble_xmpp_error_to_node (error, msg->node, errmsg);
+ gabble_xmpp_error_to_node (error, wocky_stanza_get_top_node (msg), errmsg);
_gabble_connection_send (conn, msg, NULL);
@@ -2515,7 +2516,7 @@ connection_iq_unknown_cb (LmMessageHandler *handler,
g_assert (connection == conn->lmconn);
- NODE_DEBUG (message->node, "got unknown iq");
+ STANZA_DEBUG (message, "got unknown iq");
switch (lm_message_get_sub_type (message))
{
@@ -3358,10 +3359,12 @@ gabble_connection_send_presence (GabbleConnection *conn,
sub_type);
if (LM_MESSAGE_SUB_TYPE_SUBSCRIBE == sub_type)
- lm_message_node_add_own_nick (message->node, conn);
+ lm_message_node_add_own_nick (
+ wocky_stanza_get_top_node (message), conn);
if (!CHECK_STR_EMPTY(status))
- lm_message_node_add_child (message->node, "status", status);
+ lm_message_node_add_child (
+ wocky_stanza_get_top_node (message), "status", status);
result = _gabble_connection_send (conn, message, error);
diff --git a/src/debug.h b/src/debug.h
index dcd2cb85a..4ed0605e3 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -52,6 +52,9 @@ G_END_DECLS
#define DEBUGGING gabble_debug_flag_is_set (DEBUG_FLAG)
+#define STANZA_DEBUG(st, s) \
+ NODE_DEBUG (wocky_stanza_get_top_node (st), s)
+
#define NODE_DEBUG(n, s) \
G_STMT_START { \
gchar *debug_tmp = lm_message_node_to_string (n); \
diff --git a/src/disco.c b/src/disco.c
index db2e7420a..1a9cc14d6 100644
--- a/src/disco.c
+++ b/src/disco.c
@@ -399,7 +399,8 @@ request_reply_cb (GabbleConnection *conn, LmMessage *sent_msg,
if (!g_list_find (priv->requests, request))
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
- query_node = lm_message_node_get_child_with_namespace (reply_msg->node,
+ query_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (reply_msg),
"query", disco_type_to_xmlns (request->type));
if (lm_message_get_sub_type (reply_msg) == LM_MESSAGE_SUB_TYPE_ERROR)
@@ -510,7 +511,8 @@ gabble_disco_request_with_timeout (GabbleDisco *self, GabbleDiscoType type,
priv->requests = g_list_prepend (priv->requests, request);
msg = lm_message_new_with_sub_type (jid, LM_MESSAGE_TYPE_IQ,
LM_MESSAGE_SUB_TYPE_GET);
- lm_node = lm_message_node_add_child (msg->node, "query", NULL);
+ lm_node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "query", NULL);
lm_message_node_set_attribute (lm_node, "xmlns", disco_type_to_xmlns (type));
diff --git a/src/error.c b/src/error.c
index 57edadc63..19542134a 100644
--- a/src/error.c
+++ b/src/error.c
@@ -498,8 +498,8 @@ gabble_message_get_xmpp_error (LmMessage *msg)
if (lm_message_get_sub_type (msg) == LM_MESSAGE_SUB_TYPE_ERROR)
{
- LmMessageNode *error_node = lm_message_node_get_child (msg->node,
- "error");
+ LmMessageNode *error_node = lm_message_node_get_child (
+ wocky_stanza_get_top_node (msg), "error");
if (error_node != NULL)
{
diff --git a/src/ft-channel.c b/src/ft-channel.c
index a71a2061c..b82ca4160 100644
--- a/src/ft-channel.c
+++ b/src/ft-channel.c
@@ -1113,7 +1113,7 @@ bytestream_negotiate_cb (GabbleBytestreamIface *bytestream,
return;
}
- file = lm_message_node_find_child (msg->node, "file");
+ file = lm_message_node_find_child (wocky_stanza_get_top_node (msg), "file");
if (file != NULL)
{
LmMessageNode *range;
@@ -1206,7 +1206,8 @@ gabble_file_transfer_channel_offer_file (GabbleFileTransferChannel *self,
msg = gabble_bytestream_factory_make_stream_init_iq (full_jid,
stream_id, NS_FILE_TRANSFER);
- si_node = lm_message_node_get_child_with_namespace (msg->node, "si", NS_SI);
+ si_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
g_assert (si_node != NULL);
size_str = g_strdup_printf ("%" G_GUINT64_FORMAT, self->priv->size);
diff --git a/src/ft-manager.c b/src/ft-manager.c
index 77d467380..3a4da912b 100644
--- a/src/ft-manager.c
+++ b/src/ft-manager.c
@@ -487,7 +487,8 @@ void gabble_ft_manager_handle_si_request (GabbleFtManager *self,
GabbleFileTransferChannel *chan;
gboolean resume_supported;
- si_node = lm_message_node_get_child_with_namespace (msg->node, "si", NS_SI);
+ si_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
g_assert (si_node != NULL);
file_node = lm_message_node_get_child_with_namespace (si_node, "file",
diff --git a/src/im-factory.c b/src/im-factory.c
index d2b12a112..58bcfb1b0 100644
--- a/src/im-factory.c
+++ b/src/im-factory.c
@@ -236,7 +236,7 @@ im_factory_message_cb (LmMessageHandler *handler,
handle = tp_handle_ensure (contact_repo, from, NULL, NULL);
if (handle == 0)
{
- NODE_DEBUG (message->node, "ignoring message node from malformed jid");
+ STANZA_DEBUG (message, "ignoring message node from malformed jid");
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
diff --git a/src/jingle-factory.c b/src/jingle-factory.c
index f092888e8..2cb00bcf0 100644
--- a/src/jingle-factory.c
+++ b/src/jingle-factory.c
@@ -254,8 +254,8 @@ got_jingle_info_stanza (GabbleJingleFactory *fac,
LmMessageSubType sub_type;
LmMessageNode *query_node, *node;
- query_node = lm_message_node_get_child_with_namespace (message->node,
- "query", NS_GOOGLE_JINGLE_INFO);
+ query_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (message), "query", NS_GOOGLE_JINGLE_INFO);
if (query_node == NULL)
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
@@ -266,7 +266,8 @@ got_jingle_info_stanza (GabbleJingleFactory *fac,
{
GabbleXmppError xmpp_error = XMPP_ERROR_UNDEFINED_CONDITION;
- node = lm_message_node_get_child (message->node, "error");
+ node = lm_message_node_get_child (wocky_stanza_get_top_node (message),
+ "error");
if (node != NULL)
{
xmpp_error = gabble_xmpp_error_from_node (node, NULL);
@@ -451,7 +452,8 @@ jingle_info_send_request (GabbleJingleFactory *fac)
msg = lm_message_new_with_sub_type (jid, LM_MESSAGE_TYPE_IQ,
LM_MESSAGE_SUB_TYPE_GET);
- node = lm_message_node_add_child (msg->node, "query", NULL);
+ node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "query", NULL);
lm_message_node_set_attribute (node, "xmlns", NS_GOOGLE_JINGLE_INFO);
if (!_gabble_connection_send_with_reply (priv->conn, msg,
diff --git a/src/message-util.c b/src/message-util.c
index 9094f6949..e4512abb0 100644
--- a/src/message-util.c
+++ b/src/message-util.c
@@ -41,23 +41,24 @@ _add_chat_state (LmMessage *msg,
TpChannelChatState state)
{
LmMessageNode *node = NULL;
+ WockyNode *n = wocky_stanza_get_top_node (msg);
switch (state)
{
case TP_CHANNEL_CHAT_STATE_GONE:
- node = lm_message_node_add_child (msg->node, "gone", NULL);
+ node = lm_message_node_add_child (n, "gone", NULL);
break;
case TP_CHANNEL_CHAT_STATE_INACTIVE:
- node = lm_message_node_add_child (msg->node, "inactive", NULL);
+ node = lm_message_node_add_child (n, "inactive", NULL);
break;
case TP_CHANNEL_CHAT_STATE_ACTIVE:
- node = lm_message_node_add_child (msg->node, "active", NULL);
+ node = lm_message_node_add_child (n, "active", NULL);
break;
case TP_CHANNEL_CHAT_STATE_PAUSED:
- node = lm_message_node_add_child (msg->node, "paused", NULL);
+ node = lm_message_node_add_child (n, "paused", NULL);
break;
case TP_CHANNEL_CHAT_STATE_COMPOSING:
- node = lm_message_node_add_child (msg->node, "composing", NULL);
+ node = lm_message_node_add_child (n, "composing", NULL);
break;
}
@@ -92,6 +93,7 @@ gabble_message_util_send_message (GObject *obj,
GError *error = NULL;
const GHashTable *part;
LmMessage *msg;
+ WockyNode *node;
guint type = TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
gboolean result = TRUE;
const gchar *content_type, *text;
@@ -151,24 +153,25 @@ gabble_message_util_send_message (GObject *obj,
msg = lm_message_new_with_sub_type (recipient, LM_MESSAGE_TYPE_MESSAGE,
subtype);
+ node = wocky_stanza_get_top_node (msg);
/* Generate a UUID for the message */
id = gabble_generate_id ();
- lm_message_node_set_attribute (msg->node, "id", id);
+ lm_message_node_set_attribute (node, "id", id);
tp_message_set_string (message, 0, "message-token", id);
if (send_nick)
- lm_message_node_add_own_nick (msg->node, conn);
+ lm_message_node_add_own_nick (node, conn);
if (type == TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION)
{
gchar *tmp;
tmp = g_strconcat ("/me ", text, NULL);
- lm_message_node_add_child (msg->node, "body", tmp);
+ lm_message_node_add_child (node, "body", tmp);
g_free (tmp);
}
else
{
- lm_message_node_add_child (msg->node, "body", text);
+ lm_message_node_add_child (node, "body", text);
}
_add_chat_state (msg, state);
@@ -320,7 +323,8 @@ _tp_chat_state_from_message (LmMessage *message)
LmMessageNode *node;
#define MAP_TO(str, state) \
- node = lm_message_node_get_child_with_namespace (message->node, str, \
+ node = lm_message_node_get_child_with_namespace ( \
+ wocky_stanza_get_top_node (message), str, \
NS_CHAT_STATES); \
if (node != NULL) \
return state;
@@ -381,21 +385,26 @@ gabble_message_util_parse_incoming_message (LmMessage *message,
{
LmMessageNode *error_node;
- error_node = lm_message_node_get_child (message->node, "error");
+ error_node = lm_message_node_get_child (
+ wocky_stanza_get_top_node (message), "error");
- *send_error = _tp_send_error_from_error_node (error_node, delivery_status);
+ *send_error = _tp_send_error_from_error_node (error_node,
+ delivery_status);
}
- *id = lm_message_node_get_attribute (message->node, "id");
+ *id = lm_message_node_get_attribute (wocky_stanza_get_top_node (message),
+ "id");
- *from = lm_message_node_get_attribute (message->node, "from");
+ *from = lm_message_node_get_attribute (wocky_stanza_get_top_node (message),
+ "from");
if (*from == NULL)
{
- NODE_DEBUG (message->node, "got a message without a from field");
+ STANZA_DEBUG (message, "got a message without a from field");
return FALSE;
}
- type = lm_message_node_get_attribute (message->node, "type");
+ type = lm_message_node_get_attribute (wocky_stanza_get_top_node (message),
+ "type");
/*
* Parse timestamp of delayed messages. For non-delayed, it's
@@ -403,8 +412,8 @@ gabble_message_util_parse_incoming_message (LmMessage *message,
*/
*stamp = 0;
- node = lm_message_node_get_child_with_namespace (message->node, "x",
- NS_X_DELAY);
+ node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (message), "x", NS_X_DELAY);
if (node != NULL)
{
const gchar *stamp_str;
@@ -437,7 +446,8 @@ gabble_message_util_parse_incoming_message (LmMessage *message,
/*
* Parse body if it exists.
*/
- node = lm_message_node_get_child (message->node, "body");
+ node = lm_message_node_get_child (wocky_stanza_get_top_node (message),
+ "body");
if (node)
{
@@ -460,9 +470,11 @@ gabble_message_util_parse_incoming_message (LmMessage *message,
if (body != NULL)
{
if (type == NULL &&
- lm_message_node_get_child_with_namespace (message->node,
+ lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (message),
"time", "google:timestamp") != NULL &&
- lm_message_node_get_child_with_namespace (message->node,
+ lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (message),
"x", "jabber:x:delay") != NULL)
{
/* Google servers send offline messages without a type. Work around
diff --git a/src/muc-channel.c b/src/muc-channel.c
index e0de825d7..da6e35bd2 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -289,27 +289,27 @@ static TpHandle create_room_identity (GabbleMucChannel *)
/* signatures for presence handlers */
static void handle_fill_presence (WockyMuc *muc,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
gpointer user_data);
static void handle_renamed (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
gpointer data);
static void handle_error (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
WockyXmppError errnum,
const gchar *message,
gpointer data);
static void handle_join (WockyMuc *muc,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
gpointer data);
static void handle_parted (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
const gchar *actor_jid,
const gchar *why,
@@ -317,7 +317,7 @@ static void handle_parted (GObject *source,
gpointer data);
static void handle_left (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
WockyMucMember *who,
const gchar *actor_jid,
@@ -326,13 +326,13 @@ static void handle_left (GObject *source,
gpointer data);
static void handle_presence (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
WockyMucMember *who,
gpointer data);
static void handle_perms (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
const gchar *actor,
const gchar *why,
@@ -340,7 +340,7 @@ static void handle_perms (GObject *source,
/* signatures for message handlers */
static void handle_message (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
WockyMucMsgType type,
const gchar *xmpp_id,
time_t stamp,
@@ -351,7 +351,7 @@ static void handle_message (GObject *source,
gpointer data);
static void handle_errmsg (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
WockyMucMsgType type,
const gchar *xmpp_id,
time_t stamp,
@@ -1642,7 +1642,7 @@ config_form_get_form_node (LmMessage *msg)
NodeIter i;
/* find the query node */
- node = lm_message_node_get_child (msg->node, "query");
+ node = lm_message_node_get_child (wocky_stanza_get_top_node (msg), "query");
if (node == NULL)
return NULL;
@@ -1851,7 +1851,8 @@ update_permissions (GabbleMucChannel *chan)
msg = lm_message_new_with_sub_type (priv->jid,
LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET);
- node = lm_message_node_add_child (msg->node, "query", NULL);
+ node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "query", NULL);
lm_message_node_set_attribute (node, "xmlns", NS_MUC_OWNER);
success = _gabble_connection_send_with_reply (priv->conn, msg,
@@ -1929,7 +1930,7 @@ get_aff_from_backend (WockyMucAffiliation aff)
/* connect to wocky-muc:SIG_PRESENCE_ERROR */
static void
handle_error (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
WockyXmppError errnum,
const gchar *message,
gpointer data)
@@ -2062,18 +2063,18 @@ new_tube (GabbleMucChannel *gmuc,
static void
handle_tube_presence (GabbleMucChannel *gmuc,
TpHandle from,
- WockyXmppStanza *stanza)
+ WockyStanza *stanza)
{
GabbleMucChannelPrivate *priv = GABBLE_MUC_CHANNEL_GET_PRIVATE (gmuc);
- WockyXmppNode *node = stanza->node;
+ WockyNode *node = wocky_stanza_get_top_node (stanza);
if (from == 0)
return;
if (priv->tube == NULL)
{
- WockyXmppNode *tubes;
- tubes = wocky_xmpp_node_get_child_ns (node, "tubes", NS_TUBES);
+ WockyNode *tubes;
+ tubes = wocky_node_get_child_ns (node, "tubes", NS_TUBES);
/* presence doesn't contain tubes information, no need
* to create a tubes channel */
@@ -2093,7 +2094,7 @@ handle_tube_presence (GabbleMucChannel *gmuc,
* us that we have left the channel */
static void
handle_parted (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
const gchar *actor_jid,
const gchar *why,
@@ -2149,7 +2150,8 @@ handle_parted (GObject *source,
/* handle_tube_presence creates tubes if need be, so bypass it here: */
if (priv->tube != NULL)
- gabble_tubes_channel_presence_updated (priv->tube, member, stanza->node);
+ gabble_tubes_channel_presence_updated (priv->tube, member,
+ wocky_stanza_get_top_node (stanza));
close_channel (gmuc, why, FALSE, actor, reason);
@@ -2164,7 +2166,7 @@ handle_parted (GObject *source,
* us someone [else] has left the channel */
static void
handle_left (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
WockyMucMember *who,
const gchar *actor_jid,
@@ -2219,7 +2221,8 @@ handle_left (GObject *source,
/* handle_tube_presence creates tubes if need be, so bypass it here: */
if (priv->tube != NULL)
- gabble_tubes_channel_presence_updated (priv->tube, member, stanza->node);
+ gabble_tubes_channel_presence_updated (priv->tube, member,
+ wocky_stanza_get_top_node (stanza));
tp_group_mixin_change_members (data, why, NULL, handles, NULL, NULL,
actor, reason);
@@ -2234,7 +2237,7 @@ handle_left (GObject *source,
* MUC informs us our role/affiliation has been altered */
static void
handle_perms (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
const gchar *actor,
const gchar *why,
@@ -2256,7 +2259,7 @@ handle_perms (GObject *source,
static void
handle_fill_presence (WockyMuc *muc,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
gpointer user_data)
{
GabbleMucChannel *self = GABBLE_MUC_CHANNEL (user_data);
@@ -2284,7 +2287,7 @@ handle_fill_presence (WockyMuc *muc,
* MUC informs us our nick has been changed for some reason */
static void
handle_renamed (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
gpointer data)
{
@@ -2364,7 +2367,7 @@ update_roster_presence (GabbleMucChannel *gmuc,
* changed by the MUC we will already have received a SIG_NICK_CHANGE: */
static void
handle_join (WockyMuc *muc,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
gpointer data)
{
@@ -2403,7 +2406,7 @@ handle_join (WockyMuc *muc,
{
GError *error = NULL;
gboolean sent = FALSE;
- WockyXmppStanza *accept = wocky_xmpp_stanza_build (
+ WockyStanza *accept = wocky_stanza_build (
WOCKY_STANZA_TYPE_IQ, WOCKY_STANZA_SUB_TYPE_SET,
NULL, NULL,
'(', "query", ':', WOCKY_NS_MUC_OWN,
@@ -2445,7 +2448,7 @@ handle_join (WockyMuc *muc,
* NOT our own after the initial roster has been received: */
static void
handle_presence (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
GHashTable *code,
WockyMucMember *who,
gpointer data)
@@ -2511,7 +2514,7 @@ handle_presence (GObject *source,
static void
handle_message (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
WockyMucMsgType type,
const gchar *xmpp_id,
time_t stamp,
@@ -2603,7 +2606,7 @@ handle_message (GObject *source,
static void
handle_errmsg (GObject *source,
- WockyXmppStanza *stanza,
+ WockyStanza *stanza,
WockyMucMsgType type,
const gchar *xmpp_id,
time_t stamp,
@@ -2693,10 +2696,12 @@ _gabble_muc_channel_handle_subject (GabbleMucChannel *chan,
LmMessageNode *node;
const gchar *err_desc = NULL;
- node = lm_message_node_get_child (msg->node, "error");
+ node = lm_message_node_get_child (
+ wocky_stanza_get_top_node (msg), "error");
if (node)
{
- GabbleXmppError xmpp_error = gabble_xmpp_error_from_node (node, NULL);
+ GabbleXmppError xmpp_error = gabble_xmpp_error_from_node (node,
+ NULL);
err_desc = gabble_xmpp_error_description (xmpp_error);
}
@@ -2822,7 +2827,7 @@ _gabble_muc_channel_receive (GabbleMucChannel *chan,
* that this would happen if we send an error stanza and the MUC reflects
* it back at us, so let's just ignore it.
*/
- NODE_DEBUG (msg->node, "ignoring error stanza from ourself");
+ STANZA_DEBUG (msg, "ignoring error stanza from ourself");
return;
}
@@ -2841,7 +2846,7 @@ _gabble_muc_channel_receive (GabbleMucChannel *chan,
*/
if (!is_echo && !is_error && sender_handle_type == TP_HANDLE_TYPE_ROOM)
{
- NODE_DEBUG (msg->node, "ignoring message from muc");
+ STANZA_DEBUG (msg, "ignoring message from muc");
return;
}
@@ -3135,7 +3140,8 @@ gabble_muc_channel_send_invite (GabbleMucChannel *self,
msg = lm_message_new (priv->jid, LM_MESSAGE_TYPE_MESSAGE);
- x_node = lm_message_node_add_child (msg->node, "x", NULL);
+ x_node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "x", NULL);
lm_message_node_set_attribute (x_node, "xmlns", NS_MUC_USER);
invite_node = lm_message_node_add_child (x_node, "invite", NULL);
@@ -3284,7 +3290,8 @@ gabble_muc_channel_remove_member (GObject *obj,
msg = lm_message_new_with_sub_type (priv->jid, LM_MESSAGE_TYPE_IQ,
LM_MESSAGE_SUB_TYPE_SET);
- query_node = lm_message_node_add_child (msg->node, "query", NULL);
+ query_node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "query", NULL);
lm_message_node_set_attribute (query_node, "xmlns", NS_MUC_ADMIN);
item_node = lm_message_node_add_child (query_node, "item", NULL);
@@ -3347,7 +3354,8 @@ gabble_muc_channel_do_set_properties (GObject *obj,
msg = lm_message_new_with_sub_type (priv->jid,
LM_MESSAGE_TYPE_MESSAGE, LM_MESSAGE_SUB_TYPE_GROUPCHAT);
- lm_message_node_add_child (msg->node, "subject", str);
+ lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "subject", str);
success = _gabble_connection_send (priv->conn, msg, error);
@@ -3362,7 +3370,8 @@ gabble_muc_channel_do_set_properties (GObject *obj,
{
msg = lm_message_new_with_sub_type (priv->jid,
LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET);
- node = lm_message_node_add_child (msg->node, "query", NULL);
+ node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "query", NULL);
lm_message_node_set_attribute (node, "xmlns", NS_MUC_OWNER);
success = _gabble_connection_send_with_reply (priv->conn, msg,
@@ -3413,7 +3422,8 @@ request_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg,
msg = lm_message_new_with_sub_type (priv->jid, LM_MESSAGE_TYPE_IQ,
LM_MESSAGE_SUB_TYPE_SET);
- node = lm_message_node_add_child (msg->node, "query", NULL);
+ node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "query", NULL);
lm_message_node_set_attribute (node, "xmlns", NS_MUC_OWNER);
submit_node = lm_message_node_add_child (node, "x", NULL);
@@ -3764,7 +3774,7 @@ gabble_muc_channel_send_presence (GabbleMucChannel *self,
GError **error)
{
GabbleMucChannelPrivate *priv = GABBLE_MUC_CHANNEL_GET_PRIVATE (self);
- WockyXmppStanza *stanza;
+ WockyStanza *stanza;
gboolean result;
/* do nothing if we havn't actually joined yet */
diff --git a/src/muc-factory.c b/src/muc-factory.c
index 776cc2715..f17e7a057 100644
--- a/src/muc-factory.c
+++ b/src/muc-factory.c
@@ -604,7 +604,8 @@ process_muc_invite (GabbleMucFactory *fac,
gchar *room;
/* does it have a muc subnode? */
- x_node = lm_message_node_get_child_with_namespace (message->node, "x",
+ x_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (message), "x",
NS_MUC_USER);
if (x_node == NULL)
@@ -619,7 +620,7 @@ process_muc_invite (GabbleMucFactory *fac,
/* FIXME: do something with these? */
if (send_error != GABBLE_TEXT_CHANNEL_SEND_NO_ERROR)
{
- NODE_DEBUG (message->node, "got a MUC invitation message with a send "
+ STANZA_DEBUG (message, "got a MUC invitation message with a send "
"error; ignoring");
return TRUE;
@@ -628,7 +629,7 @@ process_muc_invite (GabbleMucFactory *fac,
invite_from = lm_message_node_get_attribute (invite_node, "from");
if (invite_from == NULL)
{
- NODE_DEBUG (message->node, "got a MUC invitation message with no JID; "
+ STANZA_DEBUG (message, "got a MUC invitation message with no JID; "
"ignoring");
return TRUE;
@@ -638,7 +639,7 @@ process_muc_invite (GabbleMucFactory *fac,
NULL, NULL);
if (inviter_handle == 0)
{
- NODE_DEBUG (message->node, "got a MUC invitation message with invalid "
+ STANZA_DEBUG (message, "got a MUC invitation message with invalid "
"inviter JID; ignoring");
return TRUE;
@@ -678,8 +679,8 @@ process_obsolete_invite (GabbleMucFactory *fac,
struct DiscoInviteData *disco_udata;
/* check for obsolete invite method */
- x_node = lm_message_node_get_child_with_namespace (message->node, "x",
- NS_X_CONFERENCE);
+ x_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (message), "x", NS_X_CONFERENCE);
if (x_node == NULL)
return FALSE;
@@ -687,7 +688,8 @@ process_obsolete_invite (GabbleMucFactory *fac,
* client or something */
if (send_error != GABBLE_TEXT_CHANNEL_SEND_NO_ERROR)
{
- NODE_DEBUG (message->node, "got an obsolete MUC invitation message with "
+ STANZA_DEBUG (message,
+ "got an obsolete MUC invitation message with "
"a send error; ignoring");
return TRUE;
@@ -697,8 +699,8 @@ process_obsolete_invite (GabbleMucFactory *fac,
room = lm_message_node_get_attribute (x_node, "jid");
if (room == NULL)
{
- NODE_DEBUG (message->node, "got a obsolete MUC invitation with no room "
- "JID; ignoring");
+ STANZA_DEBUG (message,
+ "got a obsolete MUC invitation with no room JID; ignoring");
return TRUE;
}
@@ -707,7 +709,7 @@ process_obsolete_invite (GabbleMucFactory *fac,
inviter_handle = tp_handle_ensure (contact_repo, from, NULL, NULL);
if (inviter_handle == 0)
{
- NODE_DEBUG (message->node, "got an obsolete MUC invitation message from "
+ STANZA_DEBUG (message, "got an obsolete MUC invitation message from "
"an invalid JID; ignoring");
return TRUE;
diff --git a/src/olpc-activity-view.c b/src/olpc-activity-view.c
index 41639ecda..955eb2a6a 100644
--- a/src/olpc-activity-view.c
+++ b/src/olpc-activity-view.c
@@ -270,8 +270,8 @@ activity_view_query_result_cb (GabbleConnection *conn,
LmMessageNode *view_node;
GabbleOlpcView *view = GABBLE_OLPC_VIEW (_view);
- view_node = lm_message_node_get_child_with_namespace (reply_msg->node,
- "view", NS_OLPC_ACTIVITY);
+ view_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (reply_msg), "view", NS_OLPC_ACTIVITY);
if (view_node == NULL)
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
diff --git a/src/olpc-buddy-view.c b/src/olpc-buddy-view.c
index 19678b85f..f154c9967 100644
--- a/src/olpc-buddy-view.c
+++ b/src/olpc-buddy-view.c
@@ -238,7 +238,8 @@ buddy_view_query_result_cb (GabbleConnection *conn,
LmMessageNode *view_node;
GabbleOlpcView *self = GABBLE_OLPC_VIEW (_view);
- view_node = lm_message_node_get_child_with_namespace (reply_msg->node,
+ view_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (reply_msg),
"view", NS_OLPC_BUDDY);
if (view_node == NULL)
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
diff --git a/src/presence-cache.c b/src/presence-cache.c
index 8000835d9..1a0ee0aef 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -1497,7 +1497,7 @@ gabble_presence_parse_presence_message (GabblePresenceCache *cache,
}
g_free (my_full_jid);
- presence_node = message->node;
+ presence_node = wocky_stanza_get_top_node (message);
g_assert (0 == strcmp (presence_node->name, "presence"));
resource = strchr (from, '/');
@@ -1534,7 +1534,7 @@ gabble_presence_parse_presence_message (GabblePresenceCache *cache,
priority = CLAMP (atoi (prio), G_MININT8, G_MAXINT8);
}
- child_node = wocky_xmpp_node_get_child_ns (presence_node, "temppres",
+ child_node = wocky_node_get_child_ns (presence_node, "temppres",
NS_TEMPPRES);
if (child_node != NULL)
@@ -1669,11 +1669,12 @@ gabble_presence_cache_lm_message_cb (LmMessageHandler *handler,
g_assert (lmconn == priv->conn->lmconn);
- from = lm_message_node_get_attribute (message->node, "from");
+ from = lm_message_node_get_attribute (wocky_stanza_get_top_node (message),
+ "from");
if (NULL == from)
{
- NODE_DEBUG (message->node, "message without from attribute, ignoring");
+ STANZA_DEBUG (message, "message without from attribute, ignoring");
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
}
@@ -1681,7 +1682,7 @@ gabble_presence_cache_lm_message_cb (LmMessageHandler *handler,
if (0 == handle)
{
- NODE_DEBUG (message->node, "ignoring message from malformed jid");
+ STANZA_DEBUG (message, "ignoring message from malformed jid");
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
}
diff --git a/src/presence.c b/src/presence.c
index 79b901b82..ca9f50bf9 100644
--- a/src/presence.c
+++ b/src/presence.c
@@ -473,9 +473,10 @@ OUT:
void
gabble_presence_add_status_and_vcard (GabblePresence *presence,
- WockyXmppStanza *stanza)
+ WockyStanza *stanza)
{
- WockyXmppNode *vcard_node;
+ WockyNode *node = wocky_stanza_get_top_node (stanza);
+ WockyNode *vcard_node;
switch (presence->status)
{
@@ -484,19 +485,19 @@ gabble_presence_add_status_and_vcard (GabblePresence *presence,
case GABBLE_PRESENCE_HIDDEN:
break;
case GABBLE_PRESENCE_AWAY:
- wocky_xmpp_node_add_child_with_content (stanza->node, "show",
+ wocky_node_add_child_with_content (node, "show",
JABBER_PRESENCE_SHOW_AWAY);
break;
case GABBLE_PRESENCE_CHAT:
- wocky_xmpp_node_add_child_with_content (stanza->node, "show",
+ wocky_node_add_child_with_content (node, "show",
JABBER_PRESENCE_SHOW_CHAT);
break;
case GABBLE_PRESENCE_DND:
- wocky_xmpp_node_add_child_with_content (stanza->node, "show",
+ wocky_node_add_child_with_content (node, "show",
JABBER_PRESENCE_SHOW_DND);
break;
case GABBLE_PRESENCE_XA:
- wocky_xmpp_node_add_child_with_content (stanza->node, "show",
+ wocky_node_add_child_with_content (node, "show",
JABBER_PRESENCE_SHOW_XA);
break;
default:
@@ -505,15 +506,15 @@ gabble_presence_add_status_and_vcard (GabblePresence *presence,
}
if (presence->status_message)
- wocky_xmpp_node_add_child_with_content (stanza->node, "status",
+ wocky_node_add_child_with_content (node, "status",
presence->status_message);
- vcard_node = wocky_xmpp_node_add_child_ns (stanza->node, "x",
+ vcard_node = wocky_node_add_child_ns (node, "x",
NS_VCARD_TEMP_UPDATE);
if (presence->avatar_sha1 != NULL)
{
- wocky_xmpp_node_add_child_with_content (vcard_node, "photo",
+ wocky_node_add_child_with_content (vcard_node, "photo",
presence->avatar_sha1);
}
}
@@ -537,7 +538,7 @@ gabble_presence_as_message (GabblePresence *presence,
message = lm_message_new_with_sub_type (to, LM_MESSAGE_TYPE_PRESENCE,
subtype);
- gabble_presence_add_status_and_vcard (presence, WOCKY_XMPP_STANZA (message));
+ gabble_presence_add_status_and_vcard (presence, message);
if (res->priority)
{
diff --git a/src/presence.h b/src/presence.h
index e2f95885c..352aea16d 100644
--- a/src/presence.h
+++ b/src/presence.h
@@ -98,7 +98,7 @@ gboolean gabble_presence_resource_has_caps (GabblePresence *presence,
LmMessage *gabble_presence_as_message (GabblePresence *presence,
const gchar *to);
void gabble_presence_add_status_and_vcard (GabblePresence *presence,
- WockyXmppStanza *stanza);
+ WockyStanza *stanza);
gchar *gabble_presence_dump (GabblePresence *presence);
diff --git a/src/private-tubes-factory.c b/src/private-tubes-factory.c
index 30b3b35dd..8a91b81df 100644
--- a/src/private-tubes-factory.c
+++ b/src/private-tubes-factory.c
@@ -741,18 +741,19 @@ private_tubes_factory_msg_tube_cb (LmMessageHandler *handler,
const gchar *from;
TpHandle handle;
- tube_node = lm_message_node_get_child_with_namespace (msg->node, "tube",
- NS_TUBES);
- close_node = lm_message_node_get_child_with_namespace (msg->node, "close",
- NS_TUBES);
+ tube_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "tube", NS_TUBES);
+ close_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "close", NS_TUBES);
if (tube_node == NULL && close_node == NULL)
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
- from = lm_message_node_get_attribute (msg->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (msg), "from");
if (from == NULL)
{
- NODE_DEBUG (msg->node, "got a message without a from field");
+ STANZA_DEBUG (msg, "got a message without a from field");
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
diff --git a/src/roster.c b/src/roster.c
index 8fe6e989b..ec45d386c 100644
--- a/src/roster.c
+++ b/src/roster.c
@@ -735,7 +735,8 @@ _gabble_roster_message_new (GabbleRoster *roster,
LM_MESSAGE_TYPE_IQ,
sub_type);
- query_node = lm_message_node_add_child (message->node, "query", NULL);
+ query_node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (message), "query", NULL);
if (NULL != query_return)
*query_return = query_node;
@@ -1243,7 +1244,8 @@ got_roster_iq (GabbleRoster *roster,
if (query_node == NULL)
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
- from = lm_message_node_get_attribute (message->node, "from");
+ from = lm_message_node_get_attribute (
+ wocky_stanza_get_top_node (message), "from");
if (from != NULL)
{
@@ -2585,7 +2587,7 @@ gabble_roster_handle_add_to_group (GabbleRoster *roster,
tp_handle_set_add (item->groups, group);
message = _gabble_roster_item_to_message (roster, handle, NULL, NULL);
- NODE_DEBUG (message->node, "Roster item as message");
+ STANZA_DEBUG (message, "Roster item as message");
tp_handle_set_remove (item->groups, group);
/* keep the handle valid until roster_edited_cb runs; it will do the unref */
diff --git a/src/search-channel.c b/src/search-channel.c
index 75ea5ad0d..b202e3f60 100644
--- a/src/search-channel.c
+++ b/src/search-channel.c
@@ -427,8 +427,8 @@ query_reply_cb (GabbleConnection *conn,
LmMessageNode *query_node;
GError *err = NULL;
- query_node = lm_message_node_get_child_with_namespace (reply_msg->node,
- "query", NS_SEARCH);
+ query_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (reply_msg), "query", NS_SEARCH);
if (lm_message_get_sub_type (reply_msg) == LM_MESSAGE_SUB_TYPE_ERROR)
{
@@ -467,7 +467,8 @@ request_search_fields (GabbleSearchChannel *chan)
msg = lm_message_new_with_sub_type (chan->priv->server, LM_MESSAGE_TYPE_IQ,
LM_MESSAGE_SUB_TYPE_GET);
- lm_node = lm_message_node_add_child (msg->node, "query", NULL);
+ lm_node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "query", NULL);
lm_message_node_set_attribute (lm_node, "xmlns", NS_SEARCH);
if (! _gabble_connection_send_with_reply (chan->base.conn, msg,
@@ -862,8 +863,8 @@ search_reply_cb (GabbleConnection *conn,
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
- query_node = lm_message_node_get_child_with_namespace (reply_msg->node,
- "query", NS_SEARCH);
+ query_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (reply_msg), "query", NS_SEARCH);
if (lm_message_get_sub_type (reply_msg) == LM_MESSAGE_SUB_TYPE_ERROR)
{
@@ -1048,7 +1049,8 @@ do_search (GabbleSearchChannel *chan,
msg = lm_message_new_with_sub_type (chan->priv->server, LM_MESSAGE_TYPE_IQ,
LM_MESSAGE_SUB_TYPE_SET);
- query = lm_message_node_add_child (msg->node, "query", NULL);
+ query = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "query", NULL);
lm_message_node_set_attribute (query, "xmlns", NS_SEARCH);
if (chan->priv->xforms)
diff --git a/src/tube-dbus.c b/src/tube-dbus.c
index bb4961840..b7b577e60 100644
--- a/src/tube-dbus.c
+++ b/src/tube-dbus.c
@@ -1284,8 +1284,8 @@ gabble_tube_dbus_offer (GabbleTubeDBus *tube,
full_jid = g_strdup_printf ("%s/%s", jid, resource);
msg = gabble_bytestream_factory_make_stream_init_iq (full_jid,
priv->stream_id, NS_TUBES);
- si_node = lm_message_node_get_child_with_namespace (msg->node, "si",
- NS_SI);
+ si_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
g_assert (si_node != NULL);
tube_node = lm_message_node_add_child (si_node, "tube", NULL);
diff --git a/src/tube-stream.c b/src/tube-stream.c
index d81a3c2fd..b75ac275f 100644
--- a/src/tube-stream.c
+++ b/src/tube-stream.c
@@ -525,7 +525,8 @@ start_stream_initiation (GabbleTubeStream *self,
msg = gabble_bytestream_factory_make_stream_init_iq (full_jid,
stream_id, NS_TUBES);
- si_node = lm_message_node_get_child_with_namespace (msg->node, "si", NS_SI);
+ si_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
g_assert (si_node != NULL);
id_str = g_strdup_printf ("%u", priv->id);
diff --git a/src/tubes-channel.c b/src/tubes-channel.c
index 53b9e2189..fcd52cd6f 100644
--- a/src/tubes-channel.c
+++ b/src/tubes-channel.c
@@ -1133,7 +1133,8 @@ pre_presence_cb (GabbleMucChannel *muc,
LmMessageNode *node;
/* Augment the muc presence with tubes information */
- node = lm_message_node_add_child (msg->node, "tubes", NULL);
+ node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "tubes", NULL);
lm_message_node_set_attribute (node, "xmlns", NS_TUBES);
data.self = self;
data.tubes_node = node;
@@ -1173,8 +1174,8 @@ gabble_tubes_channel_tube_si_offered (GabbleTubesChannel *self,
*/
g_return_if_fail (lm_message_get_type (msg) == LM_MESSAGE_TYPE_IQ);
g_return_if_fail (lm_message_get_sub_type (msg) == LM_MESSAGE_SUB_TYPE_SET);
- si_node = lm_message_node_get_child_with_namespace (msg->node, "si",
- NS_SI);
+ si_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
g_return_if_fail (si_node != NULL);
stream_id = lm_message_node_get_attribute (si_node, "id");
g_return_if_fail (stream_id != NULL);
@@ -1260,8 +1261,8 @@ gabble_tubes_channel_bytestream_offered (GabbleTubesChannel *self,
g_return_if_fail (lm_message_get_type (msg) == LM_MESSAGE_TYPE_IQ);
g_return_if_fail (lm_message_get_sub_type (msg) == LM_MESSAGE_SUB_TYPE_SET);
- si_node = lm_message_node_get_child_with_namespace (msg->node, "si",
- NS_SI);
+ si_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "si", NS_SI);
g_return_if_fail (si_node != NULL);
if (priv->handle_type == TP_HANDLE_TYPE_CONTACT)
@@ -1369,8 +1370,8 @@ tube_msg_offered (GabbleTubesChannel *self,
GabbleTubeIface *tube;
g_return_if_fail (lm_message_get_type (msg) == LM_MESSAGE_TYPE_MESSAGE);
- tube_node = lm_message_node_get_child_with_namespace (msg->node, "tube",
- NS_TUBES);
+ 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,
@@ -1427,8 +1428,8 @@ tube_msg_close (GabbleTubesChannel *self,
GabbleTubeIface *tube;
TpTubeType type;
- close_node = lm_message_node_get_child_with_namespace (msg->node, "close",
- NS_TUBES);
+ close_node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "close", NS_TUBES);
g_assert (close_node != NULL);
tmp = lm_message_node_get_attribute (close_node, "tube");
@@ -1469,16 +1470,16 @@ gabble_tubes_channel_tube_msg (GabbleTubesChannel *self,
{
LmMessageNode *node;
- node = lm_message_node_get_child_with_namespace (msg->node, "tube",
- NS_TUBES);
+ node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "tube", NS_TUBES);
if (node != NULL)
{
tube_msg_offered (self, msg);
return;
}
- node = lm_message_node_get_child_with_namespace (msg->node, "close",
- NS_TUBES);
+ node = lm_message_node_get_child_with_namespace (
+ wocky_stanza_get_top_node (msg), "close", NS_TUBES);
if (node != NULL)
{
tube_msg_close (self, msg);
diff --git a/src/util.c b/src/util.c
index f37b993bb..07994ad7c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -164,7 +164,7 @@ lm_message_node_get_child_any_ns (LmMessageNode *node, const gchar *name)
const gchar *
lm_message_node_get_namespace (LmMessageNode *node)
{
- return wocky_xmpp_node_get_ns (node);
+ return wocky_node_get_ns (node);
}
const gchar *
@@ -189,7 +189,10 @@ lm_message_node_get_child_with_namespace (LmMessageNode *node,
LmMessageNode *found;
NodeIter i;
- found = wocky_xmpp_node_get_child_ns (node, name, ns);
+ NODE_DEBUG (node, name);
+ NODE_DEBUG (node, ns);
+
+ found = wocky_node_get_child_ns (node, name, ns);
if (found != NULL)
return found;
@@ -239,9 +242,9 @@ lm_message_node_add_build_va (LmMessageNode *node, guint spec, va_list ap)
g_return_if_fail (key != NULL);
g_return_if_fail (value != NULL);
if (!tp_strdiff (key, "xmlns"))
- wocky_xmpp_node_set_ns (stack->data, value);
+ wocky_node_set_ns (stack->data, value);
else if (!tp_strdiff (key, "xml:lang"))
- wocky_xmpp_node_set_language (stack->data, value);
+ wocky_node_set_language (stack->data, value);
else
lm_message_node_set_attribute (stack->data, key, value);
}
@@ -319,7 +322,8 @@ lm_message_build (const gchar *to, LmMessageType type, guint spec, ...)
msg = lm_message_new (to, type);
va_start (ap, spec);
- lm_message_node_add_build_va (msg->node, spec, ap);
+ lm_message_node_add_build_va (
+ wocky_stanza_get_top_node (msg), spec, ap);
va_end (ap);
return msg;
}
@@ -339,7 +343,8 @@ lm_message_build_with_sub_type (const gchar *to, LmMessageType type,
msg = lm_message_new_with_sub_type (to, type, sub_type);
va_start (ap, spec);
- lm_message_node_add_build_va (msg->node, spec, ap);
+ lm_message_node_add_build_va (
+ wocky_stanza_get_top_node (msg), spec, ap);
va_end (ap);
return msg;
}
@@ -997,7 +1002,7 @@ lm_message_node_get_attribute_with_namespace (LmMessageNode *node,
const gchar *attribute,
const gchar *ns)
{
- return wocky_xmpp_node_get_attribute_ns (node, attribute, ns);
+ return wocky_node_get_attribute_ns (node, attribute, ns);
}
GPtrArray *
diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index e33fd5290..fb3a3cc82 100644
--- a/src/vcard-manager.c
+++ b/src/vcard-manager.c
@@ -1147,7 +1147,8 @@ gabble_vcard_manager_edit_info_apply (GabbleVCardManagerEditInfo *info,
if (info->edit_type == GABBLE_VCARD_EDIT_CLEAR)
{
/* start from a clean slate... */
- vcard_node = lm_message_node_add_child (msg->node, "vCard", "");
+ vcard_node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (msg), "vCard", "");
lm_message_node_set_attribute (vcard_node, "xmlns", "vcard-temp");
/* ... but as a special case, the photo gets copied in from the old
@@ -1157,8 +1158,8 @@ gabble_vcard_manager_edit_info_apply (GabbleVCardManagerEditInfo *info,
if (node != NULL)
vcard_copy (vcard_node, node, NULL, NULL);
- /* Yes, we can do this: "LmMessageNode" is really a WockyXmppNode */
- if (wocky_xmpp_node_equal (old_vcard, vcard_node))
+ /* Yes, we can do this: "LmMessageNode" is really a WockyNode */
+ if (wocky_node_equal (old_vcard, vcard_node))
{
/* nothing actually happened, forget it */
lm_message_unref (msg);
@@ -1171,13 +1172,15 @@ gabble_vcard_manager_edit_info_apply (GabbleVCardManagerEditInfo *info,
if (info->edit_type == GABBLE_VCARD_EDIT_APPEND)
{
/* appending: keep all child nodes */
- vcard_node = vcard_copy (msg->node, old_vcard, NULL, NULL);
+ vcard_node = vcard_copy (
+ wocky_stanza_get_top_node (msg), old_vcard, NULL, NULL);
}
else
{
/* replacing or deleting: exclude all matching child nodes from
* copying */
- vcard_node = vcard_copy (msg->node, old_vcard, info->element_name,
+ vcard_node = vcard_copy (
+ wocky_stanza_get_top_node (msg), old_vcard, info->element_name,
&maybe_changed);
}
@@ -1196,7 +1199,7 @@ gabble_vcard_manager_edit_info_apply (GabbleVCardManagerEditInfo *info,
}
}
- if ((!maybe_changed) || wocky_xmpp_node_equal (old_vcard, vcard_node))
+ if ((!maybe_changed) || wocky_node_equal (old_vcard, vcard_node))
{
/* nothing actually happened, forget it */
lm_message_unref (msg);
@@ -1273,7 +1276,8 @@ manager_patch_vcard (GabbleVCardManager *self,
msg = new_msg;
/* gabble_vcard_manager_edit_info_apply always returns an IQ message
* with one vCard child */
- vcard_node = lm_message_node_get_child (msg->node, "vCard");
+ vcard_node = lm_message_node_get_child (
+ wocky_stanza_get_top_node (msg), "vCard");
g_assert (vcard_node != NULL);
}
@@ -1372,7 +1376,8 @@ pipeline_reply_cb (GabbleConnection *conn,
* from an XMPP stanza.
*/
if (reply_msg != NULL)
- error_node = lm_message_node_get_child (reply_msg->node, "error");
+ error_node = lm_message_node_get_child (
+ wocky_stanza_get_top_node (reply_msg), "error");
if (error_node != NULL)
xmpp_error = gabble_xmpp_error_from_node (error_node, &error_type);
@@ -1413,7 +1418,8 @@ pipeline_reply_cb (GabbleConnection *conn,
g_assert (reply_msg != NULL);
- vcard_node = lm_message_node_get_child (reply_msg->node, "vCard");
+ vcard_node = lm_message_node_get_child (
+ wocky_stanza_get_top_node (reply_msg), "vCard");
if (NULL == vcard_node)
{
@@ -1421,7 +1427,8 @@ pipeline_reply_cb (GabbleConnection *conn,
DEBUG ("successful lookup response contained no <vCard> node, "
"creating an empty one");
- vcard_node = lm_message_node_add_child (reply_msg->node, "vCard",
+ vcard_node = lm_message_node_add_child (
+ wocky_stanza_get_top_node (reply_msg), "vCard",
NULL);
lm_message_node_set_attribute (vcard_node, "xmlns", NS_VCARD_TEMP);
}
diff --git a/tests/test-caps-hash.c b/tests/test-caps-hash.c
index c6db40f46..365133e9b 100644
--- a/tests/test-caps-hash.c
+++ b/tests/test-caps-hash.c
@@ -9,7 +9,8 @@ check_hash (LmMessage *stanza,
{
gchar *hash;
- hash = caps_hash_compute_from_lm_node (stanza->node);
+ hash = caps_hash_compute_from_lm_node (
+ wocky_stanza_get_top_node (stanza));
g_assert (!tp_strdiff (hash, expected));
lm_message_unref (stanza);
g_free (hash);
@@ -26,8 +27,10 @@ test_simple (void)
'@', "name", "Exodus 0.9.1",
'@', "type", "pc",
')',
- '(', "feature", "", '@', "var", "http://jabber.org/protocol/disco#info", ')',
- '(', "feature", "", '@', "var", "http://jabber.org/protocol/disco#items", ')',
+ '(', "feature", "",
+ '@', "var", "http://jabber.org/protocol/disco#info", ')',
+ '(', "feature", "",
+ '@', "var", "http://jabber.org/protocol/disco#items", ')',
'(', "feature", "", '@', "var", "http://jabber.org/protocol/muc", ')',
'(', "feature", "", '@', "var", "http://jabber.org/protocol/caps", ')',
')',