]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Process.pl
warn on pmsg karma - raven24++
[infobot.git] / src / Process.pl
index d49334634ee868611869f8d9d4b84fd7fce17289..1f00469ea1831438c2dc9787c6b01a29fd44e3bc 100644 (file)
@@ -26,13 +26,14 @@ sub process {
     $learnok = 1 if ($addressed);
     if ( $param{'learn'} =~ /^HUNGRY$/i ) {
         $learnok  = 1;
-        $addrchar = 1;
-        $talkok   = 1;
+        #FIXME: why can we talk if we just want to learn?
+        #$addrchar = 1;
+        #$talkok   = 1;
     }
 
     &shmFlush();                     # hack.
 
-    # hack to support channel +o as "+o" in bot user file.
+    # hack to support channel +o as '+o' in bot user file.
     # requires +O in user file.
     # is $who arg lowercase?
     if ( exists $channels{$chan}{o}{ $orig{who} } && &IsFlag('O') eq 'O' ) {
@@ -44,7 +45,7 @@ sub process {
     if ($lobotomized) {
         if ( $addressed and IsFlag('o') eq 'o' ) {
             my $delta_time = time() - ( $cache{lobotomy}{$who} || 0 );
-            &msg( $who, "give me an unlobotomy." ) if ( $delta_time > 60 * 60 );
+            &msg( $who, 'give me an unlobotomy.' ) if ( $delta_time > 60 * 60 );
             $cache{lobotomy}{$who} = time();
         }
         return 'LOBOTOMY' unless IsFlag('A');
@@ -105,7 +106,7 @@ sub process {
         my @array = split / /, $message;
 
         if ( $who =~ /^_default$/i ) {
-            &performStrictReply("you are too eleet.");
+            &performStrictReply('you are too eleet.');
             return;
         }
 
@@ -147,7 +148,7 @@ sub process {
         my @array = split ' ', $message;
 
         if ( $who =~ /^_default$/i ) {
-            &performStrictReply("you are too eleet.");
+            &performStrictReply('you are too eleet.');
             return;
         }
 
@@ -171,7 +172,7 @@ sub process {
         }
 
         if ($first) {
-            &performStrictReply("First time user... adding you as Master.");
+            &performStrictReply('First time user... adding you as Master.');
             $users{$who}{FLAGS} = 'aemnorst';
         }
 
@@ -182,7 +183,7 @@ sub process {
         }
 
         if ( !defined $host ) {
-            &WARN("pass: host == NULL.");
+            &WARN('pass: host == NULL.');
             return;
         }
 
@@ -200,7 +201,7 @@ sub process {
     }
 
     # allowOutsiders.
-    if ( &IsParam('disallowOutsiders') and $msgType =~ /private/i ) {
+    if ( &IsParam('disallowOutsiders') and $msgType =~ /private/i and IsFlag('o') ne 'o' ) {
         my $found = 0;
 
         foreach ( keys %channels ) {
@@ -259,11 +260,11 @@ sub process {
         return '' unless ($talkok);
 
         # 'mynick: hi' or 'hi mynick' or 'hi'.
-        &status("somebody said hello");
+        &status('somebody said hello');
 
         # 50% chance of replying to a random greeting when not addressed
         if ( !defined $5 and $addressed == 0 and rand() < 0.5 ) {
-            &status("not returning unaddressed greeting");
+            &status('not returning unaddressed greeting');
             return;
         }
 
@@ -274,7 +275,7 @@ sub process {
     }
 
     # greetings.
-    if ( $message =~ /how (the hell )?are (ya|you)( doin\'?g?)?\?*$/ ) {
+    if ( $message =~ /how (the hell )?are (ya|you)( doin\'?g?)?\?*$/ && $talkok ) {
 
         &performReply( &getRandom( keys %{ $lang{'howareyou'} } ) );
         return;
@@ -303,15 +304,19 @@ sub process {
     ###
 
     # karma. set...
-    if (   $msgType =~ /public/i
-        && $message =~ /^(\S+)(--|\+\+)\s*$/
+    if (   $message =~ /^(\S+)(--|\+\+)\s*$/
         && $addressed
         && &IsChanConfOrWarn('karma') )
     {
 
-    # to request factoids such as "g++" or "libstdc++", append "?" to the query.
+        # for factoids such as 'g++' or 'libstdc++', append '?' to query.
         my ( $term, $inc ) = ( lc $1, $2 );
 
+        if( !( $msgType =~ /public/i ) ) {
+            &msg( $who, "please use karma in a channel only");
+            return;
+        }
+
         if ( lc $term eq lc $who ) {
             &msg( $who, "please don't karma yourself" );
             return;
@@ -349,7 +354,8 @@ sub process {
 
         # allow administration of bot via messages (default is DCC CHAT only)
         if ( &IsFlag('A') ) {
-            &loadMyModule('UserDCC');
+            # UserDCC.pl should autoload now from IRC/. Remove if desired
+            #&loadMyModule('UserDCC');
             $er = &userDCC();
             if ( !defined $er ) {
                 return 'SOMETHING 2';
@@ -370,7 +376,7 @@ sub process {
         &FactoidStuff();
     }
     elsif ( $param{'DBType'} =~ /^none$/i ) {
-        return "NO FACTOIDS.";
+        return 'NO FACTOIDS.';
     }
     else {
         &ERROR("INVALID FACTOID SUPPORT? ($param{'DBType'})");