X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FProcess.pl;h=4d2423c998500019cdb616df378b542c53d799fb;hb=3ec7d692f53e712dd2782c1576695517bf6ef8e0;hp=a6193e0a509f9ff8f3390375d152f667783e08e5;hpb=8db2e0f2c2cadd0bd47e873bc1ee939394b3ddff;p=infobot.git diff --git a/src/Process.pl b/src/Process.pl index a6193e0..4d2423c 100644 --- a/src/Process.pl +++ b/src/Process.pl @@ -99,8 +99,43 @@ sub process { # 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); + } + + # '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 $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; } ### @@ -215,8 +250,7 @@ sub process { } my $er = &Modules(); - if ($er =~ /\S/) { - &performStrictReply($er) if ($er ne $noreply); + if (!defined $er) { return 'SOMETHING 1'; } @@ -420,7 +454,7 @@ sub FactoidStuff { 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)) { @@ -511,13 +545,14 @@ sub FactoidStuff { } my $result = &doQuestion($message); - - return 'result is $noreply' if ($result eq $noreply); + if (!defined $result or $result eq $noreply) { + return 'result from doQ undef.'; + } if (defined $result and $result ne "") { # 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(); @@ -537,20 +572,22 @@ sub FactoidStuff { } # do the statement. - if ($_ = &doStatement($message)) { + if (defined &doStatement($message)) { return; } - if ($addressed) { - if (length $message < 64) { - &status("unparseable: $message"); - &performReply( &getRandom(keys %{$lang{'dunno'}}) ); - } else { - &status("unparse-ignore: $message"); - } - - $count{'Dunno'}++; + 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'}++; } }