# script to put in your ~/.irssi/scripts/autorun # autoidentifies to services use strict; use Irssi; use Irssi::Irc; use POSIX; use vars qw($VERSION %IRSSI $nickservfqhn $mustidentify %nickpass %idcommand); $VERSION = '0.9'; %IRSSI = ( 'author' => 'jj', 'name' => 'Autostart', 'description' => 'autoidentify to nickserv & bitlbee' ); # a regexp to match the service pseudo-user fqdn $nickservfqhn = 'NickServ!services@services.iiens.net|Z!CServ@IRCube.org'; # a regexp to match the service identification request (sent in notice) $mustidentify = 'This nickname is registered and protected|Le pseudo .* est enregistr., si c\'est le votre, identifiez vous'; # command to send to identify for a given nick # replace 'pass' with your password %idcommand = ('jj' => 'identify pass', 'tyrollus' => 'z login tyrollus pass', 'bitlbee' => 'privmsg &bitlbee :identify pass'); # notice callback, for services autoident sub event_notice { my ($server, $args, $nick, $nickad) = @_; my ($target, $msg) = $args =~ /^(\S*)\s*:(.*)$/; return unless ("$nick!$nickad" =~ /$nickservfqhn/i); return unless ($msg =~ /$mustidentify/i); $target = lc $target; $server->send_raw ($idcommand{$target}) if ($idcommand{$target}); } # join callback, for bitlbee autoident sub on_join { my ($server, $channame, $nick, $host) = @_; if($nick eq $server->{nick}) { # the send command is not secure, so check the server tag if($channame eq '&bitlbee' && $server->{tag} == 'bitlbee') { $server->send_raw($idcommand{'bitlbee'}); } } } # the kikoo (c) command sub jj_kikoo { my ($args, $server, $witem) = @_; $args =~ s/ *$//; my $c = "\003".floor(rand(16)); my $kikoo = "\002\003".floor(rand(16)).','.floor(rand(16)). ' KIKOO'.'O' x floor(rand(20))." \003".floor(rand(16)).uc($args). " \003".floor(rand(16)).'!!!!'.'!' x floor(rand(20)). " $c".":\003".floor(rand(16))."o\003".floor(rand(16))."$c)))". ')' x floor(rand(20))." \003\002"; $witem->command("MSG $witem->{name} $kikoo"); } # shortcut for /identify sub jj_identify { my ($args, $server, $witem) = @_; $server->send_raw('NICKSERV identify ' . $args); } # shortcut factory: /foo bar == /quote foo bar sub new_alias { my $alias = shift; Irssi::command_bind($alias => sub { my ($args, $server, $witem) = @_; $server->send_raw ($alias . ' ' . $args); }); } # add shortcut for those for $_ (qw(samode chanserv nickserv operserv rootserv)) { new_alias $_; } new_alias 'bip'; new_alias 'z'; Irssi::command_bind ('kikoo', 'jj_kikoo'); Irssi::signal_add('event notice', 'event_notice'); Irssi::command_bind ('identify', 'jj_identify'); Irssi::signal_add('message join', 'on_join');