logo

dotfiles

My dotfiles, one branch per machine
commit: ea722a156a7248ab0e5a46d1a4d1b1893fafa255
parent: a7c794faf23dfc01e799ce1ddc75f2749b6e77f7
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue,  1 Jan 2019 05:18:22 +0100

.weechat: Update

Diffstat:

A.weechat/perl.conf14++++++++++++++
A.weechat/perl/autoload/mass_hl_blocker.pl2++
A.weechat/perl/mass_hl_blocker.pl41+++++++++++++++++++++++++++++++++++++++++
A.weechat/python.conf14++++++++++++++
4 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/.weechat/perl.conf b/.weechat/perl.conf @@ -0,0 +1,14 @@ +# +# weechat -- perl.conf +# +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# + +[look] +check_license = off +eval_keep_context = on diff --git a/.weechat/perl/autoload/mass_hl_blocker.pl b/.weechat/perl/autoload/mass_hl_blocker.pl @@ -0,0 +1 @@ +../mass_hl_blocker.pl+ \ No newline at end of file diff --git a/.weechat/perl/mass_hl_blocker.pl b/.weechat/perl/mass_hl_blocker.pl @@ -0,0 +1,41 @@ +# Mass highlight blocker for WeeChat by arza <arza@arza.us>, distributed freely and without any warranty, licensed under GPL3 <http://www.gnu.org/licenses/gpl.html> + +weechat::register('mass_hl_blocker', 'arza <arza\@arza.us>', '0.1', 'GPL3', 'Block mass highlights', '', ''); + +my $version=weechat::info_get('version_number', '') || 0; + +my $limit=5; + +if(weechat::config_is_set_plugin('limit')){ $limit=weechat::config_get_plugin('limit'); } +else{ weechat::config_set_plugin('limit', $limit); } + +if($version>=0x00030500){ weechat::config_set_desc_plugin('limit', 'minimum amount of nicks in line to disable highlight (default: 5)'); } + +weechat::hook_config('plugins.var.perl.mass_highlight_block.limit', 'set_limit', ''); +weechat::hook_modifier('2000|weechat_print', 'block', ''); + +sub block { my $message=$_[3]; + + $_[2]=~/(\S+);(\S+)\.(\S+);(\S+)/ || return $message; + my ($plugin, $server, $channel, $tags) = ($1, $2, $3, $4); + index($message, weechat::info_get('irc_nick', $server)) != -1 && index($tags, 'notify_message') != -1 && index($tags, 'no_highlight') == -1 || return $message; + + my $count=0; + foreach my $word (split(' ', $message)){ + my $infolist=weechat::infolist_get('irc_nick', '', "$server,$channel,$word"); + if($infolist){ $count++; } + weechat::infolist_free($infolist); + } + + if($count>=$limit){ + weechat::print_date_tags(weechat::buffer_search($plugin, "$server.$channel"), 0, "$tags,no_highlight", $message); + return ''; + } + + return $message; +} + +sub set_limit { + $limit=$_[2]; + return weechat::WEECHAT_RC_OK; +} diff --git a/.weechat/python.conf b/.weechat/python.conf @@ -0,0 +1,14 @@ +# +# weechat -- python.conf +# +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# + +[look] +check_license = off +eval_keep_context = on