Public Member Functions | |
ilChatServerCommunicator (&$chat_obj) | |
Constructor public. | |
setRecipientId ($a_id) | |
getRecipientId () | |
setRecipientLogin ($a_login) | |
getRecipientLogin () | |
setKickedUser ($k_user) | |
getKickedUser () | |
setMessage ($a_message) | |
getMessage () | |
setType ($a_type) | |
getType () | |
getHtml () | |
send () | |
getServerFrameSource () | |
isAlive () | |
__getFormattedChatroom () | |
__formatLogin ($a_login) | |
__formatMessage () | |
__openSocket () | |
_initObject () | |
_login () | |
_logout () | |
Data Fields | |
$chat | |
$message | |
$socket_p | |
$type | |
$rcp_id | |
$rcp_login | |
$kicked_user |
Definition at line 33 of file class.ilChatServerCommunicator.php.
ilChatServerCommunicator::__formatLogin | ( | $ | a_login | ) |
Definition at line 145 of file class.ilChatServerCommunicator.php.
Referenced by __formatMessage(), and getServerFrameSource().
{
$nic = $this->chat->server_conf->getNic();
return substr($nic.md5($a_login),0,32);
}
ilChatServerCommunicator::__formatMessage | ( | ) |
Definition at line 151 of file class.ilChatServerCommunicator.php.
References __formatLogin(), __getFormattedChatroom(), getKickedUser(), getMessage(), getRecipientLogin(), and getType().
Referenced by send().
{ switch($this->getType()) { case 'private': // STORE MESSAGE IN DB return "|".$this->__formatLogin($this->getRecipientLogin()). $this->__formatLogin($this->chat->chat_user->getLogin()). $this->__getFormattedChatroom().$this->getMessage()."<br />"; case 'normal': // STORE MESSAGE IN DB $this->chat->chat_room->appendMessageToDb($this->getMessage()); return ">".$this->__getFormattedChatroom().$this->getMessage()."<br />"; case 'login': return "!".$this->__formatLogin($this->chat->chat_user->getLogin()).$_SERVER["REMOTE_ADDR"]; case "logout": return "-".$this->__formatLogin($this->chat->chat_user->getLogin()); case "kick": return "GET /moderate?".$this->chat->server_conf->getModeratorPassword(). "&kick&".$this->__formatLogin($this->getKickedUser()). "&".$this->__getFormattedChatroom(); case "delete": return "GET /moderate?".$this->chat->server_conf->getModeratorPassword(). "&delete&".$this->__getFormattedChatroom(); case "test": return "GET /Version"; default: return "GET /Version"; } }
ilChatServerCommunicator::__getFormattedChatroom | ( | ) |
Definition at line 138 of file class.ilChatServerCommunicator.php.
Referenced by __formatMessage(), and getServerFrameSource().
{ $nic = $this->chat->server_conf->getNic(); return $nic.$this->chat->chat_room->getInternalName(). substr("______________",0,14-strlen($this->chat->chat_room->getInternalName())); }
ilChatServerCommunicator::__openSocket | ( | ) |
Definition at line 191 of file class.ilChatServerCommunicator.php.
Referenced by send().
{ $this->socket_p = @fsockopen($this->chat->server_conf->getInternalIp(), $this->chat->server_conf->getPort(), $errno, $errstr, TIMEOUT); return $this->socket_p == null ? false : true; }
ilChatServerCommunicator::_initObject | ( | ) |
Definition at line 199 of file class.ilChatServerCommunicator.php.
References $ilias, $query, $ref_id, $res, $row, ilObjectFactory::getInstanceByRefId(), and ilChatServerCommunicator().
Referenced by _login(), and _logout().
{ global $ilias; $query = "SELECT ref_id FROM object_data NATURAL JOIN object_reference ". "WHERE type = 'chac'"; $res = $ilias->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $ref_id = $row->ref_id; } // GET INSTANCE return new ilChatServerCommunicator(ilObjectFactory::getInstanceByRefId($ref_id)); }
ilChatServerCommunicator::_login | ( | ) |
Definition at line 216 of file class.ilChatServerCommunicator.php.
References $_SESSION, $obj, and _initObject().
{ $obj =& ilChatServerCommunicator::_initObject(); // CALLED BY login.php $obj->setType("login"); $obj->chat->chat_user->setUserId($_SESSION["AccountId"]); $obj->send(); }
ilChatServerCommunicator::_logout | ( | ) |
Definition at line 226 of file class.ilChatServerCommunicator.php.
References $_SESSION, $obj, and _initObject().
{ $obj =& ilChatServerCommunicator::_initObject(); // CALLED BY login.php $obj->setType("logout"); $obj->chat->chat_user->setUserId($_SESSION["AccountId"]); $obj->send(); }
ilChatServerCommunicator::getHtml | ( | ) |
Definition at line 104 of file class.ilChatServerCommunicator.php.
{
return $this->html;
}
ilChatServerCommunicator::getKickedUser | ( | ) |
Definition at line 84 of file class.ilChatServerCommunicator.php.
Referenced by __formatMessage().
{
return $this->kicked_user;
}
ilChatServerCommunicator::getMessage | ( | ) |
Definition at line 92 of file class.ilChatServerCommunicator.php.
Referenced by __formatMessage().
{
return $this->message;
}
ilChatServerCommunicator::getRecipientId | ( | ) |
Definition at line 68 of file class.ilChatServerCommunicator.php.
{
return $this->rcp_id;
}
ilChatServerCommunicator::getRecipientLogin | ( | ) |
Definition at line 76 of file class.ilChatServerCommunicator.php.
Referenced by __formatMessage().
{
return $this->rcp_login;
}
ilChatServerCommunicator::getServerFrameSource | ( | ) |
Definition at line 121 of file class.ilChatServerCommunicator.php.
References __formatLogin(), and __getFormattedChatroom().
{ return sprintf("http://%s:%s/%s%s", $this->chat->server_conf->getExternalIp(), $this->chat->server_conf->getPort(), $this->__formatLogin($this->chat->chat_user->getLogin()), $this->__getFormattedChatroom()); }
ilChatServerCommunicator::getType | ( | ) |
Definition at line 100 of file class.ilChatServerCommunicator.php.
Referenced by __formatMessage().
{ return $this->type ? $this->type : 'normal'; }
ilChatServerCommunicator::ilChatServerCommunicator | ( | &$ | chat_obj | ) |
Constructor public.
integer | reference_id or object_id | |
boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 49 of file class.ilChatServerCommunicator.php.
Referenced by _initObject().
{ define(TIMEOUT,2); $this->chat =& $chat_obj; }
ilChatServerCommunicator::isAlive | ( | ) |
ilChatServerCommunicator::send | ( | ) |
Definition at line 109 of file class.ilChatServerCommunicator.php.
References __formatMessage(), and __openSocket().
Referenced by isAlive().
{ if(!$this->__openSocket()) { return false; } fputs($this->socket_p,$this->__formatMessage()); fclose($this->socket_p); return true; }
ilChatServerCommunicator::setKickedUser | ( | $ | k_user | ) |
Definition at line 80 of file class.ilChatServerCommunicator.php.
{ $this->kicked_user = $k_user; }
ilChatServerCommunicator::setMessage | ( | $ | a_message | ) |
Definition at line 88 of file class.ilChatServerCommunicator.php.
{ $this->message = $a_message; }
ilChatServerCommunicator::setRecipientId | ( | $ | a_id | ) |
Definition at line 57 of file class.ilChatServerCommunicator.php.
References $tmp_user, and setRecipientLogin().
{ $this->rcp_id = $a_id; if($this->rcp_id) { $tmp_user =& new ilObjUser($this->rcp_id); $this->setRecipientLogin($tmp_user->getLogin()); unset($tmp_user); } }
ilChatServerCommunicator::setRecipientLogin | ( | $ | a_login | ) |
Definition at line 72 of file class.ilChatServerCommunicator.php.
Referenced by setRecipientId().
{ $this->rcp_login = $a_login; }
ilChatServerCommunicator::setType | ( | $ | a_type | ) |
Definition at line 96 of file class.ilChatServerCommunicator.php.
Referenced by isAlive().
{ $this->type = $a_type; }
ilChatServerCommunicator::$chat |
Definition at line 35 of file class.ilChatServerCommunicator.php.
ilChatServerCommunicator::$kicked_user |
Definition at line 42 of file class.ilChatServerCommunicator.php.
ilChatServerCommunicator::$message |
Definition at line 37 of file class.ilChatServerCommunicator.php.
ilChatServerCommunicator::$rcp_id |
Definition at line 40 of file class.ilChatServerCommunicator.php.
ilChatServerCommunicator::$rcp_login |
Definition at line 41 of file class.ilChatServerCommunicator.php.
ilChatServerCommunicator::$socket_p |
Definition at line 38 of file class.ilChatServerCommunicator.php.
ilChatServerCommunicator::$type |
Definition at line 39 of file class.ilChatServerCommunicator.php.