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

Docs and Code Optimization

This commit is contained in:
Tim Düsterhus 2012-06-04 21:22:14 +02:00
parent d7f91715e4
commit d9d90e9c19
9 changed files with 59 additions and 9 deletions

View File

@ -12,18 +12,49 @@
* @subpackage system.chat.command
*/
abstract class AbstractCommand implements ICommand {
/**
* Instance of the CommandHandler
*
* @var \wcf\system\chat\command\CommandHandler
*/
public $commandHandler = null;
/**
* Should HTML be enabled?
*
* @var integer
*/
public $enableHTML = 0;
/**
* Should smilies be enabled?
*
* @var integer
* @see \wcf\system\chat\command\ICommand::SMILEY_OFF
* @see \wcf\system\chat\command\ICommand::SMILEY_ON
* @see \wcf\system\chat\command\ICommand::SMILEY_USER
*/
public $enableSmilies = ICommand::SMILEY_OFF;
public function __construct(CommandHandler $commandHandler) {
EventHandler::getInstance()->fireAction($this, 'shouldInit');
$this->commandHandler = $commandHandler;
}
/**
* Fires the didInit-event.
* You should call this when everything is properly inserted.
*/
public function didInit() {
EventHandler::getInstance()->fireAction($this, 'didInit');
}
/**
* Default-Receiver: Everyone
*
* @return null
* @see \wcf\system\chat\command\ICommand::getReceiver()
*/
public function getReceiver() {
return null;
}

View File

@ -11,11 +11,39 @@
* @subpackage system.chat.command
*/
interface ICommand {
/**
* Smilies are forced to be disabled.
*
* @var integer
*/
const SMILEY_OFF = 0;
/**
* Smilies are forced to be enabled.
*
* @var integer
*/
const SMILEY_ON = 1;
/**
* The user may decide whether smilies are on or off.
*
* @var integer
*/
const SMILEY_USER = 2;
/**
* Returns the message-type for this command.
*/
public function getType();
/**
* Returns the message-text for this command.
*/
public function getMessage();
/**
* Returns the receiver for this command.
*/
public function getReceiver();
}

View File

@ -12,8 +12,6 @@
* @subpackage system.chat.command.commands
*/
class Away extends \wcf\system\chat\command\AbstractCommand {
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_OFF;
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
parent::__construct($commandHandler);

View File

@ -12,7 +12,6 @@
* @subpackage system.chat.command.commands
*/
class Color extends \wcf\system\chat\command\AbstractCommand {
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_OFF;
public static $colors = array(
'red' => 0xFF0000,
'blue' => 0x0000FF,

View File

@ -11,8 +11,6 @@
* @subpackage system.chat.command.commands
*/
class Free extends Me {
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_OFF;
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
parent::__construct($commandHandler);

View File

@ -15,7 +15,6 @@
* @subpackage system.chat.command.commands
*/
class Info extends \wcf\system\chat\command\AbstractCommand {
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_OFF;
public $enableHTML = 1;
public $lines = array();
public $user = null;

View File

@ -13,7 +13,6 @@
* @subpackage system.chat.command.commands
*/
class Restore extends \wcf\system\chat\command\AbstractRestrictedCommand {
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_OFF;
public $enableHTML = 1;
public $user = null;
public $link = '';

View File

@ -13,7 +13,6 @@
* @subpackage system.chat.command.commands
*/
class Temproom extends \wcf\system\chat\command\AbstractRestrictedCommand {
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_OFF;
public $roomName = '';
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {

View File

@ -11,7 +11,6 @@
* @subpackage system.chat.command.commands
*/
class Where extends \wcf\system\chat\command\AbstractCommand {
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_OFF;
public $enableHTML = 1;
/**