aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-01-13 07:57:10 +0000
committerTom Feist <shabble@metavore.org>2011-01-13 07:57:10 +0000
commit70af0ead69cb868ab37e7cdb58542c34aa5b5e6d (patch)
tree240672ba3b0151a4995ed006ed1ce4aee709ae26
parentpipes: added an example feature test on how to use pipes for non-blocking (diff)
downloadirssi-scripts-70af0ead69cb868ab37e7cdb58542c34aa5b5e6d.tar.gz
irssi-scripts-70af0ead69cb868ab37e7cdb58542c34aa5b5e6d.zip
added joinforward: a script to make sure when you try joining a forwaraded
channel, all subsequent "/join #original" will point you at the new one (untested so far)
-rw-r--r--joinforward/joinforward.pl54
1 files changed, 54 insertions, 0 deletions
diff --git a/joinforward/joinforward.pl b/joinforward/joinforward.pl
new file mode 100644
index 0000000..0b685ba
--- /dev/null
+++ b/joinforward/joinforward.pl
@@ -0,0 +1,54 @@
+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');
+ Irssi::signal_add('event 473', 'sig_473');
+}
+
+sub sig_470 {
+ my ($server, $args, $sender) = @_;
+ #'shibble #mac ##mac :Forwarding to another channel',
+ my $nick = quotemeta(Irssi::parse_special('$N'));
+ if ($args =~ m/^$nick (#.*?)\s+(#.*?)\s+(.*)$/) {
+ $forwards->{$1} = $2;
+ }
+}
+
+sub sig_473 {
+ my ($server, $args, $sender) = @_;
+ #" shibble #mac :Cannot join channel (+i) - you must be invited',"
+ if ($server->{version} =~ m/ircd-seven/) { # assume freenode
+ my $nick = quotemeta(Irssi::parse_special('$N'));
+ if ($args =~ m/^$nick\s+(#.*?)\s+/) {
+ if (exists $forwards->{$1}) {
+ $server->command("window goto " . $forwards->{$1});
+ }
+ }
+
+
+ }
+}