rcpts = $config['rcpt']; } else { $this->rcpts[] = $config['rcpt']; } $this->initialized = true; } } /** * This creates the listener that listens for new * threads to send out notifications */ public function run() { $dispatcher = EventDispatcher::getInstance(); $dispatcher->attachListener(Events::THREAD_CREATE, $this, 'sendJabberNotification'); } /** * Sends notification to Jabber * @return boolean */ public function sendJabberNotification(&$args) { // Initialize jabber connection $options = new Options($this->config['server']); $options->setUsername($this->config['username']) ->setPassword($this->config['password']); $client = new Client($options); $client->connect(); // Prepare the notification $message = new Message; $message->setMessage(getlocal('You have a new user waiting for a response. Username: {0}', array($args['thread']->userName))); // Send the notification to all recipients foreach ($this->rcpts as $rcpt) { $message->setTo($rcpt); $client->send($message); } return true; } /** * Returns plugin's version. * * @return string */ public static function getVersion() { return '0.0.1'; } /** * Returns plugin's dependencies. * * @return type */ public static function getDependencies() { return array(); } }