From 22c2f481d5433335f8e0f565013b8f9c26994353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 27 Dec 2011 12:44:36 +0100 Subject: [PATCH] Added possibility for user transmission --- file/js/TimWolla.WCF.Chat.coffee | 2 +- file/lib/page/ChatMessagePage.class.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/file/js/TimWolla.WCF.Chat.coffee b/file/js/TimWolla.WCF.Chat.coffee index 47858e9..73ee1c1 100644 --- a/file/js/TimWolla.WCF.Chat.coffee +++ b/file/js/TimWolla.WCF.Chat.coffee @@ -137,7 +137,7 @@ TimWolla.WCF ?= {} dataType: 'json' type: 'POST' success: $.proxy((data, textStatus, jqXHR) -> - @handleMessages(data) + @handleMessages(data.messages) , this) ### # Inserts the new messages. diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/ChatMessagePage.class.php index b3b674d..6fc4506 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/ChatMessagePage.class.php @@ -50,11 +50,12 @@ public function show() { parent::show(); @header('Content-type: application/json'); - $result = '['; + $json = array('users' => array(), 'messages' => array()); + foreach ($this->messages as $message) { - $result .= $message->jsonify().','; + $json['messages'][] = $message->jsonify(true); } - echo rtrim($result, ',').']'; + echo \wcf\util\JSON::encode($json); exit; } }