Added lm_connection_unregister_reply_handler()
authorFrank Zschockelt <flm@freakysoft.de>
Sat, 16 Jan 2010 17:08:20 +0100
changeset 609 8dab2a5c2123
parent 608 59d517aa4770
child 610 5b1a4edfe5cf
Added lm_connection_unregister_reply_handler()
loudmouth/lm-connection.c
loudmouth/lm-connection.h
loudmouth/loudmouth.sym
--- a/loudmouth/lm-connection.c	Sun Oct 11 18:26:24 2009 +0200
+++ b/loudmouth/lm-connection.c	Sat Jan 16 17:08:20 2010 +0100
@@ -2001,6 +2001,33 @@
 }
 
 /**
+ * lm_connection_unregister_reply_handler:
+ * @connection: Connection to unregister a handler for.
+ * @handler: The handler to unregister.
+ *
+ * Unregisters the reply handler for @connection. @handler will no longer be
+ * called if an incoming message has the id for which it was registered.
+ **/
+void
+lm_connection_unregister_reply_handler (LmConnection     *connection,
+                                        LmMessageHandler *handler)
+{
+    GHashTableIter iter;
+    gpointer key, value;
+
+    g_return_if_fail (connection != NULL);
+    g_return_if_fail (handler != NULL);
+
+    g_hash_table_iter_init (&iter, connection -> id_handlers);
+    while (g_hash_table_iter_next (&iter, &key, &value)) {
+        if (handler == value) {
+            g_hash_table_iter_remove (&iter);
+            break;
+        }
+    }
+}
+
+/**
  * lm_connection_register_message_handler:
  * @connection: Connection to register a handler for.
  * @handler: Message handler to register.
--- a/loudmouth/lm-connection.h	Sun Oct 11 18:26:24 2009 +0200
+++ b/loudmouth/lm-connection.h	Sat Jan 16 17:08:20 2010 +0100
@@ -210,6 +210,9 @@
                                                LmMessage          *message,
                                                GError            **error);
 void
+lm_connection_unregister_reply_handler        (LmConnection     *connection,
+                                               LmMessageHandler *handler);
+void
 lm_connection_register_message_handler        (LmConnection       *connection,
                                                LmMessageHandler   *handler,
                                                LmMessageType       type,
--- a/loudmouth/loudmouth.sym	Sun Oct 11 18:26:24 2009 +0200
+++ b/loudmouth/loudmouth.sym	Sat Jan 16 17:08:20 2010 +0100
@@ -23,6 +23,7 @@
 lm_connection_send_raw
 lm_connection_send_with_reply
 lm_connection_send_with_reply_and_block
+lm_connection_unregister_reply_handler
 lm_connection_set_disconnect_function
 lm_connection_set_jid
 lm_connection_set_keep_alive_rate