All pastes #297124 Raw Edit

Untitled

public text v1 · immutable
#297124 ·published 2006-12-30 21:26 UTC
rendered paste body
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);

$VERSION = "0.24273";
%IRSSI = (
        authors     => "v_ufo",
        name        => "Boyan",
        description => "Prints boyan if a messae was too long.",
        license     => "Public Domain",
);

sub event_boyan {
#my $msg_length = 200;
my $msg_length = 20;
my %excludes = ("valeri_ufo", "#bsdforen.de");
my ($server, $data, $nick, $mask, $target) =@_;
my ($target, $text) = $data =~ /^(\S*)\s:(.*)/;

if(length($text) > $msg_length) {
    if ($server->ischannel($target) && !$excludes{$target}) {
         $server->command("msg $target боян");
    } elsif (!$server->ischannel($nick) && !$excludes{$nick}) {
         $server->command("msg $nick боян");
    }
}

}
Irssi::signal_add('event privmsg', 'event_boyan');