Assembla home | Assembla project page
 

Changeset 144

Show
Ignore:
Timestamp:
03/09/08 07:41:54 (9 months ago)
Author:
Slynderdale
Message:

A couple small fixes but mainly added a per channel flood protection filter instead of a global filter.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Phergie/Plugin/ChuckNorris.php

    r139 r144  
    6363    * @var int 
    6464    */ 
    65     protected $floodCheck = 10
     65    protected $floodCheck = 3
    6666 
    6767    /** 
     
    7070    * @var int 
    7171    */ 
    72     protected $floodCache = 3
     72    protected $floodCache = array()
    7373 
    7474    /** 
     
    156156                } 
    157157            } 
     158            unset($contents); 
    158159            return true; 
    159160        } 
     
    242243        if (preg_match('{(chuck\s*norris)}i', $message, $m) && 
    243244            strtolower(substr($message, 0, 5)) != 'fact:' && 
    244             ($this->floodCheck <= 0 || ($this->floodCache < (time() - $this->floodCheck)))) { 
     245            ($this->floodCheck <= 0 || ($this->floodCache[$source] < (time() - $this->floodCheck)))) { 
    245246 
    246247            // Retrieves a random fact 
    247248            $fact = $this->praiseChuckNorris(); 
    248                    if ($fact) { 
     249                if (!empty($fact)) { 
    249250                 $this->doPrivmsg($source, 'Fact: '.$fact); 
    250                  $this->floodCache = time(); 
     251                 $this->floodCache[$source] = time(); 
     252                 unset($fact); 
    251253            } 
    252254        }