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();
|
parent::readData();
|
||||||
$this->rooms = chat\room\ChatRoom::getCache();
|
$this->rooms = chat\room\ChatRoom::getCache();
|
||||||
if ($this->roomID === 0) {
|
if ($this->roomID === 0) {
|
||||||
$this->rooms->seek(0);
|
try {
|
||||||
\wcf\util\HeaderUtil::redirect(\wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
$this->rooms->seek(0);
|
||||||
'object' => $this->rooms->search($this->rooms->key())
|
\wcf\util\HeaderUtil::redirect(\wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
||||||
)));
|
'object' => $this->rooms->search($this->rooms->key())
|
||||||
exit;
|
)));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
catch (\OutOfBoundsException $e) {
|
||||||
|
throw new \wcf\system\exception\IllegalLinkException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->room = $this->rooms->search($this->roomID);
|
$this->room = $this->rooms->search($this->roomID);
|
||||||
|
|
||||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
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