diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 7a5ecce84..e6de7672c 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -70,6 +70,8 @@ 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; struct t_config_option *irc_config_look_smart_filter_delay; +struct t_config_option *irc_config_look_smart_filter_join; +struct t_config_option *irc_config_look_smart_filter_quit; struct t_config_option *irc_config_look_topic_strip_colors; /* IRC config, color section */ @@ -1436,12 +1438,22 @@ irc_config_init () N_("filter join/part/quit messages for a nick if not speaking for " "some minutes on channel (you must create a filter on tag " "\"irc_smart_filter\")"), - NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_smart_filter_delay = weechat_config_new_option ( irc_config_file, ptr_section, "smart_filter_delay", "integer", N_("delay for filtering join/part/quit messages (in minutes)"), NULL, 1, 60*24*7, "5", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_join = weechat_config_new_option ( + irc_config_file, ptr_section, + "smart_filter_join", "boolean", + N_("enable smart filter for \"join\" messages"), + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_quit = weechat_config_new_option ( + irc_config_file, ptr_section, + "smart_filter_quit", "boolean", + N_("enable smart filter for \"part\" and \"quit\" messages"), + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_notice_as_pv = weechat_config_new_option ( irc_config_file, ptr_section, "notice_as_pv", "integer", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index e463928e8..b4a45ef5d 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -92,6 +92,8 @@ 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; extern struct t_config_option *irc_config_look_smart_filter_delay; +extern struct t_config_option *irc_config_look_smart_filter_join; +extern struct t_config_option *irc_config_look_smart_filter_quit; extern struct t_config_option *irc_config_look_topic_strip_colors; extern struct t_config_option *irc_config_color_message_join; diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 0a9d2efaf..a1a0e81b6 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -364,12 +364,14 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command, if (!irc_ignore_check (server, ptr_channel, nick, host)) { local_join = (strcmp (nick, server->nick) == 0); - ptr_nick_speaking = (weechat_config_boolean (irc_config_look_smart_filter)) ? + ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter)) + && (weechat_config_boolean (irc_config_look_smart_filter_join))) ? irc_channel_nick_speaking_time_search (ptr_channel, nick, 1) : NULL; weechat_printf_tags (ptr_channel->buffer, irc_protocol_tags (command, (local_join || !weechat_config_boolean (irc_config_look_smart_filter) + || !weechat_config_boolean (irc_config_look_smart_filter_join) || ptr_nick_speaking) ? NULL : "irc_smart_filter"), _("%s%s%s %s(%s%s%s)%s has joined %s%s%s"), @@ -949,7 +951,8 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command, /* display part message */ if (!irc_ignore_check (server, ptr_channel, nick, host)) { - ptr_nick_speaking = (weechat_config_boolean (irc_config_look_smart_filter)) ? + ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter)) + && (weechat_config_boolean (irc_config_look_smart_filter_quit))) ? irc_channel_nick_speaking_time_search (ptr_channel, nick, 1) : NULL; if (pos_comment) { @@ -957,6 +960,7 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command, irc_protocol_tags (command, (local_part || !weechat_config_boolean (irc_config_look_smart_filter) + || !weechat_config_boolean (irc_config_look_smart_filter_quit) || ptr_nick_speaking) ? NULL : "irc_smart_filter"), _("%s%s%s %s(%s%s%s)%s has left %s%s%s " @@ -983,6 +987,7 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command, irc_protocol_tags (command, (local_part || !weechat_config_boolean (irc_config_look_smart_filter) + || !weechat_config_boolean (irc_config_look_smart_filter_quit) || ptr_nick_speaking) ? NULL : "irc_smart_filter"), _("%s%s%s %s(%s%s%s)%s has left " @@ -1284,7 +1289,8 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command, if (!irc_ignore_check (server, ptr_channel, nick, host)) { local_quit = (strcmp (nick, server->nick) == 0); - ptr_nick_speaking = (weechat_config_boolean (irc_config_look_smart_filter)) ? + ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter)) + && (weechat_config_boolean (irc_config_look_smart_filter_quit))) ? irc_channel_nick_speaking_time_search (ptr_channel, nick, 1) : NULL; if (pos_comment && pos_comment[0]) { @@ -1292,6 +1298,7 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command, irc_protocol_tags (command, (local_quit || !weechat_config_boolean (irc_config_look_smart_filter) + || !weechat_config_boolean (irc_config_look_smart_filter_quit) || ptr_nick_speaking) ? NULL : "irc_smart_filter"), _("%s%s%s %s(%s%s%s)%s has quit " @@ -1316,6 +1323,7 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command, irc_protocol_tags (command, (local_quit || !weechat_config_boolean (irc_config_look_smart_filter) + || !weechat_config_boolean (irc_config_look_smart_filter_quit) || ptr_nick_speaking) ? NULL : "irc_smart_filter"), _("%s%s%s %s(%s%s%s)%s has quit"),