Public feed #892054

Untitled

public text v1 · immutable
Raw Edit
·published 2008-02-05 02:39 UTC
rendered paste body
use Irssi;
use strict;
use vars qw($VERSION %IRSSI);

$VERSION = "1.00";
%IRSSI = (
    authors     => 'clever',
    name        => 'notice blocking',
    description => 'notice blocking test script',
    license     => 'Public Domain'
);

sub event_notice {
        # $server = server record where the message came
        # $data = the raw data received from server, with PRIVMSGs it is:
        #         "target :text" where target is either your nick or #channel
        # $nick = the nick who sent the message
        # $host = host of the nick who sent the message
        my ($server, $data, $nick, $host) = @_;

        # split data to target/text
        my ($target, $text) = $data =~ /^(\S*)\s:(.*)/;

        my $me = $server->{nick};
#       $server->command("echo $me test $nick");
        if ($nick eq $me) {
                # private message, $target contains our nick, so we'll need
                # to change it to $nick
#               $server->command("echo test");
                Irssi::signal_stop();
        }

}

Irssi::signal_add('event notice', 'event_notice');