summaryrefslogtreecommitdiff
path: root/lib/gibber/gibber-xmpp-node.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gibber/gibber-xmpp-node.h')
-rw-r--r--lib/gibber/gibber-xmpp-node.h123
1 files changed, 28 insertions, 95 deletions
diff --git a/lib/gibber/gibber-xmpp-node.h b/lib/gibber/gibber-xmpp-node.h
index 48c979bd..7d2a9f91 100644
--- a/lib/gibber/gibber-xmpp-node.h
+++ b/lib/gibber/gibber-xmpp-node.h
@@ -22,104 +22,37 @@
#define __GIBBER_XMPP_NODE_H__
#include <glib.h>
+#include <wocky/wocky-node.h>
G_BEGIN_DECLS
-typedef struct _GibberXmppNode GibberXmppNode;
-
-struct _GibberXmppNode {
- gchar *name;
- gchar *content;
-
- /* Private */
- gchar *language;
- GQuark ns;
- GSList *attributes;
- GSList *children;
-};
-
-typedef gboolean (*gibber_xmpp_node_each_attr_func )(const gchar *key,
- const gchar *value, const gchar *ns, gpointer user_data);
-
-typedef gboolean (*gibber_xmpp_node_each_child_func) (GibberXmppNode *node,
- gpointer user_data);
-
-void gibber_xmpp_node_each_attribute (GibberXmppNode *node,
- gibber_xmpp_node_each_attr_func func, gpointer user_data);
-
-void gibber_xmpp_node_each_child (GibberXmppNode *node,
- gibber_xmpp_node_each_child_func func, gpointer user_data);
-
-const gchar *gibber_xmpp_node_get_attribute (GibberXmppNode *node,
- const gchar *key);
-
-const gchar *gibber_xmpp_node_get_attribute_ns (GibberXmppNode *node,
- const gchar *key, const gchar *ns);
-
-void gibber_xmpp_node_set_attribute (GibberXmppNode *node, const gchar *key,
- const gchar *value);
-
-void gibber_xmpp_node_set_attribute_ns (GibberXmppNode *node,
- const gchar *key, const gchar *value, const gchar *ns);
-
-/* Set attribute with the given size for the value */
-void gibber_xmpp_node_set_attribute_n (GibberXmppNode *node, const gchar *key,
- const gchar *value, gsize value_size);
-
-void gibber_xmpp_node_set_attribute_n_ns (GibberXmppNode *node,
- const gchar *key, const gchar *value, gsize value_size,
- const gchar *ns);
-
-/* Getting children */
-GibberXmppNode *gibber_xmpp_node_get_child (GibberXmppNode *node,
- const gchar *name);
-
-GibberXmppNode *gibber_xmpp_node_get_child_ns (GibberXmppNode *node,
- const gchar *name, const gchar *ns);
-
-/* Creating child nodes */
-GibberXmppNode *gibber_xmpp_node_add_child (GibberXmppNode *node,
- const gchar *name);
-
-GibberXmppNode *gibber_xmpp_node_add_child_ns (GibberXmppNode *node,
- const gchar *name, const gchar *ns);
-
-GibberXmppNode *gibber_xmpp_node_add_child_with_content (GibberXmppNode *node,
- const gchar *name, const char *content);
-
-GibberXmppNode *gibber_xmpp_node_add_child_with_content_ns (
- GibberXmppNode *node, const gchar *name, const gchar *content,
- const gchar *ns);
-
-/* Setting/Getting namespaces */
-void gibber_xmpp_node_set_ns (GibberXmppNode *node, const gchar *ns);
-const gchar *gibber_xmpp_node_get_ns (GibberXmppNode *node);
-
-/* Setting/Getting language */
-const gchar *gibber_xmpp_node_get_language (GibberXmppNode *node);
-void gibber_xmpp_node_set_language (GibberXmppNode *node, const gchar *lang);
-void gibber_xmpp_node_set_language_n (GibberXmppNode *node, const gchar *lang,
- gsize lang_size);
-
-
-/* Setting or adding content */
-void gibber_xmpp_node_set_content (GibberXmppNode *node, const gchar *content);
-void gibber_xmpp_node_append_content (GibberXmppNode *node,
- const gchar *content);
-
-void gibber_xmpp_node_append_content_n (GibberXmppNode *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 *gibber_xmpp_node_to_string (GibberXmppNode *node);
-
-/* Create a new standalone node, usually only used by the stanza object */
-GibberXmppNode *gibber_xmpp_node_new (const char *name);
-GibberXmppNode *gibber_xmpp_node_new_ns (const char *name, const gchar *ns);
-
-/* Frees the node and all it's children! */
-void gibber_xmpp_node_free (GibberXmppNode *node);
+typedef WockyNode GibberXmppNode;
+
+#define gibber_xmpp_node_each_child wocky_node_each_child
+#define gibber_xmpp_node_get_attribute wocky_node_get_attribute
+#define gibber_xmpp_node_get_attribute_ns wocky_node_get_attribute_ns
+#define gibber_xmpp_node_set_attribute wocky_node_set_attribute
+#define gibber_xmpp_node_set_attribute_ns wocky_node_set_attribute_ns
+#define gibber_xmpp_node_set_attribute_n wocky_node_set_attribute_n
+#define gibber_xmpp_node_set_attribute_n_ns wocky_node_set_attribute_n_ns
+#define gibber_xmpp_node_get_child wocky_node_get_child
+#define gibber_xmpp_node_get_child_ns wocky_node_get_child_ns
+#define gibber_xmpp_node_add_child wocky_node_add_child
+#define gibber_xmpp_node_add_child_ns wocky_node_add_child_ns
+#define gibber_xmpp_node_add_child_with_content wocky_node_add_child_with_content
+#define gibber_xmpp_node_add_child_with_content_ns wocky_node_add_child_with_content_ns
+
+#define gibber_xmpp_node_get_ns wocky_node_get_ns
+#define gibber_xmpp_node_get_language wocky_node_get_language
+#define gibber_xmpp_node_set_language wocky_node_set_language
+#define gibber_xmpp_node_set_language_n wocky_node_set_language_n
+#define gibber_xmpp_node_set_content wocky_node_set_content
+#define gibber_xmpp_node_append_content wocky_node_append_content
+#define gibber_xmpp_node_append_content_n wocky_node_append_content_n
+#define gibber_xmpp_node_to_string wocky_node_to_string
+
+#define gibber_xmpp_node_new_ns wocky_node_new
+#define gibber_xmpp_node_free wocky_node_free
G_END_DECLS