1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Throw IllegalLinkException when no room is there

Additionally added dummy join message.
This commit is contained in:
Tim Düsterhus 2011-11-27 12:38:02 +01:00
parent 35a22767fc
commit c92e1079c3

View File

@ -39,15 +39,33 @@ 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;
try {
$this->rooms->seek(0);
\wcf\util\HeaderUtil::redirect(\wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
'object' => $this->rooms->search($this->rooms->key())
)));
exit;
}
catch (\OutOfBoundsException $e) {
throw new \wcf\system\exception\IllegalLinkException();
}
}
$this->room = $this->rooms->search($this->roomID);
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
chat\message\ChatMessageEditor::create(array(
'roomID' => $this->room->roomID,
'sender' => WCF::getUser()->userID,
'username' => WCF::getUser()->username,
'time' => TIME_NOW,
'type' => chat\message\ChatMessage::TYPE_JOIN,
'message' => 'join',
'enableSmilies' => 0,
'enableHTML' => 0,
'color1' => 0xFF0000,
'color2' => 0x00FF00
));
}
/**