# --- support routines
-# FIXME.
-# add arguments, basically '-h' and '--help', heh.
-#
+# FIXME: add arguments, basically '-h' and '--help', heh.
# added by the xk
sub duperuncheck {
babelfish: U: translate <fromLang> <toLang> <words>
babelfish: E: x en de your cars rock
--ban: D: FIXME.
+-ban: D: FIXME:
-ban: U: ## <mask|user>
-ban: E: ## *!*@owns.org
-ban: E: ## MoronMan
-+ban: D: FIXME.
++ban: D: FIXME:
+ban: U: ## <mask|user> [chan] [time] [reason]
+ban: E: ## *!*@owns.org #bots 60 stop flooding.
+ban: E: ## *!*@*microsoft.com STOOPID
httpdtype: U: ## <hostname>
httpdtype: E: ## example.com
-ignore: D: FIXME
+ignore: D: FIXME:
ignore: E: ## [mask chan expire comment]
ircstats: ircstats dumps some status information on the bot's IRC connection
wantnick: If someone's taken my nick (I hope not) and I'm using some temporary nick, I can change back to my original nick if it's not taken (again).
--host: D: FIXME.
+-host: D: FIXME:
-host: U: ## [user] <mask>
-host: E: ## *!*@owns.org
-host: E: ## owner leet!leet@*.heh.org
-+host: D: FIXME.
++host: D: FIXME:
+host: U: ## [user] <mask>
+host: E: ## *!*@owns.org
+host: E: ## owner leet!leet@*.heh.org
# Factoid related and unrelated features, mainly Extras.
#####
-# [str] addressing is when you name the bot. FIXME
+# [str] addressing is when you name the bot. FIXME:
# REQUIRE -- the bot only does something if addressed.
# OPTIONAL -- the bot responds (does not learn) irrelevent of
# addressing.
# [0/1] Uptime daemon
set uptime true
-# [0/1] Wingate checking and banning mechanism. FIXME.
+# [0/1] Wingate checking and banning mechanism. FIXME:
###set wingate false
# [int] seconds. minimum time to check.
set wingateInterval 60
# WARN: this file does not reload on HUP.
#
-# use strict; # TODO
+# TODO:
+# use strict;
use vars qw($who $msgType $conn $chan $message $ident $talkchannel
$bot_version $babel_lang_regex $bot_data_dir);
if (!defined $arg or $arg =~ /^\s*$/) {
# this is way fucking ugly.
- # TODO convert $where to hash
+ # TODO: convert $where to hash
my %hash = &sqlSelectColHash("stats", "nick,counter",
{ },
$where." ORDER BY counter DESC LIMIT 3", 1
&pSReply("zero counter for \037$type\037.");
}
} else {
- # TODO convert $where to hash and use a sqlSelect
+ # TODO: convert $where to hash and use a sqlSelect
my $x = (&sqlRawReturn("SELECT SUM(counter) FROM stats".
" WHERE $where AND nick=".&sqlQuote($arg) ))[0];
}
# defined.
- # TODO convert $where to hash
+ # TODO: convert $where to hash
my @array = &sqlSelect("stats", "nick", undef,
$where." ORDER BY counter", 1
);
return;
}
- # TODO add nick to where_href
+ # TODO: add nick to where_href
my %hash = &sqlSelectColHash("stats", "type,counter",
$where_href, " AND nick=".&sqlQuote($arg)
);
foreach (keys %hash) {
&DEBUG("_stats: hash{$_} => $hash{$_}");
# ranking.
- # TODO convert $where to hash
+ # TODO: convert $where to hash
my @array = &sqlSelect("stats", "nick", undef,
$where." ORDER BY counter", 1);
$good = 0;
##### USER COMMANDS.
#####
-# todo: support multiple flags, eg: "+o-m"
+# TODO: support multiple flags, eg: "+o-m"
sub IsFlag {
my $flags = shift;
my ($ret, $f, $o) = "";
$ignore{$chan}{$mask} = [$expire, time(), $who, $comment];
- # todo: improve this.
+ # TODO: improve this.
if ($expire == 0) {
&status("ignore: Added $mask for $chan to NEVER expire, by $who, for $comment");
} else {
return;
}
- # todo: squeeze 3 getFactInfo calls into one?
+ # TODO: squeeze 3 getFactInfo calls into one?
my $author = &getFactInfo($faqtoid, "created_by");
my $count = &getFactInfo($faqtoid, "requested_count") || 0;
# don't delete if requested $limit times
# this may eat some memory.
# prevent deletion if other factoids redirect to it.
- # todo: use hash instead of array.
+ # TODO: use hash instead of array.
my @list;
if (&getChanConf("factoidPreventForgetRedirect")) {
&status("Factoids/Core: forget: checking for redirect factoids");
$match++;
}
- # todo: warn for op aswell, but allow force delete.
+ # TODO: warn for op aswell, but allow force delete.
if (!$isop and $match) {
&msg($who, "uhm, other (redirection) factoids depend on this one.");
return;
}
# ignore.
- # todo: make forget limit configurable.
- # todo: make forget ignore time configurable.
+ # TODO: make forget limit configurable.
+ # TODO: make forget ignore time configurable.
if ($cache{forget}{$h} > 5) {
&ignoreAdd(&makeHostMask($nuh), "*", 3*24*60, "abuse of forget");
&msg($who, "forget: Ignoring you for abuse!");
# &setFactInfo($faqtoid, "modified_time", 0);
$check = &getFactoid($faqtoid);
- # todo: check if $faqtoid." #DEL#" exists?
+ # TODO: check if $faqtoid." #DEL#" exists?
if (defined $check) {
&performReply("Successfully recovered '$faqtoid'. Have fun now.");
$count{'Undelete'}++;
# Version: 1997
#
-# todo:
+# TODO:
# use strict;
sub normquery {
# to make it eleeter, split each arg and use "blah OR blah or BLAH"
# which will make it less than linear => quicker!
- # todo: cache this, update cache when altered. !!! !!! !!!
+ # TODO: cache this, update cache when altered. !!! !!! !!!
# my $t = &timeget();
my ($first) = split(/\s+/, $str);
my @list = &searchTable("factoids", "factoid_key", "factoid_key", "^CMD: $first ");
# &DEBUG("factarg: '$str' =~ /^$_\$/");
my $arg = $_;
- # todo: <greycat> ~punish apt for (Eating) (Parentheses)
+ # TODO: <greycat> ~punish apt for (Eating) (Parentheses)
# how the hell do I fix the above? -dms.
# eval (evil!) code. cleaned up courtesy of lear.
# &DEBUG("vals => @vals");
&status("Question: factoid Arguments for '$str'");
- # todo: use getReply() - need to modify it :(
+ # TODO: use getReply() - need to modify it :(
my $i = 0;
my $q = "CMD: $_";
my $r = &getFactoid($q);
requested_count => $count
} );
- # todo: rename $real to something else!
+ # TODO: rename $real to something else!
my $real = 0;
# my $author = &getFactInfo($lhs,"created_by") || '';
# $real++ if ($author =~ /^\Q$who\E\!/);
my($reply,$flag) = @_;
# $date, $time.
- # todo: support localtime.
+ # TODO: support localtime.
my $date = scalar(gmtime());
$date =~ s/\:\d+(\s+\w+)\s+\d+$/$1/;
$reply =~ s/\$date/$date/gi;
if ($also) { # 'is also'.
if ($exists =~ /^<REPLY> see /i) {
- &DEBUG("Update.pl: todo: append to linked factoid.");
+ &TODO("Update.pl: append to linked factoid.");
}
if ($also_or) { # 'is also ||'.
&chanServCheck($chan);
- ### todo: unify code with chanlimitcheck()
+ ### TODO: unify code with chanlimitcheck()
return if ($delta > 5);
&status("clc: big change in limit for $chan ($delta);".
}
# check for first hash then for next hash.
- # todo: a function for &ischanop()? &isvoice()?
+ # TODO: a function for &ischanop()? &isvoice()?
if (exists $channels{$chan} and exists $channels{$chan}{'o'}{$ident}) {
return 0;
}
### TODO: prevent users without CRYPT chatting.
if (!defined $crypto) {
- &DEBUG("todo: dcc close chat");
+ &TODO("dcc close chat");
&msg($who, "nope, no guest logins allowed...");
return;
}
my $crypto = $users{$userHandle}{PASS};
$dcc{'CHAT'}{$nick} = $sock;
- # todo: don't make DCC CHAT established in the first place.
+ # TODO: don't make DCC CHAT established in the first place.
if ($userHandle eq "_default") {
&dccsay($nick, "_default/guest not allowed");
$sock->close();
$channels{$chan}{$mode}{$newnick} = $channels{$chan}{$mode}{$nick};
}
}
- # todo: do %flood* aswell.
+ # TODO: do %flood* aswell.
&delUserInfo($nick, keys %channels);
$nuh{lc $newnick} = $nuh{lc $nick};
sub on_notice {
my ($self, $event) = @_;
+ #$conn = $self; <- ugly hack or elegant solution?
my $nick = $event->nick();
my $chan = ($event->to)[0];
my $args = ($event->args)[0];
$uh = $event->userhost();
$nuh = $nick."!".$uh;
$msgType = "public";
- # todo: move this out of hookMsg to here?
+ # TODO: move this out of hookMsg to here?
($user,$host) = split(/\@/, $uh);
$h = $host;
&kernelLoop(2);
&wingateWriteFile(2);
&factoidCheck(2); # takes a couple of seconds on a 486. defer it
-# todo: convert to new format... or nuke altogether.
+# TODO: convert to new format... or nuke altogether.
&newsFlush(1);
- # todo: squeeze this into a one-liner.
+ # TODO: squeeze this into a one-liner.
# my $count = map { exists $sched{$_}{TIME} } keys %sched;
my $count = 0;
foreach (keys %sched) {
next unless (time() > $t);
- # todo: show how old it was.
+ # TODO: show how old it was.
delete $::news{$chan}{$item};
&status("NEWS: (newsflush) deleted '$item'");
$delete++;
$none{$chan} = 1 if ($total == $i);
}
- # todo: flush users aswell.
+ # TODO: flush users aswell.
my $duser = 0;
foreach $chan (keys %::newsuser) {
next if (exists $none{$chan});
&joinNextChan();
}
- # todo: fix on_disconnect()
+ # TODO: fix on_disconnect()
if (time() - $msgtime > 3600) {
- # todo: shouldn't we use cache{connect} somewhere?
+ # TODO: shouldn't we use cache{connect} somewhere?
if (exists $cache{connect}) {
&WARN("ircCheck: no msg for 3600 and disco'd! reconnecting!");
$msgtime = time(); # just in case.
closedir DEBIAN;
# compress logs that should have been compressed.
- # todo: use strftime?
+ # TODO: use strftime?
my ($day,$month,$year) = (gmtime(time()))[3,4,5];
my $date = sprintf("%04d%02d%02d",$year+1900,$month+1,$day);
undef @wingateNow;
}
-### TODO.
+### TODO: ??
sub wingateWriteFile {
if (@_) {
&ScheduleThis(60, "wingateWriteFile");
package Debian;
use strict;
-no strict 'refs'; # FIXME dstats aborts if set
+no strict 'refs'; # FIXME: dstats aborts if set
my $announce = 0;
my $defaultdist = "sid";
if (! -f $files[0]) {
&::WARN("files[0] ($files[0]) doesn't exist.");
- &::msg($::who, "WARNING: $files[0] does not exist? FIXME");
+ &::msg($::who, "FIXME: $files[0] does not exist?");
return 'NULL';
}
while (defined($file = readdir DEBIAN)) {
next unless ($file =~ /(gz|bz2)$/);
- # todo: add bzip2 support (debian doesn't do .bz2 anyway)
+ # TODO: add bzip2 support (debian doesn't do .bz2 anyway)
my $exit = system("/bin/gzip -t '$debian_dir/$file'");
next unless ($exit);
&::DEBUG("deb: hmr... => ".(time() - (stat($file))[8])."'.");
# Version: v0.6c (20000924).
# Created: 19990914.
#
+# see http://luetzschena-stahmeln.de/dictd/
+# for a list of dict servers
package Dict;
push(@list, "total prepared for deletion - $str");
# total unique authors.
- # todo: convert to sqlSelectColHash ? (or ColArray?)
+ # TODO: convert to sqlSelectColHash ? (or ColArray?)
foreach ( &sqlRawReturn("SELECT created_by FROM factoids WHERE created_by IS NOT NULL") ) {
/^(\S+)!/;
my $nick = lc $1;
return &formListReply(1, $prefix, @list);
} elsif ($type =~ /^unrequest(ed)?$/i) {
- # todo: use sqlSelect()
+ # TODO: use sqlSelect()
my ($count) = &sqlRawReturn("SELECT COUNT(*) FROM factoids WHERE requested_count = '0'");
return "Unrequested factoids: $count";
}
if (defined $what and $what =~ s/^($::mask{chan})\s*//) {
- # todo: check if the channel exists aswell.
+ # TODO: check if the channel exists aswell.
$chan = lc $1;
if (!&::IsNickInChan($who, $chan)) {
} elsif ($what =~ /^(un)?notify$/i) {
my $state = ($1) ? 0 : 1;
- # todo: don't notify even if "news" is called.
+ # TODO: don't notify even if "news" is called.
if (!&::IsChanConf("newsNotifyAll")) {
&::DEBUG("news: chan => $chan, ::chan => $::chan.");
&::notice($who, "not available for this channel or disabled altogether.");
while (<NEWS>) {
chop;
- # todo: allow commands.
+ # TODO: allow commands.
if (/^[\s\t]+(\S+):[\s\t]+(.*)$/) {
if (!defined $item) {
return;
}
- # todo: add commands to output file.
+ # TODO: add commands to output file.
my $c = 0;
my($cc,$ci,$cu) = (0,0,0);
}
}
- # todo: show how many users we wrote down.
+ # TODO: show how many users we wrote down.
if (&::getChanConfList("newsKeepRead")) {
# old users are removed in newsFlush(), perhaps it should be
# done here.
$auth++ if (&::IsFlag("o"));
if (!$auth) {
- # todo: show when it'll expire.
+ # TODO: show when it'll expire.
&::notice($who, "Sorry, you cannot remove items; just let them expire on their own.");
return;
}
next;
}
- # todo: show request stats aswell.
+ # TODO: show request stats aswell.
&::msg($who, sprintf("\002[\002%2d\002]\002%s %s",
$i, $chr, $subtopic));
$i++;
my $item = &getNewsItem($str);
if (!defined $item or !scalar keys %{ $::news{$chan}{$item} }) {
- # todo: numerical check.
+ # TODO: numerical check.
if ($str =~ /^(\d+)[-, ](\d+)$/ or
$str =~ /^-(\d+)$/ or
$str =~ /^(\d+)-$/ or 0
}
### TODO: use m### to make code safe!
- # todo: make code safer.
+ # TODO: make code safer.
my $done = 0;
- # todo: use eval to deal with flags easily.
+ # TODO: use eval to deal with flags easily.
if ($flags eq "") {
$done++ if (!$done and $mod_news =~ s/\Q$op\E/$np/);
$done++ if (!$done and $mod_nnews =~ s/\Q$op\E/$np/);
}
if ($what eq "Expire") {
- # todo: use do_set().
+ # TODO: use do_set().
my $time = 0;
my $plus = ($value =~ s/^\+//g);
}
if (!$auth) {
- # todo: show when it'll expire.
+ # TODO: show when it'll expire.
&::notice($who, "Sorry, you cannot set items. (author $author owns it)");
return;
}
- # todo: clean this up.
+ # TODO: clean this up.
my $old = $::news{$chan}{$news}{$what};
if (defined $old) {
&::DEBUG("news: old => $old.");
$chan = $tchan;
$who = $::who;
- # todo: if chan = undefined, guess.
+ # TODO: if chan = undefined, guess.
# if (!exists $::news{$chan}) {
if (!exists $::channels{$chan}) {
&::notice($who, "invalid chan $chan") if ($flag);
} );
}
- # todo: implement throttling via schedule into ¬ice() / &msg().
+ # TODO: implement throttling via schedule into ¬ice() / &msg().
$::conn->schedule(int((2+$i)/2), sub {
&::notice($who, "|= to read, do \002news $chan read <#>\002 or \002news $chan read <keyword>\002");
} );
return;
}
- &::DEBUG("news: do_set: TODO...");
+ &::TODO("news: do_set:");
}
sub stats {
}
# Extras function.
-# todo: support arguments to get info on a particular nick?
+# TODO: support arguments to get info on a particular nick?
sub CmdrootWarn {
my $reply;
my $count = &countKeys("rootwarn");
# quit.
if ($message =~ /^(exit|quit)$/i) {
# do ircII clients support remote close? if so, cool!
- &status("userDCC: quit called. FIXME");
+ &FIXME("userDCC: quit called.");
&dcc_close($who);
&status("userDCC: after dcc_close!");
&DEBUG("chan => '$1', msg => '$msg'.");
- # todo: add nick destination.
+ # TODO: add nick destination.
if (&validChan($chan)) {
&msg($chan, $msg);
} else {
$user = &getUser($args[0]);
$mask = $args[1];
} else { # <mask>
- # who or verifyUser. FIXME (don't remember why)
+ # FIXME: who or verifyUser. (don't remember why)
$user = &getUser($who);
$mask = $args[0];
}
}
if (!defined $mask) {
- ### FIXME.
+ ### FIXME:
&pSReply("Hostmasks for $user: $users{$user}{HOSTS}");
return;
}
if ( &ignoreAdd($mask, $chan, $time, $comment) > 1) {
- &pSReply("warn: $mask already in ignore list; written over anyway. FIXME");
+ &pSReply("FIXME: $mask already in ignore list; written over anyway.");
} else {
&pSReply("added $mask to ignore list.");
}
&main::DEBUG("$translated\n===remove to first ':', optional Help\n");
$translated =~ s/\n/ /g;
- # FIXME should we do unicode->iso
+ # FIXME: should we do unicode->iso (no. use utf8!)
} else {
$translated = ":("; # failure
}
if (defined $lsize) {
&DEBUG("FTP: locsize => '$lsize'.");
if ($size != $lsize) {
- &WARN("FTP: downloaded file seems truncated. FIXME.");
+ &FIXME("FTP: downloaded file seems truncated.");
}
}
### LWP.
# Usage: &getURL($url, [$post]);
-# todo: rename this to getHTTP
+# TODO: rename this to getHTTP
sub getURL {
my ($url,$post) = @_;
my ($ua,$res,$req);
return;
}
- # todo: use &getUser()?
+ # TODO: use &getUser()?
my $first = 1;
foreach (keys %users) {
if ($users{$_}{FLAGS} =~ /n/) {
$new{$_} = $userstats{$_}{'Count'};
}
- # todo: show top 3 with percentages?
+ # TODO: show top 3 with percentages?
my($count) = (sort { $new{$a} <=> $new{$b} } keys %new)[0];
if ($count) {
$reply .= ". \002$count\002 has said the most with a total of \002$new{$count}\002 messages";
push(@list, "$str ($_, $perc %)");
}
- # todo: move this into a scheduler like nickometer
+ # TODO: move this into a scheduler like nickometer
$msgType = "private";
&pSReply( &formListReply(0, "Country Stats ", @list) );
}
# idea from dondelecarlo :)
- # todo: use cache{nickserv}
+ # TODO: use cache{nickserv}
if ($param{'nickServ_pass'}) {
return if ($param{'ircNick'} eq $ident or $force == 0);
return;
}
- # todo: better filename.
+ # TODO: better filename.
open(OUT, ">>debug.log");
print OUT "DEBUG: $str\n";
chop;
$i++;
# bleh. this tries to duplicate status().
- # todo: statcountfix
- # todo: rename to log_*someshit*
+ # TODO: statcountfix
+ # TODO: rename to log_*someshit*
if ($i == $line) {
my $msg = "$file: $i:!$_";
printf "%s[%6d]%s %s\n", $_green, $statcount, $ob, $msg;
sub loadDBModules {
my $f;
- # todo: use function to load module.
+ # TODO: use function to load module.
if ($param{'DBType'} =~ /^(mysql|SQLite|pgsql)$/i) {
eval "use DBI";