public function onOpen(Bucket $bucket) { $nick = $this->getConfiguration()->get('connection.nick'); foreach ($this->getConfiguration()->get('connection.channels') as $channel) { $bucket->getSource()->join($nick, $channel); } }
public function onPrivateMessage(Bucket $bucket) { $data = $bucket->getData(); $owner = $this->getConfiguration()->get('configuration.commands.owner'); if ($owner && $data['from']['nick'] !== $owner) { return; } switch (trim($data['message'])) { case 'quit': die; break; } }
public static function receiveException(Core\Event\Bucket $bucket) { // Early draft. self::$_message = $bucket->getData()->raise(); return; }
public function onQuit(Bucket $bucket) { $data = $bucket->getData(); $this->log(sprintf('%s quit IRC (%s)', $data['from']['nick'], $data['message'])); }
/** * Send/fire a bucket to a listener. * * @param string $listenerId Listener ID. * @param \Hoa\Core\Event\Bucket $data Data. * @return array * @throws \Hoa\Core\Exception */ public function fire($listenerId, Bucket $data) { if (false === $this->listenerExists($listenerId)) { throw new Core\Exception('Cannot fire on %s because it is not defined.', 1); } $data->setSource($this->_source); $out = []; foreach ($this->_listen[$listenerId] as $callable) { $out[] = $callable($data); } return $out; }