# check if we have our head intact.
if ($lobotomized) {
if ($addressed and IsFlag("o") eq "o") {
- &msg($who, "give me an unlobotomy.");
+ my $delta_time = time() - ($cache{lobotomy}{$who} || 0);
+ &msg($who, "give me an unlobotomy.") if ($delta_time > 60*60);
+ $cache{lobotomy}{$who} = time();
}
return 'LOBOTOMY';
}
$users{$who}{HOSTS}{$mask} = 1;
}
- my $salt = join '',('.','/',0..9,'A'..'Z','a'..'z')[rand 64, rand 64];
- # todo: show crypt?
- &pSReply("new pass for $who, salt $salt.");
- $users{$who}{PASS} = crypt($array[0], $salt);
+ $crypt = &mkcrypt($array[0]);
+ $users{$who}{PASS} = $crypt;
+ &pSReply("new pass for $who, crypt $crypt.");
return;
}
}
}
+ # override msgType.
+ if ($msgType =~ /public/ and $message =~ s/^\+//) {
+ &status("found '+' flag; setting msgType to public.");
+ $force_public_reply++;
+ $msgType = 'public';
+ $who = $chan; # major hack to fix &msg().
+ &DEBUG("addressed => $addressed.");
+ }
+
# User Processing, for all users.
if ($addressed) {
my $retval;
### bot commands...
###
- # override msgType.
- if ($msgType =~ /public/ and $message =~ s/^\+//) {
- &status("found '+' flag; setting msgType to public.");
- $force_public_reply++;
- $msgType = 'public';
- }
-
if ($message =~ s/^literal\s+//i) {
&status("literal ask of '$message'.");
$literal = 1;
}
}
-
# factoid forget.
if ($message =~ s/^forget\s+//i) {
return 'forget: no addr' unless ($addressed);
return 'locked factoid' if (&IsLocked($faqtoid) == 1);
if (&IsParam("factoidDeleteDelay")) {
+ if ($faqtoid =~ /#DEL#/ and !&IsFlag("o")) {
+ &msg($who, "cannot delete it ($faqtoid).");
+ return;
+ }
&status("forgot (safe delete): <$who> '$faqtoid' =is=> '$result'");
### TODO: check if the "backup" exists and overwrite it
my $check = &getFactoid("$faqtoid #DEL#");
if (!$check) {
- &setFactInfo($faqtoid, "factoid_key", $faqtoid." #DEL#");
-
- &setFactInfo($faqtoid, "modified_by", $who);
- &setFactInfo($faqtoid, "modified_time", time());
+ if ($faqtoid !~ /#DEL#/) {
+ &setFactInfo($faqtoid, "factoid_key", $faqtoid." #DEL#");
+
+ &setFactInfo($faqtoid, "modified_by", $who);
+ &setFactInfo($faqtoid, "modified_time", time());
+ } else {
+ &status("not backing up $faqtoid.");
+ }
} else {
&status("forget: not overwriting backup!");
}
my $result = &getFactoid($from);
if (defined $result) {
my $author = &getFactInfo($from, "created_by");
- if (&IsFlag("m") and $author =~ /^\Q$who\E\!/i) {
+
+ if (&IsFlag("m") or $author =~ /^\Q$who\E\!/i) {
&msg($who, "It's not yours to modify.");
return;
}
return;
}
-
# Fix up $message for question.
- for ($message) {
+ my $question = $message;
+ for ($question) {
# fix the string.
s/^hey([, ]+)where/where/i;
+ s/\s+\?$/?/;
s/whois/who is/ig;
s/where can i find/where is/i;
s/how about/where is/i;
$correction_plausible = 0;
}
- my $result = &doQuestion($message);
+ my $result = &doQuestion($question);
if (!defined $result or $result eq $noreply) {
return 'result from doQ undef.';
}