use strict; use vars qw( $VERSION %IRSSI ); $VERSION = '0.0.1'; %IRSSI = ( name => 'Screener', authors => 'Ian Langworth', contact => 'http://langworth.com/contact.html', url => 'http://langworth.com/pub/irssi/', license => 'GNU GPL version 2', description => 'An answering machine for those that abuse private messages', ); use Irssi qw( signal_add signal_stop print ); my $PREFIX = "AUTOMATIC REPLY:"; my %abusers = ( # Make keys in the form of "nickname|IRCNetname" # e.g., "statico|CCS" 'someguy|Freenode' => 'Please talk to me in #public', ); signal_add( 'event privmsg' => sub { my ( $server, $data, $nick ) = @_; my ($channel) = $data =~ /(\#[^\s]+)/; my $tag = $server->{tag}; return if $channel; if ( my $reply = $abusers{"$nick|$tag"} ) { $server->command("/msg -$tag $nick $PREFIX $reply"); # uncomment if you're really pedantic and don't want # to even _see_ the incoming message #signal_stop; } } ); print ">>> '$IRSSI{name}' version $VERSION loaded"; print ">>> $IRSSI{url}"; 1;