diff --git a/file/acp/be.bastelstu.chat.update.php b/file/acp/be.bastelstu.chat.update.php index ced5b0e..a55cbf0 100644 --- a/file/acp/be.bastelstu.chat.update.php +++ b/file/acp/be.bastelstu.chat.update.php @@ -26,7 +26,7 @@ final class Update { private $styles = null; public function __construct() { - $this->rooms = \wcf\data\chat\room\ChatRoom::getCache(); + $this->rooms = \chat\data\room\Room::getCache(); $this->styles = \wcf\system\style\StyleHandler::getInstance()->getAvailableStyles(); } @@ -36,11 +36,11 @@ public function __construct() { */ public function execute() { foreach ($this->rooms as $room) { - $messageAction = new \wcf\data\chat\message\ChatMessageAction(array(), 'create', array( + $messageAction = new \chat\data\message\MessageAction(array(), 'create', array( 'data' => array( 'roomID' => $room->roomID, 'time' => TIME_NOW, - 'type' => \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION, + 'type' => \chat\data\message\Message::TYPE_INFORMATION, 'message' => \wcf\system\WCF::getLanguage()->get('wcf.chat.information.chatUpdate') ) )); diff --git a/file/lib/data/message/Message.class.php b/file/lib/data/message/Message.class.php index d70fbfa..e6d45b4 100644 --- a/file/lib/data/message/Message.class.php +++ b/file/lib/data/message/Message.class.php @@ -1,8 +1,8 @@ user, $this->room, suspension\ChatSuspension::TYPE_BAN)) { + if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\Suspension::TYPE_BAN)) { if ($suspension->time > TIME_NOW + $this->time) { $this->fail = true; return; } - $editor = new suspension\ChatSuspensionEditor($suspension); + $editor = new suspension\SuspensionEditor($suspension); $editor->delete(); } - $this->suspensionAction = new suspension\ChatSuspensionAction(array(), 'create', array( + $this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array( 'data' => array( 'userID' => $this->user->userID, 'roomID' => ChatUtil::readUserData('roomID'), - 'type' => suspension\ChatSuspension::TYPE_BAN, + 'type' => suspension\Suspension::TYPE_BAN, 'time' => TIME_NOW + $this->time ) )); diff --git a/file/lib/system/command/commands/ColorCommand.class.php b/file/lib/system/command/commands/ColorCommand.class.php index 8fb8359..bec0839 100644 --- a/file/lib/system/command/commands/ColorCommand.class.php +++ b/file/lib/system/command/commands/ColorCommand.class.php @@ -64,7 +64,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_INFORMATION; } /** diff --git a/file/lib/system/command/commands/InfoCommand.class.php b/file/lib/system/command/commands/InfoCommand.class.php index c1e0066..4f01ce0 100644 --- a/file/lib/system/command/commands/InfoCommand.class.php +++ b/file/lib/system/command/commands/InfoCommand.class.php @@ -1,8 +1,8 @@ user)); + $room = new \chat\data\room\Room(ChatUtil::readUserData('roomID', $this->user)); if ($room->roomID && $room->canEnter()) { $this->lines[WCF::getLanguage()->get('wcf.chat.room')] = $room->getTitle(); } - // IP-Address - $session = $this->fetchSession(); - if ($session) { - // TODO: Check permission - $this->lines[WCF::getLanguage()->get('wcf.user.ipAddress')] = $session->ipAddress; + // ip address + if (WCF::getSession()->getPermission('admin.user.canViewIpAddress')) { + $session = $this->fetchSession(); + if ($session) { + $this->lines[WCF::getLanguage()->get('wcf.user.ipAddress')] = $session->ipAddress; + } } $this->didInit(); @@ -78,7 +79,7 @@ public function fetchSession() { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_INFORMATION; } /** diff --git a/file/lib/system/command/commands/MeCommand.class.php b/file/lib/system/command/commands/MeCommand.class.php index bfab7cb..68fe91d 100644 --- a/file/lib/system/command/commands/MeCommand.class.php +++ b/file/lib/system/command/commands/MeCommand.class.php @@ -24,7 +24,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_ME; + return \chat\data\message\Message::TYPE_ME; } /** diff --git a/file/lib/system/command/commands/MuteCommand.class.php b/file/lib/system/command/commands/MuteCommand.class.php index 65c301f..2c767f5 100644 --- a/file/lib/system/command/commands/MuteCommand.class.php +++ b/file/lib/system/command/commands/MuteCommand.class.php @@ -1,9 +1,9 @@ user, $this->room, suspension\ChatSuspension::TYPE_MUTE)) { + if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\Suspension::TYPE_MUTE)) { if ($suspension->time > TIME_NOW + $this->time) { $this->fail = true; return; } - $editor = new suspension\ChatSuspensionEditor($suspension); + $editor = new suspension\SuspensionEditor($suspension); $editor->delete(); } - $this->suspensionAction = new suspension\ChatSuspensionAction(array(), 'create', array( + $this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array( 'data' => array( 'userID' => $this->user->userID, 'roomID' => ChatUtil::readUserData('roomID'), - 'type' => suspension\ChatSuspension::TYPE_MUTE, + 'type' => suspension\Suspension::TYPE_MUTE, 'time' => TIME_NOW + $this->time ) )); @@ -77,7 +77,7 @@ public function checkPermission() { parent::checkPermission(); $this->room = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->request->room; - $ph = new \wcf\system\chat\permission\ChatPermissionHandler(); + $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(); } @@ -94,8 +94,8 @@ public function getReceiver() { * @see \chat\system\command\ICommand::getType() */ public function getType() { - if ($this->fail) return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; - return \wcf\data\chat\message\ChatMessage::TYPE_MODERATE; + if ($this->fail) return \chat\data\message\Message::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_MODERATE; } /** diff --git a/file/lib/system/command/commands/PlainCommand.class.php b/file/lib/system/command/commands/PlainCommand.class.php index bda4ed3..4c037c5 100644 --- a/file/lib/system/command/commands/PlainCommand.class.php +++ b/file/lib/system/command/commands/PlainCommand.class.php @@ -17,7 +17,7 @@ class PlainCommand extends \chat\system\command\AbstractCommand { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_NORMAL; + return \chat\data\message\Message::TYPE_NORMAL; } /** diff --git a/file/lib/system/command/commands/RestoreCommand.class.php b/file/lib/system/command/commands/RestoreCommand.class.php index b9a9246..f49f061 100644 --- a/file/lib/system/command/commands/RestoreCommand.class.php +++ b/file/lib/system/command/commands/RestoreCommand.class.php @@ -42,7 +42,7 @@ public function checkPermission() { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_MODERATE; + return \chat\data\message\Message::TYPE_MODERATE; } /** diff --git a/file/lib/system/command/commands/TemproomCommand.class.php b/file/lib/system/command/commands/TemproomCommand.class.php index 4b8e192..8fd8eb8 100644 --- a/file/lib/system/command/commands/TemproomCommand.class.php +++ b/file/lib/system/command/commands/TemproomCommand.class.php @@ -19,7 +19,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) parent::__construct($commandHandler); // create room - $this->objectAction = new \wcf\data\chat\room\ChatRoomAction(array(), 'create', array('data' => array( + $this->objectAction = new \chat\data\room\RoomAction(array(), 'create', array('data' => array( 'title' => 'Temproom', 'topic' => '', 'permanent' => 0, @@ -27,7 +27,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) ))); $this->objectAction->executeAction(); $returnValues = $this->objectAction->getReturnValues(); - $chatRoomEditor = new \wcf\data\chat\room\ChatRoomEditor($returnValues['returnValues']); + $chatRoomEditor = new \chat\data\room\RoomEditor($returnValues['returnValues']); $roomID = $returnValues['returnValues']->roomID; $this->roomName = WCF::getLanguage()->getDynamicVariable('wcf.chat.room.titleTemp', array('roomID' => $roomID)); @@ -50,7 +50,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) ); \wcf\system\acl\ACLHandler::getInstance()->save($roomID, \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room')); - \wcf\system\chat\permission\ChatPermissionHandler::clearCache(); + \chat\system\permission\PermissionHandler::clearCache(); $this->didInit(); } @@ -67,7 +67,7 @@ public function checkPermission() { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_INFORMATION; } /** diff --git a/file/lib/system/command/commands/WhereCommand.class.php b/file/lib/system/command/commands/WhereCommand.class.php index de3fc4a..dcf4792 100644 --- a/file/lib/system/command/commands/WhereCommand.class.php +++ b/file/lib/system/command/commands/WhereCommand.class.php @@ -18,14 +18,14 @@ class WhereCommand extends \chat\system\command\AbstractCommand { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_INFORMATION; } /** * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { - $rooms = \wcf\data\chat\room\ChatRoom::getCache(); + $rooms = \chat\data\room\Room::getCache(); foreach ($rooms as $room) { $users = $room->getUsers(); diff --git a/file/lib/system/command/commands/WhisperCommand.class.php b/file/lib/system/command/commands/WhisperCommand.class.php index 07120b3..f635104 100644 --- a/file/lib/system/command/commands/WhisperCommand.class.php +++ b/file/lib/system/command/commands/WhisperCommand.class.php @@ -36,7 +36,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_WHISPER; + return \chat\data\message\Message::TYPE_WHISPER; } /**