/** * XAT notice to change Ip and/or Port. * * @param \Mars\Network\Server $server The server instance. * @param array $data The data received from the socket. * * @return bool */ public function onQ(Server $server, $data) { if (isset($data['q']['d']) && isset($data['q']['p'])) { $server->Socket->disconnect(); $server->connect(null, $data['q']['d'], $data['q']['p']); return true; } return false; }
/** * Xat's telling us that we was not active for a while. * * @param \Mars\Network\Server $server The server instance. * @param array $data The data received from the socket. * * @return bool */ public function onIdle(Server $server, $data) { if (isset($data['idle']['e'])) { //We can also send a message to the user 1 every X minutes. $server->Socket->disconnect(); $server->connect(); return true; } return false; }
/** * Handle the room command. * * @param \Mars\Network\Server $server The server instance. * @param \Mars\Message\Message $message The message instance. * * @return bool|void */ protected function _handleRoom(Server $server, $message) { switch ($message->arguments[0]) { case 'go': $roomName = $message->arguments[1]; $disconnect = $server->Socket->disconnect(); if ($disconnect == true) { $server->connect($roomName); } break; default: $server->ModuleManager->message('Unknown command. Syntax: ' . $this->_commands[$message->command]['syntax']); } }