Mercurial > pidgin
comparison libpurple/cmds.c @ 24056:1de1494a13e5
propagate from branch 'im.pidgin.pidgin' (head e685599ddcc769d157547685b5498df0662de8a2)
to branch 'im.pidgin.xmpp.custom_smiley' (head 110555eba89887adcf842166213ffc82770c0ee4)
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 04 Sep 2008 21:27:33 +0000 |
parents | b5f679e95666 |
children | a6e3cb32cdd2 |
comparison
equal
deleted
inserted
replaced
23781:c45d05bd58ed | 24056:1de1494a13e5 |
---|---|
79 c->help = g_strdup(helpstr); | 79 c->help = g_strdup(helpstr); |
80 c->data = data; | 80 c->data = data; |
81 | 81 |
82 cmds = g_list_insert_sorted(cmds, c, (GCompareFunc)cmds_compare_func); | 82 cmds = g_list_insert_sorted(cmds, c, (GCompareFunc)cmds_compare_func); |
83 | 83 |
84 purple_signal_emit(purple_cmds_get_handle(), "cmd-added", cmd, p, f); | |
85 | |
84 return id; | 86 return id; |
85 } | 87 } |
86 | 88 |
87 static void purple_cmd_free(PurpleCmd *c) | 89 static void purple_cmd_free(PurpleCmd *c) |
88 { | 90 { |
101 for (l = cmds; l; l = l->next) { | 103 for (l = cmds; l; l = l->next) { |
102 c = l->data; | 104 c = l->data; |
103 | 105 |
104 if (c->id == id) { | 106 if (c->id == id) { |
105 cmds = g_list_remove(cmds, c); | 107 cmds = g_list_remove(cmds, c); |
108 purple_signal_emit(purple_cmds_get_handle(), "cmd-removed", c->cmd); | |
106 purple_cmd_free(c); | 109 purple_cmd_free(c); |
107 return; | 110 return; |
108 } | 111 } |
109 } | 112 } |
110 } | 113 } |
359 ret = g_list_sort(ret, (GCompareFunc)strcmp); | 362 ret = g_list_sort(ret, (GCompareFunc)strcmp); |
360 | 363 |
361 return ret; | 364 return ret; |
362 } | 365 } |
363 | 366 |
367 gpointer purple_cmds_get_handle(void) | |
368 { | |
369 static int handle; | |
370 return &handle; | |
371 } | |
372 | |
373 void purple_cmds_init(void) | |
374 { | |
375 gpointer handle = purple_cmds_get_handle(); | |
376 | |
377 purple_signal_register(handle, "cmd-added", | |
378 purple_marshal_VOID__POINTER_INT_INT, NULL, 3, | |
379 purple_value_new(PURPLE_TYPE_STRING), | |
380 purple_value_new(PURPLE_TYPE_INT), | |
381 purple_value_new(PURPLE_TYPE_INT)); | |
382 purple_signal_register(handle, "cmd-removed", | |
383 purple_marshal_VOID__POINTER, NULL, 1, | |
384 purple_value_new(PURPLE_TYPE_STRING)); | |
385 } | |
386 | |
387 void purple_cmds_uninit(void) | |
388 { | |
389 purple_signals_unregister_by_instance(purple_cmds_get_handle()); | |
390 } | |
391 |