# HG changeset patch # User Stu Tomlinson # Date 1262739782 0 # Node ID 91ac03a72875149a94bec429934579bb738f6ca8 # Parent 5819bf02659e14a298b90c79c96f8f01340d14c1 Add support for the uri-handler signal to the signals-test plugin diff -r 5819bf02659e -r 91ac03a72875 libpurple/plugins/signals-test.c --- a/libpurple/plugins/signals-test.c Wed Jan 06 01:00:13 2010 +0000 +++ b/libpurple/plugins/signals-test.c Wed Jan 06 01:03:02 2010 +0000 @@ -547,6 +547,26 @@ purple_debug_misc("signals test", "quitting ()\n"); } +static void +printhash(gpointer key, gpointer value, gpointer data) +{ + char *a = (char *)key; + char *b = (char *)value; + GString *str = (GString *)data; + g_string_append_printf(str, " [%s] = [%s]\n", a, b ? b : "(null)"); +} + +static gboolean +uri_handler(const char *proto, const char *cmd, GHashTable *params) +{ + GString *str = g_string_new("\n{\n"); + g_hash_table_foreach(params, printhash, str); + g_string_append_c(str, '}'); + purple_debug_misc("signals test", "uri handler (%s, %s, %s)\n", proto, cmd, str->str); + g_string_free(str, TRUE); + return FALSE; +} + /************************************************************************** * File transfer signal callbacks **************************************************************************/ @@ -820,6 +840,8 @@ /* Core signals */ purple_signal_connect(core_handle, "quitting", plugin, PURPLE_CALLBACK(quitting_cb), NULL); + purple_signal_connect(core_handle, "uri-handler", + plugin, PURPLE_CALLBACK(uri_handler), NULL); /* File transfer signals */ purple_signal_connect(ft_handle, "file-recv-accept",