1
0
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:
Tim Düsterhus 2011-12-27 14:34:42 +01:00
parent 6046e40cc2
commit fd6739bd2d
3 changed files with 10 additions and 0 deletions

View File

@ -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,

View File

@ -19,4 +19,8 @@ public function __construct(CommandHandler $commandHandler) {
$this->commandHandler = $commandHandler;
EventHandler::getInstance()->fireAction($this, 'didInit');
}
public function getReceiver() {
return null;
}
}

View File

@ -17,4 +17,5 @@ interface ICommand {
public function getType();
public function getMessage();
public function getReceiver();
}