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);
|
use Digest::MD5 qw(md5_hex);
|
||||||
|
|
||||||
|
|
||||||
#__ ___ ____ _ _ ___ _ _ ____ _ _ ____ ___ _ _ ____
|
#__ ___ ____ _ _ ___ _ _ ____ _ _ ____ ___ _ _ ____
|
||||||
#\ \ / / \ | _ \| \ | |_ _| \ | |/ ___| | | | / ___|_ _| \ | |/ ___|
|
#\ \ / / \ | _ \| \ | |_ _| \ | |/ ___| | | | / ___|_ _| \ | |/ ___|
|
||||||
# \ \ /\ / / _ \ | |_) | \| || || \| | | _ | | | \___ \| || \| | | _
|
# \ \ /\ / / _ \ | |_) | \| || || \| | | _ | | | \___ \| || \| | | _
|
||||||
# \ V V / ___ \| _ <| |\ || || |\ | |_| | | |_| |___) | || |\ | |_| |
|
# \ V V / ___ \| _ <| |\ || || |\ | |_| | | |_| |___) | || |\ | |_| |
|
||||||
# \_/\_/_/ \_\_| \_\_| \_|___|_| \_|\____| \___/|____/___|_| \_|\____|
|
# \_/\_/_/ \_\_| \_\_| \_|___|_| \_|\____| \___/|____/___|_| \_|\____|
|
||||||
#
|
#
|
||||||
# _____ _ _ _____ ____ _____ ____ ____ ____ ___ ____ _____ ____
|
# _____ _ _ _____ ____ _____ ____ ____ ____ ___ ____ _____ ____
|
||||||
#|_ _| | | | ____/ ___|| ____| / ___| / ___| _ \|_ _| _ \_ _/ ___|
|
#|_ _| | | | ____/ ___|| ____| / ___| / ___| _ \|_ _| _ \_ _/ ___|
|
||||||
# | | | |_| | _| \___ \| _| \___ \| | | |_) || || |_) || | \___ \
|
# | | | |_| | _| \___ \| _| \___ \| | | |_) || || |_) || | \___ \
|
||||||
# | | | _ | |___ ___) | |___ ___) | |___| _ < | || __/ | | ___) |
|
# | | | _ | |___ ___) | |___ ___) | |___| _ < | || __/ | | ___) |
|
||||||
# |_| |_| |_|_____|____/|_____| |____/ \____|_| \_\___|_| |_| |____/
|
# |_| |_| |_|_____|____/|_____| |____/ \____|_| \_\___|_| |_| |____/
|
||||||
#
|
#
|
||||||
# __ __ _ __ __ ____ _____ _ _ _ __ __
|
# __ __ _ __ __ ____ _____ _ _ _ __ __
|
||||||
#| \/ | / \\ \ / / | _ \| ____| / \ | | | | \ \ / /
|
#| \/ | / \\ \ / / | _ \| ____| / \ | | | | \ \ / /
|
||||||
#| |\/| | / _ \\ V / | |_) | _| / _ \ | | | | \ \//
|
#| |\/| | / _ \\ V / | |_) | _| / _ \ | | | | \ \//
|
||||||
#| | | |/ ___ \| | | _ <| |___ / ___ \| |___| |___| |
|
#| | | |/ ___ \| | | _ <| |___ / ___ \| |___| |___| |
|
||||||
#|_| |_/_/ \_\_| |_| \_\_____/_/ \_\_____|_____|_|
|
#|_| |_/_/ \_\_| |_| \_\_____/_/ \_\_____|_____|_|
|
||||||
#
|
#
|
||||||
# _____ _ _ ____ _ _____ _ _ ____ _ _ _ _ _ _____ __
|
# _____ _ _ ____ _ _____ _ _ ____ _ _ _ _ _ _____ __
|
||||||
#| ___| | | |/ ___| |/ /_ _| \ | |/ ___| / \ | \ | | \ | |/ _ \ \ / /
|
#| ___| | | |/ ___| |/ /_ _| \ | |/ ___| / \ | \ | | \ | |/ _ \ \ / /
|
||||||
#| |_ | | | | | | ' / | || \| | | _ / _ \ | \| | \| | | | \ V /
|
#| |_ | | | | | | ' / | || \| | | _ / _ \ | \| | \| | | | \ V /
|
||||||
#| _| | |_| | |___| . \ | || |\ | |_| | / ___ \| |\ | |\ | |_| || |
|
#| _| | |_| | |___| . \ | || |\ | |_| | / ___ \| |\ | |\ | |_| || |
|
||||||
#|_| \___/ \____|_|\_\___|_| \_|\____| /_/ \_\_| \_|_| \_|\___/ |_|
|
#|_| \___/ \____|_|\_\___|_| \_|\____| /_/ \_\_| \_|_| \_|\___/ |_|
|
||||||
#
|
#
|
||||||
#__ _____ _ _ ____ _ _ ____ _____ ____ ____
|
#__ _____ _ _ ____ _ _ ____ _____ ____ ____
|
||||||
#\ \ / / _ \| | | | _ \ | | | / ___|| ____| _ \/ ___|
|
#\ \ / / _ \| | | | _ \ | | | / ___|| ____| _ \/ ___|
|
||||||
# \ V / | | | | | | |_) | | | | \___ \| _| | |_) \___ \
|
# \ V / | | | | | | |_) | | | | \___ \| _| | |_) \___ \
|
||||||
# | || |_| | |_| | _ < | |_| |___) | |___| _ < ___) |
|
# | || |_| | |_| | _ < | |_| |___) | |___| _ < ___) |
|
||||||
# |_| \___/ \___/|_| \_\ \___/|____/|_____|_| \_\____/
|
# |_| \___/ \___/|_| \_\ \___/|____/|_____|_| \_\____/
|
||||||
|
|
||||||
|
|
||||||
my $SCRIPT_NAME = 'fuckyou';
|
my $SCRIPT_NAME = 'fuckyou';
|
||||||
@ -49,24 +49,32 @@ my %OPTIONS = (
|
|||||||
furry => ['Channel prefix (include # or &)', '&HYE']
|
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
|
sub cmd_fuckyou
|
||||||
{
|
{
|
||||||
my (undef, $buffer, $data) = @_;
|
my (undef, $buffer, $data) = @_;
|
||||||
my $server = weechat::buffer_get_string($buffer, 'localvar_server');
|
my $server = weechat::buffer_get_string($buffer, 'localvar_server');
|
||||||
my ($nick, $amt_end) = split(/ +/, $data);
|
our $nick; my $amt_end;
|
||||||
my $FORCEJOIN = weechat::config_get_plugin('forcejoin');
|
($nick, $amt_end) = split / +/, $data;
|
||||||
my $FURRY = weechat::config_get_plugin('furry');
|
our ($FORCEJOIN, $FURRY) = (weechat::config_get_plugin('forcejoin'),
|
||||||
unless($nick && $amt_end)
|
weechat::config_get_plugin('furry'));
|
||||||
{
|
|
||||||
|
unless ($nick and $amt_end) {
|
||||||
weechat::print($buffer, '/fuckyou <nick> <amt>');
|
weechat::print($buffer, '/fuckyou <nick> <amt>');
|
||||||
return weechat::WEECHAT_RC_OK;
|
return weechat::WEECHAT_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(1 .. $amt_end)
|
weechat::hook_timer(50, 0, $amt_end, 'fuckyou', $buffer);
|
||||||
{
|
|
||||||
my $nig = md5_hex($$ * time * $_);
|
|
||||||
weechat::command('', "/quote $FORCEJOIN $nick ${FURRY}_$nig");
|
|
||||||
}
|
|
||||||
return weechat::WEECHAT_RC_OK;
|
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_server'),
|
||||||
weechat::buffer_get_string($buffer, 'localvar_channel')
|
weechat::buffer_get_string($buffer, 'localvar_channel')
|
||||||
);
|
);
|
||||||
|
|
||||||
unless ($data) {
|
unless ($data) {
|
||||||
weechat::print($buffer, '/unfuckyou user user2 user3');
|
weechat::print($buffer, '/unfuckyou user user2 user3');
|
||||||
return weechat::WEECHAT_RC_OK;
|
return weechat::WEECHAT_RC_OK;
|
||||||
}
|
}
|
||||||
foreach my $dick (split(/ +/, $data))
|
|
||||||
{
|
foreach my $dick (split / +/, $data) {
|
||||||
weechat::hook_hsignal_send(
|
weechat::hook_hsignal_send(
|
||||||
'irc_redirect_command',
|
'irc_redirect_command',
|
||||||
{
|
{
|
||||||
@ -96,6 +105,7 @@ sub cmd_unfuckyou
|
|||||||
"$server;;1;;/whois $dick"
|
"$server;;1;;/whois $dick"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return weechat::WEECHAT_RC_OK;
|
return weechat::WEECHAT_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +124,7 @@ sub event_whois_channels
|
|||||||
|
|
||||||
$channels =~ s/ +$//;
|
$channels =~ s/ +$//;
|
||||||
|
|
||||||
my @niggers = split(/ +/, $channels);
|
my @niggers = split / +/, $channels;
|
||||||
foreach (@niggers)
|
foreach (@niggers)
|
||||||
{
|
{
|
||||||
s/^[@%+]([&#])/$1/;
|
s/^[@%+]([&#])/$1/;
|
||||||
@ -126,8 +136,10 @@ sub event_whois_channels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
weechat::print('', "Forceparted $nick from $counter channels")
|
weechat::print('', "Forceparted $nick from $counter channels")
|
||||||
if $counter;
|
if $counter;
|
||||||
|
|
||||||
return weechat::WEECHAT_RC_OK;
|
return weechat::WEECHAT_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user