diff libpurple/cmds.c @ 23516:b1457c51da46

propagate from branch 'im.pidgin.pidgin' (head 99fe11b8da675f3b74b853ea29a16d8c9564cb95) to branch 'im.pidgin.cpw.qulogic.msn' (head 86d2aabc8c0973823a48a28d3c74e0a8b988d8dd)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 09 Jul 2008 02:06:38 +0000
parents b5f679e95666
children a6e3cb32cdd2
line wrap: on
line diff
--- a/libpurple/cmds.c	Wed Jul 09 01:46:10 2008 +0000
+++ b/libpurple/cmds.c	Wed Jul 09 02:06:38 2008 +0000
@@ -81,6 +81,8 @@
 
 	cmds = g_list_insert_sorted(cmds, c, (GCompareFunc)cmds_compare_func);
 
+	purple_signal_emit(purple_cmds_get_handle(), "cmd-added", cmd, p, f);
+
 	return id;
 }
 
@@ -103,6 +105,7 @@
 
 		if (c->id == id) {
 			cmds = g_list_remove(cmds, c);
+			purple_signal_emit(purple_cmds_get_handle(), "cmd-removed", c->cmd);
 			purple_cmd_free(c);
 			return;
 		}
@@ -361,3 +364,28 @@
 	return ret;
 }
 
+gpointer purple_cmds_get_handle(void)
+{
+	static int handle;
+	return &handle;
+}
+
+void purple_cmds_init(void)
+{
+	gpointer handle = purple_cmds_get_handle();
+
+	purple_signal_register(handle, "cmd-added",
+			purple_marshal_VOID__POINTER_INT_INT, NULL, 3,
+			purple_value_new(PURPLE_TYPE_STRING),
+			purple_value_new(PURPLE_TYPE_INT),
+			purple_value_new(PURPLE_TYPE_INT));
+	purple_signal_register(handle, "cmd-removed",
+			purple_marshal_VOID__POINTER, NULL, 1,
+			purple_value_new(PURPLE_TYPE_STRING));
+}
+
+void purple_cmds_uninit(void)
+{
+	purple_signals_unregister_by_instance(purple_cmds_get_handle());
+}
+