diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-26 20:02:17 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-26 20:02:17 +0100 |
commit | 485e884751464f4b9b006e7d98cb28f0c8cd1f95 (patch) | |
tree | 213edbd372f4f8fd25c873de660407f7c7695b87 /src/plugins/irc | |
parent | 2bbc2283812aa066f80cb045380fb599443d9e37 (diff) | |
download | weechat-485e884751464f4b9b006e7d98cb28f0c8cd1f95.zip |
Add new option irc.look.part_closes_buffer to close buffer when /part is issued on channel (task #10295)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-bar-item.c | 12 | ||||
-rw-r--r-- | src/plugins/irc/irc-buffer.c | 12 | ||||
-rw-r--r-- | src/plugins/irc/irc-buffer.h | 12 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 6 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 5 |
6 files changed, 30 insertions, 18 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index 33220a20f..bcabf6d93 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -54,7 +54,7 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item, if (buffer) { - irc_buffer_get_server_channel (buffer, &server, NULL); + irc_buffer_get_server_and_channel (buffer, &server, NULL); if (server && server->is_away) { @@ -140,7 +140,7 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item, name = weechat_plugin_get_name (ptr_plugin); if (ptr_plugin == weechat_irc_plugin) { - irc_buffer_get_server_channel (buffer, &server, &channel); + irc_buffer_get_server_and_channel (buffer, &server, &channel); if (server && channel && (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_PLUGIN)) { @@ -196,7 +196,7 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item, if (buffer) { - irc_buffer_get_server_channel (buffer, &server, &channel); + irc_buffer_get_server_and_channel (buffer, &server, &channel); if (server || channel) { if (server && !channel) @@ -305,7 +305,7 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item, if (buffer) { - irc_buffer_get_server_channel (buffer, &server, &channel); + irc_buffer_get_server_and_channel (buffer, &server, &channel); if (server || channel) { if (server && !channel) @@ -375,7 +375,7 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item, if (buffer) { - irc_buffer_get_server_channel (buffer, &server, NULL); + irc_buffer_get_server_and_channel (buffer, &server, NULL); if (server && (server->lag >= weechat_config_integer (irc_config_network_lag_min_show) * 1000)) @@ -417,7 +417,7 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item, if (buffer) { - irc_buffer_get_server_channel (buffer, &server, &channel); + irc_buffer_get_server_and_channel (buffer, &server, &channel); if (!server || !server->nick) return NULL; diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c index 8a8bd044e..bdf6f0c47 100644 --- a/src/plugins/irc/irc-buffer.c +++ b/src/plugins/irc/irc-buffer.c @@ -35,15 +35,15 @@ /* - * irc_buffer_get_server_channel: get IRC server and channel pointers with a - * buffer pointer - * (buffer may be a server or a channel) + * irc_buffer_get_server_and_channel: get IRC server and channel pointers with + * a buffer pointer + * (buffer may be a server or a channel) */ void -irc_buffer_get_server_channel (struct t_gui_buffer *buffer, - struct t_irc_server **server, - struct t_irc_channel **channel) +irc_buffer_get_server_and_channel (struct t_gui_buffer *buffer, + struct t_irc_server **server, + struct t_irc_channel **channel) { struct t_irc_server *ptr_server; struct t_irc_channel *ptr_channel; diff --git a/src/plugins/irc/irc-buffer.h b/src/plugins/irc/irc-buffer.h index 0f4c5da88..4ad53334e 100644 --- a/src/plugins/irc/irc-buffer.h +++ b/src/plugins/irc/irc-buffer.h @@ -25,7 +25,7 @@ struct t_irc_server *ptr_server = NULL; \ buffer_plugin = weechat_buffer_get_pointer (__buffer, "plugin"); \ if (buffer_plugin == weechat_irc_plugin) \ - irc_buffer_get_server_channel (__buffer, &ptr_server, NULL); + irc_buffer_get_server_and_channel (__buffer, &ptr_server, NULL); #define IRC_BUFFER_GET_SERVER_CHANNEL(__buffer) \ struct t_weechat_plugin *buffer_plugin = NULL; \ @@ -34,8 +34,8 @@ buffer_plugin = weechat_buffer_get_pointer (__buffer, "plugin"); \ if (buffer_plugin == weechat_irc_plugin) \ { \ - irc_buffer_get_server_channel (__buffer, &ptr_server, \ - &ptr_channel); \ + irc_buffer_get_server_and_channel (__buffer, &ptr_server, \ + &ptr_channel); \ } #define IRC_BUFFER_RAW_NAME "irc_raw" @@ -48,9 +48,9 @@ struct t_gui_buffer; struct t_irc_server; struct t_irc_channel; -extern void irc_buffer_get_server_channel (struct t_gui_buffer *buffer, - struct t_irc_server **server, - struct t_irc_channel **channel); +extern void irc_buffer_get_server_and_channel (struct t_gui_buffer *buffer, + struct t_irc_server **server, + struct t_irc_channel **channel); extern char *irc_buffer_build_name (const char *server, const char *channel); extern int irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer); extern struct t_gui_buffer *irc_buffer_search_first_for_all_servers (); diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 404130a80..e752b4070 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -68,6 +68,7 @@ struct t_config_option *irc_config_look_highlight_tags; struct t_config_option *irc_config_look_item_display_server; struct t_config_option *irc_config_look_msgbuffer_fallback; struct t_config_option *irc_config_look_notice_as_pv; +struct t_config_option *irc_config_look_part_closes_buffer; struct t_config_option *irc_config_look_raw_messages; struct t_config_option *irc_config_look_show_away_once; struct t_config_option *irc_config_look_smart_filter; @@ -1572,6 +1573,11 @@ irc_config_init () N_("display notices as private messages (if auto, use private buffer " "if found)"), "auto|never|always", 0, 0, "auto", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_part_closes_buffer = weechat_config_new_option ( + irc_config_file, ptr_section, + "part_closes_buffer", "boolean", + N_("close buffer when /part is issued on a channel"), + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_topic_strip_colors = weechat_config_new_option ( irc_config_file, ptr_section, "topic_strip_colors", "boolean", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index e11100c5a..381e54cbc 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -90,6 +90,7 @@ extern struct t_config_option *irc_config_look_highlight_tags; extern struct t_config_option *irc_config_look_item_display_server; extern struct t_config_option *irc_config_look_msgbuffer_fallback; extern struct t_config_option *irc_config_look_notice_as_pv; +extern struct t_config_option *irc_config_look_part_closes_buffer; extern struct t_config_option *irc_config_look_raw_messages; extern struct t_config_option *irc_config_look_show_away_once; extern struct t_config_option *irc_config_look_smart_filter; diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index dc1b55db3..5c3120bbb 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -1255,6 +1255,11 @@ IRC_PROTOCOL_CALLBACK(part) else irc_command_join_server (server, ptr_channel->name); } + else + { + if (weechat_config_boolean (irc_config_look_part_closes_buffer)) + weechat_buffer_close (ptr_channel->buffer); + } } else irc_nick_free (ptr_channel, ptr_nick); |