From 613bc37bfa499fdd8d31836166b9fc9183a22587 Mon Sep 17 00:00:00 2001 From: wowaname Date: Sun, 18 Sep 2016 00:01:42 +0000 Subject: [PATCH] fix ra,rato,xra aliases --- conf/alias.conf | 6 +++--- scripts/antifuck.pl | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/conf/alias.conf b/conf/alias.conf index 80f1ec6..0049e89 100644 --- a/conf/alias.conf +++ b/conf/alias.conf @@ -99,8 +99,8 @@ qrm = "query_blocker del" quiet = "kloeri quiet" r-pair = "eval /set plugins.var.python.text_replace.replacement_pairs "${plugins.var.python.text_replace.replacement_pairs}\;$1=$2-"" r-word = "eval /set plugins.var.python.text_replace.replacement_words "${plugins.var.python.text_replace.replacement_words}\;$1=$2-"" -ra = "exec -pipe /prism sed s/^/ / ascii/*/"$*"" -rato = "exec -pipe /prism sed 's/^/$1: /' ascii/*/"$2-"" +ra = "exec -pipe "/prism -c (BEGIN) /msg -server $server $channel" sed 's/^/(BEGIN) /' ascii/*/"$*"" +rato = "exec -pipe "/prism -c (BEGIN) /msg -server $server $channel" sed 's/^/(BEGIN)$1: /' ascii/*/"$2-"" raw = "quote" rc = "reconnect" reason = "kloeri reason" @@ -145,7 +145,7 @@ wi = "whois" wii = "whois $1 $1" wv = "command core version" ww = "whowas" -xra = "exec -pipe "/prism -x" sed s/^/ / ascii/*/"$*"" +xra = "exec -pipe "/prism -xc (BEGIN) /msg -server $server $channel" sed 's/^/(BEGIN) /' ascii/*/"$*"" xyzzy = "print Nothing happens" [completion] diff --git a/scripts/antifuck.pl b/scripts/antifuck.pl index 8683091..d5e0543 100644 --- a/scripts/antifuck.pl +++ b/scripts/antifuck.pl @@ -29,11 +29,14 @@ from channel forwards, as well as forced parts, such as from the /remove command. You can configure certain behaviour using the options under "plugins.var.perl.antifuck.*". Configure rejoin-on-/remove with the irc.server_default.autorejoin and .autorejoin_delay commands. + +Running "/antifuck part" will close all forcejoined channels and part them where +appropriate. HELP 'part', 'cmd_antifuck', ''); weechat::hook_signal('irc_server_connected', 'irc_connect', ''); weechat::hook_signal('irc_server_disconnected', 'irc_disconnect', ''); - #weechat::hook_signal('irc_channel_opened', 'buffer_opened', ''); + weechat::hook_signal('irc_channel_opened', 'buffer_opened', ''); weechat::hook_signal('*,irc_out1_join', 'client_join', ''); weechat::hook_signal('*,irc_out1_part', 'client_part', ''); weechat::hook_modifier('irc_in_366', 'irc_366', ''); @@ -67,7 +70,12 @@ sub servchan { sub cmd_antifuck { my (undef, $buffer, $args) = @_; - weechat::print('',"$_: ".join(' ', keys %{ $part{$_} })) for (keys %part); + + if ($args eq 'part') { + # TODO: we really need to spend more time here making sure we send the + # fewest PARTs possible, a la irc_join_delay + weechat::buffer_close($fuckbuf); + } } sub fuckbuf_input { @@ -76,6 +84,8 @@ sub fuckbuf_input { sub fuckbuf_close { $fuckbuf = ''; + weechat::buffer_close($_) for (@partbuf); + @partbuf = (); return weechat::WEECHAT_RC_OK; } @@ -115,7 +125,7 @@ sub buffer_opened { weechat::buffer_merge($buffer, $fuckbuf); return weechat::WEECHAT_RC_OK unless weechat::config_get_plugin('autopart'); - #push @partbuf, $buffer; + push @partbuf, $buffer; return weechat::WEECHAT_RC_OK; }