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 typeof window.webkitNotifications isnt 'undefined'
if window.webkitNotifications.checkPermission() is 0 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() notification.show()
setTimeout(() -> setTimeout(() ->
notification.cancel() notification.cancel()

View File

@ -47,7 +47,7 @@ public function __toString() {
* *
* @return string * @return string
*/ */
public function getFormattedMessage() { public function getFormattedMessage($outputType = 'text/html') {
$message = $this->message; $message = $this->message;
switch ($this->type) { switch ($this->type) {
case self::TYPE_JOIN: case self::TYPE_JOIN:
@ -56,7 +56,7 @@ public function getFormattedMessage() {
$message = WCF::getLanguage()->get('wcf.chat.message.'.$this->type); $message = WCF::getLanguage()->get('wcf.chat.message.'.$this->type);
break; break;
case self::TYPE_NORMAL: case self::TYPE_NORMAL:
if (!$this->enableHTML) { if (!$this->enableHTML && $outputType == 'text/html') {
$message = \wcf\system\bbcode\SimpleMessageParser::getInstance()->parse($message, true, $this->enableSmilies); $message = \wcf\system\bbcode\SimpleMessageParser::getInstance()->parse($message, true, $this->enableSmilies);
} }
} }
@ -97,6 +97,7 @@ public function jsonify($raw = false) {
'formattedUsername' => $this->getFormattedUsername(), 'formattedUsername' => $this->getFormattedUsername(),
'formattedMessage' => (string) $this, 'formattedMessage' => (string) $this,
'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'), 'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'),
'message' => $this->getFormattedMessage('text/plain'),
'sender' => $this->sender, 'sender' => $this->sender,
'username' => $this->getUsername(), 'username' => $this->getUsername(),
'time' => $this->time, 'time' => $this->time,