getMessageType()->objectType !== 'be.bastelstu.chat.messageType.attachment') { throw new \LogicException('Unreachable'); } $room = $message->getRoom(); return $room->canSee(); } return false; } /** * @inheritDoc */ public function canUpload($objectID, $parentObjectID = 0) { if ($objectID) { return false; } if (!WCF::getSession()->getPermission('user.chat.canAttach')) { return false; } $room = null; if ($parentObjectID) { $room = RoomCache::getInstance()->getRoom($parentObjectID); } if ($room !== null) { return $room->canSee(); } return false; } /** * @inheritDoc */ public function canDelete($objectID) { return false; } /** * @inheritDoc */ public function getMaxCount() { return 1; } /** * @inheritDoc */ public function getMaxSize() { return WCF::getSession()->getPermission('user.chat.attachment.maxSize'); } /** * @inheritDoc */ public function getAllowedExtensions() { return \wcf\util\ArrayUtil::trim(\explode("\n", WCF::getSession()->getPermission('user.chat.attachment.allowedExtensions'))); } /** * @inheritDoc */ public function cacheObjects(array $objectIDs) { $messageList = new MessageList(); $messageList->setObjectIDs($objectIDs); $messageList->readObjects(); foreach ($messageList->getObjects() as $objectID => $object) { $this->cachedObjects[$objectID] = $object; } } }