# mass_highlight_block.pl by arza : Block mass highlights # This program is free software: you can modify/redistribute it under the terms of # GNU General Public License by Free Software Foundation, either version 3 or later # which you can get from . # This program is distributed in the hope that it will be useful, but without any warranty. weechat::register("mass_highlight_block", "arza ", "0.1", "GPL3", "Block mass highlights", "", ""); my $version=weechat::info_get("version_number", "") || 0; if(!weechat::config_is_set_plugin("nick_threshold")){ weechat::config_set_plugin("nick_threshold", 5); } my $nick_threshold=weechat::config_get_plugin("nick_threshold"); if($version>=0x00030500){ weechat::config_set_desc_plugin("nick_threshold", "minimum amount of nicks in line to disable highlight (default: 5)"); } weechat::hook_modifier("weechat_print", "block", ""); weechat::hook_config("plugins.var.perl.mass_highlight_block.nick_threshold", "set_nick_threshold", ""); sub block { my $message=$_[3]; $_[2]=~/(\S+);(\S+)\.(\S+);(\S+)/ || return $message; my ($plugin, $server, $channel, $tags) = ($1, $2, $3, $4); $tags=~/irc_privmsg/ && $tags!~/no_highlight/ || return $message; # my $a=1; # my @taglist=split(/,/, $tags); # foreach my $tag (@taglist){ # if($tag eq "no_highlight"){ $a=0; return $message; } # } my @words=split(" ", $message); # foreach my $word (@words){ # if($word eq weechat::info_get("irc_nick", $server)){ # my $a=1; # last; # } # } # $a || return $message; my $count=0; foreach my $word (@words){ my $infolist=weechat::infolist_get("irc_nick", "", "$server,$channel,$word"); if($infolist){ $count++; weechat::infolist_free($infolist); } } if($count>=$nick_threshold){ weechat::print_date_tags(weechat::buffer_search($plugin, "$server.$channel"), 0, "$tags,no_highlight", $message); return ""; } return $message; } sub set_nick_threshold { $nick_threshold=$_[2]; }