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
*/
public function onNotice() {
$event = $this->getEvent();
if ($event->getNick() == 'NickServ') {
$message = $event->getArgument(1);
if (preg_match($this->unregRegexp, $message, $groups)) {
$screenname = $groups[1];
call_user_func($this->regCallback, array('screenname' => $screenname, 'registered' => false));
} elseif (preg_match($this->regRegexp, $message, $groups)) {
$screenname = $groups[1];
call_user_func($this->regCallback, array('screenname' => $screenname, 'registered' => true));
if ($this->regCallback !== NULL) {
$event = $this->getEvent();
if ($event->getNick() == 'NickServ') {
$message = $event->getArgument(1);
if (preg_match($this->unregRegexp, $message, $groups)) {
$screenname = $groups[1];
call_user_func($this->regCallback, array('screenname' => $screenname, 'registered' => false));
} elseif (preg_match($this->regRegexp, $message, $groups)) {
$screenname = $groups[1];
call_user_func($this->regCallback, array('screenname' => $screenname, 'registered' => true));
}
}
}
}