Changeset 66
- Timestamp:
- 02/17/08 19:53:26 (5 years ago)
- Location:
- trunk/Phergie
- Files:
-
- 1 added
- 5 modified
-
Event/Handler.php (modified) (1 diff)
-
Plugin/Altnick.php (added)
-
Plugin/Karma.php (modified) (4 diffs)
-
Plugin/Nickserv.php (modified) (4 diffs)
-
Plugin/Pong.php (modified) (2 diffs)
-
phergie.ini (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Phergie/Event/Handler.php
r60 r66 255 255 256 256 /** 257 * Handler for when a user is kicked from a channel. 258 * 259 * @return void 260 */ 261 public function onKick() { } 262 263 /** 257 264 * Handler for when the server checks the client connection to ensure 258 265 * activity. -
trunk/Phergie/Plugin/Karma.php
r60 r66 2 2 3 3 /** 4 * @see Phergie_ Event_Handler4 * @see Phergie_Plugin_Abstract_Command 5 5 */ 6 require_once 'Phergie/ Event/Handler.php';6 require_once 'Phergie/Plugin/Abstract/Command.php'; 7 7 8 8 /** … … 11 11 * inflation or depression of counters by any single individual. 12 12 */ 13 class Phergie_Plugin_Karma extends Phergie_ Event_Handler13 class Phergie_Plugin_Karma extends Phergie_Plugin_Abstract_Command 14 14 { 15 15 /** … … 74 74 'mc2' => 'mc2 has karma of e', 75 75 'mc²' => 'mc² has karma of e', 76 'the meaning of life' => 'the meaning of life has a karma of 42' 76 77 ); 77 78 … … 116 117 return; 117 118 } 119 118 120 $source = $this->event->getSource(); 119 121 $message = $this->event->getArgument(1); 120 // Karma status request122 // Karma status request 121 123 if (preg_match('#^karma (\S+?)$#i', $message, $m)) { 122 124 $term = strtolower($m[1]); -
trunk/Phergie/Plugin/Nickserv.php
r62 r66 16 16 { 17 17 /** 18 * Index of the last alternate nick that the bot attempted to use19 *20 * @var int21 */22 protected $index;23 24 /**25 18 * Primary nick for the bot 26 19 * … … 37 30 { 38 31 $this->nick = $this->getIni('nick'); 39 $this->index = -1;40 32 } 41 33 … … 58 50 } elseif (preg_match('/^.*' . $this->nick . '.* has been killed/', $message)) { 59 51 $this->doNick($this->nick); 60 $this->setIni('nick', $this->nick);61 52 } 62 53 } … … 64 55 65 56 /** 66 * Switches to alternate nicks as needed when nick collisions occur. 57 * Changes the in-memory configuration setting for the bot nick if it is 58 * successfully changed. 67 59 * 68 60 * @return void 69 61 */ 70 public function on Response()62 public function onNick() 71 63 { 72 if ($this->event->getCode() == Phergie_Event_Response::ERR_NICKNAMEINUSE) { 73 $this->index++; 74 $altnick = $this->getIni('altnick' . $this->index); 75 if ($altnick) { 76 $this->doNick($altnick); 77 $this->setIni('nick', $altnick); 78 } 64 if ($this->event->getSource() == $this->getIni('nick')) { 65 $this->setIni('nick', $this->event->getArgument(0)); 79 66 } 80 67 } -
trunk/Phergie/Plugin/Pong.php
r61 r66 13 13 { 14 14 /** 15 * Hostname for the bot16 *17 * @var string18 */19 protected $hostname;20 21 /**22 * Stores the hostname for the bot to use in PONG responses.23 *24 * @return void25 */26 public function init()27 {28 $this->hostname = gethostbyaddr(file_get_contents('http://whatismyip.com/automation/n09230945.asp'));29 }30 31 /**32 15 * Responds to PING requests from the server to indicate that the client 33 16 * connection is still active. … … 37 20 public function onPing() 38 21 { 39 $this->doPong($this-> hostname);22 $this->doPong($this->event->getArgument(0)); 40 23 } 41 24 } -
trunk/Phergie/phergie.ini
r64 r66 19 19 ; nick to use for the bot 20 20 nick = 21 22 ; altnick0 :23 ; alternate nicks to use for the bot in the event that the preferred nick24 ; is unavailable; this setting may be repeated with a different number25 ; (i. e. altnick1, altnick2, etc.)26 altnick0 =27 21 28 22 ; realname : … … 79 73 ; if set to true, chan operators are given admin rights 80 74 admincommand.ops = true 75 76 ;----------------------------------------------------------------------------- 77 ; Alternate Nick 78 ;----------------------------------------------------------------------------- 79 80 ; altnick.altnick0 : 81 ; alternate nicks to use for the bot in the event that the preferred nick 82 ; is unavailable; this setting may be repeated with a different number 83 ; (i. e. altnick1, altnick2, etc.) 84 altnick.altnick0 = 81 85 82 86 ;-----------------------------------------------------------------------------