]> git.donarmstrong.com Git - infobot.git/commitdiff
- news: latest: use $who instead of $::who - need a standard!
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 29 May 2001 14:38:26 +0000 (14:38 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 29 May 2001 14:38:26 +0000 (14:38 +0000)
- tell: don't lowercase $target.

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@503 c11ca15a-4712-0410-83d8-924469b57eb5

src/Modules/News.pl
src/UserExtra.pl
src/db_mysql.pl

index d856d80f144d736443ddaa3695867925a1e4ba8a..64ca9ee76dc733adfab0d9934db010acaa96cbff 100644 (file)
@@ -690,15 +690,18 @@ sub set {
 
 sub latest {
     my($tchan, $flag) = @_;
+    &::DEBUG("news: latest(): who => $who, ::who => $::who");
 
     # hack hack hack.
     $chan      ||= $tchan;
-    $who       ||= $::who;
+    $who       = $::who;
+
+    &::DEBUG("news: latest(): who => $who, ::who => $::who");
 
     # todo: if chan = undefined, guess.
 #    if (!exists $::news{$chan}) {
     if (!exists $::channels{$chan}) {
-       &::notice($::who, "invalid chan $chan") if ($flag);
+       &::notice($who, "invalid chan $chan") if ($flag);
        return;
     }
 
@@ -711,9 +714,9 @@ sub latest {
 
     if (defined $t and ($t == 0 or $t == -1)) {
        if ($flag) {
-           &::notice($::who, "if you want to read news, try /msg $::ident news or /msg $::ident news notify");
+           &::notice($who, "if you want to read news, try /msg $::ident news or /msg $::ident news notify");
        } else {
-           &::DEBUG("news: not displaying any new news for $::who");
+           &::DEBUG("news: not displaying any new news for $who");
            return;
        }
     }
@@ -727,7 +730,7 @@ sub latest {
     if (!defined $t) {
        &::DEBUG("news: something went really wrong.");
        &::DEBUG("news: chan => $chan, ::chan => $::chan");
-#      &::notice($::who, "something went really wrong.");
+#      &::notice($who, "something went really wrong.");
        return;
     }
 
@@ -751,7 +754,7 @@ sub latest {
 
     # !scalar @new, $flag
     if (!scalar @new and $flag) {
-       &::notice($::who, "no new news for $chan for $who.");
+       &::notice($who, "no new news for $chan for $who.");
        # valid to set this?
        $::newsuser{$chan}{$who} = time();
        return;
@@ -765,19 +768,19 @@ sub latest {
 
        my $reply = "There are unread news in $chan ($unread unread, $total total). /msg $::ident news $::chan latest";
        $reply   .= "  If you don't want further news notification, /msg $::ident news unnotify" if ($unread == $total);
-       &::notice($::who, $reply);
+       &::notice($who, $reply);
 
        return;
     }
 
     # scalar @new, $flag
     if (scalar @new) {
-       &::notice($::who, "+==== New news for \002$chan\002 ($unread new; $total total):");
+       &::notice($who, "+==== New news for \002$chan\002 ($unread new; $total total):");
 
        my $t = $::newsuser{$chan}{$who};
        if (defined $t and $t > 1) {
            my $timestr = &::Time2String( time() - $t );
-           &::notice($::who, "|= Last time read $timestr ago");
+           &::notice($who, "|= Last time read $timestr ago");
        }
 
        my @sorted;
@@ -791,17 +794,17 @@ sub latest {
            next unless (defined $news);
 
            my $age = time() - $::news{$chan}{$news}{Time};
-           &::notice($::who, sprintf("\002[\002%2d\002]\002 %s",
+           &::notice($who, sprintf("\002[\002%2d\002]\002 %s",
                $i, $news) );
 #              $i, $_, &::Time2String($age) ) );
        }
 
-       &::notice($::who, "|= to read, do 'news read <#>' or 'news read <keyword>'");
+       &::notice($who, "|= to read, do 'news read <#>' or 'news read <keyword>'");
 
        # lame hack to prevent dupes if we just ignore it.
        my $x = $::newsuser{$chan}{$who};
        if (defined $x and ($x == 0 or $x == -1)) {
-           &::DEBUG("news: not updating time for $::who. (2)");
+           &::DEBUG("news: not updating time for $who. (2)");
        } else {
            $::newsuser{$chan}{$who} = time();
        }
index 067370bf861739b88093dee1d38a6f0753ed61a5..f4cb80904acb802a5ecc3809a2fc04180ef3a75c 100644 (file)
@@ -287,7 +287,7 @@ sub tell {
 
     # this one catches most of them
     if ($args =~ /^(\S+) (-?)about (.*)$/i) {
-       $target         = lc $1;
+       $target         = $1;
        $tell_obj       = $3;
        $dont_tell_me   = ($2) ? 1 : 0;
 
@@ -295,19 +295,19 @@ sub tell {
        $query          = $tell_obj;
     } elsif ($args =~ /^(\S+) where (\S+) can (\S+) (.*)$/i) {
        # i'm sure this could all be nicely collapsed
-       $target         = lc $1;
+       $target         = $1;
        $tell_obj       = $4;
        $query          = $tell_obj;
 
     } elsif ($args =~ /^(\S+) (what|where) (.*?) (is|are)[.?!]*$/i) {
-       $target         = lc $1;
+       $target         = $1;
        $qWord          = $2;
        $tell_obj       = $3;
        $verb           = $4;
        $query          = "$qWord $verb $tell_obj";
 
     } elsif ($args =~ /^(.*?) to (\S+)$/i) {
-       $target         = lc $3;
+       $target         = $3;
        $tell_obj       = $2;
        $query          = $tell_obj;
     }
@@ -330,7 +330,7 @@ sub tell {
 #    }
 
     # self.
-    if ($target eq $ident) {   # lc?
+    if ($target =~  /^\Q$ident\E$/i) {
        &msg($who, "Isn't that a bit silly?");
        return;
     }
index f7178deb3f36268b2a837063d46123782b97a08f..1e97faa08ff057b1a08296db7683f1d1014fd0de 100644 (file)
@@ -85,6 +85,8 @@ sub dbGetCol {
     $query     .= " WHERE ".$where if ($where);
     my %retval;
 
+    &DEBUG("dbGetCol: query => '$query'.");
+
     my $sth = $dbh->prepare($query);
     &SQLDebug($query);
     if (!$sth->execute) {