mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2025-01-09 00:20:08 +00:00
Bugfixes in Command Handling (MuteCommand)
This commit is contained in:
parent
fdb21f3daf
commit
1487fe559d
@ -41,7 +41,7 @@ public function prune() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Validates message sending.
|
||||
*/
|
||||
public function validateSend() {
|
||||
// read parameters
|
||||
@ -77,10 +77,10 @@ public function validateSend() {
|
||||
if (!isset($cache[$this->parameters['userData']['roomID']])) throw new \wcf\system\exception\IllegalLinkException();
|
||||
$this->parameters['room'] = $cache[$this->parameters['userData']['roomID']];
|
||||
|
||||
if (!$this->parameters['room']->canEnter() || !$this->parameters['room']->canWrite()) throw new PermissionDeniedException();
|
||||
if (!$this->parameters['room']->canEnter() || !$this->parameters['room']->canWrite()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||
|
||||
// handle commands
|
||||
$commandHandler = new \chat\system\command\CommandHandler($this->parameters['text']);
|
||||
$commandHandler = new \chat\system\command\CommandHandler($this->parameters['text'], $this->parameters['room']);
|
||||
if ($commandHandler->isCommand()) {
|
||||
try {
|
||||
$command = $commandHandler->loadCommand();
|
||||
@ -105,6 +105,9 @@ public function validateSend() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates sent message.
|
||||
*/
|
||||
public function send() {
|
||||
\chat\util\ChatUtil::writeUserData(array('away' => null));
|
||||
|
||||
|
@ -24,13 +24,21 @@ final class CommandHandler {
|
||||
*/
|
||||
private $text = '';
|
||||
|
||||
/**
|
||||
* current room
|
||||
* @var \chat\data\room\Room
|
||||
*/
|
||||
private $room = null;
|
||||
|
||||
/**
|
||||
* Initialises the CommandHandler
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $text
|
||||
* @param \chat\data\room\Room $room
|
||||
*/
|
||||
public function __construct($text) {
|
||||
public function __construct($text, \chat\data\room\Room $room = null) {
|
||||
$this->text = $text;
|
||||
$this->room = $room;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,6 +59,15 @@ public function getText() {
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current room.
|
||||
*
|
||||
* @return \chat\data\room\Room
|
||||
*/
|
||||
public function getRoom() {
|
||||
return $this->room;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parameter-string.
|
||||
*
|
||||
|
@ -76,7 +76,7 @@ public function executeAction() {
|
||||
public function checkPermission() {
|
||||
parent::checkPermission();
|
||||
|
||||
$this->room = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->request->room;
|
||||
$this->room = $this->commandHandler->getRoom();
|
||||
$ph = new \chat\system\permission\PermissionHandler();
|
||||
if (!$ph->getPermission($this->room, 'mod.can'.str_replace(array('chat\system\command\commands\\', 'Command'), '', get_class($this)))) throw new \wcf\system\exception\PermissionDeniedException();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user