html/warnkick.pl


   1 # warnkick.pl v0.0.2 by Svante Kvarnstrom <svarre@undernet.org>
   2 #
   3 # This script will warn you if you get kicked out of a channel which 
   4 # isn't your current "active" channel, and also hilight the refnum
   5 # to the channel you got kicked from, eg.:
   6 #
   7 # [03:42.50] >> zaei (~zaei@zaei.users.undernet.org) kicked you 
   8 # from #gentoo: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB
   9 #
  10 # This program is free software, you can redistribute it and/or modify
  11 # it under the terms of the GNU General Public License as published by
  12 # the Free Software Foundation; either version 2 of the License, or
  13 # (at your option) any later version.
  14 # 
  15 # This program is distributed in the hope that it will be useful,
  16 # but WITHOUT ANY WARRANTY; without even the implied warranty of 
  17 # MERCHANTABILITY or FITNESS FOR A PERTICULAR PURPOSE. See the 
  18 # GNU General Public License for more details.
  19 #
  20 # You should have received a copy of the GNU General License 
  21 # along with this program; if not, write to the Free Software 
  22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23 
  24 # ----------------------------------------------------------------------
  25 
  26 use Irssi qw(printformat signal_add theme_register);
  27 use Irssi::Irc;
  28 
  29 use strict;
  30 use vars qw($VERSION %IRSSI);
  31 
  32 # ----------------------------------------------------------------------
  33 
  34 $VERSION = "0.0.3";
  35 %IRSSI = (
  36     authors     =>  'Svante Kvarnström',
  37 #    contact     =>  'svarre@undernet.org',
  38 	contact		=>	'sjk@ankeborg.nu',
  39     name        =>  'warnkick',
  40     description =>  'warns you if someone kicks you out of a channel',
  41     license     =>  'GPL',
  42 	url			=>  'http://ankeborg.nu',
  43     changed     =>  'Tue Sep 28 03:51 CEST 2004',
  44 );
  45 
  46 # ----------------------------------------------------------------------
  47 
  48 sub event_kick {
  49     my ($server, $chan, $nick, $knick, $address, $reason) = @_;
  50     my $win = Irssi::active_win();
  51     my $kchan = $server->window_find_item($chan);
  52 
  53     return if $win->{refnum} == $kchan->{refnum} || $server->{nick} ne $nick;
  54 
  55     Irssi::active_win()->printformat(MSGLEVEL_CLIENTCRAP, 'warnkick', $knick, $address, $chan, $reason);
  56     $kchan->activity(4);
  57 }
  58 
  59 # ----------------------------------------------------------------------
  60 
  61 theme_register([
  62     'warnkick_loaded', '%R>>%n %_Scriptinfo:%_ Loaded $0 version $1 by $2.',
  63     'warnkick', '%R>>%n $0 ($1) kicked you from $2: $3'
  64 ]);
  65 
  66 # ----------------------------------------------------------------------
  67 
  68 signal_add("message kick", "event_kick");
  69 
  70 printformat(MSGLEVEL_CLIENTCRAP, 'warnkick_loaded', $IRSSI{name}, $VERSION, $IRSSI{authors});
  71