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

Show text/plain message

This commit is contained in:
Tim Düsterhus 2012-01-21 19:05:34 +01:00
parent c7232b8bd0
commit c2745de23b
2 changed files with 4 additions and 3 deletions

View File

@ -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()

View File

@ -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,