diff --git a/files/lib/system/attachment/MessageAttachmentObjectType.class.php b/files/lib/system/attachment/MessageAttachmentObjectType.class.php
new file mode 100644
index 0000000..b5a9f16
--- /dev/null
+++ b/files/lib/system/attachment/MessageAttachmentObjectType.class.php
@@ -0,0 +1,94 @@
+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 cacheObjects(array $objectIDs) {
+ $messageList = new MessageList();
+ $messageList->setObjectIDs($objectIDs);
+ $messageList->readObjects();
+
+ foreach ($messageList->getObjects() as $objectID => $object) {
+ $this->cachedObjects[$objectID] = $object;
+ }
+ }
+}
diff --git a/files/lib/system/message/type/AttachmentMessageType.class.php b/files/lib/system/message/type/AttachmentMessageType.class.php
new file mode 100644
index 0000000..eb7176d
--- /dev/null
+++ b/files/lib/system/message/type/AttachmentMessageType.class.php
@@ -0,0 +1,67 @@
+processor = new \wcf\system\html\output\HtmlOutputProcessor();
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getJavaScriptModuleName() {
+ return 'Bastelstu.be/Chat/MessageType/Plain';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function canDelete(\chat\data\message\Message $message, \wcf\data\user\UserProfile $user = null) {
+ if ($user === null) $user = new \wcf\data\user\UserProfile(\wcf\system\WCF::getUser());
+
+ return $user->getPermission('mod.chat.canDelete');
+ }
+
+ /**
+ * @see \chat\system\message\type\IMessageType::getPayload()
+ */
+ public function getPayload(\chat\data\message\Message $message, \wcf\data\user\UserProfile $user = null) {
+ if ($user === null) $user = new \wcf\data\user\UserProfile(\wcf\system\WCF::getUser());
+
+ $payload = $message->payload;
+
+ $parameters = [ 'message' => $message
+ , 'user' => $user
+ , 'payload' => $payload
+ ];
+ \wcf\system\event\EventHandler::getInstance()->fireAction($this, 'getPayload', $parameters);
+
+ // TODO
+
+ return $parameters['payload'];
+ }
+}
diff --git a/objectType.xml b/objectType.xml
index d0699cd..d58f59a 100644
--- a/objectType.xml
+++ b/objectType.xml
@@ -132,6 +132,12 @@
be.bastelstu.chat.messageType
chat\system\message\type\WhisperMessageType
+
+
+ be.bastelstu.chat.messageType.attachment
+ be.bastelstu.chat.messageType
+ chat\system\message\type\AttachmentMessageType
+
@@ -168,5 +174,13 @@
1
+
+
+
+ be.bastelstu.chat.message
+ com.woltlab.wcf.attachment.objectType
+ chat\system\attachment\MessageAttachmentObjectType
+
+