]> git.donarmstrong.com Git - infobot.git/commitdiff
sedbot
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 7 Jan 2006 05:35:17 +0000 (05:35 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 7 Jan 2006 05:35:17 +0000 (05:35 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1259 c11ca15a-4712-0410-83d8-924469b57eb5

src/IRC/IrcHelpers.pl

index 2e8e31a50b5e03d4fcfca2d0766ee779cf51701d..ccc0d403dbe6533546d0929b0893bd8e77520fea 100644 (file)
@@ -224,16 +224,22 @@ sub hookMsg {
     } elsif ($msgType =~ /private/i) {            # private.
        &status("[$orig{who}] $orig{message}");
        $talkchannel    = undef;
-       $chan           = "_default";
+       $chan           = '_default';
     } else {
        &DEBUG("unknown msgType => $msgType.");
     }
-    push(@ignore, keys %{ $ignore{"*"} }) if (exists $ignore{"*"});
-
-    if ((!$skipmessage or &IsChanConf("seenStoreAll") > 0) and
-       &IsChanConf("seen") > 0 and
-       $msgType =~ /public/
-    ) {
+    push(@ignore, keys %{ $ignore{'*'} }) if (exists $ignore{'*'});
+
+    if ((!$skipmessage or &IsChanConf('seenStoreAll') > 0) and
+           &IsChanConf('sed') > 0 and &IsChanConf('seen') > 0 and
+           $msgType =~ /public/ and
+            $orig{message} =~ /^s\/([^;\/]*)\/([^;\/]*)\/([g]*)$/) {
+       my $sedmsg = $seencache{$who}{'msg'};
+       eval "\$sedmsg =~ s/$1/$2/$3;"
+       &DEBUG("sed \"$orig{message}\" \"$sedmsg\"");
+       &msg($talkchannel, "$orig{who} meant: $sedmsg");
+    } elsif ((!$skipmessage or &IsChanConf('seenStoreAll') > 0) and
+           &IsChanConf('seen') > 0 and $msgType =~ /public/) {
        $seencache{$who}{'time'} = time();
        $seencache{$who}{'nick'} = $orig{who};
        $seencache{$who}{'host'} = $uh;