1#!/usr/local/bin/perl -w
2
3## Bugreports and Licence disclaimer.
4#
5# For bugreports and other improvements contact Geert Hauwaerts <geert@irssi.org>
6#
7#    This program is free software; you can redistribute it and/or modify
8#    it under the terms of the GNU General Public License as published by
9#    the Free Software Foundation; either version 2 of the License, or
10#    (at your option) any later version.
11#
12#    This program is distributed in the hope that it will be useful,
13#    but WITHOUT ANY WARRANTY; without even the implied warranty of
14#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15#    GNU General Public License for more details.
16#
17#    You should have received a copy of the GNU General Public License
18#    along with this script; if not, write to the Free Software
19#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20#
21##
22
23use strict;
24use Irssi;
25use vars qw($VERSION %IRSSI);
26
27$VERSION = "0.03";
28
29%IRSSI = (
30    authors     => 'Geert Hauwaerts',
31    contact     => 'geert@irssi.org',
32    name        => 'dancer_forwardfix.pl',
33    description => 'This script will fix the Irssi problem with channel forwarding on the Dancer ircd.',
34    license     => 'Public Domain',
35    url         => 'http://irssi.hauwaerts.be/dancer_forwardfix.pl',
36    changed     => 'Sun May  9 01:19:25 2004',
37);
38
39Irssi::theme_register([
40    'fwfix_loaded', '%R>>%n %_Scriptinfo:%_ Loaded $0 version $1 by $2.',
41    'fwfix_reason', '%R>>%n %_Forwardfix:%_ $0 forwarded to $1'
42]);
43
44sub fix_379 {
45
46    my ($server, $data) = @_;
47    my ($nick, $mainchan, $fwdchan, $reason) = split(/ /, $data);
48
49    if ($server && ($server->{'version'} =~ /dancer/)) {
50        Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'fwfix_reason', $mainchan, $fwdchan);
51        Irssi::timeout_add_once(1000, sub { $server->command("PART $mainchan"); }, undef);
52        Irssi::signal_stop;
53    }
54}
55
56Irssi::signal_add('event 379', 'fix_379');
57
58Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'fwfix_loaded', $IRSSI{name}, $VERSION, $IRSSI{authors});
59