add small delay between forcejoins
slows time til sendq and doesn't make the client freeze up on large floods
This commit is contained in:
parent
3407bebaff
commit
68d62d32b7
@ -4,35 +4,35 @@ use Time::HiRes qw(time);
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
|
||||
#__ ___ ____ _ _ ___ _ _ ____ _ _ ____ ___ _ _ ____
|
||||
#__ ___ ____ _ _ ___ _ _ ____ _ _ ____ ___ _ _ ____
|
||||
#\ \ / / \ | _ \| \ | |_ _| \ | |/ ___| | | | / ___|_ _| \ | |/ ___|
|
||||
# \ \ /\ / / _ \ | |_) | \| || || \| | | _ | | | \___ \| || \| | | _
|
||||
# \ \ /\ / / _ \ | |_) | \| || || \| | | _ | | | \___ \| || \| | | _
|
||||
# \ V V / ___ \| _ <| |\ || || |\ | |_| | | |_| |___) | || |\ | |_| |
|
||||
# \_/\_/_/ \_\_| \_\_| \_|___|_| \_|\____| \___/|____/___|_| \_|\____|
|
||||
#
|
||||
# _____ _ _ _____ ____ _____ ____ ____ ____ ___ ____ _____ ____
|
||||
#|_ _| | | | ____/ ___|| ____| / ___| / ___| _ \|_ _| _ \_ _/ ___|
|
||||
# | | | |_| | _| \___ \| _| \___ \| | | |_) || || |_) || | \___ \
|
||||
#
|
||||
# _____ _ _ _____ ____ _____ ____ ____ ____ ___ ____ _____ ____
|
||||
#|_ _| | | | ____/ ___|| ____| / ___| / ___| _ \|_ _| _ \_ _/ ___|
|
||||
# | | | |_| | _| \___ \| _| \___ \| | | |_) || || |_) || | \___ \
|
||||
# | | | _ | |___ ___) | |___ ___) | |___| _ < | || __/ | | ___) |
|
||||
# |_| |_| |_|_____|____/|_____| |____/ \____|_| \_\___|_| |_| |____/
|
||||
#
|
||||
# |_| |_| |_|_____|____/|_____| |____/ \____|_| \_\___|_| |_| |____/
|
||||
#
|
||||
# __ __ _ __ __ ____ _____ _ _ _ __ __
|
||||
#| \/ | / \\ \ / / | _ \| ____| / \ | | | | \ \ / /
|
||||
#| |\/| | / _ \\ V / | |_) | _| / _ \ | | | | \ \//
|
||||
#| | | |/ ___ \| | | _ <| |___ / ___ \| |___| |___| |
|
||||
#|_| |_/_/ \_\_| |_| \_\_____/_/ \_\_____|_____|_|
|
||||
#
|
||||
#| |\/| | / _ \\ V / | |_) | _| / _ \ | | | | \ \//
|
||||
#| | | |/ ___ \| | | _ <| |___ / ___ \| |___| |___| |
|
||||
#|_| |_/_/ \_\_| |_| \_\_____/_/ \_\_____|_____|_|
|
||||
#
|
||||
# _____ _ _ ____ _ _____ _ _ ____ _ _ _ _ _ _____ __
|
||||
#| ___| | | |/ ___| |/ /_ _| \ | |/ ___| / \ | \ | | \ | |/ _ \ \ / /
|
||||
#| |_ | | | | | | ' / | || \| | | _ / _ \ | \| | \| | | | \ V /
|
||||
#| _| | |_| | |___| . \ | || |\ | |_| | / ___ \| |\ | |\ | |_| || |
|
||||
#|_| \___/ \____|_|\_\___|_| \_|\____| /_/ \_\_| \_|_| \_|\___/ |_|
|
||||
#
|
||||
#__ _____ _ _ ____ _ _ ____ _____ ____ ____
|
||||
#\ \ / / _ \| | | | _ \ | | | / ___|| ____| _ \/ ___|
|
||||
# \ V / | | | | | | |_) | | | | \___ \| _| | |_) \___ \
|
||||
#| |_ | | | | | | ' / | || \| | | _ / _ \ | \| | \| | | | \ V /
|
||||
#| _| | |_| | |___| . \ | || |\ | |_| | / ___ \| |\ | |\ | |_| || |
|
||||
#|_| \___/ \____|_|\_\___|_| \_|\____| /_/ \_\_| \_|_| \_|\___/ |_|
|
||||
#
|
||||
#__ _____ _ _ ____ _ _ ____ _____ ____ ____
|
||||
#\ \ / / _ \| | | | _ \ | | | / ___|| ____| _ \/ ___|
|
||||
# \ V / | | | | | | |_) | | | | \___ \| _| | |_) \___ \
|
||||
# | || |_| | |_| | _ < | |_| |___) | |___| _ < ___) |
|
||||
# |_| \___/ \___/|_| \_\ \___/|____/|_____|_| \_\____/
|
||||
# |_| \___/ \___/|_| \_\ \___/|____/|_____|_| \_\____/
|
||||
|
||||
|
||||
my $SCRIPT_NAME = 'fuckyou';
|
||||
@ -49,24 +49,32 @@ my %OPTIONS = (
|
||||
furry => ['Channel prefix (include # or &)', '&HYE']
|
||||
);
|
||||
|
||||
sub fuckyou
|
||||
{
|
||||
my $buffer = shift;
|
||||
my $nig = md5_hex($$ * time);
|
||||
|
||||
weechat::command($buffer, "/quote $FORCEJOIN $nick ${FURRY}_$nig");
|
||||
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub cmd_fuckyou
|
||||
{
|
||||
my (undef, $buffer, $data) = @_;
|
||||
my $server = weechat::buffer_get_string($buffer, 'localvar_server');
|
||||
my ($nick, $amt_end) = split(/ +/, $data);
|
||||
my $FORCEJOIN = weechat::config_get_plugin('forcejoin');
|
||||
my $FURRY = weechat::config_get_plugin('furry');
|
||||
unless($nick && $amt_end)
|
||||
{
|
||||
our $nick; my $amt_end;
|
||||
($nick, $amt_end) = split / +/, $data;
|
||||
our ($FORCEJOIN, $FURRY) = (weechat::config_get_plugin('forcejoin'),
|
||||
weechat::config_get_plugin('furry'));
|
||||
|
||||
unless ($nick and $amt_end) {
|
||||
weechat::print($buffer, '/fuckyou <nick> <amt>');
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
for(1 .. $amt_end)
|
||||
{
|
||||
my $nig = md5_hex($$ * time * $_);
|
||||
weechat::command('', "/quote $FORCEJOIN $nick ${FURRY}_$nig");
|
||||
}
|
||||
weechat::hook_timer(50, 0, $amt_end, 'fuckyou', $buffer);
|
||||
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@ -77,12 +85,13 @@ sub cmd_unfuckyou
|
||||
weechat::buffer_get_string($buffer, 'localvar_server'),
|
||||
weechat::buffer_get_string($buffer, 'localvar_channel')
|
||||
);
|
||||
|
||||
unless ($data) {
|
||||
weechat::print($buffer, '/unfuckyou user user2 user3');
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
foreach my $dick (split(/ +/, $data))
|
||||
{
|
||||
|
||||
foreach my $dick (split / +/, $data) {
|
||||
weechat::hook_hsignal_send(
|
||||
'irc_redirect_command',
|
||||
{
|
||||
@ -96,6 +105,7 @@ sub cmd_unfuckyou
|
||||
"$server;;1;;/whois $dick"
|
||||
);
|
||||
}
|
||||
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@ -114,7 +124,7 @@ sub event_whois_channels
|
||||
|
||||
$channels =~ s/ +$//;
|
||||
|
||||
my @niggers = split(/ +/, $channels);
|
||||
my @niggers = split / +/, $channels;
|
||||
foreach (@niggers)
|
||||
{
|
||||
s/^[@%+]([&#])/$1/;
|
||||
@ -126,8 +136,10 @@ sub event_whois_channels
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
weechat::print('', "Forceparted $nick from $counter channels")
|
||||
if $counter;
|
||||
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user