]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Factoids/Reply.pl
* Remove merge detrius from Reply.pl; stop breaking on 'you are'
[infobot.git] / src / Factoids / Reply.pl
index d2152c1165c4034ab246f6d4c0320b88959529a3..38f65a083db6d8c534d9716887cdc629c953a236 100644 (file)
@@ -11,6 +11,7 @@
 ##
 
 # use strict;  # TODO
+use POSIX qw(strftime);
 
 use vars qw($msgType $uh $lastWho $ident);
 use vars qw(%lang %lastWho);
@@ -124,13 +125,7 @@ sub getReply {
                $reply = "$lhs $mhs $result";
            }
 
-           if ($reply =~ s/^\Q$who\E is/you are/i) {
-               # fix the person.
-           } else {
-               if ($reply =~ /^you are / or $reply =~ / you are /) {
-                   return if ($addressed);
-               }
-           }
+           $reply =~ s/^\Q$who\E is/you are/i) {
        }
     }
 
@@ -268,16 +263,17 @@ sub SARit {
 sub substVars {
     my($reply,$flag) = @_;
 
-    # $date, $time.
+    # $date, $time, $day.
     # TODO: support localtime.
-    my $date   =  scalar(gmtime());
-    $date      =~ s/\:\d+(\s+\w+)\s+\d+$/$1/;
+    my $date   =  strftime("%Y.%m.%d", gmtime());
     $reply     =~ s/\$date/$date/gi;
-    $date      =~ s/\w+\s+\w+\s+\d+\s+//;
-    $reply     =~ s/\$time/$date/gi;
+    my $time   =  strftime("%k:%M:%S", gmtime());
+    $reply     =~ s/\$time/$time/gi;
+    my $day    =  strftime("%A", gmtime());
+    $reply     =~ s/\$day/$day/gi;
 
     # support $ident when I have multiple nicks
-    my $mynick = $conn->nick();
+    my $mynick = $conn->nick() if $conn;
 
     # dollar variables.
     if ($flag) {