diff options
author | richo <richo@psych0tik.net> | 2011-07-18 03:36:40 +0000 |
---|---|---|
committer | richo <richo@psych0tik.net> | 2011-07-18 03:36:40 +0000 |
commit | e4b9ea15d7abdae8211d18737fa54933f3faf57b (patch) | |
tree | fda4cc23faebfd1f130578b39fe161fe4c0ba1f8 /joinforward | |
parent | Added goodnicks from richoH/richos-irssi (diff) | |
parent | Only attempt join if channel exists (diff) | |
download | irssi-scripts-e4b9ea15d7abdae8211d18737fa54933f3faf57b.tar.gz irssi-scripts-e4b9ea15d7abdae8211d18737fa54933f3faf57b.zip |
Merge branch 'master' into richoH-dev
Diffstat (limited to '')
-rw-r--r-- | joinforward/joinforward.pl | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/joinforward/joinforward.pl b/joinforward/joinforward.pl new file mode 100644 index 0000000..1acd72a --- /dev/null +++ b/joinforward/joinforward.pl @@ -0,0 +1,65 @@ +use strict; +use warnings; + + +use Irssi; +use Irssi::Irc; +use Irssi::TextUI; + +use Data::Dumper; + + +our $VERSION = '0.1'; +our %IRSSI = ( + authors => 'shabble', + contact => 'shabble+irssi@metavore.org', + name => 'joinforward.pl', + description => '', + license => 'Public Domain', + ); + +my $forwards; + + +init(); + + +sub init { + Irssi::signal_add('event 470', 'sig_470'); # forwarding (on freenode, anhywya) + Irssi::signal_add('event 473', 'sig_473'); # notinvited. + # or better to just overload /join? + Irssi::command_bind('fwdlist', 'cmd_fwdlist'); + print "Joinforward loaded"; +} + +sub cmd_fwdlist { + print "Known Forwards:"; + foreach my $fwd (sort keys %$forwards) { + print "$fwd -> " . $forwards->{$fwd}; + } +} + +sub sig_470 { + my ($server, $args, $sender) = @_; + #'shibble #mac ##mac :Forwarding to another channel', + print "Sig 470: $args"; + if ($args =~ m/(#.*?)\s+(#.*?)/) { + $forwards->{$1} = $2; + print "adding $1 -> $2"; + } +} + +sub sig_473 { + my ($server, $args, $sender) = @_; + print "Sig 473: $args"; + #" shibble #mac :Cannot join channel (+i) - you must be invited'," + if ($server->{version} =~ m/ircd-seven/) { # assume freenode + if ($args =~ m/^(#.*?)\s+/) { + if (exists $forwards->{$1}) { + $server->command("join " . $forwards->{$1}); + } + } + + + } +} |