mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Commands return the receiver now as well
This commit is contained in:
parent
6046e40cc2
commit
fd6739bd2d
@ -70,18 +70,22 @@ public function save() {
|
||||
if ($command::ENABLE_SMILIES != \wcf\system\chat\commands\ICommand::SMILEY_USER) $this->enableSmilies = $command::ENABLE_SMILIES;
|
||||
$type = $command->getType();
|
||||
$this->message = $command->getMessage();
|
||||
$receiver = $command->getReceiver();
|
||||
}
|
||||
catch (\wcf\system\chat\commands\NotFoundException $e) {
|
||||
$this->message = WCF::getLanguage()->get('wcf.chat.command.error.notFound');
|
||||
$type = chat\message\ChatMessage::TYPE_ERROR;
|
||||
$receiver = WCF::getUser()->userID;
|
||||
}
|
||||
catch (\wcf\system\exception\PermissionDeniedException $e) {
|
||||
$this->message = WCF::getLanguage()->get('wcf.chat.command.error.permissionDenied');
|
||||
$type = chat\message\ChatMessage::TYPE_ERROR;
|
||||
$receiver = WCF::getUser()->userID;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$type = chat\message\ChatMessage::TYPE_NORMAL;
|
||||
$receiver = null;
|
||||
}
|
||||
|
||||
$messageAction = new chat\message\ChatMessageAction(array(), 'create', array(
|
||||
@ -89,6 +93,7 @@ public function save() {
|
||||
'roomID' => $this->room->roomID,
|
||||
'sender' => WCF::getUser()->userID,
|
||||
'username' => WCF::getUser()->username,
|
||||
'receiver' => $receiver,
|
||||
'time' => TIME_NOW,
|
||||
'type' => $type,
|
||||
'message' => $this->message,
|
||||
|
@ -19,4 +19,8 @@ public function __construct(CommandHandler $commandHandler) {
|
||||
$this->commandHandler = $commandHandler;
|
||||
EventHandler::getInstance()->fireAction($this, 'didInit');
|
||||
}
|
||||
|
||||
public function getReceiver() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -17,4 +17,5 @@ interface ICommand {
|
||||
|
||||
public function getType();
|
||||
public function getMessage();
|
||||
public function getReceiver();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user