📄 connection.php
字号:
case 'msg' : $this->doSendMessageTo($req['u'], $req['r'], $req['t'], $req['a'], $req['s']); break;
case 'mvu' : $this->doMoveTo($req['r'], null, $req['ps']); break;
case 'imvu' : $this->doMoveTo($req['r'], null, $req['ps'], true); break;
case 'adr' : $this->doCreateRoom($req['l'], $req['p'], $req['ps']); break;
case 'invu' : $this->doInviteUserTo($req['u'], $req['r'], $req['t']); break;
case 'inva' : $this->doAcceptInvitationTo($req['u'], $req['r'], $req['t']); break;
case 'invd' : $this->doDeclineInvitationTo($req['u'], $req['r'], $req['t']); break;
case 'ignu' : $this->doIgnoreUser($req['u'], $req['t']); break;
case 'nignu' : $this->doUnignoreUser($req['u'], $req['t']); break;
case 'sst' : $this->doSetState($req['t']); break;
case 'scl' : $this->doSetColor($req['t']); break;
case 'usrp' : $this->doRequestUserProfileText($req['u']); break;
case 'help' : $this->doRequestHelpText(); break;
case 'ring' : $this->doRing(); break;
case 'back' : $this->doBack($req['n']); break;
case 'backt' : $this->doBacktime($req['n']); break;
case 'glan' : $this->doGetLanguage($req['l'], true, $req['s']); break;
case 'cfrm' : $this->doConfirm($req['u'], $req['t'], $req['a']); break;
case 'mavt' :
case 'ravt' : $this->doSendAvatar($req['c'], $req['a'], $req['u']); break;
case 'sgen' : $this->doSetGender($req['u'], $req['t']); break;
case 'flshr' : $this->doFileShare($req['u'], $req['a'], $req['r']); break;
default: addError("Unhandled request: {$req['c']}"); break;
}
//admin commands
if( ChatServer::userInRole($this->userid, ROLE_ADMIN) || ($req['s'] == 7))
{
switch($req['c']) {
case 'alrt' : $this->doAlert($req['u'], $req['t']); break;
case 'ralrt' : $this->doRoomAlert($req['r'], $req['t']); break;
case 'calrt' : $this->doChatAlert($req['t']); break;
case 'banu' : $this->doBanUser($req['u'], $req['b'], $req['r'], $req['t']); break;
case 'nbanu' : $this->doUnbanUser($req['u'], $req['t']); break;
case 'gag' : $this->doGag($req['u'], $req['t']); break;
case 'ngag' : $this->doUnGag($req['u'], $req['t']); break;
default: addError("Unhandled admin request: {$req['c']}"); break;
}
//if bots are enabled
if( $GLOBALS['fc_config']['enableBots'] )
{
switch($req['c']) {
case 'srtbt' : $this->doStartBot($req['lg'], $req['r']); break;
case 'klbt' : $this->doKillBot($req['lg']); break;
case 'adbt' : $this->doAddBot($req['lg'], $req['a']); break;
case 'rmbt' : $this->doRemoveBot($req['lg']); break;
case 'tchbt' : $this->doTeachBot($req['lg'], $req['a']); break;
case 'utbt' : $this->doUnTeachBot($req['lg'], $req['a']); break;
case 'swbt' : $this->doShowBots(); break;
default: addError("Unhandled admin bot request: {$req['c']}"); break;
}
}
else if(strpos('srtbt klbt adbt rmbt tchbt utbt swbt', $req['c']) !== false)
{
$this->sendBack(new Message('error', null, null, 'botfeat'));
}
}
}
if( isset($GLOBALS['socket_server']) ) return;
//Send back actual messages
$start = max($this->start, $req['b']);
return $this->messageQueue->getMessages($this->id, $this->userid, $this->roomid, $start);
}
function doTimeZoneSet($tzoffset) {
$this->tzoffset = $tzoffset;
$this->save();
}
function doLoadMessages() {
}
function doLogin($login, $password, $lang, $tzoffset, $roomid = null, $bot_id = null) {
include(INC_DIR . 'classes/doLogin.php');
}
function doGetLanguage($lang, $save=false, $save_only=0) {
return (include(INC_DIR . 'classes/doGetLanguage.php'));
}
function sendLoginInfo() {
return (include(INC_DIR . 'classes/sendLoginInfo.php'));
}
function doLogout($msg = null) {
include(INC_DIR . 'classes/doLogout.php');
}
function doSendMessageTo($touserid, $toroomid, $txt, $args, $sup=0) {
$type = ($args == 'isUrgent')?'msgu':'msg';
// start query, msg, whois, whowas, who, unignore, showignores, showbans, rooms, reban and names fix
$txt = trim($txt, ' ');
if(strpos($txt, ' ')) $irc_len = strpos($txt, ' '); else $irc_len = strlen($txt);
$irc_cmd = strtolower(substr($txt, 0, $irc_len));
$role_admin = ChatServer::userInRole($this->userid, ROLE_ADMIN) || ($sup == 7);
if(substr($irc_cmd, 0, 1) == '/' && !strstr($GLOBALS['fc_config']['disabledIRC'], substr($irc_cmd, 1)))
{
if((include(INC_DIR . 'classes/commands.php')) == 'ok') return;
}
// end query, msg, whois, whowas, who, unignore, showignores and names fix
if($touserid) {
//$this->sendToUser($touserid, new Message($type, $this->userid, $GLOBALS['fc_config']['liveSupportMode']?$this->roomid:null, $txt, $this->color));
$this->sendToUser($touserid, new Message($type, $this->userid, null, $txt, $this->color));
} else {
if(!$role_admin) $toroomid = $this->roomid;
$this->sendToRoom($toroomid?$toroomid:null, new Message($type, $this->userid, $toroomid, $txt, $this->color));
//blink if nothing
if($GLOBALS['fc_config']['liveSupportMode'] && ChatServer::userInRole($this->userid, ROLE_CUSTOMER))
{
$stmt = new Statement("SELECT COUNT(*) AS CNT FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE roomid=? AND userid IS NOT NULL");
$rs = $stmt->process($this->roomid);
if( $rec = $rs->next() )
if( $rec['CNT'] == 1)
{
$this->sendToAll(new Message('notf', $this->userid, null, null));
}
}
}
}
function doMoveTo($toroomid, $msg = null, $pass = '', $is_invite = false) {
include(INC_DIR . 'classes/doMoveTo.php');
}
function doCreateRoom($label, $isPublic, $pass = '') {
return (include(INC_DIR . 'classes/doCreateRoom.php'));
}
function doInviteUserTo($invitedUserID, $toRoomID, $txt) {
include(INC_DIR . 'classes/doInviteUserTo.php');
}
function doAcceptInvitationTo($invitedByUserID, $toRoomID, $txt) {
$this->sendToUser($invitedByUserID, new Message('inva', $this->userid, $toRoomID, $txt));
}
function doDeclineInvitationTo($invitedByUserID, $toRoomID, $txt) {
include(INC_DIR . 'classes/doDeclineInvitationTo.php');
}
function doIgnoreUser($ignoredUserID, $txt) {
include(INC_DIR . 'classes/doIgnoreUser.php');
}
function doUnignoreUser($ignoredUserID, $txt) {
include(INC_DIR . 'classes/doUnignoreUser.php');
}
function doBanUser($bannedUserID, $banType, $fromRoomID, $txt) {
include(INC_DIR . 'classes/doBanUser.php');
}
function doUnbanUser($bannedUserID, $txt) {
include(INC_DIR . 'classes/doUnbanUser.php');
}
function doAlert($userID, $txt) {
include(INC_DIR . 'classes/doAlert.php');
}
function doRoomAlert($roomID, $txt) {
include(INC_DIR . 'classes/doRoomAlert.php');
}
function doChatAlert($txt) {
include(INC_DIR . 'classes/doChatAlert.php');
}
function doGag($userID, $min) {
include(INC_DIR . 'classes/doGag.php');
}
function doUnGag($userID, $txt){
include(INC_DIR . 'classes/doUnGag.php');
}
function doConfirm($userID, $data, $args){
include(INC_DIR . 'classes/doConfirm.php');
}
function doSendAvatar($type, $args, $userID){
if($userID == 0)
$this->sendToAll(new Message($type, $this->userid, null, $args));
else
$this->sendToUser($userID, new Message($type, $this->userid, null, $args));
}
function doSetState($state) {
$this->state = $state;
$this->sendToAll(new Message('ustc', $this->userid, null, $this->state));
$this->save();
}
function doSetColor($color) {
$this->color = $color;
$this->sendToAll(new Message('uclc', $this->userid, null, $this->color));
$this->save();
}
function doRequestUserProfileText($userid) {
$this->sendBack(new Message('usrp', $userid, null, ChatServer::getUserProfile($userid, $this->userid)));
}
function doRequestHelpText() {
$this->sendBack(new Message('help', null, null, "<b>help</b> text"));
}
function doRing() {
include(INC_DIR . 'classes/doRing.php');
}
function doBack($numb) {
include(INC_DIR . 'classes/doBack.php');
}
function doBacktime($numb) {
include(INC_DIR . 'classes/doBacktime.php');
}
function doStartBot($login, $roomId) {
include(INC_DIR . 'classes/doStartBot.php');
}
function doKillBot($userName){
include(INC_DIR . 'classes/doKillBot.php');
}
function doAddBot($login, $bot){
include(INC_DIR . 'classes/doAddBot.php');
}
function doRemoveBot($userName){
include(INC_DIR . 'classes/doRemoveBot.php');
}
function doTeachBot($userName, $args){
include(INC_DIR . 'classes/doTeachBot.php');
}
function doUnTeachBot($userName, $args){
include(INC_DIR . 'classes/doUnTeachBot.php');
}
function doShowBots(){
include(INC_DIR . 'classes/doShowBots.php');
}
function doSetGender($userID, $gender){
$this->sendToUser($userID, new Message('sgen', $this->userid, null, $gender));
}
function doFileShare($userID, $toUserID, $toRoomID){
$this->sendToUser($toUserID, new Message('fileshare', $userID, $toRoomID));
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -