}
# Topic management. xk++
- # may want to add a flag(??) for topic in the near future. -xk
+ # may want to add a userflags for topic. -xk
if ($message =~ /^topic(\s+(.*))?$/i) {
return unless (&hasParam("topic"));
&performStrictReply("...but \002$lhs\002 is already something else...");
&status("FAILED update: <$who> \'$lhs\' =$mhs=> \'$rhs\'");
}
- return;
+ return 1;
}
my $author = &getFactInfo($lhs, "created_by") || "";
}
### ROOTWARN:
- # what's the +o requirement?
- &rootWarn($who,$user,$host,$chan)
- if (&IsChanConf("rootWarn") &&
- $user =~ /^r(oo|ew|00)t$/i &&
- $channels{$chan}{'o'}{$ident});
+ &rootWarn($who,$user,$host,$chan) if (
+ &IsChanConf("rootWarn") &&
+ $user =~ /^r(oo|ew|00)t$/i
+ );
### NEWS:
if (&IsChanConf("news") && &IsChanConf("newsKeepRead")) {
# Usage: &searchContents($query);
sub searchContents {
my ($dist, $query) = &getDistroFromStr($_[0]);
- &::status("Debian: Contents search for '$query' on $dist.");
+ &::status("Debian: Contents search for '$query' in '$dist'.");
my $dccsend = 0;
$dccsend++ if ($query =~ s/^dcc\s+//i);
sub set {
my($args) = @_;
- $args =~ /^(\S+)\s+(\S+)\s+(.*)$/;
- my($item, $what, $value) = ($1,$2,$3);
+ my($item, $what, $value);
+
+ $item = $1 if ($args =~ s/^(\S+)\s*//);
+ $what = $1 if ($args =~ s/^(\S+)\s*//);
+ $value = $args;
&::DEBUG("news: set called.");
return;
}
- &::DEBUG("news: set: item => '$item'.");
my $news = &getNewsItem($item);
if (!defined $news) {
}
# list all values for chan.
- if (!defined $what) {
- &::DEBUG("news: set: 1");
+ if (!defined $what or $what =~ /^\s*$/) {
+ &::msg($::who, "set: you didn't fill me on the arguments! (what and values)");
return;
}
}
# show (read) what.
- if (!defined $value) {
- &::DEBUG("news: set: 2");
+ if (!defined $value or $value =~ /^\s*$/) {
+ &::msg($::who, "set: you didn't fill me on the arguments! (value)");
return;
}
if (!$time or ($value and $value !~ /^never$/i)) {
&::DEBUG("news: set: Expire... need to parse.");
+ &::msg($::who, "hrm... couldn't parse that.");
return;
}
foreach (sort { $a <=> $b } keys %time) {
$item++;
# $no = $item if ($time{$_} eq $what);
- if ($time{$_} eq $what) {
- $no = $item;
- next;
- }
+## if ($time{$_} eq $what) {
+## $no = $item;
+## next;
+## }
push(@items, $time{$_}) if ($time{$_} =~ /\Q$what\E/i);
}
- if (defined $no and !@items) {
- &::DEBUG("news: string->number resolution: $what->$no.");
- return $no;
- }
+## if (defined $no and !@items) {
+## &::DEBUG("news: string->number resolution: $what->$no.");
+## return $no;
+## }
if (scalar @items > 1) {
&::DEBUG("news: Multiple matches, not guessing.");
my $t = time();
foreach $chan (keys %::newsuser) {
$i += $t - $::newsuser{$chan}{$_};
- &DEBUG(" i = $i");
+ &::DEBUG(" i = $i");
$j++;
}
&::DEBUG("news: stats: average latest time read: total time: $i");
my $warnmode = &getChanConf("rootWarnMode");
if ($attempt == 0) { # first timer.
- if (defined $warnmode and $warnmode =~ /aggressive/i) {
- &status("rootwarn: Detected root user; notifying nick and channel.");
- rawout("PRIVMSG $chan :R".("O" x int(rand 80 + 2))."T has landed!");
- } else {
+ if (defined $warnmode and $warnmode =~ /quiet/i) {
&status("rootwarn: Detected root user; notifying user");
+ } else {
+ &status("rootwarn: Detected root user; notifying nick and channel.");
+ rawout("PRIVMSG $chan :R".("O" x int(rand 70 + 2))."T has landed!");
}
if ($_ = &getFactoid("root")) {
}
# Extras function.
+# todo: support arguments to get info on a particular nick?
sub CmdrootWarn {
my $reply;
my $count = &countKeys("rootwarn");
}
# reply #1.
- $reply = "there ".&fixPlural("has",$count) ." been \002$i\002 ".
+ $reply = "there ".&fixPlural("has",$count) ." been \002$count\002 ".
&fixPlural("rooter",$count) ." warned about root.";
if ($param{'DBType'} !~ /^mysql$/i) {
### for those users with enough flags.
+ if ($message =~ /^tellme(\s+(.*))?$/i) {
+ my $args = $2;
+ if ($args =~ /^\s*$/) {
+ &help("tellme");
+ return;
+ }
+
+ my $result = &doQuestion($args);
+ &pSReply($result);
+
+ return;
+ }
+
# 4op.
if ($message =~ /^4op(\s+($mask{chan}))?$/i) {
return unless (&hasFlag("o"));
my $query = "SELECT $select FROM $table";
$query .= " WHERE $where" if ($where);
+ if (!defined $select) {
+ &WARN("dbGet: select == NULL. table => $table");
+ return;
+ }
+
my $sth;
if (!($sth = $dbh->prepare($query))) {
&ERROR("Get: prepare: $DBI::errstr");