summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/connect.c14
-rw-r--r--tests/wocky-data-form-test.c28
-rw-r--r--tests/wocky-pep-service-test.c10
-rw-r--r--tests/wocky-porter-test.c20
-rw-r--r--tests/wocky-pubsub-node-test.c62
-rw-r--r--tests/wocky-pubsub-service-test.c42
-rw-r--r--tests/wocky-pubsub-test-helpers.c12
-rw-r--r--tests/wocky-pubsub-test-helpers.h2
-rw-r--r--tests/wocky-roster-test.c86
-rw-r--r--tests/wocky-stanza-test.c2
-rw-r--r--tests/wocky-test-connector-server.c82
-rw-r--r--tests/wocky-test-helper.h24
-rw-r--r--tests/wocky-test-sasl-auth-server.c22
-rw-r--r--tests/wocky-xmpp-node-test.c98
-rw-r--r--tests/wocky-xmpp-readwrite-test.c28
-rw-r--r--wocky/Makefile.am4
-rw-r--r--wocky/wocky-connector.c58
-rw-r--r--wocky/wocky-data-form.c126
-rw-r--r--wocky/wocky-data-form.h8
-rw-r--r--wocky/wocky-debug.c2
-rw-r--r--wocky/wocky-muc.c98
-rw-r--r--wocky/wocky-node-tree.c2
-rw-r--r--wocky/wocky-node-tree.h4
-rw-r--r--wocky/wocky-node.c (renamed from wocky/wocky-xmpp-node.c)442
-rw-r--r--wocky/wocky-node.h206
-rw-r--r--wocky/wocky-pep-service.c4
-rw-r--r--wocky/wocky-pep-service.h2
-rw-r--r--wocky/wocky-porter.c16
-rw-r--r--wocky/wocky-pubsub-helpers.c32
-rw-r--r--wocky/wocky-pubsub-helpers.h14
-rw-r--r--wocky/wocky-pubsub-node-protected.h26
-rw-r--r--wocky/wocky-pubsub-node.c90
-rw-r--r--wocky/wocky-pubsub-node.h6
-rw-r--r--wocky/wocky-pubsub-service-protected.h12
-rw-r--r--wocky/wocky-pubsub-service.c70
-rw-r--r--wocky/wocky-roster.c52
-rw-r--r--wocky/wocky-sasl-auth.c34
-rw-r--r--wocky/wocky-stanza.c30
-rw-r--r--wocky/wocky-stanza.h4
-rw-r--r--wocky/wocky-xmpp-error.c46
-rw-r--r--wocky/wocky-xmpp-error.h12
-rw-r--r--wocky/wocky-xmpp-node.h206
-rw-r--r--wocky/wocky-xmpp-reader.c16
-rw-r--r--wocky/wocky-xmpp-writer.c14
-rw-r--r--wocky/wocky.c6
45 files changed, 1087 insertions, 1087 deletions
diff --git a/examples/connect.c b/examples/connect.c
index cd43556..540c15f 100644
--- a/examples/connect.c
+++ b/examples/connect.c
@@ -67,7 +67,7 @@ ssl_features_received_cb (GObject *source,
gpointer user_data)
{
WockyStanza *stanza;
- WockyXmppNode *node;
+ WockyNode *node;
stanza = wocky_xmpp_connection_recv_stanza_finish (conn, result, NULL);
@@ -76,7 +76,7 @@ ssl_features_received_cb (GObject *source,
node = wocky_stanza_get_top_node (stanza);
if (strcmp (node->name, "features")
- || strcmp (wocky_xmpp_node_get_ns (node), WOCKY_XMPP_NS_STREAM))
+ || strcmp (wocky_node_get_ns (node), WOCKY_XMPP_NS_STREAM))
{
printf ("Didn't receive features stanza\n");
g_main_loop_quit (mainloop);
@@ -147,7 +147,7 @@ tcp_start_tls_recv_cb (GObject *source,
gpointer user_data)
{
WockyStanza *stanza;
- WockyXmppNode *node;
+ WockyNode *node;
GError *error = NULL;
stanza = wocky_xmpp_connection_recv_stanza_finish (conn, result, NULL);
@@ -157,7 +157,7 @@ tcp_start_tls_recv_cb (GObject *source,
node = wocky_stanza_get_top_node (stanza);
if (strcmp (node->name, "proceed")
- || strcmp (wocky_xmpp_node_get_ns (node), WOCKY_XMPP_NS_TLS))
+ || strcmp (wocky_node_get_ns (node), WOCKY_XMPP_NS_TLS))
{
printf ("Server doesn't want to start tls");
g_main_loop_quit (mainloop);
@@ -196,7 +196,7 @@ tcp_features_received_cb (GObject *source,
gpointer user_data)
{
WockyStanza *stanza;
- WockyXmppNode *tls, *node;
+ WockyNode *tls, *node;
WockyStanza *starttls;
stanza = wocky_xmpp_connection_recv_stanza_finish (conn, result, NULL);
@@ -206,14 +206,14 @@ tcp_features_received_cb (GObject *source,
node = wocky_stanza_get_top_node (stanza);
if (strcmp (node->name, "features")
- || strcmp (wocky_xmpp_node_get_ns (node), WOCKY_XMPP_NS_STREAM))
+ || strcmp (wocky_node_get_ns (node), WOCKY_XMPP_NS_STREAM))
{
printf ("Didn't receive features stanza\n");
g_main_loop_quit (mainloop);
return;
}
- tls = wocky_xmpp_node_get_child_ns (node, "starttls",
+ tls = wocky_node_get_child_ns (node, "starttls",
WOCKY_XMPP_NS_TLS);
if (tls == NULL)
diff --git a/tests/wocky-data-form-test.c b/tests/wocky-data-form-test.c
index dd8d6f6..f160fce 100644
--- a/tests/wocky-data-form-test.c
+++ b/tests/wocky-data-form-test.c
@@ -15,7 +15,7 @@ static void
test_new_from_form (void)
{
WockyStanza *stanza;
- WockyXmppNode *node;
+ WockyNode *node;
WockyDataForm *form;
GError *error = NULL;
@@ -32,7 +32,7 @@ test_new_from_form (void)
g_clear_error (&error);
/* add 'x' node */
- node = wocky_xmpp_node_add_child_ns (wocky_stanza_get_top_node (stanza),
+ node = wocky_node_add_child_ns (wocky_stanza_get_top_node (stanza),
"x", WOCKY_XMPP_NS_DATA);
/* the x node doesn't have a 'type' attribute */
@@ -44,7 +44,7 @@ test_new_from_form (void)
g_clear_error (&error);
/* set wrong type */
- wocky_xmpp_node_set_attribute (node, "type", "badger");
+ wocky_node_set_attribute (node, "type", "badger");
form = wocky_data_form_new_from_form (wocky_stanza_get_top_node (stanza),
&error);
@@ -54,7 +54,7 @@ test_new_from_form (void)
g_clear_error (&error);
/* set the right type */
- wocky_xmpp_node_set_attribute (node, "type", "form");
+ wocky_node_set_attribute (node, "type", "form");
form = wocky_data_form_new_from_form (wocky_stanza_get_top_node (stanza),
&error);
@@ -359,7 +359,7 @@ test_submit (void)
{
WockyStanza *stanza;
WockyDataForm *form;
- WockyXmppNode *x;
+ WockyNode *x;
GSList *l;
const gchar *description[] = { "Badger", "Mushroom", "Snake", NULL };
const gchar *features[] = { "news", "search", NULL };
@@ -416,22 +416,22 @@ test_submit (void)
NULL, NULL, NULL);
wocky_data_form_submit (form, wocky_stanza_get_top_node (stanza));
- x = wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ x = wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"x", WOCKY_XMPP_NS_DATA);
g_assert (x != NULL);
- g_assert_cmpstr (wocky_xmpp_node_get_attribute (x, "type"), ==, "submit");
+ g_assert_cmpstr (wocky_node_get_attribute (x, "type"), ==, "submit");
for (l = x->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *v, *node = l->data;
+ WockyNode *v, *node = l->data;
const gchar *var, *type, *value = NULL;
g_assert_cmpstr (node->name, ==, "field");
- var = wocky_xmpp_node_get_attribute (node, "var");
+ var = wocky_node_get_attribute (node, "var");
g_assert (var != NULL);
- type = wocky_xmpp_node_get_attribute (node, "type");
+ type = wocky_node_get_attribute (node, "type");
- v = wocky_xmpp_node_get_child (node, "value");
+ v = wocky_node_get_child (node, "value");
if (v != NULL)
value = v->content;
@@ -453,7 +453,7 @@ test_submit (void)
g_assert_cmpstr (type, ==, "text-multi");
for (m = node->children; m != NULL; m = g_slist_next (m))
{
- WockyXmppNode *tmp = m->data;
+ WockyNode *tmp = m->data;
g_assert_cmpstr (tmp->name, ==, "value");
if (!wocky_strdiff (tmp->content, "Badger"))
@@ -485,7 +485,7 @@ test_submit (void)
g_assert_cmpstr (type, ==, "list-multi");
for (m = node->children; m != NULL; m = g_slist_next (m))
{
- WockyXmppNode *tmp = m->data;
+ WockyNode *tmp = m->data;
g_assert_cmpstr (tmp->name, ==, "value");
if (!wocky_strdiff (tmp->content, "news"))
@@ -510,7 +510,7 @@ test_submit (void)
g_assert_cmpstr (type, ==, "jid-multi");
for (m = node->children; m != NULL; m = g_slist_next (m))
{
- WockyXmppNode *tmp = m->data;
+ WockyNode *tmp = m->data;
g_assert_cmpstr (tmp->name, ==, "value");
if (!wocky_strdiff (tmp->content, "juliet@example.org"))
diff --git a/tests/wocky-pep-service-test.c b/tests/wocky-pep-service-test.c
index be6b99a..ad3fd26 100644
--- a/tests/wocky-pep-service-test.c
+++ b/tests/wocky-pep-service-test.c
@@ -229,7 +229,7 @@ test_make_publish_stanza (void)
{
WockyPepService *pep;
WockyStanza *stanza;
- WockyXmppNode *item = NULL, *n;
+ WockyNode *item = NULL, *n;
WockyStanzaType type;
WockyStanzaSubType sub_type;
@@ -243,16 +243,16 @@ test_make_publish_stanza (void)
g_assert (type == WOCKY_STANZA_TYPE_IQ);
g_assert (sub_type == WOCKY_STANZA_SUB_TYPE_SET);
- n = wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ n = wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"pubsub", WOCKY_XMPP_NS_PUBSUB);
g_assert (n != NULL);
- n = wocky_xmpp_node_get_child (n, "publish");
+ n = wocky_node_get_child (n, "publish");
g_assert (n != NULL);
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (n, "node"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (n, "node"),
TEST_NODE1));
- n = wocky_xmpp_node_get_child (n, "item");
+ n = wocky_node_get_child (n, "item");
g_assert (n != NULL);
g_assert (n == item);
diff --git a/tests/wocky-porter-test.c b/tests/wocky-porter-test.c
index 3fd8c41..c82d51b 100644
--- a/tests/wocky-porter-test.c
+++ b/tests/wocky-porter-test.c
@@ -1037,7 +1037,7 @@ test_handler_stanza_jingle_cb (WockyPorter *porter,
const gchar *id;
test_expected_stanza_received (test, stanza);
- id = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ id = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"id");
g_assert (!wocky_strdiff (id, "3") || !wocky_strdiff (id, "4"));
return TRUE;
@@ -1052,7 +1052,7 @@ test_handler_stanza_terminate_cb (WockyPorter *porter,
const gchar *id;
test_expected_stanza_received (test, stanza);
- id = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ id = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"id");
g_assert (!wocky_strdiff (id, "5"));
return TRUE;
@@ -1289,7 +1289,7 @@ test_send_iq_cb (WockyPorter *porter,
test_expected_stanza_received (test, stanza);
- id = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ id = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"id");
wocky_stanza_get_type_info (stanza, NULL, &sub_type);
@@ -1344,7 +1344,7 @@ test_send_iq_abnormal_cb (WockyPorter *porter,
test_expected_stanza_received (test, stanza);
- id = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ id = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"id");
wocky_stanza_get_type_info (stanza, NULL, &sub_type);
@@ -1625,7 +1625,7 @@ test_handler_filter_from_juliet_cb (WockyPorter *porter,
test_data_t *test = (test_data_t *) user_data;
const gchar *from;
- from = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ from = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"from");
g_assert (!wocky_strdiff (from, "juliet@example.com"));
@@ -1753,22 +1753,22 @@ test_send_iq_server_received_cb (WockyPorter *porter,
{
test_data_t *test = (test_data_t *) user_data;
WockyStanza *reply;
- WockyXmppNode *node;
+ WockyNode *node;
const gchar *id;
const gchar *from;
test_expected_stanza_received (test, iq);
node = wocky_stanza_get_top_node (iq);
- id = wocky_xmpp_node_get_attribute (node, "id");
+ id = wocky_node_get_attribute (node, "id");
- if (wocky_xmpp_node_get_child (node, "first") != NULL)
+ if (wocky_node_get_child (node, "first") != NULL)
/* No from attribute */
from = NULL;
- else if (wocky_xmpp_node_get_child (node, "second") != NULL)
+ else if (wocky_node_get_child (node, "second") != NULL)
/* bare JID */
from = "juliet@example.com";
- else if (wocky_xmpp_node_get_child (node, "third") != NULL)
+ else if (wocky_node_get_child (node, "third") != NULL)
/* full JID */
from = "juliet@example.com/Balcony";
else
diff --git a/tests/wocky-pubsub-node-test.c b/tests/wocky-pubsub-node-test.c
index 6e3dbac..b99f41b 100644
--- a/tests/wocky-pubsub-node-test.c
+++ b/tests/wocky-pubsub-node-test.c
@@ -52,7 +52,7 @@ test_make_publish_stanza (void)
WockySession *session;
WockyPubsubNode *node;
WockyStanza *stanza, *expected;
- WockyXmppNode *pubsub_node, *publish, *item;
+ WockyNode *pubsub_node, *publish, *item;
stream = g_object_new (WOCKY_TYPE_TEST_STREAM, NULL);
connection = wocky_xmpp_connection_new (stream->stream0);
@@ -69,11 +69,11 @@ test_make_publish_stanza (void)
/* I've embraced and extended pubsub, and want to put stuff on the <pubsub>
* and <publish> nodes... */
- wocky_xmpp_node_set_attribute (pubsub_node, "gig", "tomorrow");
- wocky_xmpp_node_set_attribute (publish, "kaki", "king");
+ wocky_node_set_attribute (pubsub_node, "gig", "tomorrow");
+ wocky_node_set_attribute (publish, "kaki", "king");
/* Oh, and I should probably publish something. */
- wocky_xmpp_node_add_child_with_content_ns (item, "castle", "bone chaos",
+ wocky_node_add_child_with_content_ns (item, "castle", "bone chaos",
"urn:example:songs");
expected = wocky_stanza_build (WOCKY_STANZA_TYPE_IQ,
@@ -213,17 +213,17 @@ test_unsubscribe_iq_cb (WockyPorter *porter,
{
TestUnsubscribeCtx *ctx = user_data;
test_data_t *test = ctx->test;
- WockyXmppNode *unsubscribe;
+ WockyNode *unsubscribe;
const gchar *subid;
WockyStanza *reply;
- unsubscribe = wocky_xmpp_node_get_child (
- wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ unsubscribe = wocky_node_get_child (
+ wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"pubsub", WOCKY_XMPP_NS_PUBSUB),
"unsubscribe");
g_assert (unsubscribe != NULL);
- subid = wocky_xmpp_node_get_attribute (unsubscribe, "subid");
+ subid = wocky_node_get_attribute (unsubscribe, "subid");
if (ctx->expect_subid)
g_assert_cmpstr (EXPECTED_SUBID, ==, subid);
@@ -411,7 +411,7 @@ test_list_subscribers_iq_cb (WockyPorter *porter,
{
test_data_t *test = (test_data_t *) user_data;
WockyStanza *expected, *reply;
- WockyXmppNode *subscriptions;
+ WockyNode *subscriptions;
expected = wocky_stanza_build (WOCKY_STANZA_TYPE_IQ,
WOCKY_STANZA_SUB_TYPE_GET, NULL, "pubsub.localhost",
@@ -636,12 +636,12 @@ static void
service_event_received_cb (WockyPubsubService *service,
WockyPubsubNode *node,
WockyStanza *event_stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *items_node,
+ WockyNode *event_node,
+ WockyNode *items_node,
GList *items,
test_data_t *test)
{
- WockyXmppNode *item;
+ WockyNode *item;
/* Check that we're not winding up with multiple nodes for the same thing. */
if (expected_node != NULL)
@@ -653,11 +653,11 @@ service_event_received_cb (WockyPubsubService *service,
item = g_list_nth_data (items, 0);
g_assert_cmpstr ("item", ==, item->name);
- g_assert_cmpstr ("1", ==, wocky_xmpp_node_get_attribute (item, "id"));
+ g_assert_cmpstr ("1", ==, wocky_node_get_attribute (item, "id"));
item = g_list_nth_data (items, 1);
g_assert_cmpstr ("item", ==, item->name);
- g_assert_cmpstr ("snakes", ==, wocky_xmpp_node_get_attribute (item, "id"));
+ g_assert_cmpstr ("snakes", ==, wocky_node_get_attribute (item, "id"));
test->outstanding--;
g_main_loop_quit (test->loop);
@@ -667,12 +667,12 @@ service_event_received_cb (WockyPubsubService *service,
static void
node_event_received_cb (WockyPubsubNode *node,
WockyStanza *event_stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *items_node,
+ WockyNode *event_node,
+ WockyNode *items_node,
GList *items,
test_data_t *test)
{
- WockyXmppNode *item;
+ WockyNode *item;
g_assert_cmpstr ("event", ==, event_node->name);
g_assert_cmpstr ("items", ==, items_node->name);
@@ -680,11 +680,11 @@ node_event_received_cb (WockyPubsubNode *node,
item = g_list_nth_data (items, 0);
g_assert_cmpstr ("item", ==, item->name);
- g_assert_cmpstr ("1", ==, wocky_xmpp_node_get_attribute (item, "id"));
+ g_assert_cmpstr ("1", ==, wocky_node_get_attribute (item, "id"));
item = g_list_nth_data (items, 1);
g_assert_cmpstr ("item", ==, item->name);
- g_assert_cmpstr ("snakes", ==, wocky_xmpp_node_get_attribute (item, "id"));
+ g_assert_cmpstr ("snakes", ==, wocky_node_get_attribute (item, "id"));
test->outstanding--;
g_main_loop_quit (test->loop);
@@ -822,8 +822,8 @@ service_subscription_state_changed_cb (
WockyPubsubService *service,
WockyPubsubNode *node,
WockyStanza *stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *subscription_node,
+ WockyNode *event_node,
+ WockyNode *subscription_node,
WockyPubsubSubscription *subscription,
TestSSCCtx *ctx)
{
@@ -833,7 +833,7 @@ service_subscription_state_changed_cb (
ctx->expecting_service_ssc_received_for);
g_assert_cmpstr (event_node->name, ==, "event");
- g_assert_cmpstr (wocky_xmpp_node_get_ns (event_node), ==,
+ g_assert_cmpstr (wocky_node_get_ns (event_node), ==,
WOCKY_XMPP_NS_PUBSUB_EVENT);
g_assert_cmpstr (subscription_node->name, ==, "subscription");
@@ -852,8 +852,8 @@ static void
node_subscription_state_changed_cb (
WockyPubsubNode *node,
WockyStanza *stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *subscription_node,
+ WockyNode *event_node,
+ WockyNode *subscription_node,
WockyPubsubSubscription *subscription,
TestSSCCtx *ctx)
{
@@ -863,7 +863,7 @@ node_subscription_state_changed_cb (
g_assert_cmpstr (wocky_pubsub_node_get_name (node), ==, "dairy-farmer");
g_assert_cmpstr (event_node->name, ==, "event");
- g_assert_cmpstr (wocky_xmpp_node_get_ns (event_node), ==,
+ g_assert_cmpstr (wocky_node_get_ns (event_node), ==,
WOCKY_XMPP_NS_PUBSUB_EVENT);
g_assert_cmpstr (subscription_node->name, ==, "subscription");
@@ -960,8 +960,8 @@ service_node_deleted_cb (
WockyPubsubService *service,
WockyPubsubNode *node,
WockyStanza *stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *delete_node,
+ WockyNode *event_node,
+ WockyNode *delete_node,
TestDeletedCtx *ctx)
{
g_assert (ctx->expecting_service_node_deleted_for != NULL);
@@ -970,7 +970,7 @@ service_node_deleted_cb (
ctx->expecting_service_node_deleted_for);
g_assert_cmpstr (event_node->name, ==, "event");
- g_assert_cmpstr (wocky_xmpp_node_get_ns (event_node), ==,
+ g_assert_cmpstr (wocky_node_get_ns (event_node), ==,
WOCKY_XMPP_NS_PUBSUB_EVENT);
g_assert_cmpstr (delete_node->name, ==, "delete");
@@ -984,8 +984,8 @@ static void
node_deleted_cb (
WockyPubsubNode *node,
WockyStanza *stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *delete_node,
+ WockyNode *event_node,
+ WockyNode *delete_node,
TestDeletedCtx *ctx)
{
g_assert (ctx->expecting_node_deleted);
@@ -994,7 +994,7 @@ node_deleted_cb (
g_assert_cmpstr (wocky_pubsub_node_get_name (node), ==, "dairy-farmer");
g_assert_cmpstr (event_node->name, ==, "event");
- g_assert_cmpstr (wocky_xmpp_node_get_ns (event_node), ==,
+ g_assert_cmpstr (wocky_node_get_ns (event_node), ==,
WOCKY_XMPP_NS_PUBSUB_EVENT);
g_assert_cmpstr (delete_node->name, ==, "delete");
diff --git a/tests/wocky-pubsub-service-test.c b/tests/wocky-pubsub-service-test.c
index 030712d..fad6009 100644
--- a/tests/wocky-pubsub-service-test.c
+++ b/tests/wocky-pubsub-service-test.c
@@ -255,14 +255,14 @@ test_create_node_no_config_iq_cb (WockyPorter *porter,
{
test_data_t *test = (test_data_t *) user_data;
WockyStanza *reply;
- WockyXmppNode *node;
+ WockyNode *node;
- node = wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ node = wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"pubsub", WOCKY_XMPP_NS_PUBSUB);
g_assert (node != NULL);
- node = wocky_xmpp_node_get_child (node, "create");
+ node = wocky_node_get_child (node, "create");
g_assert (node != NULL);
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "node"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "node"),
"node1"));
reply = wocky_stanza_build_iq_result (stanza, NULL);
@@ -461,14 +461,14 @@ test_create_node_renamed_iq_cb (WockyPorter *porter,
{
test_data_t *test = (test_data_t *) user_data;
WockyStanza *reply;
- WockyXmppNode *node;
+ WockyNode *node;
- node = wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ node = wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"pubsub", WOCKY_XMPP_NS_PUBSUB);
g_assert (node != NULL);
- node = wocky_xmpp_node_get_child (node, "create");
+ node = wocky_node_get_child (node, "create");
g_assert (node != NULL);
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "node"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "node"),
"node1"));
reply = wocky_stanza_build_iq_result (stanza,
@@ -550,29 +550,29 @@ test_create_node_config_create_iq_cb (WockyPorter *porter,
{
test_data_t *test = (test_data_t *) user_data;
WockyStanza *reply;
- WockyXmppNode *node;
+ WockyNode *node;
GSList *l;
gboolean form_type = FALSE, title = FALSE, notif = FALSE;
- node = wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ node = wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"pubsub", WOCKY_XMPP_NS_PUBSUB);
g_assert (node != NULL);
- node = wocky_xmpp_node_get_child (node, "configure");
+ node = wocky_node_get_child (node, "configure");
g_assert (node != NULL);
- node = wocky_xmpp_node_get_child_ns (node, "x", WOCKY_XMPP_NS_DATA);
+ node = wocky_node_get_child_ns (node, "x", WOCKY_XMPP_NS_DATA);
g_assert (node != NULL);
for (l = node->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *field = l->data;
+ WockyNode *field = l->data;
const gchar *type, *var, *value = NULL;
- WockyXmppNode *v;
+ WockyNode *v;
g_assert (!wocky_strdiff (field->name, "field"));
- var = wocky_xmpp_node_get_attribute (field, "var");
- type = wocky_xmpp_node_get_attribute (field, "type");
+ var = wocky_node_get_attribute (field, "var");
+ type = wocky_node_get_attribute (field, "type");
- v = wocky_xmpp_node_get_child (field, "value");
+ v = wocky_node_get_child (field, "value");
g_assert (v != NULL);
value = v->content;
@@ -699,7 +699,7 @@ make_subscriptions_response (WockyStanza *stanza,
CannedSubscriptions *subs)
{
WockyStanza *reply;
- WockyXmppNode *s;
+ WockyNode *s;
reply = wocky_stanza_build_iq_result (stanza,
'(', "pubsub",
@@ -711,7 +711,7 @@ make_subscriptions_response (WockyStanza *stanza,
NULL);
if (node != NULL)
- wocky_xmpp_node_set_attribute (s, "node", node);
+ wocky_node_set_attribute (s, "node", node);
test_pubsub_add_subscription_nodes (s, subs, (node == NULL));
return reply;
@@ -726,7 +726,7 @@ test_retrieve_subscriptions_iq_cb (
RetrieveSubscriptionsCtx *ctx = user_data;
test_data_t *test = ctx->test;
WockyStanza *reply, *expected;
- WockyXmppNode *subscriptions;
+ WockyNode *subscriptions;
expected = wocky_stanza_build (
WOCKY_STANZA_TYPE_IQ, WOCKY_STANZA_SUB_TYPE_GET,
@@ -740,7 +740,7 @@ test_retrieve_subscriptions_iq_cb (
NULL);
if (ctx->mode == MODE_AT_NODE)
- wocky_xmpp_node_set_attribute (subscriptions, "node", "bonghits");
+ wocky_node_set_attribute (subscriptions, "node", "bonghits");
test_assert_stanzas_equal_no_id (stanza, expected);
g_object_unref (expected);
diff --git a/tests/wocky-pubsub-test-helpers.c b/tests/wocky-pubsub-test-helpers.c
index 584eadd..102377e 100644
--- a/tests/wocky-pubsub-test-helpers.c
+++ b/tests/wocky-pubsub-test-helpers.c
@@ -4,7 +4,7 @@
void
test_pubsub_add_subscription_nodes (
- WockyXmppNode *subscriptions_node,
+ WockyNode *subscriptions_node,
CannedSubscriptions *subs,
gboolean include_node)
{
@@ -12,17 +12,17 @@ test_pubsub_add_subscription_nodes (
for (l = subs; l != NULL && l->node != NULL; l++)
{
- WockyXmppNode *sub = wocky_xmpp_node_add_child (subscriptions_node,
+ WockyNode *sub = wocky_node_add_child (subscriptions_node,
"subscription");
if (include_node)
- wocky_xmpp_node_set_attribute (sub, "node", l->node);
+ wocky_node_set_attribute (sub, "node", l->node);
- wocky_xmpp_node_set_attribute (sub, "jid", l->jid);
- wocky_xmpp_node_set_attribute (sub, "subscription", l->subscription);
+ wocky_node_set_attribute (sub, "jid", l->jid);
+ wocky_node_set_attribute (sub, "subscription", l->subscription);
if (l->subid != NULL)
- wocky_xmpp_node_set_attribute (sub, "subid", l->subid);
+ wocky_node_set_attribute (sub, "subid", l->subid);
}
}
diff --git a/tests/wocky-pubsub-test-helpers.h b/tests/wocky-pubsub-test-helpers.h
index 411c93f..98824dd 100644
--- a/tests/wocky-pubsub-test-helpers.h
+++ b/tests/wocky-pubsub-test-helpers.h
@@ -13,7 +13,7 @@ typedef struct {
} CannedSubscriptions;
void test_pubsub_add_subscription_nodes (
- WockyXmppNode *subscriptions_node,
+ WockyNode *subscriptions_node,
CannedSubscriptions *subs,
gboolean include_node);
diff --git a/tests/wocky-roster-test.c b/tests/wocky-roster-test.c
index e2fa760..09608e8 100644
--- a/tests/wocky-roster-test.c
+++ b/tests/wocky-roster-test.c
@@ -47,7 +47,7 @@ fetch_roster_send_iq_cb (WockyPorter *porter,
test_data_t *test = (test_data_t *) user_data;
WockyStanzaType type;
WockyStanzaSubType sub_type;
- WockyXmppNode *node;
+ WockyNode *node;
WockyStanza *reply;
const char *id;
@@ -57,14 +57,14 @@ fetch_roster_send_iq_cb (WockyPorter *porter,
g_assert (type == WOCKY_STANZA_TYPE_IQ);
g_assert (sub_type == WOCKY_STANZA_SUB_TYPE_GET);
- node = wocky_xmpp_node_get_child (wocky_stanza_get_top_node (stanza),
+ node = wocky_node_get_child (wocky_stanza_get_top_node (stanza),
"query");
g_assert (wocky_stanza_get_top_node (stanza) != NULL);
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_ns (node),
+ g_assert (!wocky_strdiff (wocky_node_get_ns (node),
"jabber:iq:roster"));
- id = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ id = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"id");
g_assert (id != NULL);
@@ -220,9 +220,9 @@ fetch_roster_reply_cb (WockyPorter *porter,
* is left up to the server to know which client is the user and then throw
* in a correct to attribute. Here we're just adding a from attribute so the
* IQ result builder doesn't complain. */
- if (wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ if (wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"from") == NULL)
- wocky_xmpp_node_set_attribute (wocky_stanza_get_top_node (stanza), "from",
+ wocky_node_set_attribute (wocky_stanza_get_top_node (stanza), "from",
"juliet@example.com/balcony");
reply = wocky_stanza_build_iq_result (stanza,
@@ -366,7 +366,7 @@ send_roster_update (test_data_t *test,
const gchar **groups)
{
WockyStanza *iq;
- WockyXmppNode *item;
+ WockyNode *item;
guint i;
iq = wocky_stanza_build (WOCKY_STANZA_TYPE_IQ,
@@ -380,20 +380,20 @@ send_roster_update (test_data_t *test,
NULL);
if (jid != NULL)
- wocky_xmpp_node_set_attribute (item, "jid", jid);
+ wocky_node_set_attribute (item, "jid", jid);
if (name != NULL)
- wocky_xmpp_node_set_attribute (item, "name", name);
+ wocky_node_set_attribute (item, "name", name);
if (subscription != NULL)
- wocky_xmpp_node_set_attribute (item, "subscription", subscription);
+ wocky_node_set_attribute (item, "subscription", subscription);
for (i = 0; groups != NULL && groups[i] != NULL; i++)
{
- WockyXmppNode *node;
+ WockyNode *node;
- node = wocky_xmpp_node_add_child (item, "group");
- wocky_xmpp_node_set_content (node, groups[i]);
+ node = wocky_node_add_child (item, "group");
+ wocky_node_set_content (node, groups[i]);
}
wocky_porter_send_iq_async (test->sched_out, iq, NULL,
@@ -553,7 +553,7 @@ ack_iq (WockyPorter *porter,
WockyStanza *reply;
const gchar *id;
- id = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ id = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"id");
g_assert (id != NULL);
@@ -577,7 +577,7 @@ check_edit_roster_stanza (WockyStanza *stanza,
{
WockyStanzaType type;
WockyStanzaSubType sub_type;
- WockyXmppNode *node;
+ WockyNode *node;
GSList *l;
guint i;
GHashTable *expected_groups;
@@ -587,25 +587,25 @@ check_edit_roster_stanza (WockyStanza *stanza,
g_assert (type == WOCKY_STANZA_TYPE_IQ);
g_assert (sub_type == WOCKY_STANZA_SUB_TYPE_SET);
- node = wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ node = wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"query", WOCKY_XMPP_NS_ROSTER);
g_assert (node != NULL);
- node = wocky_xmpp_node_get_child (node, "item");
+ node = wocky_node_get_child (node, "item");
g_assert (node != NULL);
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "jid"), jid));
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "jid"), jid));
if (name != NULL)
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "name"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "name"),
name));
else
- g_assert (wocky_xmpp_node_get_attribute (node, "name") == NULL);
+ g_assert (wocky_node_get_attribute (node, "name") == NULL);
if (subscription != NULL)
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node,
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node,
"subscription"), subscription));
else
- g_assert (wocky_xmpp_node_get_attribute (node, "subscription") == NULL);
+ g_assert (wocky_node_get_attribute (node, "subscription") == NULL);
if (groups == NULL)
{
@@ -623,7 +623,7 @@ check_edit_roster_stanza (WockyStanza *stanza,
for (l = node->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *group = (WockyXmppNode *) l->data;
+ WockyNode *group = (WockyNode *) l->data;
g_assert (!wocky_strdiff (group->name, "group"));
@@ -865,7 +865,7 @@ change_name_send_iq_cb (WockyPorter *porter,
test_data_t *test = (test_data_t *) user_data;
WockyStanzaType type;
WockyStanzaSubType sub_type;
- WockyXmppNode *node;
+ WockyNode *node;
const gchar *group[] = { "Friends", NULL };
/* Make sure stanza is as expected. */
@@ -874,21 +874,21 @@ change_name_send_iq_cb (WockyPorter *porter,
g_assert (type == WOCKY_STANZA_TYPE_IQ);
g_assert (sub_type == WOCKY_STANZA_SUB_TYPE_SET);
- node = wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ node = wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"query", WOCKY_XMPP_NS_ROSTER);
g_assert (node != NULL);
- node = wocky_xmpp_node_get_child (node, "item");
+ node = wocky_node_get_child (node, "item");
g_assert (node != NULL);
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "jid"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "jid"),
"romeo@example.net"));
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "name"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "name"),
"Badger"));
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node,
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node,
"subscription"), "both"));
g_assert_cmpuint (g_slist_length (node->children), ==, 1);
- node = wocky_xmpp_node_get_child (node, "group");
+ node = wocky_node_get_child (node, "group");
g_assert (node != NULL);
g_assert (!wocky_strdiff (node->content, "Friends"));
@@ -1001,7 +1001,7 @@ add_group_send_iq_cb (WockyPorter *porter,
test_data_t *test = (test_data_t *) user_data;
WockyStanzaType type;
WockyStanzaSubType sub_type;
- WockyXmppNode *node;
+ WockyNode *node;
const gchar *groups[] = { "Friends", "Badger", NULL };
GSList *l;
gboolean group_friend = FALSE, group_badger = FALSE;
@@ -1012,23 +1012,23 @@ add_group_send_iq_cb (WockyPorter *porter,
g_assert (type == WOCKY_STANZA_TYPE_IQ);
g_assert (sub_type == WOCKY_STANZA_SUB_TYPE_SET);
- node = wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ node = wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"query", WOCKY_XMPP_NS_ROSTER);
g_assert (node != NULL);
- node = wocky_xmpp_node_get_child (node, "item");
+ node = wocky_node_get_child (node, "item");
g_assert (node != NULL);
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "jid"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "jid"),
"romeo@example.net"));
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "name"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "name"),
"Romeo"));
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node,
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node,
"subscription"), "both"));
g_assert_cmpuint (g_slist_length (node->children), ==, 2);
for (l = node->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *group = (WockyXmppNode *) l->data;
+ WockyNode *group = (WockyNode *) l->data;
g_assert (!wocky_strdiff (group->name, "group"));
@@ -1150,7 +1150,7 @@ remove_group_send_iq_cb (WockyPorter *porter,
test_data_t *test = (test_data_t *) user_data;
WockyStanzaType type;
WockyStanzaSubType sub_type;
- WockyXmppNode *node;
+ WockyNode *node;
const gchar *groups[] = { NULL };
/* Make sure stanza is as expected. */
@@ -1159,17 +1159,17 @@ remove_group_send_iq_cb (WockyPorter *porter,
g_assert (type == WOCKY_STANZA_TYPE_IQ);
g_assert (sub_type == WOCKY_STANZA_SUB_TYPE_SET);
- node = wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (stanza),
+ node = wocky_node_get_child_ns (wocky_stanza_get_top_node (stanza),
"query", WOCKY_XMPP_NS_ROSTER);
g_assert (node != NULL);
- node = wocky_xmpp_node_get_child (node, "item");
+ node = wocky_node_get_child (node, "item");
g_assert (node != NULL);
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "jid"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "jid"),
"romeo@example.net"));
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node, "name"),
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node, "name"),
"Romeo"));
- g_assert (!wocky_strdiff (wocky_xmpp_node_get_attribute (node,
+ g_assert (!wocky_strdiff (wocky_node_get_attribute (node,
"subscription"), "both"));
g_assert_cmpuint (g_slist_length (node->children), ==, 0);
diff --git a/tests/wocky-stanza-test.c b/tests/wocky-stanza-test.c
index 1447aeb..8515e73 100644
--- a/tests/wocky-stanza-test.c
+++ b/tests/wocky-stanza-test.c
@@ -233,7 +233,7 @@ test_extract_errors (void)
const gchar *description = "I am a sentence.";
WockyXmppErrorType type;
GError *core = NULL, *specialized = NULL;
- WockyXmppNode *specialized_node = NULL;
+ WockyNode *specialized_node = NULL;
gboolean ret;
/* As a prelude, check that it does the right thing for non-errors. */
diff --git a/tests/wocky-test-connector-server.c b/tests/wocky-test-connector-server.c
index f945778..27607bd 100644
--- a/tests/wocky-test-connector-server.c
+++ b/tests/wocky-test-connector-server.c
@@ -253,16 +253,16 @@ error_stanza (const gchar *cond,
const gchar *msg, gboolean extended)
{
WockyStanza *error = wocky_stanza_new ("error", WOCKY_XMPP_NS_STREAM);
- WockyXmppNode *node = wocky_stanza_get_top_node (error);
+ WockyNode *node = wocky_stanza_get_top_node (error);
- wocky_xmpp_node_add_child_ns (node, cond, WOCKY_XMPP_NS_STREAMS);
+ wocky_node_add_child_ns (node, cond, WOCKY_XMPP_NS_STREAMS);
if ((msg != NULL) && (*msg != '\0'))
- wocky_xmpp_node_add_child_with_content_ns (node, "text", msg,
+ wocky_node_add_child_with_content_ns (node, "text", msg,
WOCKY_XMPP_NS_STREAMS);
if (extended)
- wocky_xmpp_node_add_child_with_content_ns (node, "something", "blah",
+ wocky_node_add_child_with_content_ns (node, "something", "blah",
"urn:ietf:a:namespace:I:made:up");
return error;
@@ -276,9 +276,9 @@ iq_set_query_XEP77_REGISTER (TestConnectorServer *self,
TestConnectorServerPrivate *priv = self->priv;
WockyXmppConnection *conn = priv->conn;
WockyStanza *iq = NULL;
- WockyXmppNode *env = wocky_stanza_get_top_node (xml);
- WockyXmppNode *query = wocky_xmpp_node_get_child (env, "query");
- const gchar *id = wocky_xmpp_node_get_attribute (env, "id");
+ WockyNode *env = wocky_stanza_get_top_node (xml);
+ WockyNode *query = wocky_node_get_child (env, "query");
+ const gchar *id = wocky_node_get_attribute (env, "id");
gpointer cb = iq_sent;
DEBUG ("");
@@ -324,7 +324,7 @@ iq_set_query_XEP77_REGISTER (TestConnectorServer *self,
}
else
{
- if (wocky_xmpp_node_get_child (query, "remove") == NULL)
+ if (wocky_node_get_child (query, "remove") == NULL)
{
iq = wocky_stanza_build (WOCKY_STANZA_TYPE_IQ,
WOCKY_STANZA_SUB_TYPE_RESULT,
@@ -412,9 +412,9 @@ iq_get_query_XEP77_REGISTER (TestConnectorServer *self,
TestConnectorServerPrivate *priv = self->priv;
WockyXmppConnection *conn = priv->conn;
WockyStanza *iq = NULL;
- WockyXmppNode *env = wocky_stanza_get_top_node (xml);
- WockyXmppNode *query = NULL;
- const gchar *id = wocky_xmpp_node_get_attribute (env, "id");
+ WockyNode *env = wocky_stanza_get_top_node (xml);
+ WockyNode *query = NULL;
+ const gchar *id = wocky_node_get_attribute (env, "id");
DEBUG ("");
if (priv->problem.connector->xep77 & XEP77_PROBLEM_NOT_AVAILABLE)
@@ -463,18 +463,18 @@ iq_get_query_XEP77_REGISTER (TestConnectorServer *self,
')',
NULL);
- query = wocky_xmpp_node_get_child (wocky_stanza_get_top_node (iq),
+ query = wocky_node_get_child (wocky_stanza_get_top_node (iq),
"query");
if (!(priv->problem.connector->xep77 & XEP77_PROBLEM_NO_ARGS))
{
- wocky_xmpp_node_add_child (query, "username");
- wocky_xmpp_node_add_child (query, "password");
+ wocky_node_add_child (query, "username");
+ wocky_node_add_child (query, "password");
if (priv->problem.connector->xep77 & XEP77_PROBLEM_EMAIL_ARG)
- wocky_xmpp_node_add_child (query, "email");
+ wocky_node_add_child (query, "email");
if (priv->problem.connector->xep77 & XEP77_PROBLEM_STRANGE_ARG)
- wocky_xmpp_node_add_child (query, "wildebeest");
+ wocky_node_add_child (query, "wildebeest");
}
}
@@ -491,11 +491,11 @@ iq_get_query_JABBER_AUTH (TestConnectorServer *self,
TestConnectorServerPrivate *priv = self->priv;
WockyXmppConnection *conn = priv->conn;
WockyStanza *iq = NULL;
- WockyXmppNode *env = wocky_stanza_get_top_node (xml);
- const gchar *id = wocky_xmpp_node_get_attribute (env, "id");
- WockyXmppNode *query = wocky_xmpp_node_get_child (env, "query");
- WockyXmppNode *user = (query != NULL) ?
- wocky_xmpp_node_get_child (query, "username") : NULL;
+ WockyNode *env = wocky_stanza_get_top_node (xml);
+ const gchar *id = wocky_node_get_attribute (env, "id");
+ WockyNode *query = wocky_node_get_child (env, "query");
+ WockyNode *user = (query != NULL) ?
+ wocky_node_get_child (query, "username") : NULL;
const gchar *name = (user != NULL) ? user->content : NULL;
DEBUG ("");
@@ -569,15 +569,15 @@ iq_set_query_JABBER_AUTH (TestConnectorServer *self,
TestConnectorServerPrivate *priv = self->priv;
WockyXmppConnection *conn = priv->conn;
WockyStanza *iq = NULL;
- WockyXmppNode *env = wocky_stanza_get_top_node (xml);
- WockyXmppNode *qry = wocky_xmpp_node_get_child (env, "query");
+ WockyNode *env = wocky_stanza_get_top_node (xml);
+ WockyNode *qry = wocky_node_get_child (env, "query");
JabberProblem problems = priv->problem.connector->jabber;
JabberProblem jp = JABBER_PROBLEM_NONE;
- WockyXmppNode *username = wocky_xmpp_node_get_child (qry, "username");
- WockyXmppNode *password = wocky_xmpp_node_get_child (qry, "password");
- WockyXmppNode *resource = wocky_xmpp_node_get_child (qry, "resource");
- WockyXmppNode *sha1hash = wocky_xmpp_node_get_child (qry, "digest");
- const gchar *id = wocky_xmpp_node_get_attribute (env, "id");
+ WockyNode *username = wocky_node_get_child (qry, "username");
+ WockyNode *password = wocky_node_get_child (qry, "password");
+ WockyNode *resource = wocky_node_get_child (qry, "resource");
+ WockyNode *sha1hash = wocky_node_get_child (qry, "digest");
+ const gchar *id = wocky_node_get_attribute (env, "id");
DEBUG ("");
if (username == NULL || resource == NULL)
@@ -761,10 +761,10 @@ iq_set_bind_XMPP_BIND (TestConnectorServer *self,
}
else
{
- WockyXmppNode *ciq = wocky_stanza_get_top_node (xml);
- WockyXmppNode *bind =
- wocky_xmpp_node_get_child_ns (ciq, "bind", WOCKY_XMPP_NS_BIND);
- WockyXmppNode *res = wocky_xmpp_node_get_child (bind, "resource");
+ WockyNode *ciq = wocky_stanza_get_top_node (xml);
+ WockyNode *bind =
+ wocky_node_get_child_ns (ciq, "bind", WOCKY_XMPP_NS_BIND);
+ WockyNode *res = wocky_node_get_child (bind, "resource");
const gchar *uniq = NULL;
gchar *jid = NULL;
@@ -1155,7 +1155,7 @@ xmpp_handler (GObject *source,
if (server_dec_outstanding (self))
return;
- ns = wocky_xmpp_node_get_ns (wocky_stanza_get_top_node (xml));
+ ns = wocky_node_get_ns (wocky_stanza_get_top_node (xml));
name = wocky_stanza_get_top_node (xml)->name;
wocky_stanza_get_type_info (xml, &type, &subtype);
@@ -1165,8 +1165,8 @@ xmpp_handler (GObject *source,
for (i = 0; iq_handlers[i].payload != NULL; i++)
{
iq_handler *iq = &iq_handlers[i];
- WockyXmppNode *payload =
- wocky_xmpp_node_get_child_ns (wocky_stanza_get_top_node (xml),
+ WockyNode *payload =
+ wocky_node_get_child_ns (wocky_stanza_get_top_node (xml),
iq->payload, iq->ns);
/* namespace, stanza subtype and payload tag name must match: */
if ((payload == NULL) || (subtype != iq->subtype))
@@ -1207,7 +1207,7 @@ after_auth (GObject *source,
{
GError *error = NULL;
WockyStanza *feat = NULL;
- WockyXmppNode *node = NULL;
+ WockyNode *node = NULL;
TestSaslAuthServer *tsas = TEST_SASL_AUTH_SERVER (source);
TestConnectorServer *tcs = TEST_CONNECTOR_SERVER (data);
TestConnectorServerPrivate *priv = tcs->priv;
@@ -1241,10 +1241,10 @@ after_auth (GObject *source,
node = wocky_stanza_get_top_node (feat);
if (!(priv->problem.connector->xmpp & XMPP_PROBLEM_NO_SESSION))
- wocky_xmpp_node_add_child_ns (node, "session", WOCKY_XMPP_NS_SESSION);
+ wocky_node_add_child_ns (node, "session", WOCKY_XMPP_NS_SESSION);
if (!(priv->problem.connector->xmpp & XMPP_PROBLEM_CANNOT_BIND))
- wocky_xmpp_node_add_child_ns (node, "bind", WOCKY_XMPP_NS_BIND);
+ wocky_node_add_child_ns (node, "bind", WOCKY_XMPP_NS_BIND);
priv->state = SERVER_STATE_FEATURES_SENT;
@@ -1264,7 +1264,7 @@ feature_stanza (TestConnectorServer *self)
XmppProblem problem = priv->problem.connector->xmpp;
const gchar *name = NULL;
WockyStanza *feat = NULL;
- WockyXmppNode *node = NULL;
+ WockyNode *node = NULL;
DEBUG ("");
if (problem & XMPP_PROBLEM_OTHER_HOST)
@@ -1284,10 +1284,10 @@ feature_stanza (TestConnectorServer *self)
}
if (problem & XMPP_PROBLEM_OLD_AUTH_FEATURE)
- wocky_xmpp_node_add_child_ns (node, "auth", WOCKY_JABBER_NS_AUTH_FEATURE);
+ wocky_node_add_child_ns (node, "auth", WOCKY_JABBER_NS_AUTH_FEATURE);
if (!(problem & XMPP_PROBLEM_NO_TLS) && !priv->tls_started)
- wocky_xmpp_node_add_child_ns (node, "starttls", WOCKY_XMPP_NS_TLS);
+ wocky_node_add_child_ns (node, "starttls", WOCKY_XMPP_NS_TLS);
return feat;
}
diff --git a/tests/wocky-test-helper.h b/tests/wocky-test-helper.h
index 2f06934..781b697 100644
--- a/tests/wocky-test-helper.h
+++ b/tests/wocky-test-helper.h
@@ -46,11 +46,11 @@ void test_close_both_porters (test_data_t *test);
#define test_assert_nodes_equal(n1, n2) \
G_STMT_START { \
- if (!wocky_xmpp_node_equal ((n1), (n2))) \
+ if (!wocky_node_equal ((n1), (n2))) \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
g_strdup_printf ("Nodes not equal:\n%s\n\n%s", \
- wocky_xmpp_node_to_string (n1), \
- wocky_xmpp_node_to_string (n2))); \
+ wocky_node_to_string (n1), \
+ wocky_node_to_string (n2))); \
} G_STMT_END
#define test_assert_stanzas_equal(s1, s2) \
@@ -59,11 +59,11 @@ void test_close_both_porters (test_data_t *test);
#define test_assert_nodes_not_equal(n1, n2) \
G_STMT_START { \
- if (wocky_xmpp_node_equal ((n1), (n2))) \
+ if (wocky_node_equal ((n1), (n2))) \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
g_strdup_printf ("Nodes unexpectedly equal:\n%s\n\n%s", \
- wocky_xmpp_node_to_string (n1), \
- wocky_xmpp_node_to_string (n2))); \
+ wocky_node_to_string (n1), \
+ wocky_node_to_string (n2))); \
} G_STMT_END
#define test_assert_stanzas_not_equal(s1, s2) \
@@ -76,14 +76,14 @@ void test_close_both_porters (test_data_t *test);
*/
#define test_assert_stanzas_equal_no_id(s1, s2) \
G_STMT_START { \
- WockyXmppNode *n1 = wocky_stanza_get_top_node (s1); \
- WockyXmppNode *n2 = wocky_stanza_get_top_node (s2); \
- const gchar *_id1 = wocky_xmpp_node_get_attribute (n1, "id"); \
- const gchar *_id2 = wocky_xmpp_node_get_attribute (n2, "id"); \
+ WockyNode *n1 = wocky_stanza_get_top_node (s1); \
+ WockyNode *n2 = wocky_stanza_get_top_node (s2); \
+ const gchar *_id1 = wocky_node_get_attribute (n1, "id"); \
+ const gchar *_id2 = wocky_node_get_attribute (n2, "id"); \
if (_id1 == NULL && _id2 != NULL) \
- wocky_xmpp_node_set_attribute (n1, "id", _id2); \
+ wocky_node_set_attribute (n1, "id", _id2); \
else if (_id1 != NULL && _id2 == NULL) \
- wocky_xmpp_node_set_attribute (n2, "id", _id1); \
+ wocky_node_set_attribute (n2, "id", _id1); \
test_assert_stanzas_equal (s1, s2); \
} G_STMT_END
diff --git a/tests/wocky-test-sasl-auth-server.c b/tests/wocky-test-sasl-auth-server.c
index c2b4136..d3de229 100644
--- a/tests/wocky-test-sasl-auth-server.c
+++ b/tests/wocky-test-sasl-auth-server.c
@@ -368,7 +368,7 @@ auth_succeeded (TestSaslAuthServer *self, const gchar *challenge)
priv->state = AUTH_STATE_AUTHENTICATED;
s = wocky_stanza_new ("success", WOCKY_XMPP_NS_SASL_AUTH);
- wocky_xmpp_node_set_content (wocky_stanza_get_top_node (s), challenge);
+ wocky_node_set_content (wocky_stanza_get_top_node (s), challenge);
wocky_xmpp_connection_send_stanza_async (priv->conn, s, NULL,
success_sent, self);
@@ -586,11 +586,11 @@ handle_auth (TestSaslAuthServer *self, WockyStanza *stanza)
unsigned challenge_len;
gsize response_len = 0;
int ret;
- WockyXmppNode *auth = wocky_stanza_get_top_node (stanza);
+ WockyNode *auth = wocky_stanza_get_top_node (stanza);
const gchar *gjdd = NULL;
g_free (priv->selected_mech);
- priv->selected_mech = g_strdup (wocky_xmpp_node_get_attribute (
+ priv->selected_mech = g_strdup (wocky_node_get_attribute (
wocky_stanza_get_top_node (stanza), "mechanism"));
if (wocky_stanza_get_top_node (stanza)->content != NULL)
@@ -600,7 +600,7 @@ handle_auth (TestSaslAuthServer *self, WockyStanza *stanza)
}
g_assert (priv->state == AUTH_STATE_STARTED);
- gjdd = wocky_xmpp_node_get_attribute_ns (auth,
+ gjdd = wocky_node_get_attribute_ns (auth,
"client-uses-full-bind-result", WOCKY_GOOGLE_NS_AUTH);
switch (priv->problem)
{
@@ -690,7 +690,7 @@ handle_auth (TestSaslAuthServer *self, WockyStanza *stanza)
}
c = wocky_stanza_new ("challenge", WOCKY_XMPP_NS_SASL_AUTH);
- wocky_xmpp_node_set_content (wocky_stanza_get_top_node (c), challenge64);
+ wocky_node_set_content (wocky_stanza_get_top_node (c), challenge64);
wocky_xmpp_connection_send_stanza_async (priv->conn, c,
NULL, NULL, NULL);
g_object_unref (c);
@@ -784,7 +784,7 @@ handle_response (TestSaslAuthServer *self, WockyStanza *stanza)
else
{
c = wocky_stanza_new ("challenge", WOCKY_XMPP_NS_SASL_AUTH);
- wocky_xmpp_node_set_content (wocky_stanza_get_top_node (c),
+ wocky_node_set_content (wocky_stanza_get_top_node (c),
challenge64);
wocky_xmpp_connection_send_stanza_async (priv->conn, c,
NULL, NULL, NULL);
@@ -839,7 +839,7 @@ received_stanza (GObject *source,
g_assert (stanza != NULL);
- if (wocky_strdiff (wocky_xmpp_node_get_ns (
+ if (wocky_strdiff (wocky_node_get_ns (
wocky_stanza_get_top_node (stanza)), WOCKY_XMPP_NS_SASL_AUTH))
{
g_assert_not_reached ();
@@ -1016,11 +1016,11 @@ test_sasl_auth_server_set_mechs (GObject *obj, WockyStanza *feat)
int ret = 0;
TestSaslAuthServer *self = TEST_SASL_AUTH_SERVER (obj);
TestSaslAuthServerPrivate *priv = self->priv;
- WockyXmppNode *mechnode = NULL;
+ WockyNode *mechnode = NULL;
if (priv->problem != SERVER_PROBLEM_NO_SASL)
{
- mechnode = wocky_xmpp_node_add_child_ns (
+ mechnode = wocky_node_add_child_ns (
wocky_stanza_get_top_node (feat),
"mechanisms", WOCKY_XMPP_NS_SASL_AUTH);
if (priv->problem == SERVER_PROBLEM_NO_MECHANISMS)
@@ -1029,7 +1029,7 @@ test_sasl_auth_server_set_mechs (GObject *obj, WockyStanza *feat)
}
else if (priv->mech != NULL)
{
- wocky_xmpp_node_add_child_with_content (mechnode, "mechanism",
+ wocky_node_add_child_with_content (mechnode, "mechanism",
priv->mech);
}
else
@@ -1049,7 +1049,7 @@ test_sasl_auth_server_set_mechs (GObject *obj, WockyStanza *feat)
mechlist = g_strsplit (mechs, "\n", -1);
for (tmp = mechlist; *tmp != NULL; tmp++)
{
- wocky_xmpp_node_add_child_with_content (mechnode,
+ wocky_node_add_child_with_content (mechnode,
"mechanism", *tmp);
}
g_strfreev (mechlist);
diff --git a/tests/wocky-xmpp-node-test.c b/tests/wocky-xmpp-node-test.c
index 9e5c8d2..a71e1cc 100644
--- a/tests/wocky-xmpp-node-test.c
+++ b/tests/wocky-xmpp-node-test.c
@@ -52,7 +52,7 @@ test_set_attribute (void)
NULL);
test_assert_stanzas_not_equal (a, b);
- wocky_xmpp_node_set_attribute (wocky_stanza_get_top_node (a),
+ wocky_node_set_attribute (wocky_stanza_get_top_node (a),
"foo", "badger");
test_assert_stanzas_equal (a, b);
@@ -62,7 +62,7 @@ test_set_attribute (void)
NULL);
test_assert_stanzas_not_equal (b, c);
- wocky_xmpp_node_set_attribute (wocky_stanza_get_top_node (b),
+ wocky_node_set_attribute (wocky_stanza_get_top_node (b),
"foo", "snake");
test_assert_stanzas_equal (b, c);
@@ -106,7 +106,7 @@ test_append_content_n (void)
/* Append content byte by byte */
for (i = 0; i < l; i++)
{
- wocky_xmpp_node_append_content_n (wocky_stanza_get_top_node (a),
+ wocky_node_append_content_n (wocky_stanza_get_top_node (a),
content + i, 1);
}
g_assert (!wocky_strdiff (wocky_stanza_get_top_node (a)->content, content));
@@ -119,8 +119,8 @@ test_set_attribute_ns (void)
{
WockyStanza *sa;
WockyStanza *sb;
- WockyXmppNode *na;
- WockyXmppNode *nb;
+ WockyNode *na;
+ WockyNode *nb;
const gchar *ca;
const gchar *cb;
const gchar *cx;
@@ -141,11 +141,11 @@ test_set_attribute_ns (void)
test_assert_nodes_equal (na, nb);
/* *********************************************************************** */
- wocky_xmpp_node_set_attribute_ns (na, "one", "1", DUMMY_NS_A);
- ca = wocky_xmpp_node_get_attribute_ns (na, "one", DUMMY_NS_A);
- cb = wocky_xmpp_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
- cx = wocky_xmpp_node_get_attribute_ns (na, "one", DUMMY_NS_B);
- cy = wocky_xmpp_node_get_attribute (na, "one");
+ wocky_node_set_attribute_ns (na, "one", "1", DUMMY_NS_A);
+ ca = wocky_node_get_attribute_ns (na, "one", DUMMY_NS_A);
+ cb = wocky_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
+ cx = wocky_node_get_attribute_ns (na, "one", DUMMY_NS_B);
+ cy = wocky_node_get_attribute (na, "one");
test_assert_nodes_not_equal (na, nb);
g_assert (ca != NULL);
@@ -156,11 +156,11 @@ test_set_attribute_ns (void)
/* *********************************************************************** */
/* set the attribute in the second node to make them equal again */
- wocky_xmpp_node_set_attribute_ns (nb, "one", "1", DUMMY_NS_A);
- ca = wocky_xmpp_node_get_attribute_ns (na, "one", DUMMY_NS_A);
- cb = wocky_xmpp_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
- cx = wocky_xmpp_node_get_attribute_ns (na, "one", DUMMY_NS_B);
- cy = wocky_xmpp_node_get_attribute (na, "one");
+ wocky_node_set_attribute_ns (nb, "one", "1", DUMMY_NS_A);
+ ca = wocky_node_get_attribute_ns (na, "one", DUMMY_NS_A);
+ cb = wocky_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
+ cx = wocky_node_get_attribute_ns (na, "one", DUMMY_NS_B);
+ cy = wocky_node_get_attribute (na, "one");
test_assert_nodes_equal (na, nb);
g_assert (ca != NULL);
@@ -170,8 +170,8 @@ test_set_attribute_ns (void)
g_assert (!strcmp (ca, "1"));
g_assert (!strcmp (ca, cb));
- wocky_xmpp_node_set_attribute_ns (nb, "one", "1", DUMMY_NS_A);
- cb = wocky_xmpp_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
+ wocky_node_set_attribute_ns (nb, "one", "1", DUMMY_NS_A);
+ cb = wocky_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
test_assert_nodes_equal (na, nb);
g_assert (cb != NULL);
@@ -179,11 +179,11 @@ test_set_attribute_ns (void)
/* *********************************************************************** */
/* change the namespaced atttribute */
- wocky_xmpp_node_set_attribute_ns (na, "one", "2", DUMMY_NS_A);
- ca = wocky_xmpp_node_get_attribute_ns (na, "one", DUMMY_NS_A);
- cb = wocky_xmpp_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
- cx = wocky_xmpp_node_get_attribute_ns (na, "one", DUMMY_NS_B);
- cy = wocky_xmpp_node_get_attribute (na, "one");
+ wocky_node_set_attribute_ns (na, "one", "2", DUMMY_NS_A);
+ ca = wocky_node_get_attribute_ns (na, "one", DUMMY_NS_A);
+ cb = wocky_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
+ cx = wocky_node_get_attribute_ns (na, "one", DUMMY_NS_B);
+ cy = wocky_node_get_attribute (na, "one");
test_assert_nodes_not_equal (na, nb);
g_assert (ca != NULL);
@@ -195,11 +195,11 @@ test_set_attribute_ns (void)
/* *********************************************************************** */
/* add another attribute in a different namespace */
- wocky_xmpp_node_set_attribute_ns (na, "one", "3", DUMMY_NS_B);
- ca = wocky_xmpp_node_get_attribute_ns (na, "one", DUMMY_NS_A);
- cb = wocky_xmpp_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
- cx = wocky_xmpp_node_get_attribute_ns (na, "one", DUMMY_NS_B);
- cy = wocky_xmpp_node_get_attribute (na, "one");
+ wocky_node_set_attribute_ns (na, "one", "3", DUMMY_NS_B);
+ ca = wocky_node_get_attribute_ns (na, "one", DUMMY_NS_A);
+ cb = wocky_node_get_attribute_ns (nb, "one", DUMMY_NS_A);
+ cx = wocky_node_get_attribute_ns (na, "one", DUMMY_NS_B);
+ cy = wocky_node_get_attribute (na, "one");
test_assert_nodes_not_equal (na, nb);
g_assert (ca != NULL);
@@ -215,18 +215,18 @@ test_set_attribute_ns (void)
/* then check to see the right prefixes were assigned */
qa = g_quark_from_string (DUMMY_NS_B);
- xml_a = wocky_xmpp_node_to_string (na);
- pa = g_strdup (wocky_xmpp_node_attribute_ns_get_prefix_from_urn (DUMMY_NS_B));
- pb = g_strdup (wocky_xmpp_node_attribute_ns_get_prefix_from_quark (qa));
+ xml_a = wocky_node_to_string (na);
+ pa = g_strdup (wocky_node_attribute_ns_get_prefix_from_urn (DUMMY_NS_B));
+ pb = g_strdup (wocky_node_attribute_ns_get_prefix_from_quark (qa));
g_assert (!strcmp (pa, pb));
g_free (pb);
/* change the prefix and re-write the attribute */
- wocky_xmpp_node_attribute_ns_set_prefix (qa, "moose");
- wocky_xmpp_node_set_attribute_ns (na, "one", "1", DUMMY_NS_B);
- xml_b = wocky_xmpp_node_to_string (na);
- pb = g_strdup (wocky_xmpp_node_attribute_ns_get_prefix_from_quark (qa));
+ wocky_node_attribute_ns_set_prefix (qa, "moose");
+ wocky_node_set_attribute_ns (na, "one", "1", DUMMY_NS_B);
+ xml_b = wocky_node_to_string (na);
+ pb = g_strdup (wocky_node_attribute_ns_get_prefix_from_quark (qa));
g_assert (strcmp (pa, pb));
g_assert (_check_attr_prefix (DUMMY_NS_B, pa, "one", xml_a));
@@ -238,8 +238,8 @@ test_set_attribute_ns (void)
g_free (xml_b);
/* *********************************************************************** */
- wocky_xmpp_node_set_attribute_ns (na, "one", "4", DUMMY_NS_B);
- cx = wocky_xmpp_node_get_attribute_ns (na, "one", DUMMY_NS_B);
+ wocky_node_set_attribute_ns (na, "one", "4", DUMMY_NS_B);
+ cx = wocky_node_get_attribute_ns (na, "one", DUMMY_NS_B);
g_assert (cx != NULL);
g_assert (!strcmp (cx, "4"));
@@ -248,17 +248,17 @@ test_set_attribute_ns (void)
}
static void
-do_test_iteration (WockyXmppNodeIter *iter, const gchar **names)
+do_test_iteration (WockyNodeIter *iter, const gchar **names)
{
- WockyXmppNode *node;
+ WockyNode *node;
int i = 0;
- while (wocky_xmpp_node_iter_next (iter, &node))
+ while (wocky_node_iter_next (iter, &node))
{
g_assert (names[i] != NULL && "Unexpected node");
g_assert_cmpstr (names[i], ==,
- wocky_xmpp_node_get_attribute (node, "name"));
+ wocky_node_get_attribute (node, "name"));
i++;
}
@@ -269,7 +269,7 @@ static void
test_node_iteration (void)
{
WockyStanza *stanza;
- WockyXmppNodeIter iter;
+ WockyNodeIter iter;
const gchar *all[] = { "SPEEX", "THEORA", "GSM", "H264",
"VIDEO?", "other", NULL };
const gchar *payloads[] = { "SPEEX", "THEORA", "GSM", "H264", NULL };
@@ -306,41 +306,41 @@ test_node_iteration (void)
NULL);
/* All children */
- wocky_xmpp_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
+ wocky_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
NULL, NULL);
do_test_iteration (&iter, all);
/* Only the payloads */
- wocky_xmpp_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
+ wocky_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
"payload-type", NULL);
do_test_iteration (&iter, payloads);
/* Only phone payloads */
- wocky_xmpp_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
+ wocky_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
"payload-type", WOCKY_NS_GOOGLE_SESSION_PHONE);
do_test_iteration (&iter, audio);
/* Only nodes with the phone namespace */
- wocky_xmpp_node_iter_init (&iter, wocky_stanza_get_top_node (stanza), NULL,
+ wocky_node_iter_init (&iter, wocky_stanza_get_top_node (stanza), NULL,
WOCKY_NS_GOOGLE_SESSION_PHONE);
do_test_iteration (&iter, audio);
/* only video payloads */
- wocky_xmpp_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
+ wocky_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
"payload-type", WOCKY_NS_GOOGLE_SESSION_VIDEO);
do_test_iteration (&iter, video);
/* only nodes with the video namespace */
- wocky_xmpp_node_iter_init (&iter, wocky_stanza_get_top_node (stanza), NULL,
+ wocky_node_iter_init (&iter, wocky_stanza_get_top_node (stanza), NULL,
WOCKY_NS_GOOGLE_SESSION_VIDEO);
do_test_iteration (&iter, video_ns);
/* nothing */
- wocky_xmpp_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
+ wocky_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
"badgers", NULL);
do_test_iteration (&iter, nothing);
- wocky_xmpp_node_iter_init (&iter, wocky_stanza_get_top_node (stanza), NULL,
+ wocky_node_iter_init (&iter, wocky_stanza_get_top_node (stanza), NULL,
"snakes");
do_test_iteration (&iter, nothing);
diff --git a/tests/wocky-xmpp-readwrite-test.c b/tests/wocky-xmpp-readwrite-test.c
index 4ce03a5..2a70ead 100644
--- a/tests/wocky-xmpp-readwrite-test.c
+++ b/tests/wocky-xmpp-readwrite-test.c
@@ -20,8 +20,8 @@ static WockyStanza *
create_stanza (void)
{
WockyStanza *stanza;
- WockyXmppNode *html;
- WockyXmppNode *head;
+ WockyNode *html;
+ WockyNode *head;
stanza = wocky_stanza_build (WOCKY_STANZA_TYPE_MESSAGE,
WOCKY_STANZA_SUB_TYPE_CHAT, "juliet@example.com", "romeo@example.net",
@@ -32,9 +32,9 @@ create_stanza (void)
')',
NULL);
- html = wocky_xmpp_node_get_child (wocky_stanza_get_top_node (stanza), "html");
- head = wocky_xmpp_node_add_child (html, "head");
- wocky_xmpp_node_set_attribute_ns (head, "rev", "0xbad1dea", DUMMY_NS);
+ html = wocky_node_get_child (wocky_stanza_get_top_node (stanza), "html");
+ head = wocky_node_add_child (html, "head");
+ wocky_node_set_attribute_ns (head, "rev", "0xbad1dea", DUMMY_NS);
return stanza;
}
@@ -84,8 +84,8 @@ test_readwrite (void)
for (i = 0; i < 3 ; i++)
{
- WockyXmppNode *html;
- WockyXmppNode *head;
+ WockyNode *html;
+ WockyNode *head;
const gchar *attr_recv = NULL;
const gchar *attr_send = NULL;
const gchar *attr_none = NULL;
@@ -101,17 +101,17 @@ test_readwrite (void)
g_assert (received != NULL);
test_assert_stanzas_equal (sent, received);
- html = wocky_xmpp_node_get_child (wocky_stanza_get_top_node (received),
+ html = wocky_node_get_child (wocky_stanza_get_top_node (received),
"html");
- head = wocky_xmpp_node_get_child (html, "head");
- attr_recv = wocky_xmpp_node_get_attribute_ns (head, "rev", DUMMY_NS);
- attr_none = wocky_xmpp_node_get_attribute_ns (head, "rev",
+ head = wocky_node_get_child (html, "head");
+ attr_recv = wocky_node_get_attribute_ns (head, "rev", DUMMY_NS);
+ attr_none = wocky_node_get_attribute_ns (head, "rev",
DUMMY_NS ":x");
- html = wocky_xmpp_node_get_child (wocky_stanza_get_top_node (sent),
+ html = wocky_node_get_child (wocky_stanza_get_top_node (sent),
"html");
- head = wocky_xmpp_node_get_child (html, "head");
- attr_send = wocky_xmpp_node_get_attribute_ns (head, "rev", DUMMY_NS);
+ head = wocky_node_get_child (html, "head");
+ attr_send = wocky_node_get_attribute_ns (head, "rev", DUMMY_NS);
g_assert (attr_none == NULL);
g_assert (attr_recv != NULL);
diff --git a/wocky/Makefile.am b/wocky/Makefile.am
index 8814b33..4c8a3e9 100644
--- a/wocky/Makefile.am
+++ b/wocky/Makefile.am
@@ -48,8 +48,8 @@ HANDWRITTEN_SOURCES = \
wocky-node-tree.h \
wocky-utils.c \
wocky-utils.h \
- wocky-xmpp-node.c \
- wocky-xmpp-node.h \
+ wocky-node.c \
+ wocky-node.h \
wocky-xmpp-reader.c \
wocky-xmpp-reader.h \
wocky-xmpp-writer.c \
diff --git a/wocky/wocky-connector.c b/wocky/wocky-connector.c
index 4837371..be717c2 100644
--- a/wocky/wocky-connector.c
+++ b/wocky/wocky-connector.c
@@ -168,7 +168,7 @@ static void xep77_cancel_recv (GObject *source,
gpointer data);
static void xep77_signup_send (WockyConnector *self,
- WockyXmppNode *req);
+ WockyNode *req);
static void xep77_signup_sent (GObject *source,
GAsyncResult *result,
gpointer data);
@@ -1002,7 +1002,7 @@ jabber_auth_fields (GObject *source,
switch (sub)
{
- WockyXmppNode *node = NULL;
+ WockyNode *node = NULL;
WockyConnectorError code;
gboolean passwd;
gboolean digest;
@@ -1025,14 +1025,14 @@ jabber_auth_fields (GObject *source,
passwd = FALSE;
digest = FALSE;
node = wocky_stanza_get_top_node (fields);
- node = wocky_xmpp_node_get_child_ns (node, "query",
+ node = wocky_node_get_child_ns (node, "query",
WOCKY_JABBER_NS_AUTH);
if ((node != NULL) &&
- (wocky_xmpp_node_get_child (node, "resource") != NULL) &&
- (wocky_xmpp_node_get_child (node, "username") != NULL))
+ (wocky_node_get_child (node, "resource") != NULL) &&
+ (wocky_node_get_child (node, "username") != NULL))
{
- passwd = wocky_xmpp_node_get_child (node, "password") != NULL;
- digest = wocky_xmpp_node_get_child (node, "digest") != NULL;
+ passwd = wocky_node_get_child (node, "password") != NULL;
+ digest = wocky_node_get_child (node, "digest") != NULL;
}
if (digest)
@@ -1366,7 +1366,7 @@ xmpp_features_cb (GObject *source,
WockyConnector *self = WOCKY_CONNECTOR (data);
WockyConnectorPrivate *priv = self->priv;
WockyStanza *stanza;
- WockyXmppNode *node;
+ WockyNode *node;
gboolean can_encrypt = FALSE;
gboolean can_bind = FALSE;
@@ -1388,7 +1388,7 @@ xmpp_features_cb (GObject *source,
node = wocky_stanza_get_top_node (stanza);
if (wocky_strdiff (node->name, "features") ||
- wocky_strdiff (wocky_xmpp_node_get_ns (node), WOCKY_XMPP_NS_STREAM))
+ wocky_strdiff (wocky_node_get_ns (node), WOCKY_XMPP_NS_STREAM))
{
char *msg = state_message (priv, "Malformed or missing feature stanza");
abort_connect_code (data, WOCKY_CONNECTOR_ERROR_BAD_FEATURES, msg);
@@ -1407,9 +1407,9 @@ xmpp_features_cb (GObject *source,
}
can_encrypt =
- wocky_xmpp_node_get_child_ns (node, "starttls", WOCKY_XMPP_NS_TLS) != NULL;
+ wocky_node_get_child_ns (node, "starttls", WOCKY_XMPP_NS_TLS) != NULL;
can_bind =
- wocky_xmpp_node_get_child_ns (node, "bind", WOCKY_XMPP_NS_BIND) != NULL;
+ wocky_node_get_child_ns (node, "bind", WOCKY_XMPP_NS_BIND) != NULL;
/* conditions:
* not encrypted, not encryptable, require encryption → ABORT
@@ -1491,7 +1491,7 @@ starttls_recv_cb (GObject *source,
GError *error = NULL;
WockyConnector *self = WOCKY_CONNECTOR (data);
WockyConnectorPrivate *priv = self->priv;
- WockyXmppNode *node;
+ WockyNode *node;
stanza =
wocky_xmpp_connection_recv_stanza_finish (priv->conn, result, &error);
@@ -1510,7 +1510,7 @@ starttls_recv_cb (GObject *source,
node = wocky_stanza_get_top_node (stanza);
if (wocky_strdiff (node->name, "proceed") ||
- wocky_strdiff (wocky_xmpp_node_get_ns (node), WOCKY_XMPP_NS_TLS))
+ wocky_strdiff (wocky_node_get_ns (node), WOCKY_XMPP_NS_TLS))
{
abort_connect_code (data, WOCKY_CONNECTOR_ERROR_TLS_REFUSED,
"STARTTLS refused by server");
@@ -1698,7 +1698,7 @@ auth_done (GObject *source,
* are allowed to attempt that instead */
if ((error->domain == WOCKY_SASL_AUTH_ERROR) &&
(error->code == WOCKY_SASL_AUTH_ERROR_SASL_NOT_SUPPORTED) &&
- (wocky_xmpp_node_get_child_ns (
+ (wocky_node_get_child_ns (
wocky_stanza_get_top_node (priv->features), "auth",
WOCKY_JABBER_NS_AUTH_FEATURE) != NULL))
jabber_auth_init (self);
@@ -1932,7 +1932,7 @@ xep77_begin_recv (GObject *source,
WockyConnector *self = WOCKY_CONNECTOR (data);
WockyConnectorPrivate *priv = self->priv;
WockyStanza *iq = NULL;
- WockyXmppNode *query = NULL;
+ WockyNode *query = NULL;
WockyStanzaType type;
WockyStanzaSubType sub_type;
@@ -1974,7 +1974,7 @@ xep77_begin_recv (GObject *source,
case WOCKY_STANZA_SUB_TYPE_RESULT:
DEBUG ("WOCKY_STANZA_SUB_TYPE_RESULT");
- query = wocky_xmpp_node_get_child_ns (
+ query = wocky_node_get_child_ns (
wocky_stanza_get_top_node (iq), "query",
WOCKY_XEP77_NS_REGISTER);
@@ -1987,7 +1987,7 @@ xep77_begin_recv (GObject *source,
}
/* already registered. woo hoo. proceed to auth stage */
- if (wocky_xmpp_node_get_child (query, "registered") != NULL)
+ if (wocky_node_get_child (query, "registered") != NULL)
{
priv->reg_op = XEP77_NONE;
request_auth (self, priv->features);
@@ -2022,11 +2022,11 @@ xep77_begin_recv (GObject *source,
static void
xep77_signup_send (WockyConnector *self,
- WockyXmppNode *req)
+ WockyNode *req)
{
WockyConnectorPrivate *priv = self->priv;
WockyStanza *riq = NULL;
- WockyXmppNode *reg = NULL;
+ WockyNode *reg = NULL;
GSList *arg = NULL;
gchar *jid = g_strdup_printf ("%s@%s", priv->user, priv->domain);
gchar *iid = wocky_xmpp_connection_new_id (priv->conn);
@@ -2038,13 +2038,13 @@ xep77_signup_send (WockyConnector *self,
WOCKY_STANZA_SUB_TYPE_SET,
jid, priv->domain,
'@', "id", iid, NULL);
- reg = wocky_xmpp_node_add_child_ns (wocky_stanza_get_top_node (riq),
+ reg = wocky_node_add_child_ns (wocky_stanza_get_top_node (riq),
"query", WOCKY_XEP77_NS_REGISTER);
for (arg = req->children; arg != NULL; arg = g_slist_next (arg))
{
gchar *value = NULL;
- WockyXmppNode *a = (WockyXmppNode *) arg->data;
+ WockyNode *a = (WockyNode *) arg->data;
if (!wocky_strdiff ("instructions", a->name))
continue;
@@ -2070,7 +2070,7 @@ xep77_signup_send (WockyConnector *self,
goto out;
}
DEBUG ("%s := %s", a->name, value);
- wocky_xmpp_node_add_child_with_content (reg, a->name, value);
+ wocky_node_add_child_with_content (reg, a->name, value);
args++;
}
@@ -2204,9 +2204,9 @@ iq_bind_resource (WockyConnector *self)
* server will make one up for us */
if ((priv->resource != NULL) && (*priv->resource != '\0'))
{
- WockyXmppNode *bind = wocky_xmpp_node_get_child (
+ WockyNode *bind = wocky_node_get_child (
wocky_stanza_get_top_node (iq), "bind");
- wocky_xmpp_node_add_child_with_content (bind, "resource", priv->resource);
+ wocky_node_add_child_with_content (bind, "resource", priv->resource);
}
DEBUG ("sending bind iq set stanza");
@@ -2272,7 +2272,7 @@ iq_bind_resource_recv_cb (GObject *source,
switch (sub)
{
- WockyXmppNode *node = NULL;
+ WockyNode *node = NULL;
WockyConnectorError code;
case WOCKY_STANZA_SUB_TYPE_ERROR:
@@ -2299,10 +2299,10 @@ iq_bind_resource_recv_cb (GObject *source,
break;
case WOCKY_STANZA_SUB_TYPE_RESULT:
- node = wocky_xmpp_node_get_child (
+ node = wocky_node_get_child (
wocky_stanza_get_top_node (reply), "bind");
if (node != NULL)
- node = wocky_xmpp_node_get_child (node, "jid");
+ node = wocky_node_get_child (node, "jid");
/* store the returned id (or the original if none came back)*/
g_free (priv->identity);
@@ -2331,13 +2331,13 @@ void
establish_session (WockyConnector *self)
{
WockyConnectorPrivate *priv = self->priv;
- WockyXmppNode *feat = (priv->features != NULL) ?
+ WockyNode *feat = (priv->features != NULL) ?
wocky_stanza_get_top_node (priv->features) : NULL;
/* _if_ session setup is advertised, a session _must_ be established to *
* allow presence/messaging etc to work. If not, it is not important */
if ((feat != NULL) &&
- wocky_xmpp_node_get_child_ns (feat, "session", WOCKY_XMPP_NS_SESSION))
+ wocky_node_get_child_ns (feat, "session", WOCKY_XMPP_NS_SESSION))
{
WockyXmppConnection *conn = priv->conn;
gchar *id = wocky_xmpp_connection_new_id (conn);
diff --git a/wocky/wocky-data-form.c b/wocky/wocky-data-form.c
index 7775fd3..529eee3 100644
--- a/wocky/wocky-data-form.c
+++ b/wocky/wocky-data-form.c
@@ -273,21 +273,21 @@ type_to_str (WockyDataFormFieldType type)
* <option/>s defined in the node
*/
static GSList *
-extract_options_list (WockyXmppNode *node)
+extract_options_list (WockyNode *node)
{
GSList *result = NULL;
- WockyXmppNodeIter iter;
- WockyXmppNode *option_node;
+ WockyNodeIter iter;
+ WockyNode *option_node;
- wocky_xmpp_node_iter_init (&iter, node, "option", NULL);
+ wocky_node_iter_init (&iter, node, "option", NULL);
- while (wocky_xmpp_node_iter_next (&iter, &option_node))
+ while (wocky_node_iter_next (&iter, &option_node))
{
WockyDataFormFieldOption *option;
const gchar *value, *label;
- value = wocky_xmpp_node_get_content_from_child (option_node, "value");
- label = wocky_xmpp_node_get_attribute (option_node, "label");
+ value = wocky_node_get_content_from_child (option_node, "value");
+ label = wocky_node_get_attribute (option_node, "label");
if (value == NULL)
continue;
@@ -310,15 +310,15 @@ extract_options_list (WockyXmppNode *node)
* the 'value' children nodes of the node
*/
static GStrv
-extract_value_list (WockyXmppNode *node)
+extract_value_list (WockyNode *node)
{
GPtrArray *tmp = g_ptr_array_new ();
- WockyXmppNodeIter iter;
- WockyXmppNode *value;
+ WockyNodeIter iter;
+ WockyNode *value;
- wocky_xmpp_node_iter_init (&iter, node, "value", NULL);
+ wocky_node_iter_init (&iter, node, "value", NULL);
- while (wocky_xmpp_node_iter_next (&iter, &value))
+ while (wocky_node_iter_next (&iter, &value))
{
if (value->content != NULL)
g_ptr_array_add (tmp, g_strdup (value->content));
@@ -333,9 +333,9 @@ extract_value_list (WockyXmppNode *node)
static GValue *
get_field_value (
WockyDataFormFieldType type,
- WockyXmppNode *field)
+ WockyNode *field)
{
- WockyXmppNode *node;
+ WockyNode *node;
const gchar *value;
if (type == WOCKY_DATA_FORM_FIELD_TYPE_UNSPECIFIED)
@@ -347,7 +347,7 @@ get_field_value (
return NULL;
}
- node = wocky_xmpp_node_get_child (field, "value");
+ node = wocky_node_get_child (field, "value");
if (node == NULL)
/* no default value */
return NULL;
@@ -387,7 +387,7 @@ get_field_value (
}
static WockyDataFormField *
-create_field (WockyXmppNode *field_node,
+create_field (WockyNode *field_node,
const gchar *var,
WockyDataFormFieldType type,
const gchar *label,
@@ -420,7 +420,7 @@ create_field (WockyXmppNode *field_node,
}
static gboolean
-extract_var_type_label (WockyXmppNode *node,
+extract_var_type_label (WockyNode *node,
const gchar **_var,
WockyDataFormFieldType *_type,
const gchar **_label)
@@ -435,7 +435,7 @@ extract_var_type_label (WockyXmppNode *node,
* 'type' attribute that defines the data "type" of the field data (if no
* 'type' is specified, the default is "text-single")
*/
- tmp = wocky_xmpp_node_get_attribute (node, "type");
+ tmp = wocky_node_get_attribute (node, "type");
if (tmp == NULL)
{
type = WOCKY_DATA_FORM_FIELD_TYPE_TEXT_SINGLE;
@@ -447,14 +447,14 @@ extract_var_type_label (WockyXmppNode *node,
return FALSE;
}
- var = wocky_xmpp_node_get_attribute (node, "var");
+ var = wocky_node_get_attribute (node, "var");
if (var == NULL && type != WOCKY_DATA_FORM_FIELD_TYPE_FIXED)
{
DEBUG ("field node doesn't have a 'var' attribute; ignoring");
return FALSE;
}
- label = wocky_xmpp_node_get_attribute (node, "label");
+ label = wocky_node_get_attribute (node, "label");
if (_var != NULL)
*_var = var;
@@ -467,7 +467,7 @@ extract_var_type_label (WockyXmppNode *node,
}
static WockyDataFormField *
-data_form_parse_form_field (WockyXmppNode *field_node)
+data_form_parse_form_field (WockyNode *field_node)
{
WockyDataFormField *field;
const gchar *var, *label, *desc;
@@ -477,8 +477,8 @@ data_form_parse_form_field (WockyXmppNode *field_node)
if (!extract_var_type_label (field_node, &var, &type, &label))
return NULL;
- desc = wocky_xmpp_node_get_content_from_child (field_node, "desc");
- required = (wocky_xmpp_node_get_child (field_node, "required") != NULL);
+ desc = wocky_node_get_content_from_child (field_node, "desc");
+ required = (wocky_node_get_child (field_node, "required") != NULL);
field = create_field (field_node, var, type, label, desc, required);
if (field == NULL)
@@ -509,15 +509,15 @@ data_form_add_field (WockyDataForm *self,
}
WockyDataForm *
-wocky_data_form_new_from_form (WockyXmppNode *root,
+wocky_data_form_new_from_form (WockyNode *root,
GError **error)
{
- WockyXmppNode *x, *node;
- WockyXmppNodeIter iter;
+ WockyNode *x, *node;
+ WockyNodeIter iter;
const gchar *type, *title, *instructions;
WockyDataForm *form;
- x = wocky_xmpp_node_get_child_ns (root, "x", WOCKY_XMPP_NS_DATA);
+ x = wocky_node_get_child_ns (root, "x", WOCKY_XMPP_NS_DATA);
if (x == NULL)
{
DEBUG ("No 'x' node");
@@ -526,7 +526,7 @@ wocky_data_form_new_from_form (WockyXmppNode *root,
return NULL;
}
- type = wocky_xmpp_node_get_attribute (x, "type");
+ type = wocky_node_get_attribute (x, "type");
if (wocky_strdiff (type, "form"))
{
DEBUG ("'type' attribute is not 'form': %s", type);
@@ -536,8 +536,8 @@ wocky_data_form_new_from_form (WockyXmppNode *root,
return NULL;
}
- title = wocky_xmpp_node_get_content_from_child (x, "title");
- instructions = wocky_xmpp_node_get_content_from_child (x, "instructions");
+ title = wocky_node_get_content_from_child (x, "title");
+ instructions = wocky_node_get_content_from_child (x, "instructions");
form = g_object_new (WOCKY_TYPE_DATA_FORM,
"title", title,
@@ -545,9 +545,9 @@ wocky_data_form_new_from_form (WockyXmppNode *root,
NULL);
/* add fields */
- wocky_xmpp_node_iter_init (&iter, x, "field", NULL);
+ wocky_node_iter_init (&iter, x, "field", NULL);
- while (wocky_xmpp_node_iter_next (&iter, &node))
+ while (wocky_node_iter_next (&iter, &node))
{
WockyDataFormField *field = data_form_parse_form_field (node);
@@ -698,11 +698,11 @@ wocky_data_form_set_strv (WockyDataForm *self,
static void
add_field_to_node (WockyDataFormField *field,
- WockyXmppNode *node)
+ WockyNode *node)
{
const GValue *value = field->value;
GType t;
- WockyXmppNode *field_node;
+ WockyNode *field_node;
/* Skip anonymous fields, which are used for instructions to the user. */
if (field->var == NULL)
@@ -718,23 +718,23 @@ add_field_to_node (WockyDataFormField *field,
if (value == NULL)
return;
- field_node = wocky_xmpp_node_add_child (node, "field");
- wocky_xmpp_node_set_attribute (field_node, "var", field->var);
+ field_node = wocky_node_add_child (node, "field");
+ wocky_node_set_attribute (field_node, "var", field->var);
if (field->type != WOCKY_DATA_FORM_FIELD_TYPE_UNSPECIFIED)
- wocky_xmpp_node_set_attribute (field_node, "type",
+ wocky_node_set_attribute (field_node, "type",
type_to_str (field->type));
t = G_VALUE_TYPE (value);
if (t == G_TYPE_BOOLEAN)
{
- wocky_xmpp_node_add_child_with_content (field_node, "value",
+ wocky_node_add_child_with_content (field_node, "value",
g_value_get_boolean (value) ? "1" : "0");
}
else if (t == G_TYPE_STRING)
{
- wocky_xmpp_node_add_child_with_content (field_node, "value",
+ wocky_node_add_child_with_content (field_node, "value",
g_value_get_string (value));
}
else if (t == G_TYPE_STRV)
@@ -743,7 +743,7 @@ add_field_to_node (WockyDataFormField *field,
GStrv s;
for (s = tmp; *s != NULL; s++)
- wocky_xmpp_node_add_child_with_content (field_node, "value", *s);
+ wocky_node_add_child_with_content (field_node, "value", *s);
}
else
{
@@ -761,26 +761,26 @@ add_field_to_node (WockyDataFormField *field,
*/
void
wocky_data_form_submit (WockyDataForm *self,
- WockyXmppNode *node)
+ WockyNode *node)
{
- WockyXmppNode *x;
+ WockyNode *x;
- x = wocky_xmpp_node_add_child_ns (node, "x", WOCKY_XMPP_NS_DATA);
- wocky_xmpp_node_set_attribute (x, "type", "submit");
+ x = wocky_node_add_child_ns (node, "x", WOCKY_XMPP_NS_DATA);
+ wocky_node_set_attribute (x, "type", "submit");
g_slist_foreach (self->fields_list, (GFunc) add_field_to_node, x);
}
static void
data_form_parse_reported (WockyDataForm *self,
- WockyXmppNode *reported_node)
+ WockyNode *reported_node)
{
WockyDataFormPrivate *priv = self->priv;
GSList *l;
for (l = reported_node->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *node = l->data;
+ WockyNode *node = l->data;
const gchar *var, *label;
WockyDataFormField *field;
WockyDataFormFieldType type;
@@ -798,21 +798,21 @@ data_form_parse_reported (WockyDataForm *self,
static void
data_form_parse_item (WockyDataForm *self,
- WockyXmppNode *item_node)
+ WockyNode *item_node)
{
WockyDataFormPrivate *priv = self->priv;
- WockyXmppNodeIter iter;
- WockyXmppNode *field_node;
+ WockyNodeIter iter;
+ WockyNode *field_node;
GSList *item = NULL;
- wocky_xmpp_node_iter_init (&iter, item_node, "field", NULL);
- while (wocky_xmpp_node_iter_next (&iter, &field_node))
+ wocky_node_iter_init (&iter, item_node, "field", NULL);
+ while (wocky_node_iter_next (&iter, &field_node))
{
const gchar *var;
WockyDataFormField *field, *result;
GValue *value;
- var = wocky_xmpp_node_get_attribute (field_node, "var");
+ var = wocky_node_get_attribute (field_node, "var");
if (var == NULL)
continue;
@@ -839,13 +839,13 @@ data_form_parse_item (WockyDataForm *self,
static void
parse_unique_result (WockyDataForm *self,
- WockyXmppNode *x)
+ WockyNode *x)
{
GSList *l, *item = NULL;
for (l = x->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *node = l->data;
+ WockyNode *node = l->data;
const gchar *var;
WockyDataFormFieldType type;
WockyDataFormField *result;
@@ -869,13 +869,13 @@ parse_unique_result (WockyDataForm *self,
gboolean
wocky_data_form_parse_result (WockyDataForm *self,
- WockyXmppNode *node,
+ WockyNode *node,
GError **error)
{
- WockyXmppNode *x, *reported;
+ WockyNode *x, *reported;
const gchar *type;
- x = wocky_xmpp_node_get_child_ns (node, "x", WOCKY_XMPP_NS_DATA);
+ x = wocky_node_get_child_ns (node, "x", WOCKY_XMPP_NS_DATA);
if (x == NULL)
{
DEBUG ("No 'x' node");
@@ -884,7 +884,7 @@ wocky_data_form_parse_result (WockyDataForm *self,
return FALSE;
}
- type = wocky_xmpp_node_get_attribute (x, "type");
+ type = wocky_node_get_attribute (x, "type");
if (wocky_strdiff (type, "result"))
{
DEBUG ("'type' attribute is not 'result': %s", type);
@@ -894,20 +894,20 @@ wocky_data_form_parse_result (WockyDataForm *self,
return FALSE;
}
- reported = wocky_xmpp_node_get_child (x, "reported");
+ reported = wocky_node_get_child (x, "reported");
if (reported != NULL)
{
- WockyXmppNodeIter iter;
- WockyXmppNode *item;
+ WockyNodeIter iter;
+ WockyNode *item;
/* The field definitions are in a <reported/> header, and a series of
* <item/> nodes contain sets of results.
*/
data_form_parse_reported (self, reported);
- wocky_xmpp_node_iter_init (&iter, x, "item", NULL);
- while (wocky_xmpp_node_iter_next (&iter, &item))
+ wocky_node_iter_init (&iter, x, "item", NULL);
+ while (wocky_node_iter_next (&iter, &item))
data_form_parse_item (self, item);
}
else
diff --git a/wocky/wocky-data-form.h b/wocky/wocky-data-form.h
index f346c12..221c075 100644
--- a/wocky/wocky-data-form.h
+++ b/wocky/wocky-data-form.h
@@ -23,7 +23,7 @@
#include <glib-object.h>
-#include "wocky-xmpp-node.h"
+#include "wocky-node.h"
G_BEGIN_DECLS
@@ -115,7 +115,7 @@ GType wocky_data_form_get_type (void);
(G_TYPE_INSTANCE_GET_CLASS ((obj), WOCKY_TYPE_DATA_FORM, \
WockyDataFormClass))
-WockyDataForm * wocky_data_form_new_from_form (WockyXmppNode *node,
+WockyDataForm * wocky_data_form_new_from_form (WockyNode *node,
GError **error);
gboolean wocky_data_form_set_type (WockyDataForm *self,
@@ -137,10 +137,10 @@ gboolean wocky_data_form_set_strv (WockyDataForm *self,
gboolean create_if_missing);
void wocky_data_form_submit (WockyDataForm *self,
- WockyXmppNode *node);
+ WockyNode *node);
gboolean wocky_data_form_parse_result (WockyDataForm *self,
- WockyXmppNode *node,
+ WockyNode *node,
GError **error);
const gchar *wocky_data_form_get_title (WockyDataForm *self);
diff --git a/wocky/wocky-debug.c b/wocky/wocky-debug.c
index d74c071..7906bf8 100644
--- a/wocky/wocky-debug.c
+++ b/wocky/wocky-debug.c
@@ -91,7 +91,7 @@ wocky_debug_stanza (DebugFlags flag,
msg = g_strdup_vprintf (format, args);
va_end (args);
- node_str = wocky_xmpp_node_to_string (
+ node_str = wocky_node_to_string (
wocky_stanza_get_top_node (stanza));
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s\n%s", msg, node_str);
diff --git a/wocky/wocky-muc.c b/wocky/wocky-muc.c
index 996606a..c8332e9 100644
--- a/wocky/wocky-muc.c
+++ b/wocky/wocky-muc.c
@@ -601,7 +601,7 @@ status_code_to_muc_flag (guint code)
/* ************************************************************************ */
/* check MUC exists/disco MUC info */
static gboolean
-store_muc_disco_info_x (WockyXmppNode *field, gpointer data)
+store_muc_disco_info_x (WockyNode *field, gpointer data)
{
WockyMucPrivate *priv = data;
const gchar *var = NULL;
@@ -609,26 +609,26 @@ store_muc_disco_info_x (WockyXmppNode *field, gpointer data)
if (wocky_strdiff (field->name, "field"))
return TRUE;
- var = wocky_xmpp_node_get_attribute (field, "var");
+ var = wocky_node_get_attribute (field, "var");
if (wocky_strdiff (var, "muc#roominfo_description"))
return TRUE;
priv->desc = g_strdup (
- wocky_xmpp_node_get_content_from_child (field, "value"));
+ wocky_node_get_content_from_child (field, "value"));
return TRUE;
}
static gboolean
-store_muc_disco_info (WockyXmppNode *feat, gpointer data)
+store_muc_disco_info (WockyNode *feat, gpointer data)
{
WockyMucPrivate *priv = data;
if (!wocky_strdiff (feat->name, "feature"))
{
guint i;
- const gchar *thing = wocky_xmpp_node_get_attribute (feat, "var");
+ const gchar *thing = wocky_node_get_attribute (feat, "var");
if (thing == NULL)
return TRUE;
@@ -643,7 +643,7 @@ store_muc_disco_info (WockyXmppNode *feat, gpointer data)
}
if (!wocky_strdiff (feat->name, "x"))
- wocky_xmpp_node_each_child (feat, store_muc_disco_info_x, priv);
+ wocky_node_each_child (feat, store_muc_disco_info_x, priv);
return TRUE;
}
@@ -691,11 +691,11 @@ muc_disco_info (GObject *source,
switch (sub)
{
- WockyXmppNode *query;
- WockyXmppNode *node;
+ WockyNode *query;
+ WockyNode *node;
case WOCKY_STANZA_SUB_TYPE_RESULT:
- query = wocky_xmpp_node_get_child_ns (
+ query = wocky_node_get_child_ns (
wocky_stanza_get_top_node (iq), "query", NS_DISCO_INFO);
if (!query)
@@ -706,7 +706,7 @@ muc_disco_info (GObject *source,
goto out;
}
- node = wocky_xmpp_node_get_child (query, "identity");
+ node = wocky_node_get_child (query, "identity");
if (!node)
{
@@ -719,20 +719,20 @@ muc_disco_info (GObject *source,
{
const gchar *attr;
- attr = wocky_xmpp_node_get_attribute (node, "category");
+ attr = wocky_node_get_attribute (node, "category");
g_free (priv->id_category);
priv->id_category = g_strdup (attr);
- attr = wocky_xmpp_node_get_attribute (node, "name");
+ attr = wocky_node_get_attribute (node, "name");
g_free (priv->id_name);
priv->id_name = g_strdup (attr);
- attr = wocky_xmpp_node_get_attribute (node, "type");
+ attr = wocky_node_get_attribute (node, "type");
g_free (priv->id_type);
priv->id_type = g_strdup (attr);
}
- wocky_xmpp_node_each_child (query, store_muc_disco_info, priv);
+ wocky_node_each_child (query, store_muc_disco_info, priv);
if (priv->state < WOCKY_MUC_INITIATED)
priv->state = WOCKY_MUC_INITIATED;
break;
@@ -814,8 +814,8 @@ wocky_muc_create_presence (WockyMuc *muc,
priv->user,
priv->jid,
NULL);
- WockyXmppNode *presence = wocky_stanza_get_top_node (stanza);
- WockyXmppNode *x = wocky_xmpp_node_add_child_ns (presence,
+ WockyNode *presence = wocky_stanza_get_top_node (stanza);
+ WockyNode *x = wocky_node_add_child_ns (presence,
"x", WOCKY_NS_MUC);
@@ -826,7 +826,7 @@ wocky_muc_create_presence (WockyMuc *muc,
if (status != NULL)
{
- wocky_xmpp_node_add_child_with_content (presence, "status", status);
+ wocky_node_add_child_with_content (presence, "status", status);
}
else
{
@@ -834,7 +834,7 @@ wocky_muc_create_presence (WockyMuc *muc,
}
if (password != NULL)
- wocky_xmpp_node_add_child_with_content (x, "password", password);
+ wocky_node_add_child_with_content (x, "password", password);
return stanza;
}
@@ -892,7 +892,7 @@ register_message_handler (WockyMuc *muc)
/* ************************************************************************ */
/* handle presence from MUC */
static gboolean
-presence_code (WockyXmppNode *node, gpointer data)
+presence_code (WockyNode *node, gpointer data)
{
const gchar *code = NULL;
GHashTable *status = data;
@@ -901,7 +901,7 @@ presence_code (WockyXmppNode *node, gpointer data)
if (wocky_strdiff (node->name, "status"))
return TRUE;
- code = wocky_xmpp_node_get_attribute (node, "code");
+ code = wocky_node_get_attribute (node, "code");
if (code == NULL) return TRUE;
@@ -932,7 +932,7 @@ presence_code (WockyXmppNode *node, gpointer data)
}
static gboolean
-presence_status (WockyXmppNode *node, gpointer data)
+presence_status (WockyNode *node, gpointer data)
{
GString **status = data;
@@ -1126,11 +1126,11 @@ handle_presence_standard (WockyMuc *muc,
gchar *serv = NULL;
gchar *nick = NULL;
gboolean ok = FALSE;
- WockyXmppNode *node = wocky_stanza_get_top_node (stanza);
- WockyXmppNode *x = wocky_xmpp_node_get_child_ns (node,
+ WockyNode *node = wocky_stanza_get_top_node (stanza);
+ WockyNode *x = wocky_node_get_child_ns (node,
"x", WOCKY_NS_MUC_USR);
- WockyXmppNode *item = NULL;
- const gchar *from = wocky_xmpp_node_get_attribute (node, "from");
+ WockyNode *item = NULL;
+ const gchar *from = wocky_node_get_attribute (node, "from");
const gchar *pjid = NULL;
const gchar *pnic = NULL;
const gchar *role = NULL;
@@ -1159,31 +1159,31 @@ handle_presence_standard (WockyMuc *muc,
return FALSE;
}
- wocky_xmpp_node_each_child (node, presence_status, &status_msg);
+ wocky_node_each_child (node, presence_status, &status_msg);
if (status_msg != NULL)
msg = g_string_free (status_msg, FALSE);
if (x != NULL)
{
- item = wocky_xmpp_node_get_child (x, "item");
+ item = wocky_node_get_child (x, "item");
if (item != NULL)
{
- WockyXmppNode *actor = NULL;
- WockyXmppNode *cause = NULL;
+ WockyNode *actor = NULL;
+ WockyNode *cause = NULL;
- pjid = wocky_xmpp_node_get_attribute (item, "jid");
- pnic = wocky_xmpp_node_get_attribute (item, "nick");
- role = wocky_xmpp_node_get_attribute (item, "role");
- aff = wocky_xmpp_node_get_attribute (item, "affiliation");
- actor = wocky_xmpp_node_get_child (item, "actor");
- cause = wocky_xmpp_node_get_child (item, "reason");
+ pjid = wocky_node_get_attribute (item, "jid");
+ pnic = wocky_node_get_attribute (item, "nick");
+ role = wocky_node_get_attribute (item, "role");
+ aff = wocky_node_get_attribute (item, "affiliation");
+ actor = wocky_node_get_child (item, "actor");
+ cause = wocky_node_get_child (item, "reason");
r = string_to_role (role);
a = string_to_aff (aff);
if (actor != NULL)
- ajid = wocky_xmpp_node_get_attribute (actor, "jid");
+ ajid = wocky_node_get_attribute (actor, "jid");
if (cause != NULL)
why = cause->content;
@@ -1194,7 +1194,7 @@ handle_presence_standard (WockyMuc *muc,
pnic = nick;
code = g_hash_table_new (g_direct_hash, NULL);
- wocky_xmpp_node_each_child (x, presence_code, code);
+ wocky_node_each_child (x, presence_code, code);
/* belt and braces: it is possible OWN_PRESENCE is not set, as it is *
* only a SHOULD in the RFC: check the 'from' stanza attribute and the *
* jid item node attribute against the MUC jid and the users full jid *
@@ -1294,7 +1294,7 @@ handle_presence_error (WockyMuc *muc,
gchar *room = NULL;
gchar *serv = NULL;
gchar *nick = NULL;
- const gchar *from = wocky_xmpp_node_get_attribute (
+ const gchar *from = wocky_node_get_attribute (
wocky_stanza_get_top_node (stanza), "from");
WockyMucPrivate *priv = muc->priv;
GError *error = NULL;
@@ -1378,9 +1378,9 @@ handle_message (WockyPorter *porter,
WockyMuc *muc = WOCKY_MUC (data);
WockyMucPrivate *priv = muc->priv;
WockyStanzaSubType stype;
- WockyXmppNode *msg = wocky_stanza_get_top_node (stanza);
+ WockyNode *msg = wocky_stanza_get_top_node (stanza);
const gchar *from = NULL;
- WockyXmppNode *child = NULL;
+ WockyNode *child = NULL;
gboolean from_self = FALSE;
int x;
@@ -1398,14 +1398,14 @@ handle_message (WockyPorter *porter,
* HACK: we interrupt this function for a HACK: *
* google servers send offline messags w/o a type; kludge it: */
if (stype == WOCKY_STANZA_SUB_TYPE_NONE &&
- wocky_xmpp_node_get_child_ns (msg, "time", "google:timestamp") != NULL &&
- wocky_xmpp_node_get_child_ns (msg, "x", WOCKY_XMPP_NS_DELAY) != NULL)
+ wocky_node_get_child_ns (msg, "time", "google:timestamp") != NULL &&
+ wocky_node_get_child_ns (msg, "x", WOCKY_XMPP_NS_DELAY) != NULL)
stype = WOCKY_STANZA_SUB_TYPE_GROUPCHAT;
/* ***************************************************************** *
* we now return you to your regular logic */
- id = wocky_xmpp_node_get_attribute (msg, "id");
- from = wocky_xmpp_node_get_attribute (msg, "from");
+ id = wocky_node_get_attribute (msg, "id");
+ from = wocky_node_get_attribute (msg, "from");
/* if the message purports to be from a MUC member, treat as such: */
if (strchr (from, '/') != NULL)
@@ -1449,16 +1449,16 @@ handle_message (WockyPorter *porter,
}
}
- body = wocky_xmpp_node_get_content_from_child (msg, "body");
- subj = wocky_xmpp_node_get_content_from_child (msg, "subject");
+ body = wocky_node_get_content_from_child (msg, "body");
+ subj = wocky_node_get_content_from_child (msg, "subject");
/* ********************************************************************** */
/* parse timestap, if any */
- child = wocky_xmpp_node_get_child_ns (msg, "x", WOCKY_XMPP_NS_DELAY);
+ child = wocky_node_get_child_ns (msg, "x", WOCKY_XMPP_NS_DELAY);
if (child != NULL)
{
- const gchar *tm = wocky_xmpp_node_get_attribute (child, "stamp");
+ const gchar *tm = wocky_node_get_attribute (child, "stamp");
/* These timestamps do not contain a timezone, but are understood to be
* in GMT. They're in the format yyyymmddThhmmss, so if we append 'Z'
@@ -1514,7 +1514,7 @@ handle_message (WockyPorter *porter,
for (x = 0; msg_state[x].name != NULL; x++)
{
const gchar *item = msg_state[x].name;
- child = wocky_xmpp_node_get_child_ns (msg, item, WOCKY_NS_CHATSTATE);
+ child = wocky_node_get_child_ns (msg, item, WOCKY_NS_CHATSTATE);
if (child != NULL)
break;
}
diff --git a/wocky/wocky-node-tree.c b/wocky/wocky-node-tree.c
index ece36b2..17fe801 100644
--- a/wocky/wocky-node-tree.c
+++ b/wocky/wocky-node-tree.c
@@ -79,7 +79,7 @@ wocky_node_tree_finalize (GObject *object)
WockyNodeTree *self = WOCKY_NODE_TREE (object);
/* free any data held directly by the object here */
- wocky_xmpp_node_free (self->node);
+ wocky_node_free (self->node);
G_OBJECT_CLASS (wocky_node_tree_parent_class)->finalize (object);
}
diff --git a/wocky/wocky-node-tree.h b/wocky/wocky-node-tree.h
index 1128b91..1778bf2 100644
--- a/wocky/wocky-node-tree.h
+++ b/wocky/wocky-node-tree.h
@@ -24,7 +24,7 @@
#include <stdarg.h>
#include <glib-object.h>
-#include "wocky-xmpp-node.h"
+#include "wocky-node.h"
#include "wocky-xmpp-error.h"
G_BEGIN_DECLS
@@ -39,7 +39,7 @@ struct _WockyNodeTreeClass {
struct _WockyNodeTree {
GObject parent;
- WockyXmppNode *node;
+ WockyNode *node;
WockyNodeTreePrivate *priv;
};
diff --git a/wocky/wocky-xmpp-node.c b/wocky/wocky-node.c
index c5c3c4a..bb60680 100644
--- a/wocky/wocky-xmpp-node.c
+++ b/wocky/wocky-node.c
@@ -1,5 +1,5 @@
/*
- * wocky-xmpp-node.c - Code for Wocky xmpp nodes
+ * wocky-node.c - Code for Wocky xmpp nodes
* Copyright (C) 2006 Collabora Ltd.
* @author Sjoerd Simons <sjoerd@luon.net>
*
@@ -21,15 +21,15 @@
#include <glib.h>
#include <string.h>
-#include "wocky-xmpp-node.h"
+#include "wocky-node.h"
#include "wocky-utils.h"
#include "wocky-namespaces.h"
/**
- * SECTION: wocky-xmpp-node
- * @title: WockyXmppNode
+ * SECTION: wocky-node
+ * @title: WockyNode
* @short_description: representation of a XMPP node
- * @include: wocky/wocky-xmpp-node.h
+ * @include: wocky/wocky-node.h
*
* Low level representation of a XMPP node. Provides ways to set various
* parameters on the node, such as content, language, namespaces and prefixes.
@@ -62,18 +62,18 @@ static GHashTable *user_ns_prefixes = NULL;
static GHashTable *default_ns_prefixes = NULL;
/**
- * wocky_xmpp_node_new:
+ * wocky_node_new:
* @name: the node's name
*
- * Convenience function which creates a #WockyXmppNode and sets its
+ * Convenience function which creates a #WockyNode and sets its
* name to @name.
*
- * Returns: a newly allocated #WockyXmppNode.
+ * Returns: a newly allocated #WockyNode.
*/
-WockyXmppNode *
-wocky_xmpp_node_new (const char *name, const gchar *ns)
+WockyNode *
+wocky_node_new (const char *name, const gchar *ns)
{
- WockyXmppNode *result = g_slice_new0 (WockyXmppNode);
+ WockyNode *result = g_slice_new0 (WockyNode);
result->name = g_strdup (name);
result->ns = (ns != NULL) ? g_quark_from_string (ns) : 0;
@@ -91,14 +91,14 @@ attribute_free (Attribute *a)
}
/**
- * wocky_xmpp_node_free:
- * @node: a #WockyXmppNode.
+ * wocky_node_free:
+ * @node: a #WockyNode.
*
- * Convenience function that frees the passed in #WockyXmppNode and
+ * Convenience function that frees the passed in #WockyNode and
* all of its children.
*/
void
-wocky_xmpp_node_free (WockyXmppNode *node)
+wocky_node_free (WockyNode *node)
{
GSList *l;
@@ -113,7 +113,7 @@ wocky_xmpp_node_free (WockyXmppNode *node)
for (l = node->children; l != NULL ; l = l->next)
{
- wocky_xmpp_node_free ((WockyXmppNode *) l->data);
+ wocky_node_free ((WockyNode *) l->data);
}
g_slist_free (node->children);
@@ -124,20 +124,20 @@ wocky_xmpp_node_free (WockyXmppNode *node)
}
g_slist_free (node->attributes);
- g_slice_free (WockyXmppNode, node);
+ g_slice_free (WockyNode, node);
}
/**
- * wocky_xmpp_node_each_attribute:
- * @node: a #WockyXmppNode
+ * wocky_node_each_attribute:
+ * @node: a #WockyNode
* @func: the function to be called on each node's attribute
* @user_data: user data to pass to the function
*
- * Calls a function for each attribute of a #WockyXmppNode.
+ * Calls a function for each attribute of a #WockyNode.
*/
void
-wocky_xmpp_node_each_attribute (WockyXmppNode *node,
- wocky_xmpp_node_each_attr_func func, gpointer user_data)
+wocky_node_each_attribute (WockyNode *node,
+ wocky_node_each_attr_func func, gpointer user_data)
{
GSList *l;
@@ -153,22 +153,22 @@ wocky_xmpp_node_each_attribute (WockyXmppNode *node,
}
/**
- * wocky_xmpp_node_each_child:
- * @node: a #WockyXmppNode
+ * wocky_node_each_child:
+ * @node: a #WockyNode
* @func: the function to be called on each node's child
* @user_data: user data to pass to the function
*
- * Calls a function for each child of a #WockyXmppNode.
+ * Calls a function for each child of a #WockyNode.
*/
void
-wocky_xmpp_node_each_child (WockyXmppNode *node,
- wocky_xmpp_node_each_child_func func, gpointer user_data)
+wocky_node_each_child (WockyNode *node,
+ wocky_node_each_child_func func, gpointer user_data)
{
GSList *l;
for (l = node->children; l != NULL ; l = l->next)
{
- WockyXmppNode *n = (WockyXmppNode *) l->data;
+ WockyNode *n = (WockyNode *) l->data;
if (!func (n, user_data))
{
return;
@@ -191,20 +191,20 @@ attribute_compare (gconstpointer a, gconstpointer b)
}
/**
- * wocky_xmpp_node_get_attribute_ns:
- * @node: a #WockyXmppNode
+ * wocky_node_get_attribute_ns:
+ * @node: a #WockyNode
* @key: the attribute name
* @ns: the namespace to search within, or %NULL
*
- * Returns the value of an attribute in a #WockyXmppNode, limiting the search
+ * Returns the value of an attribute in a #WockyNode, limiting the search
* within a specific namespace. If the namespace is %NULL, this is equivalent
- * to wocky_xmpp_node_get_attribute().
+ * to wocky_node_get_attribute().
*
* Returns: the value of the attribute @key, or %NULL if @node doesn't
* have such attribute in @ns.
*/
const gchar *
-wocky_xmpp_node_get_attribute_ns (WockyXmppNode *node,
+wocky_node_get_attribute_ns (WockyNode *node,
const gchar *key, const gchar *ns)
{
GSList *link;
@@ -219,53 +219,53 @@ wocky_xmpp_node_get_attribute_ns (WockyXmppNode *node,
}
/**
- * wocky_xmpp_node_get_attribute:
- * @node: a #WockyXmppNode
+ * wocky_node_get_attribute:
+ * @node: a #WockyNode
* @key: the attribute name
*
- * Returns the value of an attribute in a #WockyXmppNode.
+ * Returns the value of an attribute in a #WockyNode.
*
* Returns: the value of the attribute @key, or %NULL if @node doesn't
* have such attribute.
*/
const gchar *
-wocky_xmpp_node_get_attribute (WockyXmppNode *node, const gchar *key)
+wocky_node_get_attribute (WockyNode *node, const gchar *key)
{
- return wocky_xmpp_node_get_attribute_ns (node, key, NULL);
+ return wocky_node_get_attribute_ns (node, key, NULL);
}
/**
- * wocky_xmpp_node_set_attribute:
- * @node: a #WockyXmppNode
+ * wocky_node_set_attribute:
+ * @node: a #WockyNode
* @key: the attribute name to set
* @value: the value to set
*
- * Sets an attribute in a #WockyXmppNode to a specific value.
+ * Sets an attribute in a #WockyNode to a specific value.
*/
void
-wocky_xmpp_node_set_attribute (WockyXmppNode *node,
+wocky_node_set_attribute (WockyNode *node,
const gchar *key, const gchar *value)
{
g_assert (value != NULL);
- wocky_xmpp_node_set_attribute_n_ns (node, key, value, strlen (value), NULL);
+ wocky_node_set_attribute_n_ns (node, key, value, strlen (value), NULL);
}
/**
- * wocky_xmpp_node_set_attribute_ns:
- * @node: a #WockyXmppNode
+ * wocky_node_set_attribute_ns:
+ * @node: a #WockyNode
* @key: the attribute name to set
* @value: the value to set
* @ns: a namespace, or %NULL
*
- * Sets an attribute in a #WockyXmppNode, within a specific namespace.
+ * Sets an attribute in a #WockyNode, within a specific namespace.
* If the namespace is %NULL, this is equivalent to
- * wocky_xmpp_node_set_attribute().
+ * wocky_node_set_attribute().
*/
void
-wocky_xmpp_node_set_attribute_ns (WockyXmppNode *node, const gchar *key,
+wocky_node_set_attribute_ns (WockyNode *node, const gchar *key,
const gchar *value, const gchar *ns)
{
- wocky_xmpp_node_set_attribute_n_ns (node,
+ wocky_node_set_attribute_n_ns (node,
key, value, strlen (value), ns);
}
@@ -387,7 +387,7 @@ _attribute_ns_get_prefix (GQuark ns,
}
/**
- * wocky_xmpp_node_attribute_ns_get_prefix_from_quark:
+ * wocky_node_attribute_ns_get_prefix_from_quark:
* @ns: a quark corresponding to an XML namespace URN
*
* Gets the prefix of the namespace identified by the quark.
@@ -395,7 +395,7 @@ _attribute_ns_get_prefix (GQuark ns,
* Returns: a string containing the prefix of the namespace @ns.
*/
const gchar *
-wocky_xmpp_node_attribute_ns_get_prefix_from_quark (GQuark ns)
+wocky_node_attribute_ns_get_prefix_from_quark (GQuark ns)
{
const gchar *urn;
@@ -410,7 +410,7 @@ wocky_xmpp_node_attribute_ns_get_prefix_from_quark (GQuark ns)
}
/**
- * wocky_xmpp_node_attribute_ns_get_prefix_from_urn:
+ * wocky_node_attribute_ns_get_prefix_from_urn:
* @urn: a string containing an URN
*
* Gets the prefix of the namespace identified by the URN.
@@ -418,7 +418,7 @@ wocky_xmpp_node_attribute_ns_get_prefix_from_quark (GQuark ns)
* Returns: a string containing the prefix of the namespace @urn.
*/
const gchar *
-wocky_xmpp_node_attribute_ns_get_prefix_from_urn (const gchar *urn)
+wocky_node_attribute_ns_get_prefix_from_urn (const gchar *urn)
{
GQuark ns;
@@ -433,14 +433,14 @@ wocky_xmpp_node_attribute_ns_get_prefix_from_urn (const gchar *urn)
}
/**
- * wocky_xmpp_node_attribute_ns_set_prefix:
+ * wocky_node_attribute_ns_set_prefix:
* @ns: a #GQuark
* @prefix: a string containing the desired prefix
*
* Sets a desired prefix for a namespace.
*/
void
-wocky_xmpp_node_attribute_ns_set_prefix (GQuark ns, const gchar *prefix)
+wocky_node_attribute_ns_set_prefix (GQuark ns, const gchar *prefix)
{
const gchar *urn = g_quark_to_string (ns);
@@ -449,19 +449,19 @@ wocky_xmpp_node_attribute_ns_set_prefix (GQuark ns, const gchar *prefix)
}
/**
- * wocky_xmpp_node_set_attribute_n_ns:
- * @node: a #WockyXmppNode
+ * wocky_node_set_attribute_n_ns:
+ * @node: a #WockyNode
* @key: the attribute to set
* @value: the value to set
* @value_size: the number of bytes of @value to set as a value
* @ns: a namespace, or %NULL
*
- * Sets a new attribute to a #WockyXmppNode, with the supplied values.
+ * Sets a new attribute to a #WockyNode, with the supplied values.
* If the namespace is %NULL, this is equivalent to
- * wocky_xmpp_node_set_attribute_n().
+ * wocky_node_set_attribute_n().
*/
void
-wocky_xmpp_node_set_attribute_n_ns (WockyXmppNode *node, const gchar *key,
+wocky_node_set_attribute_n_ns (WockyNode *node, const gchar *key,
const gchar *value, gsize value_size, const gchar *ns)
{
Attribute *a = g_slice_new0 (Attribute);
@@ -470,7 +470,7 @@ wocky_xmpp_node_set_attribute_n_ns (WockyXmppNode *node, const gchar *key,
a->key = g_strdup (key);
a->value = g_strndup (value, value_size);
- a->prefix = g_strdup (wocky_xmpp_node_attribute_ns_get_prefix_from_urn (ns));
+ a->prefix = g_strdup (wocky_node_attribute_ns_get_prefix_from_urn (ns));
a->ns = (ns != NULL) ? g_quark_from_string (ns) : 0;
/* Remove the old attribute if needed */
@@ -488,25 +488,25 @@ wocky_xmpp_node_set_attribute_n_ns (WockyXmppNode *node, const gchar *key,
}
/**
- * wocky_xmpp_node_set_attribute_n:
- * @node: a #WockyXmppNode
+ * wocky_node_set_attribute_n:
+ * @node: a #WockyNode
* @key: the attribute to set
* @value: the value to set
* @value_size: the number of bytes of @value to set as a value
*
- * Sets a new attribute to a #WockyXmppNode, with the supplied values.
+ * Sets a new attribute to a #WockyNode, with the supplied values.
*/
void
-wocky_xmpp_node_set_attribute_n (WockyXmppNode *node, const gchar *key,
+wocky_node_set_attribute_n (WockyNode *node, const gchar *key,
const gchar *value, gsize value_size)
{
- wocky_xmpp_node_set_attribute_n_ns (node, key, value, value_size, NULL);
+ wocky_node_set_attribute_n_ns (node, key, value, value_size, NULL);
}
static gint
node_compare_child (gconstpointer a, gconstpointer b)
{
- const WockyXmppNode *node = (const WockyXmppNode *)a;
+ const WockyNode *node = (const WockyNode *)a;
Tuple *target = (Tuple *) b;
if (target->ns != 0 && target->ns != node->ns)
@@ -518,19 +518,19 @@ node_compare_child (gconstpointer a, gconstpointer b)
}
/**
- * wocky_xmpp_node_get_child_ns:
- * @node: a #WockyXmppNode
+ * wocky_node_get_child_ns:
+ * @node: a #WockyNode
* @name: the name of the child to get
* @ns: the namespace of the child to get, or %NULL
*
* Gets the child of a node, searching by name and limiting the search
* to the specified namespace.
- * If the namespace is %NULL, this is equivalent to wocky_xmpp_node_get_child()
+ * If the namespace is %NULL, this is equivalent to wocky_node_get_child()
*
- * Returns: a #WockyXmppNode.
+ * Returns: a #WockyNode.
*/
-WockyXmppNode *
-wocky_xmpp_node_get_child_ns (WockyXmppNode *node, const gchar *name,
+WockyNode *
+wocky_node_get_child_ns (WockyNode *node, const gchar *name,
const gchar *ns)
{
GSList *link;
@@ -541,43 +541,43 @@ wocky_xmpp_node_get_child_ns (WockyXmppNode *node, const gchar *name,
link = g_slist_find_custom (node->children, &t, node_compare_child);
- return (link == NULL) ? NULL : (WockyXmppNode *) (link->data);
+ return (link == NULL) ? NULL : (WockyNode *) (link->data);
}
/**
- * wocky_xmpp_node_get_child:
- * @node: a #WockyXmppNode
+ * wocky_node_get_child:
+ * @node: a #WockyNode
* @name: the name of the child to get
*
* Gets a child of a node, searching by name.
*
- * Returns: a #WockyXmppNode.
+ * Returns: a #WockyNode.
*/
-WockyXmppNode *
-wocky_xmpp_node_get_child (WockyXmppNode *node, const gchar *name)
+WockyNode *
+wocky_node_get_child (WockyNode *node, const gchar *name)
{
- return wocky_xmpp_node_get_child_ns (node, name, NULL);
+ return wocky_node_get_child_ns (node, name, NULL);
}
/**
- * wocky_xmpp_node_get_first_child:
- * @node: a #WockyXmppNode
+ * wocky_node_get_first_child:
+ * @node: a #WockyNode
*
- * Convenience function to return the first child of a #WockyXmppNode.
+ * Convenience function to return the first child of a #WockyNode.
*
- * Returns: a #WockyXmppNode.
+ * Returns: a #WockyNode.
*/
-WockyXmppNode *
-wocky_xmpp_node_get_first_child (WockyXmppNode *node)
+WockyNode *
+wocky_node_get_first_child (WockyNode *node)
{
g_return_val_if_fail (node != NULL, NULL);
g_return_val_if_fail (node->children != NULL, NULL);
- return (WockyXmppNode *) node->children->data;
+ return (WockyNode *) node->children->data;
}
/**
- * wocky_xmpp_node_get_content_from_child:
- * @node: a #WockyXmppNode
+ * wocky_node_get_content_from_child:
+ * @node: a #WockyNode
* @name: the name of the child whose content to retrieve
*
* Retrieves the content from a child of a node, if it exists.
@@ -586,15 +586,15 @@ wocky_xmpp_node_get_first_child (WockyXmppNode *node)
* has no such child.
*/
const gchar *
-wocky_xmpp_node_get_content_from_child (WockyXmppNode *node,
+wocky_node_get_content_from_child (WockyNode *node,
const gchar *name)
{
- return wocky_xmpp_node_get_content_from_child_ns (node, name, NULL);
+ return wocky_node_get_content_from_child_ns (node, name, NULL);
}
/**
- * wocky_xmpp_node_get_content_from_child_ns:
- * @node: a #WockyXmppNode
+ * wocky_node_get_content_from_child_ns:
+ * @node: a #WockyNode
* @name: the name of the child whose content to retrieve
* @ns: the namespace of the child whose content to retrieve
*
@@ -603,11 +603,11 @@ wocky_xmpp_node_get_content_from_child (WockyXmppNode *node,
* Returns: the content of the child of @node named @name in @ns, or %NULL if
* @node has no such child.
*/
-const gchar *wocky_xmpp_node_get_content_from_child_ns (WockyXmppNode *node,
+const gchar *wocky_node_get_content_from_child_ns (WockyNode *node,
const gchar *name,
const gchar *ns)
{
- WockyXmppNode *child = wocky_xmpp_node_get_child_ns (node, name, ns);
+ WockyNode *child = wocky_node_get_child_ns (node, name, ns);
if (child == NULL)
return NULL;
@@ -616,157 +616,157 @@ const gchar *wocky_xmpp_node_get_content_from_child_ns (WockyXmppNode *node,
}
/**
- * wocky_xmpp_node_add_child:
- * @node: a #WockyXmppNode
+ * wocky_node_add_child:
+ * @node: a #WockyNode
* @name: the name of the child to add
*
- * Adds a #WockyXmppNode with the specified name to an already existing node.
+ * Adds a #WockyNode with the specified name to an already existing node.
*
- * Returns: the newly added #WockyXmppNode.
+ * Returns: the newly added #WockyNode.
*/
-WockyXmppNode *
-wocky_xmpp_node_add_child (WockyXmppNode *node, const gchar *name)
+WockyNode *
+wocky_node_add_child (WockyNode *node, const gchar *name)
{
- return wocky_xmpp_node_add_child_with_content_ns (node, name, NULL, NULL);
+ return wocky_node_add_child_with_content_ns (node, name, NULL, NULL);
}
/**
- * wocky_xmpp_node_add_child_ns:
- * @node: a #WockyXmppNode
+ * wocky_node_add_child_ns:
+ * @node: a #WockyNode
* @name: the name of the child to add
* @ns: a namespace
*
- * Adds a #WockyXmppNode with the specified name to an already existing node,
+ * Adds a #WockyNode with the specified name to an already existing node,
* under the specified namespace. If the namespace is %NULL, this is equivalent
- * to wocky_xmpp_node_add_child().
+ * to wocky_node_add_child().
*
- * Returns: the newly added #WockyXmppNode.
+ * Returns: the newly added #WockyNode.
*/
-WockyXmppNode *
-wocky_xmpp_node_add_child_ns (WockyXmppNode *node, const gchar *name,
+WockyNode *
+wocky_node_add_child_ns (WockyNode *node, const gchar *name,
const gchar *ns)
{
- return wocky_xmpp_node_add_child_with_content_ns (node, name, NULL, ns);
+ return wocky_node_add_child_with_content_ns (node, name, NULL, ns);
}
/**
- * wocky_xmpp_node_add_child_with_content:
- * @node: a #WockyXmppNode
+ * wocky_node_add_child_with_content:
+ * @node: a #WockyNode
* @name: the name of the child to add
* @content: the content of the child to add
*
- * Adds a #WockyXmppNode with the specified name and containing the
+ * Adds a #WockyNode with the specified name and containing the
* specified content to an already existing node.
*
- * Returns: the newly added #WockyXmppNode.
+ * Returns: the newly added #WockyNode.
*/
-WockyXmppNode *
-wocky_xmpp_node_add_child_with_content (WockyXmppNode *node,
+WockyNode *
+wocky_node_add_child_with_content (WockyNode *node,
const gchar *name, const char *content)
{
- return wocky_xmpp_node_add_child_with_content_ns (node, name,
+ return wocky_node_add_child_with_content_ns (node, name,
content, NULL);
}
/**
- * wocky_xmpp_node_add_child_with_content_ns:
- * @node: a #WockyXmppNode
+ * wocky_node_add_child_with_content_ns:
+ * @node: a #WockyNode
* @name: the name of the child to add
* @content: the content of the child to add
* @ns: a namespace
*
- * Adds a #WockyXmppNode with the specified name and the specified content
+ * Adds a #WockyNode with the specified name and the specified content
* to an already existing node, under the specified namespace.
* If the namespace is %NULL, this is equivalent to
- * wocky_xmpp_node_add_child_with_content().
+ * wocky_node_add_child_with_content().
*
- * Returns: the newly added #WockyXmppNode.
+ * Returns: the newly added #WockyNode.
*/
-WockyXmppNode *
-wocky_xmpp_node_add_child_with_content_ns (WockyXmppNode *node,
+WockyNode *
+wocky_node_add_child_with_content_ns (WockyNode *node,
const gchar *name, const gchar *content, const gchar *ns)
{
- WockyXmppNode *result = wocky_xmpp_node_new (name, ns);
+ WockyNode *result = wocky_node_new (name, ns);
if (result->ns == 0)
result->ns = node->ns;
- wocky_xmpp_node_set_content (result, content);
+ wocky_node_set_content (result, content);
node->children = g_slist_append (node->children, result);
return result;
}
/**
- * wocky_xmpp_node_set_ns:
- * @node: a #WockyXmppNode
+ * wocky_node_set_ns:
+ * @node: a #WockyNode
* @ns: a namespace
*
- * Sets the namespace of a #WockyXmppNode.
+ * Sets the namespace of a #WockyNode.
*/
void
-wocky_xmpp_node_set_ns (WockyXmppNode *node, const gchar *ns)
+wocky_node_set_ns (WockyNode *node, const gchar *ns)
{
- wocky_xmpp_node_set_ns_q (node, g_quark_from_string (ns));
+ wocky_node_set_ns_q (node, g_quark_from_string (ns));
}
void
-wocky_xmpp_node_set_ns_q (WockyXmppNode *node, GQuark ns)
+wocky_node_set_ns_q (WockyNode *node, GQuark ns)
{
node->ns = ns;
}
/**
- * wocky_xmpp_node_get_ns:
- * @node: a #WockyXmppNode
+ * wocky_node_get_ns:
+ * @node: a #WockyNode
*
- * Gets the namespace of a #WockyXmppNode
+ * Gets the namespace of a #WockyNode
*
* Returns: a string containing the namespace of the node.
*/
const gchar *
-wocky_xmpp_node_get_ns (WockyXmppNode *node)
+wocky_node_get_ns (WockyNode *node)
{
return g_quark_to_string (node->ns);
}
gboolean
-wocky_xmpp_node_has_ns (WockyXmppNode *node, const gchar *ns)
+wocky_node_has_ns (WockyNode *node, const gchar *ns)
{
- return wocky_xmpp_node_has_ns_q (node, g_quark_try_string (ns));
+ return wocky_node_has_ns_q (node, g_quark_try_string (ns));
}
gboolean
-wocky_xmpp_node_has_ns_q (WockyXmppNode *node, GQuark ns)
+wocky_node_has_ns_q (WockyNode *node, GQuark ns)
{
return node->ns == ns;
}
/**
- * wocky_xmpp_node_get_language:
- * @node: a #WockyXmppNode
+ * wocky_node_get_language:
+ * @node: a #WockyNode
*
- * Gets the language of a #WockyXmppNode
+ * Gets the language of a #WockyNode
*
* Returns: a string containing the language of the node.
*/
const gchar *
-wocky_xmpp_node_get_language (WockyXmppNode *node)
+wocky_node_get_language (WockyNode *node)
{
g_return_val_if_fail (node != NULL, NULL);
return node->language;
}
/**
- * wocky_xmpp_node_set_language_n:
- * @node: a #WockyXmppNode
+ * wocky_node_set_language_n:
+ * @node: a #WockyNode
* @lang: a language
* @lang_size: the length of @lang, in bytes.
*
- * Sets the language of a #WockyXmppNode.
+ * Sets the language of a #WockyNode.
*/
void
-wocky_xmpp_node_set_language_n (WockyXmppNode *node, const gchar *lang,
+wocky_node_set_language_n (WockyNode *node, const gchar *lang,
gsize lang_size)
{
g_free (node->language);
@@ -774,45 +774,45 @@ wocky_xmpp_node_set_language_n (WockyXmppNode *node, const gchar *lang,
}
/**
- * wocky_xmpp_node_set_language:
- * @node: a #WockyXmppNode
+ * wocky_node_set_language:
+ * @node: a #WockyNode
* @lang: a %NULL-terminated string containing the language
*
- * Sets the language of a #WockyXmppNode.
+ * Sets the language of a #WockyNode.
*/
void
-wocky_xmpp_node_set_language (WockyXmppNode *node, const gchar *lang)
+wocky_node_set_language (WockyNode *node, const gchar *lang)
{
gsize lang_size = 0;
if (lang != NULL) {
lang_size = strlen (lang);
}
- wocky_xmpp_node_set_language_n (node, lang, lang_size);
+ wocky_node_set_language_n (node, lang, lang_size);
}
/**
- * wocky_xmpp_node_set_content:
- * @node: a #WockyXmppNode
+ * wocky_node_set_content:
+ * @node: a #WockyNode
* @content: the content to set to the node
*
- * Sets the content of a #WockyXmppNode.
+ * Sets the content of a #WockyNode.
*/
void
-wocky_xmpp_node_set_content (WockyXmppNode *node, const gchar *content)
+wocky_node_set_content (WockyNode *node, const gchar *content)
{
g_free (node->content);
node->content = g_strdup (content);
}
/**
- * wocky_xmpp_node_append_content:
- * @node: a #WockyXmppNode
+ * wocky_node_append_content:
+ * @node: a #WockyNode
* @content: the content to append to the node
*
- * Appends some content to the content of a #WockyXmppNode.
+ * Appends some content to the content of a #WockyNode.
*/
void
-wocky_xmpp_node_append_content (WockyXmppNode *node,
+wocky_node_append_content (WockyNode *node,
const gchar *content)
{
gchar *t = node->content;
@@ -821,16 +821,16 @@ wocky_xmpp_node_append_content (WockyXmppNode *node,
}
/**
- * wocky_xmpp_node_append_content_n:
- * @node: a #WockyXmppNode
+ * wocky_node_append_content_n:
+ * @node: a #WockyNode
* @content: the content to append to the node
* @size: the size of the content to append
*
* Appends a specified number of content bytes to the content of a
- * #WockyXmppNode.
+ * #WockyNode.
*/
void
-wocky_xmpp_node_append_content_n (WockyXmppNode *node, const gchar *content,
+wocky_node_append_content_n (WockyNode *node, const gchar *content,
gsize size)
{
gsize csize = node->content != NULL ? strlen (node->content) : 0;
@@ -860,7 +860,7 @@ attribute_to_string (const gchar *key, const gchar *value,
}
static gboolean
-node_to_string (WockyXmppNode *node,
+node_to_string (WockyNode *node,
GQuark parent_ns,
const gchar *prefix,
GString *str)
@@ -872,11 +872,11 @@ node_to_string (WockyXmppNode *node,
if (parent_ns != node->ns)
{
- const gchar *ns = wocky_xmpp_node_get_ns (node);
+ const gchar *ns = wocky_node_get_ns (node);
g_string_append_printf (str, " xmlns='%s'", ns);
}
- wocky_xmpp_node_each_attribute (node, attribute_to_string, str);
+ wocky_node_each_attribute (node, attribute_to_string, str);
g_string_append_c (str, '\n');
nprefix = g_strdup_printf ("%s ", prefix);
@@ -892,16 +892,16 @@ node_to_string (WockyXmppNode *node,
}
/**
- * wocky_xmpp_node_to_string:
- * @node: a #WockyXmppNode
+ * wocky_node_to_string:
+ * @node: a #WockyNode
*
- * Obtains a string representation of a #WockyXmppNode.
+ * Obtains a string representation of a #WockyNode.
*
* Returns: a newly allocated string containing a serialization of
* the node.
*/
gchar *
-wocky_xmpp_node_to_string (WockyXmppNode *node)
+wocky_node_to_string (WockyNode *node)
{
GString *str;
gchar *result;
@@ -916,17 +916,17 @@ wocky_xmpp_node_to_string (WockyXmppNode *node)
}
/**
- * wocky_xmpp_node_equal:
- * @node0: a #WockyXmppNode
- * @node1: a #WockyXmppNode to compare to @node0
+ * wocky_node_equal:
+ * @node0: a #WockyNode
+ * @node1: a #WockyNode to compare to @node0
*
- * Compares two #WockyXmppNode<!-- -->s for equality.
+ * Compares two #WockyNode<!-- -->s for equality.
*
* Returns: %TRUE if the two nodes are equal.
*/
gboolean
-wocky_xmpp_node_equal (WockyXmppNode *node0,
- WockyXmppNode *node1)
+wocky_node_equal (WockyNode *node0,
+ WockyNode *node1)
{
GSList *l0, *l1;
@@ -951,7 +951,7 @@ wocky_xmpp_node_equal (WockyXmppNode *node0,
Attribute *a = (Attribute *) l0->data;
const gchar *c;
- c = wocky_xmpp_node_get_attribute_ns (node1, a->key,
+ c = wocky_node_get_attribute_ns (node1, a->key,
a->ns == 0 ? NULL : g_quark_to_string (a->ns));
if (wocky_strdiff (a->value, c))
@@ -963,10 +963,10 @@ wocky_xmpp_node_equal (WockyXmppNode *node0,
l0 != NULL && l1 != NULL;
l0 = g_slist_next (l0), l1 = g_slist_next (l1))
{
- WockyXmppNode *c0 = (WockyXmppNode *) l0->data;
- WockyXmppNode *c1 = (WockyXmppNode *) l1->data;
+ WockyNode *c0 = (WockyNode *) l0->data;
+ WockyNode *c1 = (WockyNode *) l1->data;
- if (!wocky_xmpp_node_equal (c0, c1))
+ if (!wocky_node_equal (c0, c1))
return FALSE;
}
@@ -977,15 +977,15 @@ wocky_xmpp_node_equal (WockyXmppNode *node0,
}
/**
- * wocky_xmpp_node_is_superset:
- * @node: the #WockyXmppNode to test
+ * wocky_node_is_superset:
+ * @node: the #WockyNode to test
* @pattern: the supposed subset
*
* Returns: %TRUE if @node is a superset of @subset.
*/
gboolean
-wocky_xmpp_node_is_superset (WockyXmppNode *node,
- WockyXmppNode *subset)
+wocky_node_is_superset (WockyNode *node,
+ WockyNode *subset)
{
GSList *l;
@@ -1017,7 +1017,7 @@ wocky_xmpp_node_is_superset (WockyXmppNode *node,
Attribute *a = (Attribute *) l->data;
const gchar *c;
- c = wocky_xmpp_node_get_attribute_ns (node, a->key,
+ c = wocky_node_get_attribute_ns (node, a->key,
a->ns == 0 ? NULL : g_quark_to_string (a->ns));
if (wocky_strdiff (a->value, c))
@@ -1027,13 +1027,13 @@ wocky_xmpp_node_is_superset (WockyXmppNode *node,
/* Recursively check children; order doesn't matter */
for (l = subset->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *pattern_child = (WockyXmppNode *) l->data;
- WockyXmppNode *node_child;
+ WockyNode *pattern_child = (WockyNode *) l->data;
+ WockyNode *node_child;
- node_child = wocky_xmpp_node_get_child_ns (node, pattern_child->name,
- wocky_xmpp_node_get_ns (pattern_child));
+ node_child = wocky_node_get_child_ns (node, pattern_child->name,
+ wocky_node_get_ns (pattern_child));
- if (!wocky_xmpp_node_is_superset (node_child, pattern_child))
+ if (!wocky_node_is_superset (node_child, pattern_child))
return FALSE;
}
@@ -1041,7 +1041,7 @@ wocky_xmpp_node_is_superset (WockyXmppNode *node,
}
/**
- * wocky_xmpp_node_iter_init:
+ * wocky_node_iter_init:
* @iter: unitialized iterator
* @node: Node whose children to iterate over
* @name: Name to filter on or %NULL
@@ -1050,21 +1050,21 @@ wocky_xmpp_node_is_superset (WockyXmppNode *node,
* Initializes an iterator that can be used to iterate over the children of
* @node, filtered by @name and @ns
* |[
- * WockyXmppNodeIter iter;
- * WockyXmppNode *child;
+ * WockyNodeIter iter;
+ * WockyNode *child;
*
- * wocky_xmpp_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
+ * wocky_node_iter_init (&iter, wocky_stanza_get_top_node (stanza),
* "payload-type",
* WOCKY_XMPP_NS_JINGLE_RTP);
- * while (wocky_xmpp_node_iter_next (iter, &child))
+ * while (wocky_node_iter_next (iter, &child))
* {
* /<!-- -->* do something with the child *<!-- -->/
* }
* ]|
*/
void
-wocky_xmpp_node_iter_init (WockyXmppNodeIter *iter,
- WockyXmppNode *node,
+wocky_node_iter_init (WockyNodeIter *iter,
+ WockyNode *node,
const gchar *name,
const gchar *ns)
{
@@ -1074,8 +1074,8 @@ wocky_xmpp_node_iter_init (WockyXmppNodeIter *iter,
}
/**
- * wocky_xmpp_node_iter_next:
- * @iter: an initialized WockyXmppNodeIter
+ * wocky_node_iter_next:
+ * @iter: an initialized WockyNodeIter
* @next: a location to store the next child
*
* Advances iter to the next child that matches its filter. if %FALSE is
@@ -1085,12 +1085,12 @@ wocky_xmpp_node_iter_init (WockyXmppNodeIter *iter,
*
*/
gboolean
-wocky_xmpp_node_iter_next (WockyXmppNodeIter *iter,
- WockyXmppNode **next)
+wocky_node_iter_next (WockyNodeIter *iter,
+ WockyNode **next)
{
while (iter->pending != NULL)
{
- WockyXmppNode *ln = (WockyXmppNode *) iter->pending->data;
+ WockyNode *ln = (WockyNode *) iter->pending->data;
iter->pending = g_slist_next (iter->pending);
@@ -1110,19 +1110,19 @@ wocky_xmpp_node_iter_next (WockyXmppNodeIter *iter,
}
void
-wocky_xmpp_node_add_build (WockyXmppNode *node,
+wocky_node_add_build (WockyNode *node,
WockyNodeBuildTag first_tag,
...)
{
va_list ap;
va_start (ap, first_tag);
- wocky_xmpp_node_add_build_va (node, ap);
+ wocky_node_add_build_va (node, ap);
va_end (ap);
}
void
-wocky_xmpp_node_add_build_va (WockyXmppNode *node, va_list ap)
+wocky_node_add_build_va (WockyNode *node, va_list ap)
{
GSList *stack = NULL;
WockyNodeBuildTag arg;
@@ -1140,17 +1140,17 @@ wocky_xmpp_node_add_build_va (WockyXmppNode *node, va_list ap)
g_assert (key != NULL);
g_assert (value != NULL);
- wocky_xmpp_node_set_attribute (stack->data, key, value);
+ wocky_node_set_attribute (stack->data, key, value);
}
break;
- case WOCKY_NODE:
+ case WOCKY_NODE_START:
{
gchar *name = va_arg (ap, gchar *);
- WockyXmppNode *child;
+ WockyNode *child;
g_assert (name != NULL);
- child = wocky_xmpp_node_add_child (stack->data, name);
+ child = wocky_node_add_child (stack->data, name);
stack = g_slist_prepend (stack, child);
}
break;
@@ -1160,7 +1160,7 @@ wocky_xmpp_node_add_build_va (WockyXmppNode *node, va_list ap)
gchar *txt = va_arg (ap, gchar *);
g_assert (txt != NULL);
- wocky_xmpp_node_set_content (stack->data, txt);
+ wocky_node_set_content (stack->data, txt);
}
break;
@@ -1169,7 +1169,7 @@ wocky_xmpp_node_add_build_va (WockyXmppNode *node, va_list ap)
gchar *ns = va_arg (ap, gchar *);
g_assert (ns != NULL);
- wocky_xmpp_node_set_ns (stack->data, ns);
+ wocky_node_set_ns (stack->data, ns);
}
break;
@@ -1183,7 +1183,7 @@ wocky_xmpp_node_add_build_va (WockyXmppNode *node, va_list ap)
case WOCKY_NODE_ASSIGN_TO:
{
- WockyXmppNode **dest = va_arg (ap, WockyXmppNode **);
+ WockyNode **dest = va_arg (ap, WockyNode **);
g_assert (dest != NULL);
*dest = stack->data;
@@ -1201,7 +1201,7 @@ wocky_xmpp_node_add_build_va (WockyXmppNode *node, va_list ap)
while (stack != NULL && stack->data != node)
{
- WockyXmppNode *unclosed = stack->data;
+ WockyNode *unclosed = stack->data;
g_string_append_printf (still_open, "</%s> ", unclosed->name);
stack = stack->next;
@@ -1215,25 +1215,25 @@ wocky_xmpp_node_add_build_va (WockyXmppNode *node, va_list ap)
}
/**
- * wocky_xmpp_node_init:
+ * wocky_node_init:
*
- * Initializes the caches used by #WockyXmppNode.
- * This should be always called before using #WockyXmppNode structs.
+ * Initializes the caches used by #WockyNode.
+ * This should be always called before using #WockyNode structs.
*/
void
-wocky_xmpp_node_init ()
+wocky_node_init ()
{
_init_user_prefix_table ();
_init_default_prefix_table ();
}
/**
- * wocky_xmpp_node_deinit:
+ * wocky_node_deinit:
*
- * Releases all the resources used by the #WockyXmppNode caches.
+ * Releases all the resources used by the #WockyNode caches.
*/
void
-wocky_xmpp_node_deinit ()
+wocky_node_deinit ()
{
g_hash_table_unref (user_ns_prefixes);
g_hash_table_unref (default_ns_prefixes);
diff --git a/wocky/wocky-node.h b/wocky/wocky-node.h
new file mode 100644
index 0000000..e190036
--- /dev/null
+++ b/wocky/wocky-node.h
@@ -0,0 +1,206 @@
+/*
+ * wocky-node.h - Header for Wocky xmpp nodes
+ * Copyright (C) 2006, 2010 Collabora Ltd.
+ * @author Sjoerd Simons <sjoerd@luon.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __WOCKY__NODE_H__
+#define __WOCKY__NODE_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+ WOCKY_NODE_START = '(',
+ WOCKY_NODE_TEXT = '$',
+ WOCKY_NODE_END = ')',
+ WOCKY_NODE_ATTRIBUTE = '@',
+ WOCKY_NODE_XMLNS = ':',
+ WOCKY_NODE_ASSIGN_TO = '*'
+} WockyNodeBuildTag;
+
+typedef struct _WockyNode WockyNode;
+
+struct _WockyNode {
+ gchar *name;
+ gchar *content;
+
+ /* Private */
+ gchar *language;
+ GQuark ns;
+ GSList *attributes;
+ GSList *children;
+};
+
+/**
+ * wocky_node_each_attr_func:
+ * @key: the attribute's key
+ * @value: the attribute's value
+ * @pref: the attribute's prefix
+ * @ns: the attribute's namespace
+ * @user_data: user data passed to wocky_node_each_attribute()
+ *
+ * Specifies the type of functions passed to wocky_node_each_attribute().
+ *
+ * Returns: %FALSE to stop further attributes from being examined.
+ */
+typedef gboolean (*wocky_node_each_attr_func) (const gchar *key,
+ const gchar *value, const gchar *pref, const gchar *ns, gpointer user_data);
+
+/**
+ * wocky_node_each_child_func:
+ * @node: a #WockyNode
+ * @user_data: user data passed to wocky_node_each_child()
+ *
+ * Specifies the type of functions passed to wocky_node_each_child().
+ *
+ * Returns: %FALSE to stop further children from being examined.
+ */
+typedef gboolean (*wocky_node_each_child_func) (WockyNode *node,
+ gpointer user_data);
+
+void wocky_node_each_attribute (WockyNode *node,
+ wocky_node_each_attr_func func, gpointer user_data);
+
+void wocky_node_each_child (WockyNode *node,
+ wocky_node_each_child_func func, gpointer user_data);
+
+const gchar *wocky_node_get_attribute (WockyNode *node,
+ const gchar *key);
+
+const gchar *wocky_node_get_attribute_ns (WockyNode *node,
+ const gchar *key, const gchar *ns);
+
+void wocky_node_set_attribute (WockyNode *node, const gchar *key,
+ const gchar *value);
+
+void wocky_node_set_attribute_ns (WockyNode *node,
+ const gchar *key, const gchar *value, const gchar *ns);
+
+/* Set attribute with the given size for the value */
+void wocky_node_set_attribute_n (WockyNode *node, const gchar *key,
+ const gchar *value, gsize value_size);
+
+void wocky_node_set_attribute_n_ns (WockyNode *node,
+ const gchar *key, const gchar *value, gsize value_size, const gchar *ns);
+
+/* namespaced attributes: when we want to override autogenerated prefixes */
+const gchar *wocky_node_attribute_ns_get_prefix_from_urn (const gchar *urn);
+const gchar *wocky_node_attribute_ns_get_prefix_from_quark (GQuark ns);
+void wocky_node_attribute_ns_set_prefix (GQuark ns, const gchar *prefix);
+
+/* Getting children */
+WockyNode *wocky_node_get_child (WockyNode *node,
+ const gchar *name);
+
+WockyNode *wocky_node_get_child_ns (WockyNode *node,
+ const gchar *name, const gchar *ns);
+
+WockyNode *wocky_node_get_first_child (WockyNode *node);
+
+/* Getting content from children */
+const gchar *wocky_node_get_content_from_child (WockyNode *node,
+ const gchar *name);
+
+const gchar *wocky_node_get_content_from_child_ns (WockyNode *node,
+ const gchar *name,
+ const gchar *ns);
+
+/* Creating child nodes */
+WockyNode *wocky_node_add_child (WockyNode *node,
+ const gchar *name);
+
+WockyNode *wocky_node_add_child_ns (WockyNode *node,
+ const gchar *name, const gchar *ns);
+
+WockyNode *wocky_node_add_child_with_content (WockyNode *node,
+ const gchar *name, const char *content);
+
+WockyNode *wocky_node_add_child_with_content_ns (
+ WockyNode *node, const gchar *name, const gchar *content,
+ const gchar *ns);
+
+/* Setting/Getting namespaces */
+void wocky_node_set_ns (WockyNode *node, const gchar *ns);
+void wocky_node_set_ns_q (WockyNode *node, GQuark ns);
+const gchar *wocky_node_get_ns (WockyNode *node);
+gboolean wocky_node_has_ns (WockyNode *node, const gchar *ns);
+gboolean wocky_node_has_ns_q (WockyNode *node, GQuark ns);
+
+/* Setting/Getting language */
+const gchar *wocky_node_get_language (WockyNode *node);
+void wocky_node_set_language (WockyNode *node, const gchar *lang);
+void wocky_node_set_language_n (WockyNode *node, const gchar *lang,
+ gsize lang_size);
+
+
+/* Setting or adding content */
+void wocky_node_set_content (WockyNode *node, const gchar *content);
+void wocky_node_append_content (WockyNode *node,
+ const gchar *content);
+
+void wocky_node_append_content_n (WockyNode *node,
+ const gchar *content, gsize size);
+
+/* Return a reading friendly representation of a node and its children.
+ * Should be use for debugging purpose only. */
+gchar *wocky_node_to_string (WockyNode *node);
+
+/* Create a new standalone node, usually only used by the stanza object */
+WockyNode *wocky_node_new (const char *name, const gchar *ns);
+
+/* Frees the node and all it's children! */
+void wocky_node_free (WockyNode *node);
+
+/* Compare two nodes and all their children */
+gboolean wocky_node_equal (WockyNode *node0,
+ WockyNode *node1);
+
+gboolean wocky_node_is_superset (WockyNode *node,
+ WockyNode *subset);
+
+/* Iterate over a nodes children */
+typedef struct {
+ GSList *pending;
+ const gchar *name;
+ GQuark ns;
+} WockyNodeIter;
+
+void wocky_node_iter_init (WockyNodeIter *iter,
+ WockyNode *node,
+ const gchar *name,
+ const gchar *ns);
+
+gboolean wocky_node_iter_next (WockyNodeIter *iter,
+ WockyNode **next);
+
+
+void wocky_node_add_build (WockyNode *node,
+ WockyNodeBuildTag first_tag,
+ ...);
+
+void wocky_node_add_build_va (WockyNode *node,
+ va_list va);
+
+void wocky_node_init (void);
+void wocky_node_deinit (void);
+
+G_END_DECLS
+
+#endif /* #ifndef __WOCKY__NODE_H__*/
diff --git a/wocky/wocky-pep-service.c b/wocky/wocky-pep-service.c
index e0ca1e7..4d5ad89 100644
--- a/wocky/wocky-pep-service.c
+++ b/wocky/wocky-pep-service.c
@@ -214,7 +214,7 @@ msg_event_cb (WockyPorter *porter,
const gchar *from;
WockyBareContact *contact;
- from = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ from = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"from");
if (from == NULL)
{
@@ -345,7 +345,7 @@ wocky_pep_service_get_finish (WockyPepService *self,
WockyStanza *
wocky_pep_service_make_publish_stanza (WockyPepService *self,
- WockyXmppNode **item)
+ WockyNode **item)
{
WockyPepServicePrivate *priv = self->priv;
diff --git a/wocky/wocky-pep-service.h b/wocky/wocky-pep-service.h
index 1fccb07..8a7f395 100644
--- a/wocky/wocky-pep-service.h
+++ b/wocky/wocky-pep-service.h
@@ -77,7 +77,7 @@ WockyStanza * wocky_pep_service_get_finish (WockyPepService *pep,
GError **error);
WockyStanza * wocky_pep_service_make_publish_stanza (WockyPepService *pep,
- WockyXmppNode **item);
+ WockyNode **item);
G_END_DECLS
diff --git a/wocky/wocky-porter.c b/wocky/wocky-porter.c
index ca844fa..760f601 100644
--- a/wocky/wocky-porter.c
+++ b/wocky/wocky-porter.c
@@ -791,7 +791,7 @@ handle_iq_reply (WockyPorter *self,
StanzaIqHandler *handler;
gboolean ret = FALSE;
- id = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (reply), "id");
+ id = wocky_node_get_attribute (wocky_stanza_get_top_node (reply), "id");
if (id == NULL)
{
DEBUG ("Ignoring reply without IQ id");
@@ -806,7 +806,7 @@ handle_iq_reply (WockyPorter *self,
return FALSE;
}
- from = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (reply),
+ from = wocky_node_get_attribute (wocky_stanza_get_top_node (reply),
"from");
/* FIXME: If handler->recipient is NULL, we should check if the 'from' is
* either NULL, our bare jid or our full jid. */
@@ -861,7 +861,7 @@ handle_stanza (WockyPorter *self,
/* The from attribute of the stanza need not always be present, for example
* when receiving roster items, so don't enforce it. */
- from = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ from = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"from");
if (from != NULL)
@@ -899,7 +899,7 @@ handle_stanza (WockyPorter *self,
}
/* Check if the stanza matches the pattern */
- if (!wocky_xmpp_node_is_superset (wocky_stanza_get_top_node (stanza),
+ if (!wocky_node_is_superset (wocky_stanza_get_top_node (stanza),
wocky_stanza_get_top_node (handler->match)))
continue;
@@ -1335,7 +1335,7 @@ compare_handler (StanzaHandler *a,
* @user_data: Passed to @callback.
* @Varargs: a wocky_stanza_build() specification. The handler
* will match a stanza only if the stanza received is a superset of the one
- * passed to this function, as per wocky_xmpp_node_is_superset().
+ * passed to this function, as per wocky_node_is_superset().
*
* Register a new stanza handler.
* Stanza handlers are called when the Porter receives a new stanza matching
@@ -1520,7 +1520,7 @@ wocky_porter_send_iq_async (WockyPorter *self,
g_assert (stanza != NULL && wocky_stanza_get_top_node (stanza) != NULL);
- node = wocky_xmpp_node_to_string (wocky_stanza_get_top_node (stanza));
+ node = wocky_node_to_string (wocky_stanza_get_top_node (stanza));
g_simple_async_report_error_in_idle (G_OBJECT (self), callback,
user_data, WOCKY_PORTER_ERROR,
WOCKY_PORTER_ERROR_CLOSING,
@@ -1539,7 +1539,7 @@ wocky_porter_send_iq_async (WockyPorter *self,
sub_type != WOCKY_STANZA_SUB_TYPE_SET)
goto wrong_stanza;
- recipient = wocky_xmpp_node_get_attribute (
+ recipient = wocky_node_get_attribute (
wocky_stanza_get_top_node (stanza), "to");
/* Set an unique ID */
@@ -1550,7 +1550,7 @@ wocky_porter_send_iq_async (WockyPorter *self,
}
while (g_hash_table_lookup (priv->iq_reply_handlers, id) != NULL);
- wocky_xmpp_node_set_attribute (wocky_stanza_get_top_node (stanza), "id", id);
+ wocky_node_set_attribute (wocky_stanza_get_top_node (stanza), "id", id);
result = g_simple_async_result_new (G_OBJECT (self),
callback, user_data, wocky_porter_send_iq_finish);
diff --git a/wocky/wocky-pubsub-helpers.c b/wocky/wocky-pubsub-helpers.c
index 92a0292..e99ea8d 100644
--- a/wocky/wocky-pubsub-helpers.c
+++ b/wocky/wocky-pubsub-helpers.c
@@ -40,20 +40,20 @@ WockyStanza *
wocky_pubsub_make_publish_stanza (
const gchar *service,
const gchar *node,
- WockyXmppNode **pubsub_out,
- WockyXmppNode **publish_out,
- WockyXmppNode **item_out)
+ WockyNode **pubsub_out,
+ WockyNode **publish_out,
+ WockyNode **item_out)
{
WockyStanza *stanza;
- WockyXmppNode *publish, *item;
+ WockyNode *publish, *item;
g_return_val_if_fail (node != NULL, NULL);
stanza = wocky_pubsub_make_stanza (service, WOCKY_STANZA_SUB_TYPE_SET,
WOCKY_XMPP_NS_PUBSUB, "publish", pubsub_out, &publish);
- wocky_xmpp_node_set_attribute (publish, "node", node);
- item = wocky_xmpp_node_add_child (publish, "item");
+ wocky_node_set_attribute (publish, "node", node);
+ item = wocky_node_add_child (publish, "item");
if (publish_out != NULL)
*publish_out = publish;
@@ -83,11 +83,11 @@ wocky_pubsub_make_stanza (
WockyStanzaSubType sub_type,
const gchar *pubsub_ns,
const gchar *action_name,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **action_node)
+ WockyNode **pubsub_node,
+ WockyNode **action_node)
{
WockyStanza *stanza;
- WockyXmppNode *pubsub, *action;
+ WockyNode *pubsub, *action;
g_assert (pubsub_ns != NULL);
g_assert (action_name != NULL);
@@ -117,14 +117,14 @@ static gboolean
get_pubsub_child_node (WockyStanza *reply,
const gchar *pubsub_ns,
const gchar *child_name,
- WockyXmppNode **child_out,
+ WockyNode **child_out,
GError **error)
{
- WockyXmppNode *n;
+ WockyNode *n;
g_return_val_if_fail (reply != NULL, FALSE);
- n = wocky_xmpp_node_get_child_ns (
+ n = wocky_node_get_child_ns (
wocky_stanza_get_top_node (reply), "pubsub", pubsub_ns);
if (n == NULL)
@@ -135,7 +135,7 @@ get_pubsub_child_node (WockyStanza *reply,
return FALSE;
}
- n = wocky_xmpp_node_get_child (n, child_name);
+ n = wocky_node_get_child (n, child_name);
if (n == NULL)
{
@@ -157,7 +157,7 @@ wocky_pubsub_distill_iq_reply_internal (GObject *source,
const gchar *pubsub_ns,
const gchar *child_name,
gboolean body_optional,
- WockyXmppNode **child_out,
+ WockyNode **child_out,
GError **error)
{
WockyStanza *reply;
@@ -230,7 +230,7 @@ wocky_pubsub_distill_iq_reply (GObject *source,
GAsyncResult *res,
const gchar *pubsub_ns,
const gchar *child_name,
- WockyXmppNode **child_out,
+ WockyNode **child_out,
GError **error)
{
return wocky_pubsub_distill_iq_reply_internal (source, res, pubsub_ns,
@@ -290,7 +290,7 @@ wocky_pubsub_distill_ambivalent_iq_reply (GObject *source,
GAsyncResult *res,
const gchar *pubsub_ns,
const gchar *child_name,
- WockyXmppNode **child_out,
+ WockyNode **child_out,
GError **error)
{
return wocky_pubsub_distill_iq_reply_internal (source, res, pubsub_ns,
diff --git a/wocky/wocky-pubsub-helpers.h b/wocky/wocky-pubsub-helpers.h
index d8d3584..f9e7acd 100644
--- a/wocky/wocky-pubsub-helpers.h
+++ b/wocky/wocky-pubsub-helpers.h
@@ -30,28 +30,28 @@ WockyStanza *wocky_pubsub_make_stanza (
WockyStanzaSubType sub_type,
const gchar *pubsub_ns,
const gchar *action_name,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **action_node);
+ WockyNode **pubsub_node,
+ WockyNode **action_node);
WockyStanza *wocky_pubsub_make_publish_stanza (
const gchar *service,
const gchar *node,
- WockyXmppNode **pubsub_out,
- WockyXmppNode **publish_out,
- WockyXmppNode **item_out);
+ WockyNode **pubsub_out,
+ WockyNode **publish_out,
+ WockyNode **item_out);
gboolean wocky_pubsub_distill_iq_reply (GObject *source,
GAsyncResult *res,
const gchar *pubsub_ns,
const gchar *child_name,
- WockyXmppNode **child_out,
+ WockyNode **child_out,
GError **error);
gboolean wocky_pubsub_distill_ambivalent_iq_reply (GObject *source,
GAsyncResult *res,
const gchar *pubsub_ns,
const gchar *child_name,
- WockyXmppNode **child_out,
+ WockyNode **child_out,
GError **error);
gboolean wocky_pubsub_distill_void_iq_reply (GObject *source,
diff --git a/wocky/wocky-pubsub-node-protected.h b/wocky/wocky-pubsub-node-protected.h
index f4e3ba2..c06d710 100644
--- a/wocky/wocky-pubsub-node-protected.h
+++ b/wocky/wocky-pubsub-node-protected.h
@@ -28,8 +28,8 @@
typedef void (*WockyPubsubNodeEventHandler) (
WockyPubsubNode *self,
WockyStanza *event_stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *action_node);
+ WockyNode *event_node,
+ WockyNode *action_node);
typedef struct {
const gchar *action;
@@ -45,33 +45,33 @@ WockyPorter *wocky_pubsub_node_get_porter (WockyPubsubNode *self);
WockyStanza *wocky_pubsub_node_make_subscribe_stanza (WockyPubsubNode *self,
const gchar *jid,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **subscribe_node);
+ WockyNode **pubsub_node,
+ WockyNode **subscribe_node);
WockyStanza *wocky_pubsub_node_make_unsubscribe_stanza (
WockyPubsubNode *self,
const gchar *jid,
const gchar *subid,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **unsubscribe_node);
+ WockyNode **pubsub_node,
+ WockyNode **unsubscribe_node);
WockyStanza *wocky_pubsub_node_make_delete_stanza (
WockyPubsubNode *self,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **delete_node);
+ WockyNode **pubsub_node,
+ WockyNode **delete_node);
WockyStanza *wocky_pubsub_node_make_list_subscribers_stanza (
WockyPubsubNode *self,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **subscriptions_node);
+ WockyNode **pubsub_node,
+ WockyNode **subscriptions_node);
WockyStanza *wocky_pubsub_node_make_list_affiliates_stanza (
WockyPubsubNode *self,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **affiliations_node);
+ WockyNode **pubsub_node,
+ WockyNode **affiliations_node);
GList *wocky_pubsub_node_parse_affiliations (
WockyPubsubNode *self,
- WockyXmppNode *affiliations_node);
+ WockyNode *affiliations_node);
#endif /* WOCKY_PUBSUB_NODE_PROTECTED_H */
diff --git a/wocky/wocky-pubsub-node.c b/wocky/wocky-pubsub-node.c
index 9f0c362..affdda0 100644
--- a/wocky/wocky-pubsub-node.c
+++ b/wocky/wocky-pubsub-node.c
@@ -171,8 +171,8 @@ static void
wocky_pubsub_node_emit_event_received (
WockyPubsubNode *self,
WockyStanza *event_stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *items_node,
+ WockyNode *event_node,
+ WockyNode *items_node,
GList *items)
{
g_signal_emit (self, signals[SIG_EVENT_RECEIVED], 0, event_stanza,
@@ -183,8 +183,8 @@ static void
wocky_pubsub_node_emit_subscription_state_changed (
WockyPubsubNode *self,
WockyStanza *stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *subscription_node,
+ WockyNode *event_node,
+ WockyNode *subscription_node,
WockyPubsubSubscription *subscription)
{
g_signal_emit (self, signals[SIG_SUB_STATE_CHANGED], 0, stanza,
@@ -195,8 +195,8 @@ static void
wocky_pubsub_node_emit_deleted (
WockyPubsubNode *self,
WockyStanza *stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *delete_node)
+ WockyNode *event_node,
+ WockyNode *delete_node)
{
g_signal_emit (self, signals[SIG_DELETED], 0, stanza,
event_node, delete_node);
@@ -237,7 +237,7 @@ wocky_pubsub_node_class_init (
* @event_stanza: the message/event stanza in its entirity
* @event_node: the event node from the stanza
* @items_node: the items node from the stanza
- * @items: a list of WockyXmppNode *s for each item child of @items_node
+ * @items: a list of WockyNode *s for each item child of @items_node
*/
signals[SIG_EVENT_RECEIVED] = g_signal_new ("event-received", ctype,
0, 0, NULL, NULL,
@@ -280,16 +280,16 @@ wocky_pubsub_node_class_init (
static void
pubsub_node_handle_items_event (WockyPubsubNode *self,
WockyStanza *event_stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *items_node)
+ WockyNode *event_node,
+ WockyNode *items_node)
{
- WockyXmppNode *item_node;
+ WockyNode *item_node;
GQueue items = G_QUEUE_INIT;
- WockyXmppNodeIter iter;
+ WockyNodeIter iter;
- wocky_xmpp_node_iter_init (&iter, items_node, "item", NULL);
+ wocky_node_iter_init (&iter, items_node, "item", NULL);
- while (wocky_xmpp_node_iter_next (&iter, &item_node))
+ while (wocky_node_iter_next (&iter, &item_node))
g_queue_push_tail (&items, item_node);
DEBUG_STANZA (event_stanza, "extracted %u items", items.length);
@@ -302,8 +302,8 @@ pubsub_node_handle_items_event (WockyPubsubNode *self,
static void
pubsub_node_handle_subscription_event (WockyPubsubNode *self,
WockyStanza *event_stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *subscription_node)
+ WockyNode *event_node,
+ WockyNode *subscription_node)
{
WockyPubsubNodePrivate *priv = self->priv;
WockyPubsubSubscription *sub;
@@ -352,9 +352,9 @@ wocky_pubsub_node_get_name (WockyPubsubNode *self)
WockyStanza *
wocky_pubsub_node_make_publish_stanza (WockyPubsubNode *self,
- WockyXmppNode **pubsub_out,
- WockyXmppNode **publish_out,
- WockyXmppNode **item_out)
+ WockyNode **pubsub_out,
+ WockyNode **publish_out,
+ WockyNode **item_out)
{
WockyPubsubNodePrivate *priv = self->priv;
@@ -368,22 +368,22 @@ pubsub_node_make_action_stanza (WockyPubsubNode *self,
const gchar *pubsub_ns,
const gchar *action_name,
const gchar *jid,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **action_node)
+ WockyNode **pubsub_node,
+ WockyNode **action_node)
{
WockyPubsubNodePrivate *priv = self->priv;
WockyStanza *stanza;
- WockyXmppNode *action;
+ WockyNode *action;
g_assert (pubsub_ns != NULL);
g_assert (action_name != NULL);
stanza = wocky_pubsub_make_stanza (priv->service_jid, sub_type, pubsub_ns,
action_name, pubsub_node, &action);
- wocky_xmpp_node_set_attribute (action, "node", priv->name);
+ wocky_node_set_attribute (action, "node", priv->name);
if (jid != NULL)
- wocky_xmpp_node_set_attribute (action, "jid", jid);
+ wocky_node_set_attribute (action, "jid", jid);
if (action_node != NULL)
*action_node = action;
@@ -394,8 +394,8 @@ pubsub_node_make_action_stanza (WockyPubsubNode *self,
WockyStanza *
wocky_pubsub_node_make_subscribe_stanza (WockyPubsubNode *self,
const gchar *jid,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **subscribe_node)
+ WockyNode **pubsub_node,
+ WockyNode **subscribe_node)
{
/* TODO: when the connection/porter/session/something knows our own JID, we
* should provide an easy way to say “my bare JID” or “my full JID”. Could be
@@ -418,7 +418,7 @@ subscribe_cb (GObject *source,
WockyPubsubNode *self = WOCKY_PUBSUB_NODE (
g_async_result_get_source_object (user_data));
WockyPubsubNodePrivate *priv = self->priv;
- WockyXmppNode *subscription_node;
+ WockyNode *subscription_node;
WockyPubsubSubscription *sub = NULL;
GError *error = NULL;
@@ -499,11 +499,11 @@ WockyStanza *
wocky_pubsub_node_make_unsubscribe_stanza (WockyPubsubNode *self,
const gchar *jid,
const gchar *subid,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **unsubscribe_node)
+ WockyNode **pubsub_node,
+ WockyNode **unsubscribe_node)
{
WockyStanza *stanza;
- WockyXmppNode *unsubscribe;
+ WockyNode *unsubscribe;
/* TODO: when the connection/porter/session/something knows our own JID, we
* should provide an easy way to say “my bare JID” or “my full JID”. Could be
@@ -517,7 +517,7 @@ wocky_pubsub_node_make_unsubscribe_stanza (WockyPubsubNode *self,
pubsub_node, &unsubscribe);
if (subid != NULL)
- wocky_xmpp_node_set_attribute (unsubscribe, "subid", subid);
+ wocky_node_set_attribute (unsubscribe, "subid", subid);
if (unsubscribe_node != NULL)
*unsubscribe_node = unsubscribe;
@@ -619,8 +619,8 @@ delete_node_iq_cb (GObject *source,
WockyStanza *
wocky_pubsub_node_make_delete_stanza (
WockyPubsubNode *self,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **delete_node)
+ WockyNode **pubsub_node,
+ WockyNode **delete_node)
{
return pubsub_node_make_action_stanza (self, WOCKY_STANZA_SUB_TYPE_SET,
WOCKY_XMPP_NS_PUBSUB_OWNER, "delete", NULL, pubsub_node, delete_node);
@@ -662,8 +662,8 @@ wocky_pubsub_node_delete_finish (WockyPubsubNode *self,
WockyStanza *
wocky_pubsub_node_make_list_subscribers_stanza (
WockyPubsubNode *self,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **subscriptions_node)
+ WockyNode **pubsub_node,
+ WockyNode **subscriptions_node)
{
return pubsub_node_make_action_stanza (self, WOCKY_STANZA_SUB_TYPE_GET,
WOCKY_XMPP_NS_PUBSUB_OWNER, "subscriptions", NULL,
@@ -679,7 +679,7 @@ list_subscribers_cb (GObject *source,
WockyPubsubNode *self = WOCKY_PUBSUB_NODE (
g_async_result_get_source_object (user_data));
WockyPubsubNodePrivate *priv = self->priv;
- WockyXmppNode *subscriptions_node;
+ WockyNode *subscriptions_node;
GError *error = NULL;
if (wocky_pubsub_distill_iq_reply (source, res, WOCKY_XMPP_NS_PUBSUB_OWNER,
@@ -764,8 +764,8 @@ wocky_pubsub_node_list_subscribers_finish (
WockyStanza *
wocky_pubsub_node_make_list_affiliates_stanza (
WockyPubsubNode *self,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **affiliations_node)
+ WockyNode **pubsub_node,
+ WockyNode **affiliations_node)
{
return pubsub_node_make_action_stanza (self, WOCKY_STANZA_SUB_TYPE_GET,
WOCKY_XMPP_NS_PUBSUB_OWNER, "affiliations", NULL,
@@ -775,18 +775,18 @@ wocky_pubsub_node_make_list_affiliates_stanza (
GList *
wocky_pubsub_node_parse_affiliations (
WockyPubsubNode *self,
- WockyXmppNode *affiliations_node)
+ WockyNode *affiliations_node)
{
GQueue affs = G_QUEUE_INIT;
- WockyXmppNodeIter i;
- WockyXmppNode *n;
+ WockyNodeIter i;
+ WockyNode *n;
- wocky_xmpp_node_iter_init (&i, affiliations_node, "affiliation", NULL);
+ wocky_node_iter_init (&i, affiliations_node, "affiliation", NULL);
- while (wocky_xmpp_node_iter_next (&i, &n))
+ while (wocky_node_iter_next (&i, &n))
{
- const gchar *jid = wocky_xmpp_node_get_attribute (n, "jid");
- const gchar *affiliation = wocky_xmpp_node_get_attribute (n,
+ const gchar *jid = wocky_node_get_attribute (n, "jid");
+ const gchar *affiliation = wocky_node_get_attribute (n,
"affiliation");
gint state;
@@ -824,7 +824,7 @@ list_affiliates_cb (GObject *source,
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
WockyPubsubNode *self = WOCKY_PUBSUB_NODE (
g_async_result_get_source_object (user_data));
- WockyXmppNode *affiliations_node;
+ WockyNode *affiliations_node;
GError *error = NULL;
if (wocky_pubsub_distill_iq_reply (source, res, WOCKY_XMPP_NS_PUBSUB_OWNER,
diff --git a/wocky/wocky-pubsub-node.h b/wocky/wocky-pubsub-node.h
index ae54e34..0153264 100644
--- a/wocky/wocky-pubsub-node.h
+++ b/wocky/wocky-pubsub-node.h
@@ -64,9 +64,9 @@ GType wocky_pubsub_node_get_type (void);
const gchar * wocky_pubsub_node_get_name (WockyPubsubNode *self);
WockyStanza *wocky_pubsub_node_make_publish_stanza (WockyPubsubNode *self,
- WockyXmppNode **pubsub_out,
- WockyXmppNode **publish_out,
- WockyXmppNode **item_out);
+ WockyNode **pubsub_out,
+ WockyNode **publish_out,
+ WockyNode **item_out);
void wocky_pubsub_node_subscribe_async (WockyPubsubNode *self,
const gchar *jid,
diff --git a/wocky/wocky-pubsub-service-protected.h b/wocky/wocky-pubsub-service-protected.h
index 284d461..2aafa9c 100644
--- a/wocky/wocky-pubsub-service-protected.h
+++ b/wocky/wocky-pubsub-service-protected.h
@@ -26,25 +26,25 @@
WockyStanza *wocky_pubsub_service_create_retrieve_subscriptions_stanza (
WockyPubsubService *self,
WockyPubsubNode *node,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **subscriptions_node);
+ WockyNode **pubsub_node,
+ WockyNode **subscriptions_node);
WockyPubsubSubscription *
wocky_pubsub_service_parse_subscription (WockyPubsubService *self,
- WockyXmppNode *subscription_node,
+ WockyNode *subscription_node,
const gchar *parent_node_attr,
GError **error);
GList * wocky_pubsub_service_parse_subscriptions (WockyPubsubService *self,
- WockyXmppNode *subscriptions_node,
+ WockyNode *subscriptions_node,
GList **subscription_nodes);
WockyStanza *wocky_pubsub_service_create_create_node_stanza (
WockyPubsubService *self,
const gchar *name,
WockyDataForm *config,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **create_node);
+ WockyNode **pubsub_node,
+ WockyNode **create_node);
WockyPubsubNode *wocky_pubsub_service_handle_create_node_reply (
WockyPubsubService *self,
diff --git a/wocky/wocky-pubsub-service.c b/wocky/wocky-pubsub-service.c
index fff6ded..c0a1c41 100644
--- a/wocky/wocky-pubsub-service.c
+++ b/wocky/wocky-pubsub-service.c
@@ -267,7 +267,7 @@ wocky_pubsub_service_class_init (
* @event_stanza: the message/event stanza in its entirity
* @event_node: the event node from the stanza
* @items_node: the items node from the stanza
- * @items: a list of WockyXmppNode *s for each item child of @items_node
+ * @items: a list of WockyNode *s for each item child of @items_node
*
* Emitted when an event is received for a node.
*/
@@ -347,8 +347,8 @@ static void
pubsub_service_node_event_received_cb (
WockyPubsubNode *node,
WockyStanza *event_stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *items_node,
+ WockyNode *event_node,
+ WockyNode *items_node,
GList *items,
gpointer user_data)
{
@@ -362,8 +362,8 @@ static void
pubsub_service_node_subscription_state_changed_cb (
WockyPubsubNode *node,
WockyStanza *stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *subscription_node,
+ WockyNode *event_node,
+ WockyNode *subscription_node,
WockyPubsubSubscription *subscription,
gpointer user_data)
{
@@ -377,8 +377,8 @@ static void
pubsub_service_node_deleted_cb (
WockyPubsubNode *node,
WockyStanza *stanza,
- WockyXmppNode *event_node,
- WockyXmppNode *delete_node,
+ WockyNode *event_node,
+ WockyNode *delete_node,
gpointer user_data)
{
WockyPubsubService *self = WOCKY_PUBSUB_SERVICE (user_data);
@@ -474,21 +474,21 @@ pubsub_service_propagate_event (WockyPorter *porter,
{
EventTrampoline *trampoline = user_data;
WockyPubsubService *self = trampoline->self;
- WockyXmppNode *event_node, *action_node;
+ WockyNode *event_node, *action_node;
const gchar *node_name;
WockyPubsubNode *node;
g_assert (WOCKY_IS_PUBSUB_SERVICE (self));
- event_node = wocky_xmpp_node_get_child_ns (
+ event_node = wocky_node_get_child_ns (
wocky_stanza_get_top_node (event_stanza), "event",
WOCKY_XMPP_NS_PUBSUB_EVENT);
g_return_val_if_fail (event_node != NULL, FALSE);
- action_node = wocky_xmpp_node_get_child (event_node,
+ action_node = wocky_node_get_child (event_node,
trampoline->mapping->action);
g_return_val_if_fail (action_node != NULL, FALSE);
- node_name = wocky_xmpp_node_get_attribute (action_node, "node");
+ node_name = wocky_node_get_attribute (action_node, "node");
if (node_name == NULL)
{
@@ -511,7 +511,7 @@ default_configuration_iq_cb (GObject *source,
{
GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT (user_data);
GError *error = NULL;
- WockyXmppNode *node;
+ WockyNode *node;
WockyDataForm *form;
if (!wocky_pubsub_distill_iq_reply (source, res,
@@ -578,15 +578,15 @@ wocky_pubsub_service_get_default_node_configuration_finish (
WockyPubsubSubscription *
wocky_pubsub_service_parse_subscription (WockyPubsubService *self,
- WockyXmppNode *subscription_node,
+ WockyNode *subscription_node,
const gchar *parent_node_attr,
GError **error)
{
const gchar *node;
- const gchar *jid = wocky_xmpp_node_get_attribute (subscription_node, "jid");
- const gchar *subscription = wocky_xmpp_node_get_attribute (subscription_node,
+ const gchar *jid = wocky_node_get_attribute (subscription_node, "jid");
+ const gchar *subscription = wocky_node_get_attribute (subscription_node,
"subscription");
- const gchar *subid = wocky_xmpp_node_get_attribute (subscription_node,
+ const gchar *subid = wocky_node_get_attribute (subscription_node,
"subid");
WockyPubsubNode *node_obj;
gint state;
@@ -595,7 +595,7 @@ wocky_pubsub_service_parse_subscription (WockyPubsubService *self,
if (parent_node_attr != NULL)
node = parent_node_attr;
else
- node = wocky_xmpp_node_get_attribute (subscription_node, "node");
+ node = wocky_node_get_attribute (subscription_node, "node");
#define FAIL_IF_NULL(attr) \
if (attr == NULL) \
@@ -631,19 +631,19 @@ wocky_pubsub_service_parse_subscription (WockyPubsubService *self,
GList *
wocky_pubsub_service_parse_subscriptions (WockyPubsubService *self,
- WockyXmppNode *subscriptions_node,
+ WockyNode *subscriptions_node,
GList **subscription_nodes)
{
- const gchar *parent_node_attr = wocky_xmpp_node_get_attribute (
+ const gchar *parent_node_attr = wocky_node_get_attribute (
subscriptions_node, "node");
GQueue subs = G_QUEUE_INIT;
GQueue sub_nodes = G_QUEUE_INIT;
- WockyXmppNode *n;
- WockyXmppNodeIter i;
+ WockyNode *n;
+ WockyNodeIter i;
- wocky_xmpp_node_iter_init (&i, subscriptions_node, "subscription", NULL);
+ wocky_node_iter_init (&i, subscriptions_node, "subscription", NULL);
- while (wocky_xmpp_node_iter_next (&i, &n))
+ while (wocky_node_iter_next (&i, &n))
{
GError *error = NULL;
WockyPubsubSubscription *sub = wocky_pubsub_service_parse_subscription (
@@ -677,7 +677,7 @@ receive_subscriptions_cb (GObject *source,
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
WockyPubsubService *self = WOCKY_PUBSUB_SERVICE (
g_async_result_get_source_object (user_data));
- WockyXmppNode *subscriptions_node;
+ WockyNode *subscriptions_node;
GError *error = NULL;
if (wocky_pubsub_distill_iq_reply (source, res, WOCKY_XMPP_NS_PUBSUB,
@@ -702,18 +702,18 @@ WockyStanza *
wocky_pubsub_service_create_retrieve_subscriptions_stanza (
WockyPubsubService *self,
WockyPubsubNode *node,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **subscriptions_node)
+ WockyNode **pubsub_node,
+ WockyNode **subscriptions_node)
{
WockyPubsubServicePrivate *priv = self->priv;
WockyStanza *stanza;
- WockyXmppNode *subscriptions;
+ WockyNode *subscriptions;
stanza = wocky_pubsub_make_stanza (priv->jid, WOCKY_STANZA_SUB_TYPE_GET,
WOCKY_XMPP_NS_PUBSUB, "subscriptions", pubsub_node, &subscriptions);
if (node != NULL)
- wocky_xmpp_node_set_attribute (subscriptions, "node",
+ wocky_node_set_attribute (subscriptions, "node",
wocky_pubsub_node_get_name (node));
if (subscriptions_node != NULL)
@@ -766,7 +766,7 @@ wocky_pubsub_service_handle_create_node_reply (
{
WockyPubsubNode *node = NULL;
const gchar *name = NULL;
- WockyXmppNode *n;
+ WockyNode *n;
if (!wocky_pubsub_distill_ambivalent_iq_reply (source, res,
WOCKY_XMPP_NS_PUBSUB, "create", &n, error))
@@ -777,7 +777,7 @@ wocky_pubsub_service_handle_create_node_reply (
/* If the reply contained <pubsub><create>, it'd better contain the
* nodeID.
*/
- name = wocky_xmpp_node_get_attribute (n, "node");
+ name = wocky_node_get_attribute (n, "node");
if (name == NULL)
g_set_error (error, WOCKY_PUBSUB_SERVICE_ERROR,
@@ -844,21 +844,21 @@ wocky_pubsub_service_create_create_node_stanza (
WockyPubsubService *self,
const gchar *name,
WockyDataForm *config,
- WockyXmppNode **pubsub_node,
- WockyXmppNode **create_node)
+ WockyNode **pubsub_node,
+ WockyNode **create_node)
{
WockyPubsubServicePrivate *priv = self->priv;
WockyStanza *stanza;
- WockyXmppNode *pubsub, *create;
+ WockyNode *pubsub, *create;
stanza = wocky_pubsub_make_stanza (priv->jid, WOCKY_STANZA_SUB_TYPE_SET,
WOCKY_XMPP_NS_PUBSUB, "create", &pubsub, &create);
if (name != NULL)
- wocky_xmpp_node_set_attribute (create, "node", name);
+ wocky_node_set_attribute (create, "node", name);
if (config != NULL)
- wocky_data_form_submit (config, wocky_xmpp_node_add_child (pubsub,
+ wocky_data_form_submit (config, wocky_node_add_child (pubsub,
"configure"));
if (pubsub_node != NULL)
diff --git a/wocky/wocky-roster.c b/wocky/wocky-roster.c
index 41fbec4..8ff82b7 100644
--- a/wocky/wocky-roster.c
+++ b/wocky/wocky-roster.c
@@ -375,7 +375,7 @@ roster_update (WockyRoster *self,
{
WockyRosterPrivate *priv = self->priv;
gboolean google_roster = FALSE;
- WockyXmppNode *query_node;
+ WockyNode *query_node;
GSList *j;
/* Check for google roster support */
@@ -385,7 +385,7 @@ roster_update (WockyRoster *self,
/* FIXME: this is wrong, we should use _get_attribute_ns instead of
* assuming the prefix */
- gr_ext = wocky_xmpp_node_get_attribute (
+ gr_ext = wocky_node_get_attribute (
wocky_stanza_get_top_node (stanza), "gr:ext");
if (!wocky_strdiff (gr_ext, GOOGLE_ROSTER_VERSION))
@@ -393,7 +393,7 @@ roster_update (WockyRoster *self,
}
/* Check stanza contains query node. */
- query_node = wocky_xmpp_node_get_child_ns (
+ query_node = wocky_node_get_child_ns (
wocky_stanza_get_top_node (stanza), "query", WOCKY_XMPP_NS_ROSTER);
if (query_node == NULL)
@@ -409,7 +409,7 @@ roster_update (WockyRoster *self,
for (j = query_node->children; j; j = j->next)
{
const gchar *jid;
- WockyXmppNode *n = (WockyXmppNode *) j->data;
+ WockyNode *n = (WockyNode *) j->data;
WockyBareContact *contact = NULL;
const gchar *subscription;
WockyRosterSubscriptionFlags subscription_type;
@@ -423,7 +423,7 @@ roster_update (WockyRoster *self,
continue;
}
- jid = wocky_xmpp_node_get_attribute (n, "jid");
+ jid = wocky_node_get_attribute (n, "jid");
if (jid == NULL)
{
@@ -438,7 +438,7 @@ roster_update (WockyRoster *self,
}
/* Parse item. */
- subscription = wocky_xmpp_node_get_attribute (n, "subscription");
+ subscription = wocky_node_get_attribute (n, "subscription");
if (!wocky_strdiff (subscription, "to"))
subscription_type = WOCKY_ROSTER_SUBSCRIPTION_TYPE_TO;
@@ -464,7 +464,7 @@ roster_update (WockyRoster *self,
/* Look for "group" nodes */
for (l = n->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *node = (WockyXmppNode *) l->data;
+ WockyNode *node = (WockyNode *) l->data;
if (wocky_strdiff (node->name, "group"))
continue;
@@ -481,7 +481,7 @@ roster_update (WockyRoster *self,
{
/* Contact already exists; update. */
wocky_bare_contact_set_name (contact,
- wocky_xmpp_node_get_attribute (n, "name"));
+ wocky_node_get_attribute (n, "name"));
wocky_bare_contact_set_subscription (contact, subscription_type);
@@ -494,7 +494,7 @@ roster_update (WockyRoster *self,
priv->contact_factory, jid);
g_object_set (contact,
- "name", wocky_xmpp_node_get_attribute (n, "name"),
+ "name", wocky_node_get_attribute (n, "name"),
"subscription", subscription_type,
"groups", groups,
NULL);
@@ -524,7 +524,7 @@ roster_iq_handler_set_cb (WockyPorter *porter,
GError *error = NULL;
WockyStanza *reply;
- from = wocky_xmpp_node_get_attribute (wocky_stanza_get_top_node (stanza),
+ from = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
"from");
if (from != NULL)
@@ -778,10 +778,10 @@ wocky_roster_get_all_contacts (WockyRoster *self)
* If not NULL, item_node will contain a pointer on the "item" node */
static WockyStanza *
build_iq_for_contact (WockyBareContact *contact,
- WockyXmppNode **item_node)
+ WockyNode **item_node)
{
WockyStanza *iq;
- WockyXmppNode *item = NULL;
+ WockyNode *item = NULL;
const gchar *jid, *name;
const gchar * const *groups;
guint i;
@@ -806,23 +806,23 @@ build_iq_for_contact (WockyBareContact *contact,
name = wocky_bare_contact_get_name (contact);
if (name != NULL)
{
- wocky_xmpp_node_set_attribute (item, "name", name);
+ wocky_node_set_attribute (item, "name", name);
}
subscription = wocky_bare_contact_get_subscription (contact);
if (subscription != WOCKY_ROSTER_SUBSCRIPTION_TYPE_NONE)
{
- wocky_xmpp_node_set_attribute (item, "subscription",
+ wocky_node_set_attribute (item, "subscription",
wocky_roster_subscription_to_string (subscription));
}
groups = wocky_bare_contact_get_groups (contact);
for (i = 0; groups != NULL && groups[i] != NULL; i++)
{
- WockyXmppNode *group;
+ WockyNode *group;
- group = wocky_xmpp_node_add_child (item, "group");
- wocky_xmpp_node_set_content (group, groups[i]);
+ group = wocky_node_add_child (item, "group");
+ wocky_node_set_content (group, groups[i]);
}
if (item_node != NULL)
@@ -1232,7 +1232,7 @@ wocky_roster_change_contact_name_async (WockyRoster *self,
{
WockyRosterPrivate *priv = self->priv;
WockyStanza *iq;
- WockyXmppNode *item;
+ WockyNode *item;
GSimpleAsyncResult *result;
PendingOperation *pending;
const gchar *jid;
@@ -1275,7 +1275,7 @@ wocky_roster_change_contact_name_async (WockyRoster *self,
iq = build_iq_for_contact (contact, &item);
/* set new name */
- wocky_xmpp_node_set_attribute (item, "name", name);
+ wocky_node_set_attribute (item, "name", name);
wocky_porter_send_iq_async (priv->porter,
iq, cancellable, change_roster_iq_cb, pending);
@@ -1309,7 +1309,7 @@ wocky_roster_contact_add_group_async (WockyRoster *self,
{
WockyRosterPrivate *priv = self->priv;
WockyStanza *iq;
- WockyXmppNode *item, *group_node;
+ WockyNode *item, *group_node;
GSimpleAsyncResult *result;
PendingOperation *pending;
const gchar *jid;
@@ -1353,8 +1353,8 @@ wocky_roster_contact_add_group_async (WockyRoster *self,
iq = build_iq_for_contact (contact, &item);
/* add new group */
- group_node = wocky_xmpp_node_add_child (item, "group");
- wocky_xmpp_node_set_content (group_node, group);
+ group_node = wocky_node_add_child (item, "group");
+ wocky_node_set_content (group_node, group);
wocky_porter_send_iq_async (priv->porter,
iq, cancellable, change_roster_iq_cb, pending);
@@ -1388,7 +1388,7 @@ wocky_roster_contact_remove_group_async (WockyRoster *self,
{
WockyRosterPrivate *priv = self->priv;
WockyStanza *iq;
- WockyXmppNode *item;
+ WockyNode *item;
GSimpleAsyncResult *result;
GSList *l;
PendingOperation *pending;
@@ -1432,17 +1432,17 @@ wocky_roster_contact_remove_group_async (WockyRoster *self,
iq = build_iq_for_contact (contact, &item);
/* remove the group */
- /* FIXME: should we add a wocky_xmpp_node_remove_child () ? */
+ /* FIXME: should we add a wocky_node_remove_child () ? */
for (l = item->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *group_node = (WockyXmppNode *) l->data;
+ WockyNode *group_node = (WockyNode *) l->data;
if (wocky_strdiff (group_node->name, "group"))
continue;
if (!wocky_strdiff (group_node->content, group))
{
- wocky_xmpp_node_free (group_node);
+ wocky_node_free (group_node);
item->children = g_slist_delete_link (item->children, l);
break;
}
diff --git a/wocky/wocky-sasl-auth.c b/wocky/wocky-sasl-auth.c
index 0d8bc2a..d0f9788 100644
--- a/wocky/wocky-sasl-auth.c
+++ b/wocky/wocky-sasl-auth.c
@@ -294,12 +294,12 @@ static gboolean
stream_error (WockySaslAuth *sasl, WockyStanza *stanza)
{
WockyStanzaType type = WOCKY_STANZA_TYPE_NONE;
- WockyXmppNode *xmpp = NULL;
+ WockyNode *xmpp = NULL;
GSList *item = NULL;
const gchar *msg = NULL;
const gchar *err = NULL;
- WockyXmppNode *cond = NULL;
- WockyXmppNode *text = NULL;
+ WockyNode *cond = NULL;
+ WockyNode *text = NULL;
if (stanza == NULL)
{
@@ -314,8 +314,8 @@ stream_error (WockySaslAuth *sasl, WockyStanza *stanza)
xmpp = wocky_stanza_get_top_node (stanza);
for (item = xmpp->children; item != NULL; item = g_slist_next (item))
{
- WockyXmppNode *child = item->data;
- const gchar *cns = wocky_xmpp_node_get_ns (child);
+ WockyNode *child = item->data;
+ const gchar *cns = wocky_node_get_ns (child);
if (wocky_strdiff (cns, WOCKY_XMPP_NS_STREAMS))
continue;
@@ -357,7 +357,7 @@ wocky_sasl_auth_new (const gchar *server,
}
static gboolean
-each_mechanism (WockyXmppNode *node, gpointer user_data)
+each_mechanism (WockyNode *node, gpointer user_data)
{
GSList **list = (GSList **)user_data;
if (wocky_strdiff (node->name, "mechanism"))
@@ -369,14 +369,14 @@ each_mechanism (WockyXmppNode *node, gpointer user_data)
}
static GSList *
-wocky_sasl_auth_mechanisms_to_list (WockyXmppNode *mechanisms)
+wocky_sasl_auth_mechanisms_to_list (WockyNode *mechanisms)
{
GSList *result = NULL;
if (mechanisms == NULL)
return NULL;
- wocky_xmpp_node_each_child (mechanisms, each_mechanism, &result);
+ wocky_node_each_child (mechanisms, each_mechanism, &result);
return result;
}
@@ -396,13 +396,13 @@ sasl_auth_got_failure (WockySaslAuth *sasl,
WockyStanza *stanza,
GError **error)
{
- WockyXmppNode *reason = NULL;
+ WockyNode *reason = NULL;
if (wocky_stanza_get_top_node (stanza)->children != NULL)
{
/* TODO add a wocky xmpp node utility to either get the first child or
* iterate the children list */
- reason = (WockyXmppNode *)
+ reason = (WockyNode *)
wocky_stanza_get_top_node (stanza)->children->data;
}
/* TODO Handle the different error cases in a different way. i.e.
@@ -432,7 +432,7 @@ sasl_auth_stanza_received (GObject *source,
return;
if (wocky_strdiff (
- wocky_xmpp_node_get_ns (wocky_stanza_get_top_node (stanza)),
+ wocky_node_get_ns (wocky_stanza_get_top_node (stanza)),
WOCKY_XMPP_NS_SASL_AUTH))
{
auth_failed (sasl, WOCKY_SASL_AUTH_ERROR_INVALID_REPLY,
@@ -458,7 +458,7 @@ sasl_auth_stanza_received (GObject *source,
goto failure;
response_stanza = wocky_stanza_new ("response", WOCKY_XMPP_NS_SASL_AUTH);
- wocky_xmpp_node_set_content (wocky_stanza_get_top_node (response_stanza),
+ wocky_node_set_content (wocky_stanza_get_top_node (response_stanza),
response);
/* FIXME handle send error */
@@ -533,7 +533,7 @@ wocky_sasl_auth_start_mechanism (WockySaslAuth *sasl,
stanza = wocky_stanza_new ("auth", WOCKY_XMPP_NS_SASL_AUTH);
/* google JID domain discovery - client sets a namespaced attribute */
- wocky_xmpp_node_set_attribute_ns (wocky_stanza_get_top_node (stanza),
+ wocky_node_set_attribute_ns (wocky_stanza_get_top_node (stanza),
"client-uses-full-bind-result", "true", WOCKY_GOOGLE_NS_AUTH);
if (!wocky_sasl_handler_get_initial_response (priv->handler,
@@ -545,14 +545,14 @@ wocky_sasl_auth_start_mechanism (WockySaslAuth *sasl,
if (initial_response != NULL)
{
- wocky_xmpp_node_set_content (
+ wocky_node_set_content (
wocky_stanza_get_top_node (stanza),
initial_response);
g_free (initial_response);
}
/* FIXME handle send error */
- wocky_xmpp_node_set_attribute (wocky_stanza_get_top_node (stanza),
+ wocky_node_set_attribute (wocky_stanza_get_top_node (stanza),
"mechanism",
wocky_sasl_handler_get_mechanism (priv->handler));
wocky_xmpp_connection_send_stanza_async (priv->connection, stanza,
@@ -639,14 +639,14 @@ wocky_sasl_auth_authenticate_async (WockySaslAuth *sasl,
gpointer user_data)
{
WockySaslAuthPrivate *priv = sasl->priv;
- WockyXmppNode *mech_node;
+ WockyNode *mech_node;
GSList *mechanisms, *t;
WockySaslHandler *handler = NULL;
g_assert (sasl != NULL);
g_assert (features != NULL);
- mech_node = wocky_xmpp_node_get_child_ns (
+ mech_node = wocky_node_get_child_ns (
wocky_stanza_get_top_node (features),
"mechanisms", WOCKY_XMPP_NS_SASL_AUTH);
diff --git a/wocky/wocky-stanza.c b/wocky/wocky-stanza.c
index be5687f..ae1f543 100644
--- a/wocky/wocky-stanza.c
+++ b/wocky/wocky-stanza.c
@@ -167,7 +167,7 @@ wocky_stanza_new (const gchar *name, const gchar *ns)
WockyStanza *result;
result = WOCKY_STANZA (g_object_new (WOCKY_TYPE_STANZA, NULL));
- result->parent.node = wocky_xmpp_node_new (name, ns);
+ result->parent.node = wocky_node_new (name, ns);
return result;
}
@@ -235,7 +235,7 @@ wocky_stanza_new_with_sub_type (WockyStanzaType type,
sub_type_name = get_sub_type_name (sub_type);
if (sub_type_name != NULL)
- wocky_xmpp_node_set_attribute (wocky_stanza_get_top_node (stanza),
+ wocky_node_set_attribute (wocky_stanza_get_top_node (stanza),
"type", sub_type_name);
return stanza;
@@ -334,14 +334,14 @@ wocky_stanza_build_va (WockyStanzaType type,
return NULL;
if (from != NULL)
- wocky_xmpp_node_set_attribute (wocky_stanza_get_top_node (stanza),
+ wocky_node_set_attribute (wocky_stanza_get_top_node (stanza),
"from", from);
if (to != NULL)
- wocky_xmpp_node_set_attribute (wocky_stanza_get_top_node (stanza),
+ wocky_node_set_attribute (wocky_stanza_get_top_node (stanza),
"to", to);
- wocky_xmpp_node_add_build_va (wocky_stanza_get_top_node (stanza), ap);
+ wocky_node_add_build_va (wocky_stanza_get_top_node (stanza), ap);
return stanza;
}
@@ -400,7 +400,7 @@ wocky_stanza_get_type_info (WockyStanza *stanza,
*type = get_type_from_name (wocky_stanza_get_top_node (stanza)->name);
if (sub_type != NULL)
- *sub_type = get_sub_type_from_name (wocky_xmpp_node_get_attribute (
+ *sub_type = get_sub_type_from_name (wocky_node_get_attribute (
wocky_stanza_get_top_node (stanza), "type"));
}
@@ -411,7 +411,7 @@ create_iq_reply (WockyStanza *iq,
{
WockyStanza *reply;
WockyStanzaType type;
- WockyXmppNode *node;
+ WockyNode *node;
WockyStanzaSubType sub_type;
const gchar *from, *to, *id;
@@ -423,15 +423,15 @@ create_iq_reply (WockyStanza *iq,
sub_type == WOCKY_STANZA_SUB_TYPE_SET, NULL);
node = wocky_stanza_get_top_node (iq);
- from = wocky_xmpp_node_get_attribute (node, "from");
- to = wocky_xmpp_node_get_attribute (node, "to");
- id = wocky_xmpp_node_get_attribute (node, "id");
+ from = wocky_node_get_attribute (node, "from");
+ to = wocky_node_get_attribute (node, "to");
+ id = wocky_node_get_attribute (node, "id");
g_return_val_if_fail (id != NULL, NULL);
reply = wocky_stanza_build_va (WOCKY_STANZA_TYPE_IQ,
sub_type_reply, to, from, ap);
- wocky_xmpp_node_set_attribute (wocky_stanza_get_top_node (reply), "id", id);
+ wocky_node_set_attribute (wocky_stanza_get_top_node (reply), "id", id);
return reply;
}
@@ -490,17 +490,17 @@ wocky_stanza_extract_errors (WockyStanza *stanza,
WockyXmppErrorType *type,
GError **core,
GError **specialized,
- WockyXmppNode **specialized_node)
+ WockyNode **specialized_node)
{
WockyStanzaSubType sub_type;
- WockyXmppNode *error;
+ WockyNode *error;
wocky_stanza_get_type_info (stanza, NULL, &sub_type);
if (sub_type != WOCKY_STANZA_SUB_TYPE_ERROR)
return FALSE;
- error = wocky_xmpp_node_get_child (wocky_stanza_get_top_node (stanza),
+ error = wocky_node_get_child (wocky_stanza_get_top_node (stanza),
"error");
if (error == NULL)
@@ -555,7 +555,7 @@ wocky_stanza_extract_stream_error (WockyStanza *stanza,
*
* Returns: A pointer to the topmost node of the stanza
*/
-WockyXmppNode *
+WockyNode *
wocky_stanza_get_top_node (WockyStanza *self)
{
return self->parent.node;
diff --git a/wocky/wocky-stanza.h b/wocky/wocky-stanza.h
index 917d291..8294250 100644
--- a/wocky/wocky-stanza.h
+++ b/wocky/wocky-stanza.h
@@ -102,7 +102,7 @@ typedef enum
WockyStanza * wocky_stanza_new (const gchar *name, const gchar *ns);
-WockyXmppNode *wocky_stanza_get_top_node (WockyStanza *self);
+WockyNode *wocky_stanza_get_top_node (WockyStanza *self);
WockyStanza * wocky_stanza_build (WockyStanzaType type,
WockyStanzaSubType sub_type, const gchar *from, const gchar *to,
@@ -127,7 +127,7 @@ gboolean wocky_stanza_extract_errors (WockyStanza *stanza,
WockyXmppErrorType *type,
GError **core,
GError **specialized,
- WockyXmppNode **specialized_node);
+ WockyNode **specialized_node);
gboolean wocky_stanza_extract_stream_error (WockyStanza *stanza,
GError **stream_error);
diff --git a/wocky/wocky-xmpp-error.c b/wocky/wocky-xmpp-error.c
index d717384..288e08b 100644
--- a/wocky/wocky-xmpp-error.c
+++ b/wocky/wocky-xmpp-error.c
@@ -304,7 +304,7 @@ xmpp_error_find_domain (GQuark domain)
*/
static gboolean
xmpp_error_from_node_for_ns (
- WockyXmppNode *node,
+ WockyNode *node,
GQuark ns,
GType enum_type,
gint *code)
@@ -313,9 +313,9 @@ xmpp_error_from_node_for_ns (
for (l = node->children; l != NULL; l = l->next)
{
- WockyXmppNode *child = l->data;
+ WockyNode *child = l->data;
- if (wocky_xmpp_node_has_ns_q (child, ns) &&
+ if (wocky_node_has_ns_q (child, ns) &&
wocky_enum_from_nick (enum_type, child->name, code))
return TRUE;
}
@@ -326,10 +326,10 @@ xmpp_error_from_node_for_ns (
/* Attempts to divine a WockyXmppError from a legacy numeric code='' attribute
*/
static WockyXmppError
-xmpp_error_from_code (WockyXmppNode *error_node,
+xmpp_error_from_code (WockyNode *error_node,
WockyXmppErrorType *type)
{
- const gchar *code = wocky_xmpp_node_get_attribute (error_node, "code");
+ const gchar *code = wocky_node_get_attribute (error_node, "code");
gint error_code, i, j;
if (code == NULL)
@@ -386,17 +386,17 @@ out:
* valid as long as the latter is alive.
*/
void
-wocky_xmpp_error_extract (WockyXmppNode *error,
+wocky_xmpp_error_extract (WockyNode *error,
WockyXmppErrorType *type,
GError **core,
GError **specialized,
- WockyXmppNode **specialized_node)
+ WockyNode **specialized_node)
{
gboolean found_core_error = FALSE;
gint core_code = WOCKY_XMPP_ERROR_UNDEFINED_CONDITION;
GQuark specialized_domain = 0;
gint specialized_code;
- WockyXmppNode *specialized_node_tmp = NULL;
+ WockyNode *specialized_node_tmp = NULL;
const gchar *message = NULL;
GSList *l;
@@ -409,7 +409,7 @@ wocky_xmpp_error_extract (WockyXmppNode *error,
*/
if (type != NULL)
{
- const gchar *type_attr = wocky_xmpp_node_get_attribute (error, "type");
+ const gchar *type_attr = wocky_node_get_attribute (error, "type");
gint type_i = WOCKY_XMPP_ERROR_TYPE_CANCEL;
if (type_attr != NULL)
@@ -420,7 +420,7 @@ wocky_xmpp_error_extract (WockyXmppNode *error,
for (l = error->children; l != NULL; l = g_slist_next (l))
{
- WockyXmppNode *child = l->data;
+ WockyNode *child = l->data;
if (child->ns == WOCKY_XMPP_ERROR)
{
@@ -492,11 +492,11 @@ wocky_xmpp_error_extract (WockyXmppNode *error,
*
* Returns: the newly-created <error/> node
*/
-WockyXmppNode *
+WockyNode *
wocky_stanza_error_to_node (const GError *error,
- WockyXmppNode *parent_node)
+ WockyNode *parent_node)
{
- WockyXmppNode *error_node, *node;
+ WockyNode *error_node, *node;
WockyXmppErrorDomain *domain = NULL;
WockyXmppError core_error;
const XmppErrorSpec *spec;
@@ -505,7 +505,7 @@ wocky_stanza_error_to_node (const GError *error,
g_return_val_if_fail (parent_node != NULL, NULL);
- error_node = wocky_xmpp_node_add_child (parent_node, "error");
+ error_node = wocky_node_add_child (parent_node, "error");
g_return_val_if_fail (error != NULL, error_node);
@@ -535,25 +535,25 @@ wocky_stanza_error_to_node (const GError *error,
}
sprintf (str, "%d", spec->legacy_errors[0]);
- wocky_xmpp_node_set_attribute (error_node, "code", str);
+ wocky_node_set_attribute (error_node, "code", str);
- wocky_xmpp_node_set_attribute (error_node, "type",
+ wocky_node_set_attribute (error_node, "type",
wocky_enum_to_nick (WOCKY_TYPE_XMPP_ERROR_TYPE, spec->type));
- node = wocky_xmpp_node_add_child (error_node,
+ node = wocky_node_add_child (error_node,
wocky_xmpp_error_string (core_error));
- wocky_xmpp_node_set_ns (node, WOCKY_XMPP_NS_STANZAS);
+ wocky_node_set_ns (node, WOCKY_XMPP_NS_STANZAS);
if (domain != NULL)
{
const gchar *name = wocky_enum_to_nick (domain->enum_type, error->code);
- node = wocky_xmpp_node_add_child (error_node, name);
- wocky_xmpp_node_set_ns_q (node, domain->domain);
+ node = wocky_node_add_child (error_node, name);
+ wocky_node_set_ns_q (node, domain->domain);
}
if (error->message != NULL && *error->message != '\0')
- wocky_xmpp_node_add_child_with_content_ns (error_node, "text",
+ wocky_node_add_child_with_content_ns (error_node, "text",
error->message, WOCKY_XMPP_NS_STANZAS);
return error_node;
@@ -590,7 +590,7 @@ wocky_xmpp_stream_error_quark (void)
* Returns: a GError in the #WOCKY_XMPP_STREAM_ERROR domain.
*/
GError *
-wocky_xmpp_stream_error_from_node (WockyXmppNode *error)
+wocky_xmpp_stream_error_from_node (WockyNode *error)
{
gint code = WOCKY_XMPP_STREAM_ERROR_UNKNOWN;
const gchar *message = NULL;
@@ -599,7 +599,7 @@ wocky_xmpp_stream_error_from_node (WockyXmppNode *error)
xmpp_error_from_node_for_ns (error, WOCKY_XMPP_STREAM_ERROR,
WOCKY_TYPE_XMPP_STREAM_ERROR, &code);
- message = wocky_xmpp_node_get_content_from_child_ns (error, "text",
+ message = wocky_node_get_content_from_child_ns (error, "text",
WOCKY_XMPP_NS_STREAMS);
if (message == NULL)
diff --git a/wocky/wocky-xmpp-error.h b/wocky/wocky-xmpp-error.h
index 7e5e6ea..1c2af8b 100644
--- a/wocky/wocky-xmpp-error.h
+++ b/wocky/wocky-xmpp-error.h
@@ -24,7 +24,7 @@
#include <glib.h>
#include <glib-object.h>
-#include "wocky-xmpp-node.h"
+#include "wocky-node.h"
/*< prefix=WOCKY_XMPP_ERROR_TYPE >*/
typedef enum {
@@ -156,16 +156,16 @@ GQuark wocky_xmpp_stream_error_quark (void);
const gchar *wocky_xmpp_error_string (WockyXmppError error);
const gchar *wocky_xmpp_error_description (WockyXmppError error);
-GError *wocky_xmpp_stream_error_from_node (WockyXmppNode *node);
+GError *wocky_xmpp_stream_error_from_node (WockyNode *node);
-WockyXmppNode *wocky_stanza_error_to_node (const GError *error,
- WockyXmppNode *parent_node);
+WockyNode *wocky_stanza_error_to_node (const GError *error,
+ WockyNode *parent_node);
-void wocky_xmpp_error_extract (WockyXmppNode *error,
+void wocky_xmpp_error_extract (WockyNode *error,
WockyXmppErrorType *type,
GError **core,
GError **specialized,
- WockyXmppNode **specialized_node);
+ WockyNode **specialized_node);
void wocky_xmpp_error_init (void);
void wocky_xmpp_error_deinit (void);
diff --git a/wocky/wocky-xmpp-node.h b/wocky/wocky-xmpp-node.h
deleted file mode 100644
index e3dca04..0000000
--- a/wocky/wocky-xmpp-node.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * wocky-xmpp-node.h - Header for Wocky xmpp nodes
- * Copyright (C) 2006 Collabora Ltd.
- * @author Sjoerd Simons <sjoerd@luon.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __WOCKY_XMPP_NODE_H__
-#define __WOCKY_XMPP_NODE_H__
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-typedef enum
-{
- WOCKY_NODE = '(',
- WOCKY_NODE_TEXT = '$',
- WOCKY_NODE_END = ')',
- WOCKY_NODE_ATTRIBUTE = '@',
- WOCKY_NODE_XMLNS = ':',
- WOCKY_NODE_ASSIGN_TO = '*'
-} WockyNodeBuildTag;
-
-typedef struct _WockyXmppNode WockyXmppNode;
-
-struct _WockyXmppNode {
- gchar *name;
- gchar *content;
-
- /* Private */
- gchar *language;
- GQuark ns;
- GSList *attributes;
- GSList *children;
-};
-
-/**
- * wocky_xmpp_node_each_attr_func:
- * @key: the attribute's key
- * @value: the attribute's value
- * @pref: the attribute's prefix
- * @ns: the attribute's namespace
- * @user_data: user data passed to wocky_xmpp_node_each_attribute()
- *
- * Specifies the type of functions passed to wocky_xmpp_node_each_attribute().
- *
- * Returns: %FALSE to stop further attributes from being examined.
- */
-typedef gboolean (*wocky_xmpp_node_each_attr_func) (const gchar *key,
- const gchar *value, const gchar *pref, const gchar *ns, gpointer user_data);
-
-/**
- * wocky_xmpp_node_each_child_func:
- * @node: a #WockyXmppNode
- * @user_data: user data passed to wocky_xmpp_node_each_child()
- *
- * Specifies the type of functions passed to wocky_xmpp_node_each_child().
- *
- * Returns: %FALSE to stop further children from being examined.
- */
-typedef gboolean (*wocky_xmpp_node_each_child_func) (WockyXmppNode *node,
- gpointer user_data);
-
-void wocky_xmpp_node_each_attribute (WockyXmppNode *node,
- wocky_xmpp_node_each_attr_func func, gpointer user_data);
-
-void wocky_xmpp_node_each_child (WockyXmppNode *node,
- wocky_xmpp_node_each_child_func func, gpointer user_data);
-
-const gchar *wocky_xmpp_node_get_attribute (WockyXmppNode *node,
- const gchar *key);
-
-const gchar *wocky_xmpp_node_get_attribute_ns (WockyXmppNode *node,
- const gchar *key, const gchar *ns);
-
-void wocky_xmpp_node_set_attribute (WockyXmppNode *node, const gchar *key,
- const gchar *value);
-
-void wocky_xmpp_node_set_attribute_ns (WockyXmppNode *node,
- const gchar *key, const gchar *value, const gchar *ns);
-
-/* Set attribute with the given size for the value */
-void wocky_xmpp_node_set_attribute_n (WockyXmppNode *node, const gchar *key,
- const gchar *value, gsize value_size);
-
-void wocky_xmpp_node_set_attribute_n_ns (WockyXmppNode *node,
- const gchar *key, const gchar *value, gsize value_size, const gchar *ns);
-
-/* namespaced attributes: when we want to override autogenerated prefixes */
-const gchar *wocky_xmpp_node_attribute_ns_get_prefix_from_urn (const gchar *urn);
-const gchar *wocky_xmpp_node_attribute_ns_get_prefix_from_quark (GQuark ns);
-void wocky_xmpp_node_attribute_ns_set_prefix (GQuark ns, const gchar *prefix);
-
-/* Getting children */
-WockyXmppNode *wocky_xmpp_node_get_child (WockyXmppNode *node,
- const gchar *name);
-
-WockyXmppNode *wocky_xmpp_node_get_child_ns (WockyXmppNode *node,
- const gchar *name, const gchar *ns);
-
-WockyXmppNode *wocky_xmpp_node_get_first_child (WockyXmppNode *node);
-
-/* Getting content from children */
-const gchar *wocky_xmpp_node_get_content_from_child (WockyXmppNode *node,
- const gchar *name);
-
-const gchar *wocky_xmpp_node_get_content_from_child_ns (WockyXmppNode *node,
- const gchar *name,
- const gchar *ns);
-
-/* Creating child nodes */
-WockyXmppNode *wocky_xmpp_node_add_child (WockyXmppNode *node,
- const gchar *name);
-
-WockyXmppNode *wocky_xmpp_node_add_child_ns (WockyXmppNode *node,
- const gchar *name, const gchar *ns);
-
-WockyXmppNode *wocky_xmpp_node_add_child_with_content (WockyXmppNode *node,
- const gchar *name, const char *content);
-
-WockyXmppNode *wocky_xmpp_node_add_child_with_content_ns (
- WockyXmppNode *node, const gchar *name, const gchar *content,
- const gchar *ns);
-
-/* Setting/Getting namespaces */
-void wocky_xmpp_node_set_ns (WockyXmppNode *node, const gchar *ns);
-void wocky_xmpp_node_set_ns_q (WockyXmppNode *node, GQuark ns);
-const gchar *wocky_xmpp_node_get_ns (WockyXmppNode *node);
-gboolean wocky_xmpp_node_has_ns (WockyXmppNode *node, const gchar *ns);
-gboolean wocky_xmpp_node_has_ns_q (WockyXmppNode *node, GQuark ns);
-
-/* Setting/Getting language */
-const gchar *wocky_xmpp_node_get_language (WockyXmppNode *node);
-void wocky_xmpp_node_set_language (WockyXmppNode *node, const gchar *lang);
-void wocky_xmpp_node_set_language_n (WockyXmppNode *node, const gchar *lang,
- gsize lang_size);
-
-
-/* Setting or adding content */
-void wocky_xmpp_node_set_content (WockyXmppNode *node, const gchar *content);
-void wocky_xmpp_node_append_content (WockyXmppNode *node,
- const gchar *content);
-
-void wocky_xmpp_node_append_content_n (WockyXmppNode *node,
- const gchar *content, gsize size);
-
-/* Return a reading friendly representation of a node and its children.
- * Should be use for debugging purpose only. */
-gchar *wocky_xmpp_node_to_string (WockyXmppNode *node);
-
-/* Create a new standalone node, usually only used by the stanza object */
-WockyXmppNode *wocky_xmpp_node_new (const char *name, const gchar *ns);
-
-/* Frees the node and all it's children! */
-void wocky_xmpp_node_free (WockyXmppNode *node);
-
-/* Compare two nodes and all their children */
-gboolean wocky_xmpp_node_equal (WockyXmppNode *node0,
- WockyXmppNode *node1);
-
-gboolean wocky_xmpp_node_is_superset (WockyXmppNode *node,
- WockyXmppNode *subset);
-
-/* Iterate over a nodes children */
-typedef struct {
- GSList *pending;
- const gchar *name;
- GQuark ns;
-} WockyXmppNodeIter;
-
-void wocky_xmpp_node_iter_init (WockyXmppNodeIter *iter,
- WockyXmppNode *node,
- const gchar *name,
- const gchar *ns);
-
-gboolean wocky_xmpp_node_iter_next (WockyXmppNodeIter *iter,
- WockyXmppNode **next);
-
-
-void wocky_xmpp_node_add_build (WockyXmppNode *node,
- WockyNodeBuildTag first_tag,
- ...);
-
-void wocky_xmpp_node_add_build_va (WockyXmppNode *node,
- va_list va);
-
-void wocky_xmpp_node_init (void);
-void wocky_xmpp_node_deinit (void);
-
-G_END_DECLS
-
-#endif /* #ifndef __WOCKY_XMPP_NODE_H__*/
diff --git a/wocky/wocky-xmpp-reader.c b/wocky/wocky-xmpp-reader.c
index 522afcc..17a0616 100644
--- a/wocky/wocky-xmpp-reader.c
+++ b/wocky/wocky-xmpp-reader.c
@@ -109,7 +109,7 @@ struct _WockyXmppReaderPrivate
xmlParserCtxtPtr parser;
guint depth;
WockyStanza *stanza;
- WockyXmppNode *node;
+ WockyNode *node;
GQueue *nodes;
gchar *to;
gchar *from;
@@ -486,7 +486,7 @@ _start_element_ns (void *user_data, const xmlChar *localname,
else
{
g_queue_push_tail (priv->nodes, priv->node);
- priv->node = wocky_xmpp_node_add_child_ns (priv->node,
+ priv->node = wocky_node_add_child_ns (priv->node,
(gchar *) localname,
(gchar *) uri);
}
@@ -497,7 +497,7 @@ _start_element_ns (void *user_data, const xmlChar *localname,
if (attributes[i+1] != NULL && !strcmp ((gchar *) attributes[i+1], "xml")
&& !strcmp ((gchar *) attributes[i], "lang"))
{
- wocky_xmpp_node_set_language_n (priv->node,
+ wocky_node_set_language_n (priv->node,
(gchar *) attributes[i+3],
(gsize) (attributes[i+4] - attributes[i+3]));
}
@@ -509,10 +509,10 @@ _start_element_ns (void *user_data, const xmlChar *localname,
const gchar *urn = (gchar *) attributes[i+2];
const gchar *pre = (gchar *) attributes[i+1];
GQuark ns = g_quark_from_string (urn);
- wocky_xmpp_node_attribute_ns_set_prefix (ns, pre);
+ wocky_node_attribute_ns_set_prefix (ns, pre);
}
- wocky_xmpp_node_set_attribute_n_ns (priv->node,
+ wocky_node_set_attribute_n_ns (priv->node,
(gchar *) attributes[i], /* key */
(gchar *) attributes[i+3], /* value */
(gsize)(attributes[i+4] - attributes[i+3]), /* length */
@@ -530,7 +530,7 @@ _characters (void *user_data, const xmlChar *ch, int len)
if (priv->node != NULL)
{
- wocky_xmpp_node_append_content_n (priv->node, (const gchar *)ch,
+ wocky_node_append_content_n (priv->node, (const gchar *)ch,
(gsize)len);
}
}
@@ -551,7 +551,7 @@ _end_element_ns (void *user_data, const xmlChar *localname,
for (c = priv->node->content; *c != '\0' && g_ascii_isspace (*c); c++)
;
if (*c == '\0')
- wocky_xmpp_node_set_content (priv->node, NULL);
+ wocky_node_set_content (priv->node, NULL);
}
if (priv->stream_mode && priv->depth == 0)
@@ -569,7 +569,7 @@ _end_element_ns (void *user_data, const xmlChar *localname,
}
else
{
- priv->node = (WockyXmppNode *) g_queue_pop_tail (priv->nodes);
+ priv->node = (WockyNode *) g_queue_pop_tail (priv->nodes);
}
}
diff --git a/wocky/wocky-xmpp-writer.c b/wocky/wocky-xmpp-writer.c
index f54a7e0..835d758 100644
--- a/wocky/wocky-xmpp-writer.c
+++ b/wocky/wocky-xmpp-writer.c
@@ -326,7 +326,7 @@ wocky_xmpp_writer_stream_close (WockyXmppWriter *writer,
}
static void
-_xml_write_node (WockyXmppWriter *writer, WockyXmppNode *node);
+_xml_write_node (WockyXmppWriter *writer, WockyNode *node);
static gboolean
_write_attr (const gchar *key, const gchar *value,
@@ -364,14 +364,14 @@ _write_attr (const gchar *key, const gchar *value,
}
static gboolean
-_write_child (WockyXmppNode *node, gpointer user_data)
+_write_child (WockyNode *node, gpointer user_data)
{
_xml_write_node (WOCKY_XMPP_WRITER (user_data), node);
return TRUE;
}
static void
-_xml_write_node (WockyXmppWriter *writer, WockyXmppNode *node)
+_xml_write_node (WockyXmppWriter *writer, WockyNode *node)
{
const gchar *l;
GQuark oldns;
@@ -395,12 +395,12 @@ _xml_write_node (WockyXmppWriter *writer, WockyXmppNode *node)
priv->current_ns = node->ns;
xmlTextWriterStartElementNS (priv->xmlwriter,
NULL, (const xmlChar *) node->name,
- (const xmlChar *) wocky_xmpp_node_get_ns (node));
+ (const xmlChar *) wocky_node_get_ns (node));
}
- wocky_xmpp_node_each_attribute (node, _write_attr, writer);
+ wocky_node_each_attribute (node, _write_attr, writer);
- l = wocky_xmpp_node_get_language (node);
+ l = wocky_node_get_language (node);
if (l != NULL)
{
@@ -409,7 +409,7 @@ _xml_write_node (WockyXmppWriter *writer, WockyXmppNode *node)
(const xmlChar *)l);
}
- wocky_xmpp_node_each_child (node, _write_child, writer);
+ wocky_node_each_child (node, _write_child, writer);
if (node->content)
{
diff --git a/wocky/wocky.c b/wocky/wocky.c
index 0a13418..8b1920b 100644
--- a/wocky/wocky.c
+++ b/wocky/wocky.c
@@ -21,7 +21,7 @@
#include <libxml/parser.h>
#include "wocky.h"
-#include "wocky-xmpp-node.h"
+#include "wocky-node.h"
#include "wocky-xmpp-error.h"
/**
@@ -35,7 +35,7 @@ void
wocky_init (void)
{
xmlInitParser ();
- wocky_xmpp_node_init ();
+ wocky_node_init ();
wocky_xmpp_error_init ();
}
@@ -55,6 +55,6 @@ void
wocky_deinit (void)
{
xmlCleanupParser ();
- wocky_xmpp_node_deinit ();
+ wocky_node_deinit ();
wocky_xmpp_error_deinit ();
}