diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-02-04 17:09:04 +0000 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-02-04 17:09:04 +0000 |
commit | 71b7a1e56c441b3b8e7c28db68c88770d9f33aca (patch) | |
tree | cb5a5aa9194cb1694d22df667d9daf4c4a2300e4 | |
parent | d88cfb9dd3c0ff4f2b52b7d375d9c8ddaf7f6a0a (diff) |
loudmouth: Remove LmMessageNodeBYE-BYE-LOUDMOUTH
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | lib/loudmouth/Makefile.am | 2 | ||||
-rw-r--r-- | lib/loudmouth/lm-message-node.c | 176 | ||||
-rw-r--r-- | lib/loudmouth/lm-message-node.h | 62 | ||||
-rw-r--r-- | lib/loudmouth/lm-message.c | 2 | ||||
-rw-r--r-- | lib/loudmouth/lm-message.h | 4 | ||||
-rw-r--r-- | lib/loudmouth/loudmouth.h | 1 |
6 files changed, 2 insertions, 245 deletions
diff --git a/lib/loudmouth/Makefile.am b/lib/loudmouth/Makefile.am index 928f3f26e..af6f61d24 100644 --- a/lib/loudmouth/Makefile.am +++ b/lib/loudmouth/Makefile.am @@ -12,8 +12,6 @@ OUR_SOURCES = \ lm-connection.h \ lm-message.c \ lm-message.h \ - lm-message-node.c \ - lm-message-node.h \ lm-message-handler.c \ lm-message-handler.h \ lm-connection.c \ diff --git a/lib/loudmouth/lm-message-node.c b/lib/loudmouth/lm-message-node.c deleted file mode 100644 index 8f5417cf9..000000000 --- a/lib/loudmouth/lm-message-node.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * lm-message-node.c - Loudmouth-Wocky compatibility layer - * Copyright (C) 2009 Collabora Ltd. - * @author Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> - * - * 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 - */ - -#include "lm-message-node.h" - -#include <wocky/wocky-utils.h> - -static gboolean -copy_attribute (const gchar *key, - const gchar *value, - const gchar *prefix, - const gchar *ns, - gpointer user_data) -{ - WockyNode *copy = (WockyNode *) user_data; - - wocky_node_set_attribute_ns (copy, key, value, ns); - return TRUE; -} - -static WockyNode * -copy_node (WockyNode *node) -{ - WockyNode *copy; - GSList *l; - - copy = wocky_node_new (node->name, wocky_node_get_ns (node)); - wocky_node_set_content (copy, node->content); - wocky_node_set_language (copy, wocky_node_get_language (node)); - - wocky_node_each_attribute (node, copy_attribute, copy); - - for (l = node->children; l != NULL; l = g_slist_next (l)) - { - WockyNode *child = l->data; - - copy->children = g_slist_prepend (copy->children, copy_node (child)); - } - copy->children = g_slist_reverse (copy->children); - - return copy; -} - -LmMessageNode * -lm_message_node_ref (LmMessageNode *node) -{ - /* WockyNode is not ref counted. Return a copy of the node */ - return copy_node (node); -} - -void -lm_message_node_unref (LmMessageNode *node) -{ - wocky_node_free (node); -} - -void -lm_message_node_set_attribute (LmMessageNode *node, - const gchar *name, - const gchar *value) -{ - if (!wocky_strdiff (name, "xmlns")) - node->ns = g_quark_from_string (value); - else if (!wocky_strdiff (name, "xml:lang")) - wocky_node_set_language (node, value); - else - wocky_node_set_attribute (node, name, value); -} - -const gchar * -lm_message_node_get_attribute (LmMessageNode *node, - const gchar *name) -{ - if (!wocky_strdiff (name, "xmlns")) - return wocky_node_get_ns (node); - else if (!wocky_strdiff (name, "xml:lang")) - return wocky_node_get_language (node); - - return wocky_node_get_attribute (node, name); -} - -void -lm_message_node_set_attributes (LmMessageNode *node, - const gchar *name, - ...) -{ - va_list args; - - g_return_if_fail (node != NULL); - - va_start (args, name); - while (name != NULL) - { - const gchar *value; - value = (const gchar *) va_arg (args, gchar *); - - lm_message_node_set_attribute (node, name, value); - - name = (const gchar *) va_arg (args, gchar *); - } - va_end (args); -} - -LmMessageNode * -lm_message_node_add_child (LmMessageNode *node, - const gchar *name, - const gchar *value) -{ - return wocky_node_add_child_with_content (node, name, value); -} - -LmMessageNode * -lm_message_node_get_child (LmMessageNode *node, - const gchar *child_name) -{ - return wocky_node_get_child (node, child_name); -} - -LmMessageNode * -lm_message_node_find_child (LmMessageNode *node, - const gchar *child_name) -{ - WockyNode *found; - GSList *l; - - found = wocky_node_get_child (node, child_name); - if (found != NULL) - return found; - - for (l = node->children; l != NULL; l = g_slist_next (l)) - { - WockyNode *child = l->data; - - found = lm_message_node_find_child (child, child_name); - if (found != NULL) - return found; - } - - return NULL; -} - -const gchar * -lm_message_node_get_value (LmMessageNode *node) -{ - return node->content; -} - -void -lm_message_node_set_value (LmMessageNode *node, - const gchar *value) -{ - wocky_node_set_content (node, value); -} - -gchar * -lm_message_node_to_string (LmMessageNode *node) -{ - return wocky_node_to_string (node); -} diff --git a/lib/loudmouth/lm-message-node.h b/lib/loudmouth/lm-message-node.h deleted file mode 100644 index 1ea8b734d..000000000 --- a/lib/loudmouth/lm-message-node.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * lm-message-node.h - Loudmouth-Wocky compatibility layer - * Copyright (C) 2009 Collabora Ltd. - * @author Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> - * - * 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 __LM_MESSAGE_NODE_H__ -#define __LM_MESSAGE_NODE_H__ - -#include <wocky/wocky-node.h> - -G_BEGIN_DECLS - -typedef WockyNode LmMessageNode; - -LmMessageNode * lm_message_node_ref (LmMessageNode *node) - G_GNUC_WARN_UNUSED_RESULT; -void lm_message_node_unref (LmMessageNode *node); - -void lm_message_node_set_attribute (LmMessageNode *node, - const gchar *name, - const gchar *value); - -const gchar * lm_message_node_get_attribute (LmMessageNode *node, - const gchar *name); - -void lm_message_node_set_attributes (LmMessageNode *node, - const gchar *name, - ...); - -LmMessageNode * lm_message_node_add_child (LmMessageNode *node, - const gchar *name, - const gchar *value); - -LmMessageNode * lm_message_node_get_child (LmMessageNode *node, - const gchar *child_name); - -LmMessageNode * lm_message_node_find_child (LmMessageNode *node, - const gchar *child_name); - -const gchar * lm_message_node_get_value (LmMessageNode *node); - -void lm_message_node_set_value (LmMessageNode *node, - const gchar *value); - -gchar * lm_message_node_to_string (LmMessageNode *node); - -#endif /* #ifndef __LM_MESSAGE_NODE_H__ */ diff --git a/lib/loudmouth/lm-message.c b/lib/loudmouth/lm-message.c index d6a0c7925..74b071277 100644 --- a/lib/loudmouth/lm-message.c +++ b/lib/loudmouth/lm-message.c @@ -67,7 +67,7 @@ lm_message_get_sub_type (LmMessage *message) return sub_type; } -LmMessageNode * +WockyNode * lm_message_get_node (LmMessage *message) { return wocky_stanza_get_top_node (message); diff --git a/lib/loudmouth/lm-message.h b/lib/loudmouth/lm-message.h index c1df07056..fbbcbdd3c 100644 --- a/lib/loudmouth/lm-message.h +++ b/lib/loudmouth/lm-message.h @@ -23,8 +23,6 @@ #include <wocky/wocky-stanza.h> -#include "lm-message-node.h" - G_BEGIN_DECLS typedef WockyStanza LmMessage; @@ -81,7 +79,7 @@ void lm_message_unref (LmMessage *message); LmMessageType lm_message_get_type (LmMessage *message); LmMessageSubType lm_message_get_sub_type (LmMessage *message); -LmMessageNode * lm_message_get_node (LmMessage *message); +WockyNode * lm_message_get_node (LmMessage *message); G_END_DECLS diff --git a/lib/loudmouth/loudmouth.h b/lib/loudmouth/loudmouth.h index 3f3bf7e6c..6fac606a0 100644 --- a/lib/loudmouth/loudmouth.h +++ b/lib/loudmouth/loudmouth.h @@ -24,6 +24,5 @@ #include <loudmouth/lm-connection.h> #include <loudmouth/lm-message.h> #include <loudmouth/lm-message-handler.h> -#include <loudmouth/lm-message-node.h> #endif /* #ifndef __LOUDMOUTH_H__ */ |