summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-01-27 21:24:26 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2012-01-27 22:16:00 +0000
commit7319d124c880f0d8858ac137768bddd5c6ebc869 (patch)
tree54d29bfb8e5cd2a93e1b71d575eb09f18ecfa7ae /lib
parent5881a6456bad0b47dba58134dfabd7f766b2cd17 (diff)
Remove LmMessageHandler API.
LmHandlerResult shows up in _gabble_connection_send_with_reply(), so we can't ditch that just yet.
Diffstat (limited to 'lib')
-rw-r--r--lib/loudmouth/lm-connection.c106
-rw-r--r--lib/loudmouth/lm-connection.h12
-rw-r--r--lib/loudmouth/lm-message-handler.c35
-rw-r--r--lib/loudmouth/lm-message-handler.h27
-rw-r--r--lib/loudmouth/lm-types.h1
5 files changed, 0 insertions, 181 deletions
diff --git a/lib/loudmouth/lm-connection.c b/lib/loudmouth/lm-connection.c
index 6fbffdf7b..912b88431 100644
--- a/lib/loudmouth/lm-connection.c
+++ b/lib/loudmouth/lm-connection.c
@@ -21,98 +21,9 @@
#include "lm-connection.h"
#include "lm-message-handler.h"
-static gboolean
-stanza_cb (WockyPorter *self,
- WockyStanza *stanza,
- gpointer user_data)
-{
- LmMessageHandler *handler = (LmMessageHandler *) user_data;
- LmHandlerResult result;
-
- result = handler->function (handler, handler->connection, stanza,
- handler->user_data);
-
- if (result == LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS)
- return FALSE;
- else
- return TRUE;
-}
-
-typedef struct
-{
- LmMessageHandler *handler;
- WockyStanzaType type;
- LmHandlerPriority priority;
-} delayed_handler;
-
-void
-lm_connection_register_message_handler (LmConnection *connection,
- LmMessageHandler *handler,
- WockyStanzaType type,
- LmHandlerPriority priority)
-{
- if (connection->porter == NULL)
- {
- /* Loudmouth lets you register handlers before the connection is
- * connected. We can't do currently do that with Wocky so we store the
- * handler and will register it once lm_connection_set_porter is called.*/
- delayed_handler *delayed;
-
- delayed = g_slice_new (delayed_handler);
- delayed->handler = handler;
- delayed->type = type;
- delayed->priority = priority;
-
- connection->delayed_handlers = g_slist_prepend (
- connection->delayed_handlers, delayed);
- return;
- }
-
- /* Genuine Loudmouth lets you register the same handler once per message
- * type, but this compatibility shim only lets you register each
- * LmMessageHandler once. */
- g_assert (handler->handler_id == 0);
- g_assert (handler->connection == NULL);
-
- handler->connection = connection;
-
- handler->handler_id = wocky_porter_register_handler_from_anyone (
- connection->porter, type, WOCKY_STANZA_SUB_TYPE_NONE, priority, stanza_cb,
- handler, NULL);
-}
-
-void
-lm_connection_unregister_message_handler (LmConnection *connection,
- LmMessageHandler *handler,
- WockyStanzaType type)
-{
- if (handler->handler_id == 0)
- return;
-
- g_assert (handler->connection != NULL);
-
- wocky_porter_unregister_handler (handler->connection->porter,
- handler->handler_id);
-
- handler->handler_id = 0;
- handler->connection = NULL;
-}
-
void
lm_connection_unref (LmConnection *connection)
{
- GSList *l;
-
- for (l = connection->delayed_handlers; l != NULL; l = g_slist_next (l))
- {
- delayed_handler *delayed = l->data;
-
- g_slice_free (delayed_handler, delayed);
- }
-
- g_slist_free (connection->delayed_handlers);
- connection->delayed_handlers = NULL;
-
g_cancellable_cancel (connection->iq_reply_cancellable);
g_object_unref (connection->iq_reply_cancellable);
connection->iq_reply_cancellable = NULL;
@@ -133,7 +44,6 @@ lm_connection_new (void)
connection = g_malloc (sizeof (LmConnection));
connection->porter = NULL;
- connection->delayed_handlers = NULL;
connection->iq_reply_cancellable = g_cancellable_new ();
return connection;
@@ -143,23 +53,7 @@ void
lm_connection_set_porter (LmConnection *connection,
WockyPorter *porter)
{
- GSList *l;
-
g_assert (connection != NULL);
g_assert (connection->porter == NULL);
connection->porter = g_object_ref (porter);
-
- /* Now that we have a porter we can register the delayed handlers */
- for (l = connection->delayed_handlers; l != NULL; l = g_slist_next (l))
- {
- delayed_handler *delayed = l->data;
-
- lm_connection_register_message_handler (connection, delayed->handler,
- delayed->type, delayed->priority);
-
- g_slice_free (delayed_handler, delayed);
- }
-
- g_slist_free (connection->delayed_handlers);
- connection->delayed_handlers = NULL;
}
diff --git a/lib/loudmouth/lm-connection.h b/lib/loudmouth/lm-connection.h
index afde40930..97fb08c23 100644
--- a/lib/loudmouth/lm-connection.h
+++ b/lib/loudmouth/lm-connection.h
@@ -32,23 +32,11 @@ G_BEGIN_DECLS
struct _LmConnection
{
WockyPorter *porter;
- GSList *delayed_handlers;
GCancellable *iq_reply_cancellable;
};
-typedef guint LmHandlerPriority;
-
LmConnection * lm_connection_new (void);
-void lm_connection_register_message_handler (LmConnection *connection,
- LmMessageHandler *handler,
- WockyStanzaType type,
- LmHandlerPriority priority);
-
-void lm_connection_unregister_message_handler (LmConnection *connection,
- LmMessageHandler *handler,
- WockyStanzaType type);
-
void lm_connection_unref (LmConnection *connection);
/* Fake API. This is not part of loudmouth */
diff --git a/lib/loudmouth/lm-message-handler.c b/lib/loudmouth/lm-message-handler.c
index f3c3988a7..8cb62084b 100644
--- a/lib/loudmouth/lm-message-handler.c
+++ b/lib/loudmouth/lm-message-handler.c
@@ -19,38 +19,3 @@
*/
#include "lm-message-handler.h"
-
-LmMessageHandler *
-lm_message_handler_new (LmHandleMessageFunction function,
- gpointer user_data,
- GDestroyNotify notify)
-{
- LmMessageHandler *handler = g_slice_new0 (LmMessageHandler);
- handler->function = function;
- handler->user_data = user_data;
- handler->notify = notify;
- handler->ref_count = 1;
-
- return handler;
-}
-
-void
-lm_message_handler_unref (LmMessageHandler *handler)
-{
- handler->ref_count--;
-
- if (handler->ref_count == 0)
- {
- if (handler->notify != NULL)
- handler->notify (handler->user_data);
- g_slice_free (LmMessageHandler, handler);
- }
-}
-
-LmMessageHandler *
-lm_message_handler_ref (LmMessageHandler *handler)
-{
- handler->ref_count++;
-
- return handler;
-}
diff --git a/lib/loudmouth/lm-message-handler.h b/lib/loudmouth/lm-message-handler.h
index a263adfaa..e82f5d5b6 100644
--- a/lib/loudmouth/lm-message-handler.h
+++ b/lib/loudmouth/lm-message-handler.h
@@ -33,33 +33,6 @@ typedef enum {
LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS
} LmHandlerResult;
-typedef LmHandlerResult (*LmHandleMessageFunction) (LmMessageHandler *handler,
- LmConnection *connection,
- WockyStanza *message,
- gpointer user_data);
-
-struct _LmMessageHandler
-{
- guint handler_id;
- LmConnection *connection;
- LmHandleMessageFunction function;
- gpointer user_data;
- GDestroyNotify notify;
- guint ref_count;
-};
-
-#define LM_HANDLER_PRIORITY_LAST WOCKY_PORTER_HANDLER_PRIORITY_MIN
-#define LM_HANDLER_PRIORITY_NORMAL WOCKY_PORTER_HANDLER_PRIORITY_NORMAL
-#define LM_HANDLER_PRIORITY_FIRST WOCKY_PORTER_HANDLER_PRIORITY_MAX
-
-LmMessageHandler * lm_message_handler_new (LmHandleMessageFunction function,
- gpointer user_data,
- GDestroyNotify notify);
-
-void lm_message_handler_unref (LmMessageHandler *handler);
-
-LmMessageHandler * lm_message_handler_ref (LmMessageHandler *handler);
-
G_END_DECLS
#endif /* #ifndef __LM_MESSAGE_HANDLER_H__ */
diff --git a/lib/loudmouth/lm-types.h b/lib/loudmouth/lm-types.h
index 077ccbc33..0fc37b48f 100644
--- a/lib/loudmouth/lm-types.h
+++ b/lib/loudmouth/lm-types.h
@@ -5,7 +5,6 @@
G_BEGIN_DECLS
-typedef struct _LmMessageHandler LmMessageHandler;
typedef struct _LmConnection LmConnection;
G_END_DECLS