Assembla home | Assembla project page
 

Changeset 20

Show
Ignore:
Timestamp:
02/09/08 00:43:11 (10 months ago)
Author:
Seldaek
Message:

+ added cron abstract class
+ added JoinPart? that handles join/part #chan
+ added RSSParser plugin, although a small feature is still missing (see TODO tag), it seems to be stable
+ documented phergie.ini (feel free to change doc format though, it's just a proposal)
* get/setIni are now case insensitive (modifies Client, AdminCommand? and Quit)
* small modification in Autojoin for consistency with other ini-"lists" which can all be separated by a comma or a space
* fix in Daddy (debug data was left)

Files:

Legend:

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

    r1 r20  
    4242 
    4343    /** 
    44     * Associative array mapping configuration setting names to their  
     44    * Associative array mapping configuration setting names to their 
    4545    * respective values 
    4646    * 
     
    8585    public final function getIni($name) 
    8686    { 
    87         if (!isset($this->_configuration[$name])) { 
     87        if (!isset($this->_configuration[strtolower($name)])) { 
    8888            return null; 
    8989        } 
    90         return $this->_configuration[$name]; 
     90        return $this->_configuration[strtolower($name)]; 
    9191    } 
    9292 
    9393    /** 
    94     * Sets the value of a specified configuration setting, overwriting any  
     94    * Sets the value of a specified configuration setting, overwriting any 
    9595    * existing value for that setting. 
    9696    * 
     
    100100    public final function setIni($name, $value) 
    101101    { 
    102         $this->_configuration[$name] = $value; 
     102        $this->_configuration[strtolower($name)] = $value; 
    103103    } 
    104104 
  • trunk/Phergie/Event/Handler/AdminCommand.php

    r17 r20  
    3636        protected $_adminOps = array(); 
    3737 
    38     public function isAdmin(Phergie_Event_Request $event, $__class__ = __CLASS__
     38    public function isAdmin(Phergie_Event_Request $event
    3939    { 
    40         $class = substr($__class__, 22); 
     40        $class = substr(get_class($this), 22); 
    4141        if (!isset($this->_admins[$class])) { 
    4242                $this->initialize($class); 
     
    5959    { 
    6060        // Set adminOps values 
    61         $ini = $this->getIni($class.'.adminOps'); 
     61        $ini = $this->getIni($class.'.admin_ops'); 
    6262        if ($ini===null) { 
    63                 $ini = $this->getIni('AdminCommand.adminOps'); 
     63                $ini = $this->getIni('admincommand.admin_ops'); 
    6464        } 
    6565        if ($ini==='true' || $ini==='1') { 
     
    7272        $ini = $this->getIni($class.'.admins'); 
    7373        if ($ini===null) { 
    74                 $ini = $this->getIni('AdminCommand.admins'); 
     74                $ini = $this->getIni('admincommand.admins'); 
    7575        } 
    76         $admins = explode(',', $ini); 
     76        $admins = preg_split('#[\s\r\n,]+#', $ini); 
     77        var_dump($admins); 
     78        die; 
    7779        foreach ($admins as $admin) { 
    7880                // Find out which chars are present in the config mask and exclude them from the regex match 
  • trunk/Phergie/Event/Handler/Autojoin.php

    r18 r20  
    1010        if (!empty($channels) 
    1111            && $response->getCode() == Phergie_Event_Response::RPL_ENDOFMOTD) { 
    12             $this->doJoin($channels); 
     12            $this->doJoin(implode(' ', preg_split('#[, ]+#', $channels))); 
    1313        } 
    1414    } 
  • trunk/Phergie/Event/Handler/Daddy.php

    r19 r20  
    1212        $bot = $this->getConnection()->getNick(); 
    1313        $msg = $event->getArgument(1); 
    14         echo 'system -> bot: ' . $bot . "\n"; 
    15         echo 'system -> msg: ' . $msg . "\n"; 
    16         if (preg_match('/' . $bot . '\s*:?\s+?who\'?s your daddy\\??/iAD', $msg, $match)) { 
     14        if (preg_match('/' . $bot . '\s*:?\s+?who\'?s your daddy\\??/iAD', $msg)) { 
    1715            $this->doPrivmsg($event->getArgument(0), 'You\'re my daddy, ' . $event->getNick() . '!'); 
    1816        } 
  • trunk/Phergie/Event/Handler/Quit.php

    r16 r20  
    1010    public function onPrivmsg(Phergie_Event_Request $event) 
    1111    { 
    12         if($event->getArgument(1)=='quit' && $this->isAdmin($event, __CLASS__)) { 
     12        if($event->getArgument(1)=='quit' && $this->isAdmin($event)) { 
    1313                $this->doQuit('by request of ' . $event->getNick()); 
    1414        } 
  • trunk/Phergie/phergie.ini

    r18 r20  
    55plugins = all 
    66 
    7 nickserv.password =  
     7nickserv.password = 
    88 
    9 autojoin.channels =  
     9autojoin.channels = 
     10 
     11;------------------------ 
     12; Admin Command settings 
     13;------------------------ 
     14[admincommand] 
     15; admincommand.admins : 
     16;    a list of hostmasks containing wildcards that are 
     17;    granted access to the bot's admin features, it must be 
     18;    enclosed by double quotes and entries are separated 
     19;    by spaces or commas 
     20admincommand.admins = "" 
     21; admincommand.admin_ops : 
     22;    if set to true, chan operators are given admin rights 
     23admincommand.admin_ops = true 
     24 
     25;------------------------ 
     26; RSSParser settings 
     27;------------------------ 
     28[rssparser] 
     29; rssparser.feed0 : 
     30;    a feed url, enclosed by double quotes, to have multiple feeds 
     31;    you should put them in feed1, feed2, feed3 and so on. be careful 
     32;    not to leave a gap in between two feed numbers as it will not 
     33;    find those after the gap 
     34rssparser.feed0 = "" 
     35; rssparser.chans0 : 
     36;    contains a list of channels where the feedN must be advertised 
     37;    entries are separated by spaces or commas 
     38rssparser.chans0 = "" 
     39; rssparser.time_to_live : 
     40;    that's the frequency, in seconds, at which the feeds are checked 
     41;    for new data, the default is 1800 (every 30minutes) 
     42rssparser.time_to_live = 1800