From 17149d0f01728f9892943749b6b5c447838cf891 Mon Sep 17 00:00:00 2001 From: wowaname Date: Sun, 27 Nov 2016 12:36:58 +0000 Subject: [PATCH] antifuck.pl: sync channels on script load --- scripts/antifuck.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/antifuck.pl b/scripts/antifuck.pl index 05c822d..415099c 100644 --- a/scripts/antifuck.pl +++ b/scripts/antifuck.pl @@ -48,6 +48,18 @@ HELP unless weechat::config_is_set_plugin($option); weechat::config_set_desc_plugin($option, $OPTIONS{$option}[0]); } + + my $iptr = weechat::infolist_get('buffer', '', ''); + + while (weechat::infolist_next($iptr)) { + next unless weechat::infolist_string($iptr, 'plugin_name') eq 'irc'; + my $buf = weechat::infolist_pointer($iptr, 'pointer'); + $channels{ + lc weechat::buffer_get_string($buf, 'localvar_server')}{ + lc weechat::buffer_get_string($buf, 'localvar_channel')} = 1; + } + + weechat::infolist_free($iptr); } sub mynick