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
@ -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