mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Throw IllegalLinkException when no room is there
Additionally added dummy join message.
This commit is contained in:
parent
35a22767fc
commit
c92e1079c3
@ -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
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user