mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-21 21:30: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.
|
||||
*/
|
||||
public function validateSend() {
|
||||
public function validateSend() {
|
||||
// read parameters
|
||||
$this->readString('text');
|
||||
$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();
|
||||
|
||||
\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
|
||||
$commandHandler = new \chat\system\command\CommandHandler($this->parameters['text'], $this->parameters['room']);
|
||||
if ($commandHandler->isCommand()) {
|
||||
@ -103,33 +122,12 @@ public function validateSend() {
|
||||
$this->parameters['type'] = Message::TYPE_NORMAL;
|
||||
$this->parameters['receiver'] = null;
|
||||
}
|
||||
|
||||
$this->parameters['text'] = PreParser::getInstance()->parse($this->parameters['text'], explode(',', WCF::getSession()->getPermission('user.chat.allowedBBCodes')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates sent message.
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
public function send() {
|
||||
$this->objectAction = new MessageAction(array(), 'create', array(
|
||||
'data' => array(
|
||||
'roomID' => $this->parameters['room']->roomID,
|
||||
|
Loading…
Reference in New Issue
Block a user