Changeset 64

Show
Ignore:
Timestamp:
02/17/08 18:27:54 (5 years ago)
Author:
tobias382
Message:

* Added a check for messages containing no commands
* Added a check for blank titles to the Url plugin
* Added port and password settings to the stock config file

Location:
trunk/Phergie
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/Phergie/Plugin/Abstract/Command.php

    r60 r64  
    5151        } 
    5252 
    53         preg_match('/^(\S+)(?:\s+(.*))?$/', $message, $match); 
    54         $command = strtolower($match[1]); 
    55         $params = isset ($match[2]) ? $match[2] : array(); 
     53        if (preg_match('/^(\S+)(?:\s+(.*))?$/', $message, $match)) { 
     54            $command = strtolower($match[1]); 
     55            $params = isset ($match[2]) ? $match[2] : array(); 
    5656 
    57         if (isset ($this->methods[$command])) { 
    58             $method = 'onDo' . ucfirst($command); 
    59             if (empty ($params)) { 
    60                 if (!$this->methods[$command]) { 
    61                     $this->$method(); 
    62                 } 
    63             } else { 
    64                 $params = preg_split('/\s+/', $params, $this->methods[$command]); 
    65                 if ($this->methods[$command] <= count($params)) { 
    66                     call_user_func_array(array($this, $method), $params); 
     57            if (isset ($this->methods[$command])) { 
     58                $method = 'onDo' . ucfirst($command); 
     59                if (empty ($params)) { 
     60                    if (!$this->methods[$command]) { 
     61                        $this->$method(); 
     62                    } 
     63                } else { 
     64                    $params = preg_split('/\s+/', $params, $this->methods[$command]); 
     65                    if ($this->methods[$command] <= count($params)) { 
     66                        call_user_func_array(array($this, $method), $params); 
     67                    } 
    6768                } 
    6869            } 
  • trunk/Phergie/Plugin/Url.php

    r61 r64  
    8484            } 
    8585 
     86            if (!isset($title)) { 
     87                $title = '[ No Title ]'; 
     88            } 
     89 
    8690            $this->doPrivmsg( 
    8791                $this->event->getSource(), 
  • trunk/Phergie/phergie.ini

    r60 r64  
    66;    host name of the server to which the bot should connect 
    77server = 
     8 
     9; port : 
     10;    port on which the bot should connect, defaults to 6667 if none is 
     11;    specified; if you don't know what this is for, just leave it blank 
     12port = 
    813 
    914; username : 
     
    2429;    real name to use for the bot 
    2530realname = 
     31 
     32; password : 
     33;    server password to use when connecting; if you don't know what this is 
     34;    for, just leave it blank 
     35password = 
    2636 
    2737; gender :