Changeset 30
- Timestamp:
- 02/09/08 19:28:36 (10 months ago)
- Files:
-
- trunk/Phergie/Event/Handler/Command.php (modified) (2 diffs)
- trunk/Phergie/Event/Handler/JoinPart.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Event/Handler/Command.php
r29 r30 33 33 $cache['needs_event'] = false; 34 34 foreach ($method->getParameters() as $key => $param) { 35 if ($param->getClass()->getName() == 'Phergie_Event_Request') { 35 $paramClass = $param->getClass(); 36 if ($paramClass && $paramClass->getName() == 'Phergie_Event_Request') { 36 37 $cache['needs_event'] = true; 37 38 $cache['event_position'] = $key; … … 46 47 47 48 if ($method['exists']) { 48 $params = preg_split('/\s+/', $message, $method['num_args'] + 1); 49 array_shift($params); 49 $params = array_slice(preg_split('/\s+/', $message, $method['num_args'] + 1), 1); 50 $paramsCount = count($params); 51 if ($method['num_args'] > $paramsCount) { 52 $params += array_fill(0, $method['num_args'] - $paramsCount, null); 53 } 50 54 if ($method['needs_event']) { 51 array_splice($params, $method['event_position'], 0, array($event));55 $params[$method['event_position']] = $event; 52 56 } 53 57 if (count($params) == $method['num_args']) { trunk/Phergie/Event/Handler/JoinPart.php
r24 r30 22 22 * specified. 23 23 * 24 * @param mixed $spec A string containing the name of the channel to part 25 * or an instance of Phergie_Event_Request for the 26 * original event that occurred 24 * @param string $channel Name of the channel to part (optional) 25 * @param Phergie_Event_Request $event Intercepted event 27 26 */ 28 public function onDoPart($ spec)27 public function onDoPart($channel = null, Phergie_Event_Request $event) 29 28 { 30 if ( $spec instanceof Phergie_Event_Request) {31 $this->doPart($ spec->getArgument(0));29 if (empty($channel)) { 30 $this->doPart($event->getArgument(0)); 32 31 } else { 33 $this->doPart($ spec);32 $this->doPart($channel); 34 33 } 35 34 }