diff --git a/file/lib/data/chat/message/ChatMessage.class.php b/file/lib/data/chat/message/ChatMessage.class.php index 4b61dcf..9de2527 100755 --- a/file/lib/data/chat/message/ChatMessage.class.php +++ b/file/lib/data/chat/message/ChatMessage.class.php @@ -89,10 +89,11 @@ public function getUsername() { /** * Converts this message into json-form. * + * @param boolean $raw * @return string */ - public function jsonify() { - return \wcf\util\JSON::encode(array( + public function jsonify($raw = false) { + $array = array( 'formattedUsername' => $this->getFormattedUsername(), 'formattedMessage' => (string) $this, 'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'), @@ -102,6 +103,9 @@ public function jsonify() { 'receiver' => $this->receiver, 'type' => $this->type, 'roomID' => $this->roomID - )); + ); + + if ($raw) return $array; + return \wcf\util\JSON::encode($array); } }