The Code
Following is a small example script. It
makes a person believe she is in your ignore list, which can help to
kill some boring discussions from time to time:
#!/usr/bin/perl -w
use strict;
use vars qw($VERSION %IRSSI);
# This file is partially based on rainbow.pl
$VERSION = "1";
%IRSSI = (
authors => 'Wilmer van der Gaast',
contact => 'lintux@lintux.cx',
name => 'Fake-Ignore',
license => 'GNU GPLv2 or later',
);
use Irssi;
use Irssi::Irc;
sub fignore {
my ($text, $server, $dest) = @_;
if (!$server || !$server->{connected}) {
Irssi::print("Not connected to server");
return;
}
return unless $dest;
if ($dest->{type} eq "CHANNEL" || $dest->{type} eq "QUERY") {
$text = `date +%H:%M:%S` . ' Ignoring ALL from ' . $text;
$text =~ s/[\n\r ]+/ /gs;
$dest->command("/msg " . $dest->{name} . " " . $text );
}
}
Irssi::command_bind( "fignore", "fignore" );
The %IRSSI hash is used to define some information
about the module. This is usually the best place to put the
information about your module, such as who wrote it and how he can be
contacted. The module defines a couple of subs and, in the end, those
subs are linked to either irssi commands or
events. This example script is tied to a client command, so if you
were to type /fignorenickname, the target user would see a
message suggesting that she is being ignored by your client. If you
want to know more about event-based scripts, you can take one of the
many other scripts as an example. Here is the result from running
this script:
/fignore brannigan
23:51:29 Ignoring ALL from brannigan
Wilmer van der Gaast