use SOAP::Lite; use Data::Dumper; use strict; BEGIN { unless (exists $::{"Irssi::"}) { require Pod::Usage; Pod::Usage::pod2usage(-verbose => 2); } } use Text::ParseWords; use vars qw($VERSION %IRSSI); use Irssi qw( command_bind settings_get_bool settings_add_bool settings_get_str settings_add_str signal_add ); $VERSION = '0.01'; %IRSSI = ( authors => 'Justin Lee', contact => 'kool.name@gmail.com', name => 'googlebot', description => 'Google script... Just for fun', license => 'GPL', ); # Start of man page =head1 DESCRIPTION =head2 Methods =over 5 =item C<< >> =back =head1 AUTHOR Dean - L =cut # Start of script load_globals(); #signal_add('setup changed', 'load_globals'); signal_add('event privmsg', 'irc_privmsg'); sub load_globals { # map { $google_active_channels{uc($_)} = 1 } # quotewords(',', 0, settings_get_str('google_active_channels')); } sub checkTime { open(TIMELOG, ">>~/.irssi/.send_away") || die "cannot create/open file: $!"; my @data = @_; unless( =~ /$data[0]/g){ return 1; } print TIMELOG "$data[0]\n"; # I still have to add the time time... close(TIMELOG) || # I think I'll use /proc/uptime to die "cannot close file: $!"; # store a time in the file return 0; # then just calc the diff between the # file and live /proc/uptime to leave # atleast ten mintutes between messages } sub irc_privmsg { my ($server, $data, $from, $address) = @_; my ($to, $message) = split(/\s+:/, $data, 2); my ($mode, $me, $target) = ($server->{'usermode_away'}, $server->{'nick'}, find_target($to, $from)); if($mode) { if($target){ if(checkTime($target, $server) { $server->command("SEND_AWAY $target"); } } } return 1; } sub find_target { my ($to, $from) = @_; if($to =~ /^#/){ return; # from a channel } return $from; # from a private message }