mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Adding some more doc-blocks and cleaning up code.
This commit is contained in:
parent
c71d19e16a
commit
0a7fa7f640
@ -2,7 +2,7 @@
|
||||
namespace be\bastelstu\wcf\chat;
|
||||
|
||||
/**
|
||||
* Handles updates.
|
||||
* Handles updates of Tims Chat.
|
||||
*
|
||||
* @author Tim Düsterhus
|
||||
* @copyright 2010-2012 Tim Düsterhus
|
||||
@ -10,11 +10,20 @@
|
||||
* @package be.bastelstu.wcf.chat
|
||||
*/
|
||||
final class Update {
|
||||
/**
|
||||
* Contains all the rooms the current installation has.
|
||||
*
|
||||
* @var array<\wcf\data\chat\room\ChatRoom>
|
||||
*/
|
||||
private $rooms = null;
|
||||
|
||||
public function __construct() {
|
||||
$this->rooms = \wcf\data\chat\room\ChatRoom::getCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies users to refresh the chat as the JS may no longer be fully compatible with the PHP code.
|
||||
*/
|
||||
public function execute() {
|
||||
foreach ($this->rooms as $room) {
|
||||
$messageAction = new \wcf\data\chat\message\ChatMessageAction(array(), 'create', array(
|
||||
|
@ -12,7 +12,14 @@
|
||||
* @subpackage page
|
||||
*/
|
||||
class ChatCopyrightPage extends AbstractPage {
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededModules
|
||||
*/
|
||||
public $neededModules = array('CHAT_ACTIVE');
|
||||
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||
*/
|
||||
public $neededPermissions = array('user.chat.canEnter');
|
||||
|
||||
/**
|
||||
|
@ -13,12 +13,40 @@
|
||||
* @subpackage page
|
||||
*/
|
||||
class ChatMessagePage extends AbstractPage {
|
||||
/**
|
||||
* The new and unseen messages.
|
||||
*
|
||||
* @var array<\wcf\data\chat\message\ChatMessage>
|
||||
*/
|
||||
public $messages = array();
|
||||
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededModules
|
||||
*/
|
||||
public $neededModules = array('CHAT_ACTIVE');
|
||||
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||
*/
|
||||
public $neededPermissions = array('user.chat.canEnter');
|
||||
|
||||
/**
|
||||
* The room the user joined.
|
||||
*
|
||||
* @var \wcf\data\chat\room\ChatRoom
|
||||
*/
|
||||
public $room = null;
|
||||
public $roomID = 0;
|
||||
|
||||
/**
|
||||
* All the users that are currently in the room $this->room.
|
||||
*
|
||||
* @var array<\wcf\data\user\User>
|
||||
*/
|
||||
public $users = array();
|
||||
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$useTemplate
|
||||
*/
|
||||
public $useTemplate = false;
|
||||
|
||||
/**
|
||||
@ -82,9 +110,9 @@ public function readMessages() {
|
||||
* Initializes the room databaseobject.
|
||||
*/
|
||||
public function readRoom() {
|
||||
$this->roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
||||
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
||||
|
||||
$this->room = chat\room\ChatRoom::getCache()->search($this->roomID);
|
||||
$this->room = chat\room\ChatRoom::getCache()->search($roomID);
|
||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||
}
|
||||
|
@ -15,7 +15,14 @@
|
||||
*/
|
||||
class ChatPage extends AbstractPage {
|
||||
public $chatVersion = '';
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededModules
|
||||
*/
|
||||
public $neededModules = array('CHAT_ACTIVE');
|
||||
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||
*/
|
||||
public $neededPermissions = array('user.chat.canEnter');
|
||||
public $newestMessages = array();
|
||||
public $room = null;
|
||||
|
@ -14,23 +14,33 @@
|
||||
* @subpackage page
|
||||
*/
|
||||
class ChatRefreshRoomListPage extends AbstractPage {
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededModules
|
||||
*/
|
||||
public $neededModules = array('CHAT_ACTIVE');
|
||||
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||
*/
|
||||
public $neededPermissions = array('user.chat.canEnter');
|
||||
public $room = null;
|
||||
public $roomID = 0;
|
||||
public $rooms = array();
|
||||
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$useTemplate
|
||||
*/
|
||||
public $useTemplate = false;
|
||||
|
||||
/**
|
||||
* Reads room data.
|
||||
* @see \wcf\page\IPage::readData()
|
||||
*/
|
||||
public function readData() {
|
||||
parent::readData();
|
||||
$this->roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
||||
|
||||
$this->rooms = chat\room\ChatRoom::getCache();
|
||||
|
||||
$this->room = $this->rooms->search($this->roomID);
|
||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
||||
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
||||
$room = $this->rooms->search($roomID);
|
||||
if (!$room) throw new \wcf\system\exception\IllegalLinkException();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user