diff options
author | Tom Feist <shabble@metavore.org> | 2011-04-22 02:27:12 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2011-04-22 02:27:12 +0000 |
commit | fe6e50a76dba36899782fdda0f97590ee5f02a3c (patch) | |
tree | a8ae7406048f00807ba54aecb5dfcd9c0dd08944 /joinforward | |
parent | removed docs/ from dev branch, since they're all in their own repo (well, wiki) (diff) | |
parent | feature-tests/key_sig: test to see if there's any useful info in the 'keyboard (diff) | |
download | irssi-scripts-fe6e50a76dba36899782fdda0f97590ee5f02a3c.tar.gz irssi-scripts-fe6e50a76dba36899782fdda0f97590ee5f02a3c.zip |
Merge branch 'master' into dev
Diffstat (limited to 'joinforward')
-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}); + } + } + + + } +} |