1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Fix aliasing

This commit is contained in:
Tim Düsterhus 2013-06-18 00:13:24 +02:00
parent 8ccefdb971
commit 38b29303d8
2 changed files with 4 additions and 6 deletions

View File

@ -42,8 +42,10 @@ public function __construct($text, \chat\data\room\Room $room = null) {
$aliases = self::getAliasMap();
foreach ($aliases as $search => $replace) {
$this->text = \wcf\system\Regex::compile('^'.preg_quote($search))->replace($this->text, $replace);
$this->text = \wcf\system\Regex::compile('^'.preg_quote(self::COMMAND_CHAR.$search).'( |$)')->replace($this->text, self::COMMAND_CHAR.$replace.' ');
}
$this->text = \wcf\system\Regex::compile('^//')->replace($this->text, '/plain ');
}
/**
@ -107,10 +109,6 @@ public function getParameters() {
public function loadCommand() {
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2);
if ($this->isCommand($parts[0])) {
return new commands\PlainCommand($this);
}
$class = '\chat\system\command\commands\\'.ucfirst(strtolower($parts[0])).'Command';
if (!class_exists($class)) {
throw new NotFoundException();

View File

@ -24,7 +24,7 @@ public function getType() {
* @see \chat\system\command\ICommand::getMessage()
*/
public function getMessage() {
return \wcf\system\bbcode\PreParser::getInstance()->parse(\wcf\util\StringUtil::substring($this->commandHandler->getText(), 1), explode(',', \wcf\system\WCF::getSession()->getPermission('user.chat.allowedBBCodes')));
return \wcf\system\bbcode\PreParser::getInstance()->parse(\chat\system\command\CommandHandler::COMMAND_CHAR.$this->commandHandler->getParameters(), explode(',', \wcf\system\WCF::getSession()->getPermission('user.chat.allowedBBCodes')));
}
/**