diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-02-01 18:56:12 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-02-01 18:56:12 +0100 |
commit | 184700e597f7374146ba0c0ca6932f83d8d6add2 (patch) | |
tree | d8ce9882815bacac549435d5494ebd08bdc28310 /src/plugins/demo | |
parent | d15c1956b59d749f503091ca88565610c0cc8946 (diff) | |
download | weechat-184700e597f7374146ba0c0ca6932f83d8d6add2.zip |
New "close callback" for buffers, use of this callback in IRC plugin to leave channel or disconnect from server when buffer is closed
Diffstat (limited to 'src/plugins/demo')
-rw-r--r-- | src/plugins/demo/demo.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c index f5fe25412..4865ecb05 100644 --- a/src/plugins/demo/demo.c +++ b/src/plugins/demo/demo.c @@ -115,7 +115,31 @@ demo_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer, (void) data; weechat_printf (buffer, - "buffer input_data_cb: input_data = '%s'", input_data); + "buffer_input_data_cb: buffer = %x (%s / %s), " + "input_data = '%s'", + buffer, + weechat_buffer_get (buffer, "category"), + weechat_buffer_get (buffer, "name"), + input_data); + + return WEECHAT_RC_OK; +} + +/* + * demo_buffer_close_cb: callback for buffer closed + */ + +int +demo_buffer_close_cb (void *data, struct t_gui_buffer *buffer) +{ + /* make C compiler happy */ + (void) data; + + weechat_printf (NULL, + "buffer_close_cb: buffer = %x (%s / %s)", + buffer, + weechat_buffer_get (buffer, "category"), + weechat_buffer_get (buffer, "name")); return WEECHAT_RC_OK; } @@ -138,8 +162,8 @@ demo_buffer_command_cb (void *data, struct t_gui_buffer *buffer, int argc, if (argc > 2) { new_buffer = weechat_buffer_new (argv[1], argv[2], - &demo_buffer_input_data_cb, - NULL); + &demo_buffer_input_data_cb, NULL, + &demo_buffer_close_cb, NULL); if (new_buffer) weechat_buffer_set (new_buffer, "display", "1"); weechat_hook_signal_send ("logger_backlog", |