diff --git a/file/js/TimWolla.WCF.Chat.coffee b/file/js/TimWolla.WCF.Chat.coffee index f78c3c8..b83a6a5 100644 --- a/file/js/TimWolla.WCF.Chat.coffee +++ b/file/js/TimWolla.WCF.Chat.coffee @@ -253,7 +253,7 @@ TimWolla.WCF ?= {} if typeof window.webkitNotifications isnt 'undefined' if window.webkitNotifications.checkPermission() is 0 - notification = window.webkitNotifications.createNotification WCF.Icon.get('timwolla.wcf.chat.chat'), WCF.Language.get('wcf.chat.newMessages'), 'New message by' + message.username + notification = window.webkitNotifications.createNotification WCF.Icon.get('timwolla.wcf.chat.chat'), WCF.Language.get('wcf.chat.newMessages'), message.username + ' ' + message.message notification.show() setTimeout(() -> notification.cancel() diff --git a/file/lib/data/chat/message/ChatMessage.class.php b/file/lib/data/chat/message/ChatMessage.class.php index 9de2527..1be0d03 100755 --- a/file/lib/data/chat/message/ChatMessage.class.php +++ b/file/lib/data/chat/message/ChatMessage.class.php @@ -47,7 +47,7 @@ public function __toString() { * * @return string */ - public function getFormattedMessage() { + public function getFormattedMessage($outputType = 'text/html') { $message = $this->message; switch ($this->type) { case self::TYPE_JOIN: @@ -56,7 +56,7 @@ public function getFormattedMessage() { $message = WCF::getLanguage()->get('wcf.chat.message.'.$this->type); break; case self::TYPE_NORMAL: - if (!$this->enableHTML) { + if (!$this->enableHTML && $outputType == 'text/html') { $message = \wcf\system\bbcode\SimpleMessageParser::getInstance()->parse($message, true, $this->enableSmilies); } } @@ -97,6 +97,7 @@ public function jsonify($raw = false) { 'formattedUsername' => $this->getFormattedUsername(), 'formattedMessage' => (string) $this, 'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'), + 'message' => $this->getFormattedMessage('text/plain'), 'sender' => $this->sender, 'username' => $this->getUsername(), 'time' => $this->time,