diff --git a/file/lib/data/message/Message.class.php b/file/lib/data/message/Message.class.php
index 76876be..cefa8bb 100644
--- a/file/lib/data/message/Message.class.php
+++ b/file/lib/data/message/Message.class.php
@@ -57,7 +57,7 @@ public function __toString() {
* @param string $outputType outputtype for messageparser
* @return string
*/
- public function getFormattedMessage($outputType = 'text/html') {
+ public function getFormattedMessage() {
$message = $this->message;
switch ($this->type) {
@@ -70,24 +70,15 @@ public function getFormattedMessage($outputType = 'text/html') {
case self::TYPE_MODERATE:
$message = unserialize($message);
$message = WCF::getLanguage()->getDynamicVariable('chat.message.'.$this->type.'.'.$message['type'], $message ?: array());
- $message = self::replaceUserLink($message, $outputType);
break;
case self::TYPE_WHISPER:
$message = unserialize($message);
$message = $message['message'];
case self::TYPE_NORMAL:
case self::TYPE_ME:
- $messageParser = \wcf\system\bbcode\MessageParser::getInstance();
- $messageParser->setOutputType($outputType);
- $message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false);
- break;
default:
- if ($this->enableHTML) {
- $message = self::replaceUserLink($message, $outputType);
- }
-
$messageParser = \wcf\system\bbcode\MessageParser::getInstance();
- $messageParser->setOutputType($outputType);
+ $messageParser->setOutputType('text/html');
$message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false);
break;
}
@@ -118,45 +109,6 @@ public function getUsername($colored = false) {
return $username;
}
- /**
- * Replaces a userLink in a message.
- */
- public static function replaceUserLink($message, $outputType) {
- static $regex = null;
- if ($regex === null) $regex = new Regex('');
-
- if ($outputType === 'text/html') {
- return $regex->replace($message, new \wcf\system\Callback(function ($matches) {
- return self::getUserLink($matches[1]);
- }));
- }
- else {
- return $regex->replace($message, new \wcf\system\Callback(function ($matches) {
- self::getUserLink($matches[1]);
-
- return self::$users[$matches[1]]->username;
- }));
- }
- }
-
- /**
- * Returns a fully colored userlink.
- */
- public static function getUserLink($userID) {
- if (!isset(self::$users[$userID])) {
- self::$users[$userID] = $user = new \wcf\data\user\User($userID);
-
- // Username + link to profile
- $color = ChatUtil::readUserData('color', $user);
- $profile = \wcf\system\request\LinkHandler::getInstance()->getLink('User', array(
- 'object' => $user
- ));
- self::$users[$userID]->userLink = ''.ChatUtil::gradient($user->username, $color[1], $color[2]).'';
- }
-
- return self::$users[$userID]->userLink;
- }
-
/**
* Converts this message into json-form.
*
@@ -181,7 +133,7 @@ public function jsonify($raw = false) {
'formattedMessage' => $this->getFormattedMessage(),
'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'),
'separator' => $separator,
- 'message' => $this->getFormattedMessage('text/plain'),
+ 'message' => $this->message,
'sender' => (int) $this->sender,
'username' => $this->getUsername(),
'time' => (int) $this->time,
diff --git a/file/lib/data/message/MessageAction.class.php b/file/lib/data/message/MessageAction.class.php
index 60ddb5e..a09cb68 100644
--- a/file/lib/data/message/MessageAction.class.php
+++ b/file/lib/data/message/MessageAction.class.php
@@ -43,7 +43,7 @@ public function prune() {
/**
* Validates message sending.
*/
- public function validateSend() {
+ public function validateSend() {
// read parameters
$this->readString('text');
$this->readBoolean('enableSmilies');
diff --git a/file/lib/system/command/commands/InfoCommand.class.php b/file/lib/system/command/commands/InfoCommand.class.php
index 15f51f4..2d0fbc9 100644
--- a/file/lib/system/command/commands/InfoCommand.class.php
+++ b/file/lib/system/command/commands/InfoCommand.class.php
@@ -26,11 +26,10 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler)
if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ','));
// Username + link to profile
- $color = ChatUtil::readUserData('color', $this->user);
$profile = \wcf\system\request\LinkHandler::getInstance()->getLink('User', array(
- 'object' => $this->user
+ 'object' => $this->user
));
- $this->lines[WCF::getLanguage()->get('wcf.user.username')] = '';
+ $this->lines[WCF::getLanguage()->get('wcf.user.username')] = "[url='".$profile."']".$this->user->username.'[/url]';
// Away-Status
if (ChatUtil::readUserData('away', $this->user) !== null) {
diff --git a/file/lib/system/command/commands/WhereCommand.class.php b/file/lib/system/command/commands/WhereCommand.class.php
index e694016..ad19333 100644
--- a/file/lib/system/command/commands/WhereCommand.class.php
+++ b/file/lib/system/command/commands/WhereCommand.class.php
@@ -30,7 +30,10 @@ public function getMessage() {
$users = $room->getUsers();
$tmp = array();
foreach ($users as $user) {
- $tmp[] = '';
+ $profile = \wcf\system\request\LinkHandler::getInstance()->getLink('User', array(
+ 'object' => $user
+ ));
+ $tmp[] = "[url='".$profile."']".$user->username.'[/url]';
}
if (!empty($tmp)) $lines[] = '[b]'.$room.':[/b] '.implode(', ', $tmp);
}