Only attempt callback if non-null

This commit is contained in:
Luke Fitzgerald 2010-08-04 08:46:04 -07:00
parent 4cfe04a68f
commit 2250273942

View File

@ -84,15 +84,17 @@ class Phergie_Plugin_Statusnet extends Phergie_Plugin_Abstract {
* @return void * @return void
*/ */
public function onNotice() { public function onNotice() {
$event = $this->getEvent(); if ($this->regCallback !== NULL) {
if ($event->getNick() == 'NickServ') { $event = $this->getEvent();
$message = $event->getArgument(1); if ($event->getNick() == 'NickServ') {
if (preg_match($this->unregRegexp, $message, $groups)) { $message = $event->getArgument(1);
$screenname = $groups[1]; if (preg_match($this->unregRegexp, $message, $groups)) {
call_user_func($this->regCallback, array('screenname' => $screenname, 'registered' => false)); $screenname = $groups[1];
} elseif (preg_match($this->regRegexp, $message, $groups)) { call_user_func($this->regCallback, array('screenname' => $screenname, 'registered' => false));
$screenname = $groups[1]; } elseif (preg_match($this->regRegexp, $message, $groups)) {
call_user_func($this->regCallback, array('screenname' => $screenname, 'registered' => true)); $screenname = $groups[1];
call_user_func($this->regCallback, array('screenname' => $screenname, 'registered' => true));
}
} }
} }
} }