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/gui/gui-buffer.c | |
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/gui/gui-buffer.c')
-rw-r--r-- | src/gui/gui-buffer.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 4c2df12a1..a5a4bbdc6 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -69,7 +69,10 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name, int (*input_callback)(void *data, struct t_gui_buffer *buffer, char *input_data), - void *input_callback_data) + void *input_callback_data, + int (*close_callback)(void *data, + struct t_gui_buffer *buffer), + void *close_callback_data) { struct t_gui_buffer *new_buffer; struct t_gui_completion *new_completion; @@ -99,6 +102,10 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name, new_buffer->notify_level = GUI_BUFFER_NOTIFY_LEVEL_DEFAULT; new_buffer->num_displayed = 0; + /* close callback */ + new_buffer->close_callback = close_callback; + new_buffer->close_callback_data = close_callback_data; + /* title */ new_buffer->title = NULL; new_buffer->title_refresh_needed = 1; @@ -623,6 +630,11 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another) hook_signal_send ("buffer_close", WEECHAT_HOOK_SIGNAL_POINTER, buffer); + if (buffer->close_callback) + { + (void)(buffer->close_callback) (buffer->close_callback_data, buffer); + } + if (switch_to_another) { for (ptr_window = gui_windows; ptr_window; |