[telepathy-gabble/master] remove wocky-pubsub
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Mon Sep 21 07:40:48 PDT 2009
---
src/Makefile.am | 2 -
src/types.h | 1 -
src/wocky-pubsub.c | 418 ----------------------------------------------------
src/wocky-pubsub.h | 97 ------------
4 files changed, 0 insertions(+), 518 deletions(-)
delete mode 100644 src/wocky-pubsub.c
delete mode 100644 src/wocky-pubsub.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 80596a4..23ebcb9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -106,8 +106,6 @@ libgabble_convenience_la_SOURCES = \
olpc-gadget-manager.c \
olpc-view.h \
olpc-view.c \
- wocky-pubsub.h \
- wocky-pubsub.c \
wocky-pep-service.h \
wocky-pep-service.c \
presence.h \
diff --git a/src/types.h b/src/types.h
index f874321..01d8a4d 100644
--- a/src/types.h
+++ b/src/types.h
@@ -52,7 +52,6 @@ typedef struct _GabbleJingleTransportIceUdp GabbleJingleTransportIceUdp;
typedef struct _GabbleJingleMediaRtp GabbleJingleMediaRtp;
typedef struct _JingleCandidate JingleCandidate;
-typedef struct _WockyPubsub WockyPubsub;
typedef enum {
INITIATOR_INVALID = -1,
diff --git a/src/wocky-pubsub.c b/src/wocky-pubsub.c
deleted file mode 100644
index a27cdc7..0000000
--- a/src/wocky-pubsub.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * wocky-pubsub.c - Wocky Pubsub
- * Copyright (C) 2007 Collabora Ltd.
- *
- * 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 "wocky-pubsub.h"
-
-#include <wocky/wocky-porter.h>
-#include <wocky/wocky-utils.h>
-#include <wocky/wocky-namespaces.h>
-
-G_DEFINE_TYPE (WockyPubsub, wocky_pubsub, G_TYPE_OBJECT)
-
-typedef struct
-{
- gchar *node;
- WockyPubsubEventHandlerFunction handle_function;
- gpointer user_data;
- guint id;
-} PubsubEventHandler;
-
-static PubsubEventHandler *
-pubsub_event_handler_new (const gchar *node,
- WockyPubsubEventHandlerFunction func,
- gpointer user_data,
- guint id)
-{
- PubsubEventHandler *handler = g_slice_new (PubsubEventHandler);
- handler->node = g_strdup (node);
- handler->handle_function = func;
- handler->user_data = user_data;
- handler->id = id;
-
- return handler;
-}
-
-static void
-pubsub_event_handler_free (PubsubEventHandler *handler)
-{
- g_free (handler->node);
- g_slice_free (PubsubEventHandler, handler);
-}
-
-/* signal enum */
-enum
-{
- LAST_SIGNAL,
-};
-
-/*
-static guint signals[LAST_SIGNAL] = {0};
-*/
-
-/* private structure */
-typedef struct _WockyPubsubPrivate WockyPubsubPrivate;
-
-struct _WockyPubsubPrivate
-{
- WockySession *session;
- WockyPorter *porter;
-
- guint handler_id;
-
- /* list of owned (PubsubEventHandler *) */
- GSList *handlers;
- guint last_id_used;
-
- gboolean dispose_has_run;
-};
-
-#define WOCKY_PUBSUB_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), WOCKY_TYPE_PUBSUB, \
- WockyPubsubPrivate))
-
-static void
-wocky_pubsub_init (WockyPubsub *obj)
-{
- /*
- WockyPubsub *self = WOCKY_PUBSUB (obj);
- WockyPubsubPrivate *priv = WOCKY_PUBSUB_GET_PRIVATE (self);
- */
-}
-
-static void
-wocky_pubsub_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-wocky_pubsub_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-
-static void
-wocky_pubsub_dispose (GObject *object)
-{
- WockyPubsub *self = WOCKY_PUBSUB (object);
- WockyPubsubPrivate *priv = WOCKY_PUBSUB_GET_PRIVATE (self);
-
- if (priv->dispose_has_run)
- return;
-
- priv->dispose_has_run = TRUE;
-
- if (priv->handler_id != 0)
- {
- wocky_porter_unregister_handler (priv->porter, priv->handler_id);
- priv->handler_id = 0;
- }
-
- if (priv->porter != NULL)
- g_object_unref (priv->porter);
-
- if (G_OBJECT_CLASS (wocky_pubsub_parent_class)->dispose)
- G_OBJECT_CLASS (wocky_pubsub_parent_class)->dispose (object);
-}
-
-static void
-wocky_pubsub_finalize (GObject *object)
-{
- WockyPubsub *self = WOCKY_PUBSUB (object);
- WockyPubsubPrivate *priv = WOCKY_PUBSUB_GET_PRIVATE (self);
- GSList *l;
-
- for (l = priv->handlers; l != NULL; l = g_slist_next (l))
- {
- PubsubEventHandler *handler = (PubsubEventHandler *) l->data;
-
- pubsub_event_handler_free (handler);
- }
- g_slist_free (priv->handlers);
-
- G_OBJECT_CLASS (wocky_pubsub_parent_class)->finalize (object);
-}
-
-static void
-wocky_pubsub_class_init (WockyPubsubClass *wocky_pubsub_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (wocky_pubsub_class);
-
- g_type_class_add_private (wocky_pubsub_class,
- sizeof (WockyPubsubPrivate));
-
- object_class->set_property = wocky_pubsub_set_property;
- object_class->get_property = wocky_pubsub_get_property;
- object_class->dispose = wocky_pubsub_dispose;
- object_class->finalize = wocky_pubsub_finalize;
-}
-
-static gboolean
-gabble_pubsub_event_handler (WockyPubsub *self,
- WockyXmppStanza *msg,
- const gchar *from,
- WockyXmppNode *items_node)
-{
- WockyPubsubPrivate *priv = WOCKY_PUBSUB_GET_PRIVATE (self);
- const gchar *node;
- GSList *l;
-
- node = wocky_xmpp_node_get_attribute (items_node, "node");
-
- if (node == NULL)
- {
- return FALSE;
- }
-
- for (l = priv->handlers; l != NULL; l = g_slist_next (l))
- {
- PubsubEventHandler *handler = l->data;
-
- if (!wocky_strdiff (handler->node, node))
- {
- handler->handle_function (self, msg, from, handler->user_data);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static void
-send_query_cb (GObject *source,
- GAsyncResult *res,
- gpointer user_data)
-{
- GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT (user_data);
- GError *error = NULL;
- WockyXmppStanza *reply;
-
- reply = wocky_porter_send_iq_finish (WOCKY_PORTER (source), res, &error);
- if (reply == NULL)
- {
- g_simple_async_result_set_from_error (result, error);
- g_error_free (error);
- }
-
- g_simple_async_result_set_op_res_gpointer (result, reply, NULL);
- g_simple_async_result_complete (result);
- g_object_unref (result);
-}
-
-void
-wocky_pubsub_send_query_async (WockyPubsub *self,
- const gchar *jid,
- const gchar *node,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- WockyPubsubPrivate *priv = WOCKY_PUBSUB_GET_PRIVATE (self);
- WockyXmppStanza *msg;
- GSimpleAsyncResult *result;
-
- g_assert (priv->porter != NULL);
-
- msg = wocky_xmpp_stanza_build (
- WOCKY_STANZA_TYPE_IQ, WOCKY_STANZA_SUB_TYPE_GET,
- NULL, jid,
- WOCKY_NODE, "pubsub",
- WOCKY_NODE_XMLNS, WOCKY_XMPP_NS_PUBSUB,
- WOCKY_NODE, "items",
- WOCKY_NODE_ATTRIBUTE, "node", node,
- WOCKY_NODE_END,
- WOCKY_NODE_END, WOCKY_STANZA_END);
-
- result = g_simple_async_result_new (G_OBJECT (self),
- callback, user_data, wocky_pubsub_send_query_finish);
-
- wocky_porter_send_iq_async (priv->porter, msg, cancellable, send_query_cb,
- result);
-
- g_object_unref (msg);
-}
-
-WockyXmppStanza *
-wocky_pubsub_send_query_finish (WockyPubsub *self,
- GAsyncResult *result,
- GError **error)
-{
- if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
- error))
- return NULL;
-
- g_return_val_if_fail (g_simple_async_result_is_valid (result,
- G_OBJECT (self), wocky_pubsub_send_query_finish), NULL);
-
- return g_simple_async_result_get_op_res_gpointer (
- G_SIMPLE_ASYNC_RESULT (result));
-}
-
-WockyXmppStanza *
-pubsub_make_publish_msg (
- const gchar *to,
- const gchar *node_name,
- const gchar *item_ns,
- const gchar *item_name,
- WockyXmppNode **node)
-{
- return wocky_xmpp_stanza_build (
- WOCKY_STANZA_TYPE_IQ, WOCKY_STANZA_SUB_TYPE_SET,
- NULL, to,
- WOCKY_NODE, "pubsub",
- WOCKY_NODE_XMLNS, WOCKY_XMPP_NS_PUBSUB,
- WOCKY_NODE, "publish",
- WOCKY_NODE_ATTRIBUTE, "node", node_name,
- WOCKY_NODE, "item",
- WOCKY_NODE, item_name,
- WOCKY_NODE_ASSIGN_TO, node,
- WOCKY_NODE_XMLNS, item_ns,
- WOCKY_NODE_END,
- WOCKY_NODE_END,
- WOCKY_NODE_END,
- WOCKY_NODE_END, WOCKY_STANZA_END);
-}
-
-/**
- * pubsub_msg_event_cb
- *
- * Called by Wocky when we get an incoming <message>. This handler handles
- * pubsub events.
- */
-static gboolean
-pubsub_msg_event_cb (WockyPorter *porter,
- WockyXmppStanza *message,
- gpointer user_data)
-{
- WockyPubsub *self = WOCKY_PUBSUB (user_data);
- WockyXmppNode *node;
- const gchar *event_ns, *from;
-
- node = wocky_xmpp_node_get_child (message->node, "event");
-
- if (node)
- {
- event_ns = wocky_xmpp_node_get_ns (node);
- }
- else
- {
- return FALSE;
- }
-
- if (event_ns == NULL || !g_str_has_prefix (event_ns, WOCKY_XMPP_NS_PUBSUB))
- {
- return FALSE;
- }
-
- from = wocky_xmpp_node_get_attribute (message->node, "from");
- if (from == NULL)
- {
- return TRUE;
- }
-
- node = wocky_xmpp_node_get_child (node, "items");
- if (node == NULL)
- {
- return TRUE;
- }
-
- gabble_pubsub_event_handler (self, message, from, node);
-
- return TRUE;
-}
-
-WockyPubsub *
-wocky_pubsub_new (void)
-{
- return g_object_new (WOCKY_TYPE_PUBSUB,
- NULL);
-}
-
-void
-wocky_pubsub_start (WockyPubsub *self,
- WockySession *session)
-{
- WockyPubsubPrivate *priv = WOCKY_PUBSUB_GET_PRIVATE (self);
-
- g_assert (priv->session == NULL);
- priv->session = session;
-
- priv->porter = wocky_session_get_porter (priv->session);
- g_object_ref (priv->porter);
-
- /* Register message handler */
- priv->handler_id = wocky_porter_register_handler (priv->porter,
- WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE, NULL,
- WOCKY_PORTER_HANDLER_PRIORITY_MAX,
- pubsub_msg_event_cb, self, WOCKY_STANZA_END);
-}
-
-guint
-wocky_pubsub_register_event_handler (WockyPubsub *self,
- const gchar *node,
- WockyPubsubEventHandlerFunction func,
- gpointer user_data)
-{
- WockyPubsubPrivate *priv = WOCKY_PUBSUB_GET_PRIVATE (self);
- PubsubEventHandler *handler;
-
- priv->last_id_used++;
- handler = pubsub_event_handler_new (node, func, user_data,
- priv->last_id_used);
-
- priv->handlers = g_slist_append (priv->handlers, handler);
-
- return priv->last_id_used;
-}
-
-void
-wocky_pubsub_unregister_event_handler (WockyPubsub *self,
- guint id)
-{
- WockyPubsubPrivate *priv = WOCKY_PUBSUB_GET_PRIVATE (self);
- GSList *l;
-
- for (l = priv->handlers; l != NULL; l = g_slist_next (l))
- {
- PubsubEventHandler *handler = l->data;
-
- if (handler->id == id)
- {
- priv->handlers = g_slist_delete_link (priv->handlers, l);
- return;
- }
- }
-}
diff --git a/src/wocky-pubsub.h b/src/wocky-pubsub.h
deleted file mode 100644
index 016b630..0000000
--- a/src/wocky-pubsub.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * wocky-pubsub.h - Header of Wocky Pubsub
- * Copyright (C) 2007 Collabora Ltd.
- *
- * 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_PUBSUB_H__
-#define __WOCKY_PUBSUB_H__
-
-#include <glib-object.h>
-#include <wocky/wocky-xmpp-stanza.h>
-#include <wocky/wocky-session.h>
-
-#include "types.h"
-
-G_BEGIN_DECLS
-
-typedef struct _WockyPubsubClass WockyPubsubClass;
-
-struct _WockyPubsubClass {
- GObjectClass parent_class;
-};
-
-struct _WockyPubsub {
- GObject parent;
-};
-
-GType wocky_pubsub_get_type (void);
-
-#define WOCKY_TYPE_PUBSUB \
- (wocky_pubsub_get_type ())
-#define WOCKY_PUBSUB(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), WOCKY_TYPE_PUBSUB, \
- WockyPubsub))
-#define WOCKY_PUBSUB_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), WOCKY_TYPE_PUBSUB, \
- WockyPubsubClass))
-#define WOCKY_IS_PUBSUB(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), WOCKY_TYPE_PUBSUB))
-#define WOCKY_IS_PUBSUB_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), WOCKY_TYPE_PUBSUB))
-#define WOCKY_PUBSUB_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), WOCKY_TYPE_PUBSUB, \
- WockyPubsubClass))
-
-WockyPubsub * wocky_pubsub_new (void);
-
-void wocky_pubsub_start (WockyPubsub *pubsub,
- WockySession *session);
-
-typedef gboolean (* WockyPubsubEventHandlerFunction) (WockyPubsub *pubsub,
- WockyXmppStanza *msg,
- const gchar *from,
- gpointer user_data);
-
-guint wocky_pubsub_register_event_handler (WockyPubsub *pubsub,
- const gchar *node,
- WockyPubsubEventHandlerFunction func,
- gpointer user_data);
-
-void wocky_pubsub_send_query_async (WockyPubsub *pubsub,
- const gchar *jid,
- const gchar *node,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-WockyXmppStanza * wocky_pubsub_send_query_finish (WockyPubsub *pubsub,
- GAsyncResult *result,
- GError **error);
-
-void wocky_pubsub_unregister_event_handler (WockyPubsub *pubsub,
- guint id);
-
-/* not methods */
-WockyXmppStanza * pubsub_make_publish_msg (const gchar *to,
- const gchar *node_name,
- const gchar *item_ns,
- const gchar *item_name,
- WockyXmppNode **node);
-
-G_END_DECLS
-
-#endif /* __WOCKY_PUBSUB_H__ */
--
1.5.6.5
More information about the telepathy-commits
mailing list