diff --git a/scripts/fuckyou.pl b/scripts/fuckyou.pl index 0399831..0b37b89 100644 --- a/scripts/fuckyou.pl +++ b/scripts/fuckyou.pl @@ -37,7 +37,7 @@ use Digest::MD5 qw(md5_hex); my $SCRIPT_NAME = 'fuckyou'; my $SCRIPT_AUTHOR = 'Goat-See '; -my $SCRIPT_VERSION = '2.2'; +my $SCRIPT_VERSION = '2.3'; my $SCRIPT_LICENCE = 'urmom'; my $SCRIPT_DESC = '/fuckyou NICK numberchannels'; @@ -46,15 +46,20 @@ my %OPTIONS = ( 'forcejoin'], forcepart => ['Command to forcepart. ratbox uses forcepart, unreal sapart', 'forcepart'], - furry => ['Channel prefix (include # or &)', '&HYE'] + furry => ['Channel prefix (include # or &)', '&HYE'], + parallel => ['Number of channels to send per forcejoin command', 1], + whois_cmd => ['Prefix to whois user (e.g. for ratbox operspy, "/whois !")', + '/whois '], ); sub fuckyou { my $buffer = shift; - my $nig = md5_hex($$ * time); + my $nig = $$ * time; + my @jews; + push @jews, "${FURRY}_".md5_hex($nig + $_) for (1..$PARALLEL); - weechat::command($buffer, "/quote $FORCEJOIN $target ${FURRY}_$nig"); + weechat::command($buffer, "/quote $FORCEJOIN $target ".join(',', @jews)); return weechat::WEECHAT_RC_OK; } @@ -65,13 +70,18 @@ sub cmd_fuckyou my $server = weechat::buffer_get_string($buffer, 'localvar_server'); my $amt_end; ($target, $amt_end) = split / +/, $data; - our ($FORCEJOIN, $FURRY) = (weechat::config_get_plugin('forcejoin'), - weechat::config_get_plugin('furry')); + our ($FORCEJOIN, $FURRY, $PARALLEL) = ( + weechat::config_get_plugin('forcejoin'), + weechat::config_get_plugin('furry'), + weechat::config_get_plugin('parallel')); - unless ($target and $amt_end) { - weechat::print($buffer, '/fuckyou '); + unless ($target) { + weechat::print($buffer, 'Stopping any current /fuckyou'); + weechat::unhook($signal) if $signal; + weechat::unhook($timer) if $timer; return weechat::WEECHAT_RC_OK; } + $amt_end //= 0; $signal = weechat::hook_signal("$server,irc_raw_in_402", 'irc_402', ''); $timer = weechat::hook_timer(50, 0, $amt_end, 'fuckyou', $buffer); @@ -86,6 +96,7 @@ sub cmd_unfuckyou weechat::buffer_get_string($buffer, 'localvar_server'), weechat::buffer_get_string($buffer, 'localvar_channel') ); + my $WHOIS = weechat::config_get_plugin('whois_cmd'); unless ($data) { weechat::print($buffer, '/unfuckyou user user2 user3'); @@ -103,7 +114,7 @@ sub cmd_unfuckyou weechat::hook_signal_send( 'irc_input_send', weechat::WEECHAT_HOOK_SIGNAL_STRING, - "$server;;1;;/whois $dick" + "$server;;1;;$WHOIS$dick" ); } @@ -128,7 +139,7 @@ sub event_whois_channels my @niggers = split / +/, $channels; foreach (@niggers) { - s/^[@%+]([&#])/$1/; + s/^[!@%+]*([&#])/$1/; if(/${FURRY}_[a-f0-9]+/i) { #Irssi::print("Forceparting $nick from $_"); @@ -157,8 +168,11 @@ sub irc_402 { if (weechat::register($SCRIPT_NAME, $SCRIPT_AUTHOR, $SCRIPT_VERSION, $SCRIPT_LICENCE, $SCRIPT_DESC, '', '')) { - weechat::hook_command('fuckyou', '', ' ', '', '', - 'cmd_fuckyou', ''); + weechat::hook_command('fuckyou', '', '[ []]', + "if nick is not given, stops current fuckyou, if any is running\n\n". + "amt is 0 by default - user will be fuckyoud until they disconnect\n". + "or you stop it manually\n", + '', 'cmd_fuckyou', ''); weechat::hook_command('unfuckyou', '', ' [nick...]', '', '', 'cmd_unfuckyou', ''); weechat::hook_hsignal('irc_redirection_sigwhois_whois',