$2 =~ /^($mask{chan})(,(\S+))?/;
my($thischan, $key) = (lc $1, $3);
- my $chankey = $thischan;
+ my $chankey = lc $thischan;
$chankey .= " $key" if (defined $key);
if ($thischan eq "") {
return;
}
- # Thanks to Eden Li (tile) for the channel key patch
- my @chans = split(/[\s\t]+/, $param{'join_channels'});
- if (!grep /^$thischan$/i, @chans) {
- if (&IsFlag("o") ne "o") {
+ if (&IsFlag("o") ne "o") {
+ if (!exists $chanconf{$thischan}) {
&msg($who, "I am not allowed to join $thischan.");
return;
}
- }
- if (&validChan($thischan) and &IsFlag("o") ne "o") {
- &msg($who,"I'm already on $thischan...");
- return;
+ if (&validChan($thischan)) {
+ &msg($who,"I'm already on $thischan...");
+ return;
+ }
}
- $joinverb{$thischan} = $who; # used for on_join self.
+ $cache{join}{$thischan} = $who; # used for on_join self.
&joinchan($chankey);
&status("JOIN $chankey <$who>");
return;
}
+ # '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 (!&ckpasswd($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;
+ }
+
# allowOutsiders.
if (&IsParam("disallowOutsiders") and $msgType =~ /private/i) {
my $found = 0;
# User Processing, for all users.
if ($addressed) {
- return '$noreply from pCH' if &parseCmdHook("main",$message);
- return '$noreply from userC' if &userCommands() eq $noreply;
+ my $retval;
+ return 'returned from pCH' if &parseCmdHook("main",$message);
+
+ $retval = &userCommands();
+ return unless (defined $retval);
+ return if ($retval eq $noreply);
}
###
# 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'}}) );
}
my $er = &Modules();
- if ($er =~ /\S/) {
- &performStrictReply($er) if ($er ne $noreply);
+ if (!defined $er) {
return 'SOMETHING 1';
}
return;
}
- # strongly requested by #debian on 19991028. -xk
- if (1 and $faqtoid !~ /^\Q$who\E$/i and &IsFlag("o") ne "o") {
- &msg($who,"sorry, locking cannot be used since it can be abused unneccesarily.");
- &status("Replace 1 with 0 in Process.pl#~324 for locking support.");
- return;
- }
-
if (&getFactoid($faqtoid) eq "") {
&msg($who, "factoid \002$faqtoid\002 does not exist");
return;
}
if ($function eq "lock") {
+ # strongly requested by #debian on 19991028. -xk
+ if (1 and $faqtoid !~ /^\Q$who\E$/i and &IsFlag("o") ne "o") {
+ &msg($who,"sorry, locking cannot be used since it can be abused unneccesarily.");
+ &status("Replace 1 with 0 in Process.pl#~324 for locking support.");
+ return;
+ }
+
&CmdLock($faqtoid);
} else {
&CmdUnLock($faqtoid);
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;
}
if ($_ = &getFactoid($to)) {
}
my $result = &doQuestion($message);
+ if (!defined $result or $result eq $noreply) {
+ return 'result from doQ undef.';
+ }
- return 'result is $noreply' if ($result eq $noreply);
-
- if (defined $result and $result ne "") { # question.
+ if (defined $result and $result !~ /^0?$/) { # question.
&status("question: <$who> $message");
$count{'Question'}++;
- } elsif (&IsParam("perlMath") and $addressed) { # perl math.
+ } elsif (&IsChanConf("perlMath") > 0 and $addressed) { # perl math.
&loadMyModule("perlMath");
my $newresult = &perlMath();
}
}
- 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 ($_ = &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'}));
+ }
- if ($addressed) {
- if (length $message < 64) {
- &status("unparseable: $message");
- &performReply( &getRandom(keys %{$lang{'dunno'}}) );
- } else {
- &status("unparse-ignore: $message");
- }
-
- $count{'Dunno'}++;
- }
+ # do the statement.
+ if (!defined &doStatement($message)) {
+ return;
+ }
+
+ return unless ($addressed);
+
+ 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;