Show
Ignore:
Timestamp:
02/15/08 10:37:33 (5 years ago)
Author:
tobias382
Message:

Unstable commit - driver seems to work, most plugins still need testing
* Modified the streams driver to correctly parse the first argument for

PRIVMSG events into an array

* Added a new debug flag setting to the bundled configuration file
* Moved the debug method from the streams driver to the base driver and

modified it to use the new debug flag setting

* Renamed CtcpAction? methods to Action in order to make logic for

construction and parsing of related requests more compatible with the
same for other commands

* Moved Event_Handler::getEventSource to Event_Request::getSource
* Added Event_Handler::tinyUrl convenience method for converting URLs to

their TinyURL equivalents

* Improved docblock coverage in various classes
* Changed all plugin calls to getConnection()->getNick() to getIni('nick')
* Fixed a memory leak in the Command plugin class
* Added alternate nick support to the Nickserv plugin
* Too many more to name!

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Phergie/Plugin/Say.php

    r57 r59  
    22 
    33/** 
    4 * @see Phergie_Plugin_AdminCommand 
     4* @see Phergie_Plugin_Abstract_AdminCommand 
    55*/ 
    6 require_once 'Phergie/Event/Handler/AdminCommand.php'; 
     6require_once 'Phergie/Plugin/Abstract/AdminCommand.php'; 
    77 
    8 class Phergie_Plugin_Say extends Phergie_Event_Handler_AdminCommand 
     8/** 
     9* Allows administrators to effectively speak as the bot. 
     10*/ 
     11class Phergie_Plugin_Say extends Phergie_Plugin_Abstract_AdminCommand 
    912{ 
    10         /** 
    11          * Makes the bot say a message 
    12          * 
    13          * <code>Botname: say [#chan] message</code> 
    14          */ 
    15     public function onDoSay($what, Phergie_Event_Request $event) 
     13    /** 
     14    * Handles a request for the bot to repeat a given message in a specified 
     15    * channel. 
     16    * 
     17    * <code>Botname: say [#chan] message</code> 
     18    * 
     19    * @return void 
     20    */ 
     21    public function onDoSay($what) 
    1622    { 
    17         preg_match('{^(#\S+\s)?(.+)}', $what, $match); 
    18         if(!empty($match[1])) { 
    19                 $this->doPrivmsg(trim($match[1]), $match[2]); 
    20         } elseif(substr($event->getArgument(0), 0, 1) === '#') { 
    21                 $this->doPrivmsg($event->getArgument(0), $what); 
    22         } 
     23        $source = $this->getSource(); 
     24        preg_match('{^(#\S+\s)?(.+)}', $what, $match); 
     25        if (!empty ($match[1])) { 
     26            $this->doPrivmsg(trim($match[1]), $match[2]); 
     27        } elseif ($source[0] === '#') { 
     28            $this->doPrivmsg($source, $what); 
     29        } 
    2330    } 
    2431}