summaryrefslogtreecommitdiff
path: root/src/plugins/demo
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-01-09 18:26:17 +0100
committerSebastien Helleu <flashcode@flashtux.org>2008-01-09 18:26:17 +0100
commit9f2fc59569d03d660e2108e21ae5d7b6fb7c1469 (patch)
tree794efb76225b4cc1e5e89f94d0cfc4e4e9fa79fb /src/plugins/demo
parentf94b679a4a97365de29bb99ede3b2bc5c44cd93f (diff)
downloadweechat-9f2fc59569d03d660e2108e21ae5d7b6fb7c1469.zip
Partial migration of Perl plugin to new API
Diffstat (limited to 'src/plugins/demo')
-rw-r--r--src/plugins/demo/demo.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c
index e65bfd533..fb99f86b1 100644
--- a/src/plugins/demo/demo.c
+++ b/src/plugins/demo/demo.c
@@ -134,7 +134,8 @@ demo_buffer_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
demo_buffer_input_data_cb);
if (new_buffer)
weechat_buffer_set (new_buffer, "display", "1");
- weechat_hook_signal_send ("logger_backlog", new_buffer);
+ weechat_hook_signal_send ("logger_backlog",
+ WEECHAT_HOOK_SIGNAL_POINTER, new_buffer);
}
return WEECHAT_RC_OK;
@@ -281,14 +282,39 @@ demo_info_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
*/
int
-demo_signal_cb (void *data, char *signal, void *signal_data)
+demo_signal_cb (void *data, char *signal, char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
- weechat_printf (NULL,
- _("demo_signal: signal: %s, signal_data: %X"),
- signal, signal_data);
+ if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
+ {
+ weechat_printf (NULL,
+ _("demo_signal: signal: %s, type_data: %s, "
+ "signal_data: '%s'"),
+ signal, type_data, (char *)signal_data);
+ }
+ else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
+ {
+ weechat_printf (NULL,
+ _("demo_signal: signal: %s, type_data: %s, "
+ "signal_data: %d"),
+ signal, type_data, *((int *)signal_data));
+ }
+ else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0)
+ {
+ weechat_printf (NULL,
+ _("demo_signal: signal: %s, type_data: %s, "
+ "signal_data: 0x%x"),
+ signal, type_data, signal_data);
+ }
+ else
+ {
+ weechat_printf (NULL,
+ _("demo_signal: signal: %s, type_data: %s, "
+ "signal_data: 0x%x (unknown type)"),
+ signal, type_data, signal_data);
+ }
return WEECHAT_RC_OK;
}