return if ($retval eq $noreply);
}
+ # 'identify'
+ if ($msgType =~ /private/ and $message =~ s/^identify//) {
+ $message =~ s/^\s+|\s+$//g;
+ my @array = split / /, $message;
+
+ if ($who =~ /^_default$/i) {
+ &pSReply("you are too eleet.");
+ return;
+ }
+
+ if (!scalar @array or scalar @array > 2) {
+ &help("identify");
+ return;
+ }
+
+ my $do_nick = $array[1] || $who;
+
+ if (!exists $users{$do_nick}) {
+ &pSReply("nick $do_nick is not in user list.");
+ return;
+ }
+
+ my $crypt = $users{$do_nick}{PASS};
+ if (!defined $crypt) {
+ &pSReply("user $do_nick has no passwd set.");
+ return;
+ }
+
+ if (!&ckpass($array[0], $crypt)) {
+ &pSReply("invalid passwd for $do_nick.");
+ return;
+ }
+
+ my $mask = "*!$user@".&makeHostMask($host);
+ ### TODO: prevent adding multiple dupe masks?
+ ### TODO: make &addHostMask() CMD?
+ &pSReply("Added $mask for $do_nick...");
+ $users{$do_nick}{HOSTS}{$mask} = 1;
+
+ return;
+ }
+
###
# once useless messages have been parsed out, we match them.
###
# thanks.
if ($message =~ /^than(ks?|x)( you)?( \S+)?/i) {
- &DEBUG("thanks: talkok => '$talkok', addressed => '$addressed'.");
return 'thank: no addr' unless ($message =~ /$ident/ or $talkok);
&performReply( &getRandom(keys %{$lang{'welcome'}}) );
return 'result from doQ undef.';
}
- if (defined $result and $result ne "") { # question.
+ if (defined $result and $result !~ /^0?$/) { # question.
&status("question: <$who> $message");
$count{'Question'}++;
} elsif (&IsChanConf("perlMath") > 0 and $addressed) { # perl math.
}
}
- if ($result ne "") {
+ if ($result !~ /^0?$/) {
&performStrictReply($result);
return;
- } else {
- # why would a friendly bot get passed here?
- if (&IsParam("friendlyBots")) {
- return if (grep lc($_) eq lc($who), split(/\s+/, $param{'friendlyBots'}));
- }
+ }
- # do the statement.
- if (defined &doStatement($message)) {
- return;
- }
+ # why would a friendly bot get passed here?
+ if (&IsParam("friendlyBots")) {
+ return if (grep lc($_) eq lc($who), split(/\s+/, $param{'friendlyBots'}));
+ }
- return unless ($addressed);
+ # do the statement.
+ if (!defined &doStatement($message)) {
+ return;
+ }
- if (length $message > 64) {
- &status("unparseable-moron: $message");
- &performReply( &getRandom(keys %{$lang{'moron'}}) );
- $count{'Moron'}++;
- return;
- }
+ return unless ($addressed);
- &status("unparseable: $message");
- &performReply( &getRandom(keys %{$lang{'dunno'}}) );
- $count{'Dunno'}++;
+ if (length $message > 64) {
+ &status("unparseable-moron: $message");
+ &performReply( &getRandom(keys %{$lang{'moron'}}) );
+ $count{'Moron'}++;
+ return;
}
+
+ &status("unparseable: $message");
+ &performReply( &getRandom(keys %{$lang{'dunno'}}) );
+ $count{'Dunno'}++;
}
1;