&addCmdHook("main", 'chan(stats|info)', ('CODEREF' => 'chaninfo', ) );
&addCmdHook("main", 'cmd(stats|info)', ('CODEREF' => 'cmdstats', ) );
+&addCmdHook("main", 'sched(stats|info)', ('CODEREF' => 'scheduleList', ) );
&addCmdHook("main", 'factinfo', ('CODEREF' => 'factinfo',
- 'Cmdstats' => 'Factoid Info', Module => 'factoids', ) );
+ 'Cmdstats' => 'Factoid Info', Module => 'Factoids', ) );
&addCmdHook("main", 'factstats?', ('CODEREF' => 'factstats',
'Cmdstats' => 'Factoid Stats', Help => "factstats",
- Forker => 1, 'Identifier' => 'factoids', ) );
+ Forker => 1, 'Identifier' => 'Factoids', ) );
&addCmdHook("main", 'help', ('CODEREF' => 'help',
'Cmdstats' => 'Help', ) );
&addCmdHook("main", 'karma', ('CODEREF' => 'karma', ) );
}
# TODO: show top 3 with percentages?
- my($count) = (sort { $new{$a} <=> $new{$b} } keys %new)[0];
+ my($count) = (sort { $new{$b} <=> $new{$a} } keys %new)[0];
if ($count) {
$reply .= ". \002$count\002 has said the most with a total of \002$new{$count}\002 messages";
}
sub ispell {
my $query = shift;
+ my $binary;
+ my @binaries = (
+ '/usr/bin/aspell',
+ '/usr/bin/ispell',
+ '/usr/bin/spell'
+ );
+
+ foreach (@binaries) {
+ if (-x $_) {
+ $binary=$_;
+ last;
+ }
+ }
- if (! -x "/usr/bin/ispell") {
+ if (!$binary) {
&msg($who, "no binary found.");
return;
}
my $reply = "I can't find alternate spellings for '$query'";
- foreach (`/bin/echo '$query' | /usr/bin/ispell -a -S`) {
+ foreach (`/bin/echo '$query' | $binary -a -S`) {
chop;
last if !length; # end of query.
}
# wantNick. xk++
-# if ($message =~ /^wantNick(\+)?$/i) {
-# my ($force) = ($1) ? 1 : 0;
-# $force = 0 unless (&IsFlag("n"));
-#
-# # cannot trust Net::IRC's nick() (TimRiker asks why?)
-# if ($param{'ircNick'} eq $ident) {
-# &msg($who, "I hope you're right. I'll try anyway.");
-# &DEBUG("ircNick => $param{'ircNick'}");
-# &DEBUG("ident => $ident");
-# }
-#
-# # fallback check, I guess. needed?
-# if (! &IsNickInAnyChan( $param{'ircNick'} ) ) {
-# my $str = "attempting to change nick to $param{'ircNick'}";
-# &status($str);
-# &msg($who, $str);
-# &nick($param{ 'ircNick' });
-# return;
-# }
-#
-# # idea from dondelecarlo :)
-# # TODO: use cache{nickserv}
-# if ($param{'nickServ_pass'}) {
-# return if ($param{'ircNick'} eq $ident or $force == 0);
-#
-# &status("someone is using our nick; GHOSTing");
-# &msg($who, "using GHOST on $param{'ircNick'}.");
-# &msg("NickServ", "GHOST $param{'ircNick'} $param{'nickServ_pass'}");
-#
-# $conn->schedule(5, sub {
-# &status("going to change nick after GHOST.");
-# &nick( $param{'ircNick'} );
-# } );
-#
-# return;
-# }
-#
-# return;
-# }
+ # FIXME does not try to get nick "back", just switches nicks
+ if ($message =~ /^wantNick\s(.*)?$/i) {
+ return unless (&hasFlag("o"));
+ my $wantnick = lc $1;
+ my $mynick = $conn->nick();
+
+ if ($mynick eq $wantnick) {
+ &msg($who, "I hope you're right. I'll try anyway (mynick=$mynick, wantnick=$wantnick).");
+ }
+
+ # fallback check, I guess. needed?
+ if (! &IsNickInAnyChan( $wantnick ) ) {
+ my $str = "attempting to change nick from $mynick to $wantnick";
+ &status($str);
+ &msg($who, $str);
+ &nick($wantnick);
+ return;
+ }
+
+ # idea from dondelecarlo :)
+ # TODO: use cache{nickserv}
+ if ($param{'nickServ_pass'}) {
+ my $str = "someone is using nick $wantnick; GHOSTing";
+ &status($str);
+ &msg($who, $str);
+ &msg("NickServ", "GHOST $wantnick $param{'nickServ_pass'}");
+
+ $conn->schedule(5, sub {
+ &status("going to change nick from $mynick to $wantnick after GHOST.");
+ &nick($wantnick);
+ } );
+
+ return;
+ }
+
+ return;
+ }
return "CONTINUE";
}