mirror of
https://github.com/weechat/weechat.git
synced 2026-07-07 10:13:12 +02:00
Add options irc.look.smart_filter_join/quit, smart filter enabled by default
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user