Posted by Cheez Thu 8th Mar 2007 14:12 - Syntax is Perl - 52 views
Download | New Post | Modify | Hide line numbers
  1. use strict;
  2. use vars ($VERSION %IRSSI);
  3. use Irssi;
  4.  
  5. $VERSION = '1.0';
  6. %IRSSI = (
  7.     authors     => "Chris \'Cheez\' Stretton",
  8.     contact     => "cstretton\@gmail.com",
  9.     name        => "keepnick",
  10.     description => "Changes to the given nick if that nick parts a channel",
  11.     licence     => "Public Domain"
  12. );
  13.  
  14. sub check_nick {
  15.     my ($server, $nick) = @_;
  16.     my $checkednick = Irssi::settings_get_str('keepnick_nick');
  17.     $_ = $nick;
  18.     if (/$checkednick/i) {
  19.         $server->command('nick ' . $checkednick);
  20.     }
  21. }
  22.  
  23. sub keepnick_part {
  24.     my ($server, $channel, $nick, $address, $reason) = @_;
  25.     check_nick($server, $nick);
  26.     Irssi::signal_continue($server, $channel, $nick, $address, $reason);
  27. }
  28.  
  29. sub keepnick_quit {
  30.     my ($server, $nick, $address, $reason) = @_;
  31.     check_nick($server, $nick);
  32.     Irssi::signal_continue($server, $nick, $address, $reason);
  33. }
  34.  
  35. Irssi::settings_add_str("keepnick", "keepnick_nick", "");
  36.  
  37. Irssi::signal_add("message part", "keepnick_part");
  38. Irssi::signal_add("message quit", "keepnick_quit");

PermaLink to this entry https://pastebin.co.uk/11564
Posted by Cheez Thu 8th Mar 2007 14:12 - Syntax is Perl - 52 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0