From 962dbea595b3d761f8ce66efe969b047a31b0778 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Fri, 2 Dec 2011 11:36:29 +0000 Subject: Add a whole bunch of un-tracked files that need some looking at. --- feature-tests/rejoin-unban.pl | 83 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 feature-tests/rejoin-unban.pl (limited to 'feature-tests/rejoin-unban.pl') diff --git a/feature-tests/rejoin-unban.pl b/feature-tests/rejoin-unban.pl new file mode 100644 index 0000000..ea43220 --- /dev/null +++ b/feature-tests/rejoin-unban.pl @@ -0,0 +1,83 @@ + +use strict; +use warnings; + +use Data::Dumper; + +# not sure of hte original source author, but probably based on +# autorejoin.pl: http://scripts.irssi.org/html/autorejoin.pl.html + +our $VERSION = '0.1'; +our %IRSSI = ( + authors => 'shabble, dunno original source', + contact => 'shabble+irssi@metavore.org', + name => '', + description => '', + license => 'GPLv2', + updated => '$DATE' + ); + + +use Irssi; +use Irssi::Irc; + + +sub event_rejoin_kick { + my ($server, $data) = @_; + my ($channel, $nick) = split(/ +/, $data); + + return if ($server->{nick} ne $nick); + + my $chanrec = $server->channel_find($channel); + my $password = $chanrec->{key} if ($chanrec); + + Irssi::print "Rejoining $channel..."; + + $server->send_raw("JOIN $channel $password"); +} + +sub event_rejoin_unban { + my ($server, $data, $nick, $address) = @_; + my ($target, $text) = $data =~ /^(\S*)\s:(.*)/; + + if ($text =~ m/(\w+) has been unbanned from (#?\w+)/) { + my ($nick, $channel) = ($1, $2); + my $chanrec = $server->channel_find($channel); + my $password = $chanrec->{key} if ($chanrec); + + Irssi::print "Rejoining $channel..."; + $server->command("JOIN $channel $password"); + } +} + +sub event_unban { + my ($server, $data) = @_; + my ($nick, $channel) = split(/ +/, $data); + + Irssi::print "Attempting unban on $channel..."; + $server->send_raw("PRIVMSG ChanServ unban $channel"); +} + +sub sig_msg_kick { + my ($server, $channel, $victim, $kicker, $addr, $reason) = @_; + +} + +sub sig_msg_notice { + my ($server, $msg, $nick, $addr, $target) = @_; + +} + +sub sig_event_joinfail_banned { + +} + +sub init { + + Irssi::signal_add('message kick', 'sig_msg_kick'); + Irssi::signal_add('message notice', 'sig_msg_notice'); + Irssi::signal_add('event 474', 'sig_event_joinfail_banned'); + +} + +init(); -- cgit v1.2.3