fuckyou.pl: stop when target disconnects
This commit is contained in:
parent
4a700c7e9b
commit
904bbf5304
@ -37,7 +37,7 @@ use Digest::MD5 qw(md5_hex);
|
|||||||
|
|
||||||
my $SCRIPT_NAME = 'fuckyou';
|
my $SCRIPT_NAME = 'fuckyou';
|
||||||
my $SCRIPT_AUTHOR = 'Goat-See <mrtheplague@gmail.com>';
|
my $SCRIPT_AUTHOR = 'Goat-See <mrtheplague@gmail.com>';
|
||||||
my $SCRIPT_VERSION = '2.1';
|
my $SCRIPT_VERSION = '2.2';
|
||||||
my $SCRIPT_LICENCE = 'urmom';
|
my $SCRIPT_LICENCE = 'urmom';
|
||||||
my $SCRIPT_DESC = '/fuckyou NICK numberchannels';
|
my $SCRIPT_DESC = '/fuckyou NICK numberchannels';
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ sub fuckyou
|
|||||||
my $buffer = shift;
|
my $buffer = shift;
|
||||||
my $nig = md5_hex($$ * time);
|
my $nig = md5_hex($$ * time);
|
||||||
|
|
||||||
weechat::command($buffer, "/quote $FORCEJOIN $nick ${FURRY}_$nig");
|
weechat::command($buffer, "/quote $FORCEJOIN $target ${FURRY}_$nig");
|
||||||
|
|
||||||
return weechat::WEECHAT_RC_OK;
|
return weechat::WEECHAT_RC_OK;
|
||||||
}
|
}
|
||||||
@ -63,17 +63,18 @@ 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');
|
||||||
our $nick; my $amt_end;
|
my $amt_end;
|
||||||
($nick, $amt_end) = split / +/, $data;
|
($target, $amt_end) = split / +/, $data;
|
||||||
our ($FORCEJOIN, $FURRY) = (weechat::config_get_plugin('forcejoin'),
|
our ($FORCEJOIN, $FURRY) = (weechat::config_get_plugin('forcejoin'),
|
||||||
weechat::config_get_plugin('furry'));
|
weechat::config_get_plugin('furry'));
|
||||||
|
|
||||||
unless ($nick and $amt_end) {
|
unless ($target 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
weechat::hook_timer(50, 0, $amt_end, 'fuckyou', $buffer);
|
$signal = weechat::hook_signal("$server,irc_raw_in_402", 'irc_402', '');
|
||||||
|
$timer = weechat::hook_timer(50, 0, $amt_end, 'fuckyou', $buffer);
|
||||||
|
|
||||||
return weechat::WEECHAT_RC_OK;
|
return weechat::WEECHAT_RC_OK;
|
||||||
}
|
}
|
||||||
@ -143,6 +144,17 @@ sub event_whois_channels
|
|||||||
return weechat::WEECHAT_RC_OK;
|
return weechat::WEECHAT_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub irc_402 {
|
||||||
|
my $message = pop;
|
||||||
|
|
||||||
|
return weechat::WEECHAT_RC_OK
|
||||||
|
unless ($message =~ /^[^ ]* 402 [^ ]+ $target /i);
|
||||||
|
weechat::unhook($signal);
|
||||||
|
weechat::unhook($timer);
|
||||||
|
|
||||||
|
return weechat::WEECHAT_RC_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (weechat::register($SCRIPT_NAME, $SCRIPT_AUTHOR, $SCRIPT_VERSION,
|
if (weechat::register($SCRIPT_NAME, $SCRIPT_AUTHOR, $SCRIPT_VERSION,
|
||||||
$SCRIPT_LICENCE, $SCRIPT_DESC, '', '')) {
|
$SCRIPT_LICENCE, $SCRIPT_DESC, '', '')) {
|
||||||
weechat::hook_command('fuckyou', '', '<nick> <amt>', '', '',
|
weechat::hook_command('fuckyou', '', '<nick> <amt>', '', '',
|
||||||
|
Loading…
Reference in New Issue
Block a user