Assembla home | Assembla project page
 

Changeset 236

Show
Ignore:
Timestamp:
04/14/08 08:19:40 (7 months ago)
Author:
Slynderdale
Message:

Added a method_exists check to prevent call_user_func_array errors from commands for methods that don't exist from malformed packets and such. Also I changed it so the ignored list gets updated in real time instead of just when connecting.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Phergie/Driver/Streams.php

    r232 r236  
    156156        } 
    157157 
    158         $ignore = $this->hostmasksToRegex($this->getIni('ignore')); 
    159  
    160158        // Run the onConnect handler since we successfully connected to the server 
    161159        foreach($this->plugins as $plugin) { 
     
    313311            } 
    314312 
     313            $ignore = $this->hostmasksToRegex($this->getIni('ignore')); 
     314            $method = 'on' . ucfirst($cmd); 
    315315            foreach($this->plugins as $plugin) { 
    316316                // Skip disabled plugins 
     
    324324                if ($event instanceof Phergie_Event_Response) { 
    325325                    $plugin->onResponse(); 
    326                 // Skip events from ignored users 
    327                 } elseif (!preg_match($ignore, $event->getHostmask()) && !empty($cmd)) { 
    328                     call_user_func(array($plugin, 'on' . ucfirst($cmd))); 
    329                 } 
    330             } 
     326                // Skip events from ignored users and malformed packets 
     327                } elseif (!empty($cmd) && method_exists($plugin, $method) && 
     328                          !preg_match($ignore, $event->getHostmask())) { 
     329                        call_user_func(array($plugin, $method)); 
     330                } 
     331            } 
     332 
    331333            $this->queueing = false; 
    332334            foreach($this->priority as $command) {