ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilChatServerCommunicator Class Reference

Class ilChatServerCommunicator. More...

+ Collaboration diagram for ilChatServerCommunicator:

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 ()
 __emoticons ()
 __openSocket ()
 _initObject ()
 _login ()
 _logout ()

Data Fields

 $chat
 $message
 $socket_p
 $type
 $rcp_id
 $rcp_login
 $kicked_user

Detailed Description

Class ilChatServerCommunicator.

Author
Stefan Meyer
Version
Id:
class.ilChatServerCommunicator.php 15697 2008-01-08 20:04:33Z hschottm

Definition at line 32 of file class.ilChatServerCommunicator.php.

Member Function Documentation

ilChatServerCommunicator::__emoticons ( )

Definition at line 199 of file class.ilChatServerCommunicator.php.

References getMessage(), and setMessage().

Referenced by __formatMessage().

{
$str = $this->getMessage();
$str = str_replace(":)", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_smile.gif\" border=0>", $str);
$str = str_replace(":-)", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_smile.gif\" border=0>", $str);
$str = str_replace(":smile:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_smile.gif\" border=0>", $str);
$str = str_replace(";)", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_wink.gif\" border=0>", $str);
$str = str_replace(";-)", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_wink.gif\" border=0>", $str);
$str = str_replace(":wink:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_wink.gif\" border=0>", $str);
$str = str_replace(":D", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_laugh.gif\" border=0>", $str);
$str = str_replace(":-D", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_laugh.gif\" border=0>", $str);
$str = str_replace(":laugh:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_laugh.gif\" border=0>", $str);
$str = str_replace(":grin:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_laugh.gif\" border=0>", $str);
$str = str_replace(":biggrin:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_laugh.gif\" border=0>", $str);
$str = str_replace(":(", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_sad.gif\" border=0>", $str);
$str = str_replace(":-(", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_sad.gif\" border=0>", $str);
$str = str_replace(":sad:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_sad.gif\" border=0>", $str);
$str = str_replace(":o", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_shocked.gif\" border=0>", $str);
$str = str_replace(":-o", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_shocked.gif\" border=0>", $str);
$str = str_replace(":shocked:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_smile.gif\" border=0>", $str);
$str = str_replace(":p", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_tongue.gif\" border=0>", $str);
$str = str_replace(":-p", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_tongue.gif\" border=0>", $str);
$str = str_replace(":tongue:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_smile.gif\" border=0>", $str);
$str = str_replace(":cool:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_cool.gif\" border=0>", $str);
$str = str_replace(":eek:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_eek.gif\" border=0>", $str);
$str = str_replace(":||", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_angry.gif\" border=0>", $str);
$str = str_replace(":-||", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_angry.gif\" border=0>", $str);
$str = str_replace(":angry:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_angry.gif\" border=0>", $str);
$str = str_replace(":flush:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_flush.gif\" border=0>", $str);
$str = str_replace(":idea:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_idea.gif\" border=0>", $str);
$str = str_replace(":thumbup:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_thumbup.gif\" border=0>", $str);
$str = str_replace(":thumbdown:", "<img src=\"" . ILIAS_HTTP_PATH .
"/templates/default/images/emoticons/icon_thumbdown.gif\" border=0>", $str);
$this->setMessage($str);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatServerCommunicator::__formatLogin (   $a_login)

Definition at line 143 of file class.ilChatServerCommunicator.php.

Referenced by __formatMessage(), and getServerFrameSource().

{
$nic = $this->chat->server_conf->getNic();
return substr($nic.md5($a_login),0,32);
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::__formatMessage ( )

Definition at line 149 of file class.ilChatServerCommunicator.php.

References __emoticons(), __formatLogin(), __getFormattedChatroom(), getKickedUser(), getMessage(), getRecipientLogin(), and getType().

Referenced by send().

{
$this->__emoticons();
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 'address':
// STORE MESSAGE IN DB
$this->chat->chat_room->appendMessageToDb($this->getMessage());
return ">".$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 "empty":
return "GET /moderate?".$this->chat->server_conf->getModeratorPassword().
"&clear&".$this->__getFormattedChatroom();
case "test":
return "GET /Version";
default:
return "GET /Version";
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatServerCommunicator::__getFormattedChatroom ( )

Definition at line 136 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()));
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::__openSocket ( )

Definition at line 263 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;
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::_initObject ( )

Definition at line 272 of file class.ilChatServerCommunicator.php.

References $ref_id, $res, DB_FETCHMODE_OBJECT, 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
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatServerCommunicator::_login ( )

Definition at line 289 of file class.ilChatServerCommunicator.php.

References $_SESSION, and _initObject().

Referenced by ilStartUpGUI\showLogin().

{
// CALLED BY login.php
$obj->setType("login");
$obj->chat->chat_user->setUserId($_SESSION["AccountId"]);
$obj->send();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatServerCommunicator::_logout ( )

Definition at line 299 of file class.ilChatServerCommunicator.php.

References $_SESSION, and _initObject().

Referenced by ilStartUpGUI\showLogout().

{
// CALLED BY login.php
$obj->setType("logout");
$obj->chat->chat_user->setUserId($_SESSION["AccountId"]);
$obj->send();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatServerCommunicator::getHtml ( )

Definition at line 103 of file class.ilChatServerCommunicator.php.

{
return $this->html;
}
ilChatServerCommunicator::getKickedUser ( )

Definition at line 83 of file class.ilChatServerCommunicator.php.

References $kicked_user.

Referenced by __formatMessage().

{
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::getMessage ( )

Definition at line 91 of file class.ilChatServerCommunicator.php.

References $message.

Referenced by __emoticons(), and __formatMessage().

{
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::getRecipientId ( )

Definition at line 67 of file class.ilChatServerCommunicator.php.

References $rcp_id.

{
return $this->rcp_id;
}
ilChatServerCommunicator::getRecipientLogin ( )

Definition at line 75 of file class.ilChatServerCommunicator.php.

References $rcp_login.

Referenced by __formatMessage().

{
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::getServerFrameSource ( )

Definition at line 120 of file class.ilChatServerCommunicator.php.

References __formatLogin(), and __getFormattedChatroom().

{
return sprintf("http".($this->chat->server_conf->getSSLStatus() && $this->chat->server_conf->getSSLPort() ? "s" : "")."://%s:%s/%s%s",
$this->chat->server_conf->getExternalIp(),
($this->chat->server_conf->getSSLStatus() && $this->chat->server_conf->getSSLPort() ? $this->chat->server_conf->getSSLPort() : $this->chat->server_conf->getPort()),
$this->__formatLogin($this->chat->chat_user->getLogin()),
}

+ Here is the call graph for this function:

ilChatServerCommunicator::getType ( )

Definition at line 99 of file class.ilChatServerCommunicator.php.

Referenced by __formatMessage().

{
return $this->type ? $this->type : 'normal';
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::ilChatServerCommunicator ( $chat_obj)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 48 of file class.ilChatServerCommunicator.php.

Referenced by _initObject().

{
define(TIMEOUT,2);
$this->chat =& $chat_obj;
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::isAlive ( )

Definition at line 129 of file class.ilChatServerCommunicator.php.

References send(), and setType().

{
$this->setType("test");
return $this->send();
}

+ Here is the call graph for this function:

ilChatServerCommunicator::send ( )

Definition at line 108 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;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatServerCommunicator::setKickedUser (   $k_user)

Definition at line 79 of file class.ilChatServerCommunicator.php.

{
$this->kicked_user = $k_user;
}
ilChatServerCommunicator::setMessage (   $a_message)

Definition at line 87 of file class.ilChatServerCommunicator.php.

Referenced by __emoticons().

{
$this->message = $a_message;
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::setRecipientId (   $a_id)

Definition at line 56 of file class.ilChatServerCommunicator.php.

References 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);
}
}

+ Here is the call graph for this function:

ilChatServerCommunicator::setRecipientLogin (   $a_login)

Definition at line 71 of file class.ilChatServerCommunicator.php.

Referenced by setRecipientId().

{
$this->rcp_login = $a_login;
}

+ Here is the caller graph for this function:

ilChatServerCommunicator::setType (   $a_type)

Definition at line 95 of file class.ilChatServerCommunicator.php.

Referenced by isAlive().

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

Field Documentation

ilChatServerCommunicator::$chat

Definition at line 34 of file class.ilChatServerCommunicator.php.

ilChatServerCommunicator::$kicked_user

Definition at line 41 of file class.ilChatServerCommunicator.php.

Referenced by getKickedUser().

ilChatServerCommunicator::$message

Definition at line 36 of file class.ilChatServerCommunicator.php.

Referenced by getMessage().

ilChatServerCommunicator::$rcp_id

Definition at line 39 of file class.ilChatServerCommunicator.php.

Referenced by getRecipientId().

ilChatServerCommunicator::$rcp_login

Definition at line 40 of file class.ilChatServerCommunicator.php.

Referenced by getRecipientLogin().

ilChatServerCommunicator::$socket_p

Definition at line 37 of file class.ilChatServerCommunicator.php.

ilChatServerCommunicator::$type

Definition at line 38 of file class.ilChatServerCommunicator.php.


The documentation for this class was generated from the following file: