mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Fix away reset
This commit is contained in:
parent
5bca9885d5
commit
805d7a3a11
@ -43,7 +43,7 @@ public function prune() {
|
|||||||
/**
|
/**
|
||||||
* Validates message sending.
|
* Validates message sending.
|
||||||
*/
|
*/
|
||||||
public function validateSend() {
|
public function validateSend() {
|
||||||
// read parameters
|
// read parameters
|
||||||
$this->readString('text');
|
$this->readString('text');
|
||||||
$this->readBoolean('enableSmilies');
|
$this->readBoolean('enableSmilies');
|
||||||
@ -79,6 +79,25 @@ public function validateSend() {
|
|||||||
|
|
||||||
if (!$this->parameters['room']->canEnter() || !$this->parameters['room']->canWrite()) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$this->parameters['room']->canEnter() || !$this->parameters['room']->canWrite()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
|
|
||||||
|
\chat\util\ChatUtil::writeUserData(array('away' => null));
|
||||||
|
|
||||||
|
// mark user as back
|
||||||
|
if ($this->parameters['userData']['away'] !== null) {
|
||||||
|
$messageAction = new MessageAction(array(), 'create', array(
|
||||||
|
'data' => array(
|
||||||
|
'roomID' => $this->parameters['room']->roomID,
|
||||||
|
'sender' => WCF::getUser()->userID,
|
||||||
|
'username' => WCF::getUser()->username,
|
||||||
|
'time' => TIME_NOW,
|
||||||
|
'type' => Message::TYPE_BACK,
|
||||||
|
'message' => '',
|
||||||
|
'color1' => $this->parameters['userData']['color'][1],
|
||||||
|
'color2' => $this->parameters['userData']['color'][2]
|
||||||
|
)
|
||||||
|
));
|
||||||
|
$messageAction->executeAction();
|
||||||
|
}
|
||||||
|
|
||||||
// handle commands
|
// handle commands
|
||||||
$commandHandler = new \chat\system\command\CommandHandler($this->parameters['text'], $this->parameters['room']);
|
$commandHandler = new \chat\system\command\CommandHandler($this->parameters['text'], $this->parameters['room']);
|
||||||
if ($commandHandler->isCommand()) {
|
if ($commandHandler->isCommand()) {
|
||||||
@ -103,33 +122,12 @@ public function validateSend() {
|
|||||||
$this->parameters['type'] = Message::TYPE_NORMAL;
|
$this->parameters['type'] = Message::TYPE_NORMAL;
|
||||||
$this->parameters['receiver'] = null;
|
$this->parameters['receiver'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->parameters['text'] = PreParser::getInstance()->parse($this->parameters['text'], explode(',', WCF::getSession()->getPermission('user.chat.allowedBBCodes')));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates sent message.
|
* Creates sent message.
|
||||||
*/
|
*/
|
||||||
public function send() {
|
public function send() {
|
||||||
\chat\util\ChatUtil::writeUserData(array('away' => null));
|
|
||||||
|
|
||||||
// mark user as back
|
|
||||||
if ($this->parameters['userData']['away'] !== null) {
|
|
||||||
$messageAction = new MessageAction(array(), 'create', array(
|
|
||||||
'data' => array(
|
|
||||||
'roomID' => $this->parameters['room']->roomID,
|
|
||||||
'sender' => WCF::getUser()->userID,
|
|
||||||
'username' => WCF::getUser()->username,
|
|
||||||
'time' => TIME_NOW,
|
|
||||||
'type' => Message::TYPE_BACK,
|
|
||||||
'message' => '',
|
|
||||||
'color1' => $this->userData['color'][1],
|
|
||||||
'color2' => $this->userData['color'][2]
|
|
||||||
)
|
|
||||||
));
|
|
||||||
$messageAction->executeAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->objectAction = new MessageAction(array(), 'create', array(
|
$this->objectAction = new MessageAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'roomID' => $this->parameters['room']->roomID,
|
'roomID' => $this->parameters['room']->roomID,
|
||||||
|
Loading…
Reference in New Issue
Block a user