-# infobot :: Kevin Lenzo 1997-1999
+###
+### Process.pl: Kevin Lenzo 1997-1999
+###
+
#
# process the incoming message
#
}
# User Processing, for all users.
- return 'NOREPLY from userC' if &userCommands() eq 'NOREPLY';
+ return '$noreply from userC' if &userCommands() eq $noreply;
###
# once useless messages have been parsed out, we match them.
###
- # addressed.
- if ($message =~ /^\Q$ident\E\s*\?*$/i) {
- &status("feedback addressing from $who");
-
- &performReply("yes?");
-
- return;
- }
-
# confused? is this for infobot communications?
foreach (keys %{$lang{'confused'}}) {
my $y = $_;
# here's where the external routines get called.
# if they return anything but null, that's the "answer".
if ($addressed) {
+ if (&parseCmdHook()) {
+ return 'DID SOMETHING IN PCH.';
+ }
+
my $er = &Modules();
if ($er =~ /\S/) {
- &performStrictReply($er) if ($er ne 'NOREPLY');
+ &performStrictReply($er) if ($er ne $noreply);
return 'SOMETHING 1';
}
# inter-infobot.
if ($msgType =~ /private/ and $message =~ s/^:INFOBOT://) {
### identification.
- &status("infobot <$nuh> identified") unless $infobots{$nuh};
- $infobots{$nuh} = $who;
+ &status("infobot <$nuh> identified") unless $bots{$nuh};
+ $bots{$nuh} = $who;
### communication.
return 'locked factoid' if (&IsLocked($faqtoid) == 1);
- &status("forget: <$who> '$faqtoid' =is=> '$result'");
- &delFactoid($faqtoid);
+ if (&IsParam("factoidDeleteDelay")) {
+ &status("forgot (safe delete): <$who> '$faqtoid' =is=> '$result'");
+ &setFactInfo($faqtoid, "factoid_key", $faqtoid." #DEL#");
+
+ ### delete info. modified_ isn't really used.
+ &setFactInfo($faqtoid, "modified_by", $who);
+ &setFactInfo($faqtoid, "modified_time", time());
+ } else {
+ &status("forget: <$who> '$faqtoid' =is=> '$result'");
+ &delFactoid($faqtoid);
+ }
&performReply("i forgot $faqtoid");
return;
}
+ # factoid unforget/undelete.
+ if ($message =~ s/^un(forget|delete)\s+//i) {
+ return 'unforget: no addr' unless ($addressed);
+
+ if (!&IsParam("factoidDeleteDelay")) {
+ &performReply("safe delete has been disable so what is there to undelete?");
+ return;
+ }
+
+ my $faqtoid = $message;
+ if ($faqtoid eq "") {
+ &help("undelete");
+ return;
+ }
+
+ $faqtoid =~ tr/A-Z/a-z/;
+ my $result = &getFactoid($faqtoid." #DEL#");
+ my $check = &getFactoid($faqtoid);
+
+ if (!defined $result) {
+ &performReply("i didn't have anything ('$faqtoid') to undelete.");
+ return;
+ }
+
+ if (defined $check) {
+ &performReply("cannot undeleted '$faqtoid' because it already exists?");
+ return;
+ }
+
+ &setFactInfo($faqtoid." #DEL#", "factoid_key", $faqtoid);
+
+ ### delete info. modified_ isn't really used.
+ &setFactInfo($faqtoid, "modified_by", "");
+ &setFactInfo($faqtoid, "modified_time", 0);
+
+ &performReply("Successfully recovered '$faqtoid'. Have fun now.");
+
+ $count{'Undelete'}++;
+
+ return;
+ }
+
# factoid locking.
if ($message =~ /^((un)?lock)(\s+(.*))?\s*?$/i) {
return 'lock: no addr 2' unless ($addressed);
my $author = &getFactInfo($from, "created_by");
if (&IsFlag("m") and $author =~ /^\Q$who\E\!/i) {
&msg($who, "It's not yours to modify.");
- return 'NOREPLY';
+ return $noreply;
}
if ($_ = &getFactoid($to)) {
my $result = &doQuestion($message);
- return 'result is NOREPLY' if ($result eq 'NOREPLY');
+ return 'result is $noreply' if ($result eq $noreply);
if (defined $result and $result ne "") { # question.
&status("question: <$who> $message");
}
if ($addressed) {
- &status("unparseable: $message");
- &performReply( &getRandom(keys %{$lang{'dunno'}}) );
+ if (length $message < 64) {
+ &status("unparseable: $message");
+ &performReply( &getRandom(keys %{$lang{'dunno'}}) );
+ } else {
+ &status("unparse-ignore: $message");
+ }
+
$count{'Dunno'}++;
}
}