blob: 0b685ba4e9cb58b941552fb89f0e688821612726 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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});
}
}
}
}
|