diff --git a/file/lib/data/chat/room/ChatRoom.class.php b/file/lib/data/chat/room/ChatRoom.class.php index f15e5e1..a47b624 100644 --- a/file/lib/data/chat/room/ChatRoom.class.php +++ b/file/lib/data/chat/room/ChatRoom.class.php @@ -11,7 +11,7 @@ * @package timwolla.wcf.chat * @subpackage data.chat.room */ -class ChatRoom extends \wcf\data\DatabaseObject { +class ChatRoom extends \wcf\data\DatabaseObject implements \wcf\system\request\IRouteController { /** * @see wcf\data\DatabaseObject::$databaseTableName */ @@ -46,11 +46,27 @@ public static function getCache() { } /** - * Returns the name of this chat-room. - * - * @return string + * @see \wcf\data\chat\room\ChatRoom::getTitle(); */ public function __tostring() { + return $this->getTitle; + } + + /** + * Returns the name of this chat-room. + * + * @see \wcf\system\request\IRouteController + */ + public function getTitle() { return $this->title; } + + /** + * Returns the ID of this chat-room. + * + * @see \wcf\system\request\RRouteHandler + */ + public function getID() { + return $this->roomID; + } } diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 331e538..c509192 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -26,7 +26,9 @@ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( - 'roomID' => $this->roomID + 'room' => $this->room, + 'roomID' => $this->roomID, + 'rooms' => $this->rooms )); } @@ -36,6 +38,13 @@ public function assignVariables() { public function readData() { parent::readData(); $this->rooms = chat\room\ChatRoom::getCache(); + if ($this->roomID === 0) { + $this->rooms->seek(0); + \wcf\util\HeaderUtil::redirect(\wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array( + 'object' => $this->rooms->search($this->rooms->key()) + ))); + exit; + } $this->room = $this->rooms->search($this->roomID); if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();