# HG changeset patch # User Paul Aurich # Date 1242968952 0 # Node ID e0f6c61ba7798ff20150d0d7c74a00ad01a9517d # Parent 31f65046b92d405dc0e5d5198097948c15d18fcf Add the XMPP signals to the signals-test plugin diff -r 31f65046b92d -r e0f6c61ba779 libpurple/plugins/signals-test.c --- a/libpurple/plugins/signals-test.c Fri May 22 04:56:05 2009 +0000 +++ b/libpurple/plugins/signals-test.c Fri May 22 05:09:12 2009 +0000 @@ -624,6 +624,43 @@ } /************************************************************************** + * Jabber signals callbacks + **************************************************************************/ +static gboolean +jabber_iq_received(PurpleConnection *pc, const char *type, const char *id, + const char *from, xmlnode *iq) +{ + purple_debug_misc("signals test", "received IQ (type=%s, id=%s, from=%s) %p\n", + type, id, from, iq); + + /* We don't want the plugin to stop processing */ + return FALSE; +} + +static gboolean +jabber_message_received(PurpleConnection *pc, const char *type, const char *id, + const char *from, const char *to, xmlnode *message) +{ + purple_debug_misc("signals test", "received message (type=%s, id=%s, " + "from=%s to=%s) %p\n", + type, id, from, to, message); + + /* We don't want the plugin to stop processing */ + return FALSE; +} + +static gboolean +jabber_presence_received(PurpleConnection *pc, const char *type, + const char *from, xmlnode *presence) +{ + purple_debug_misc("signals test", "received presence (type=%s, from=%s) %p\n", + type, from, presence); + + /* We don't want the plugin to stop processing */ + return FALSE; +} + +/************************************************************************** * Plugin stuff **************************************************************************/ static gboolean @@ -638,6 +675,7 @@ void *ft_handle = purple_xfers_get_handle(); void *sound_handle = purple_sounds_get_handle(); void *notify_handle = purple_notify_get_handle(); + void *jabber_handle = purple_plugins_find_with_id("prpl-jabber"); /* Accounts subsystem signals */ purple_signal_connect(accounts_handle, "account-connecting", @@ -783,6 +821,24 @@ purple_signal_connect(notify_handle, "displaying-emails-notification", plugin, PURPLE_CALLBACK(notify_emails_cb), NULL); + /* Jabber signals */ + if (jabber_handle) { + purple_signal_connect(jabber_handle, "jabber-receiving-iq", plugin, + PURPLE_CALLBACK(jabber_iq_received), NULL); + purple_signal_connect(jabber_handle, "jabber-receiving-message", plugin, + PURPLE_CALLBACK(jabber_message_received), NULL); + purple_signal_connect(jabber_handle, "jabber-receiving-presence", plugin, + PURPLE_CALLBACK(jabber_presence_received), NULL); + } + + return TRUE; +} + +static gboolean +plugin_unload(PurplePlugin *plugin) +{ + purple_signals_disconnect_by_handle(plugin); + return TRUE; } @@ -808,7 +864,7 @@ PURPLE_WEBSITE, /**< homepage */ plugin_load, /**< load */ - NULL, /**< unload */ + plugin_unload, /**< unload */ NULL, /**< destroy */ NULL, /**< ui_info */