From 2a4f48cec7423dab332a8d2ad803ac3f0af9c592 Mon Sep 17 00:00:00 2001 From: jsrobson10 Date: Sat, 13 Apr 2019 10:19:14 +1000 Subject: [PATCH] Allowed server to update the chat list --- scripts/communications.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/communications.js b/scripts/communications.js index a1b0b93..66ffb52 100644 --- a/scripts/communications.js +++ b/scripts/communications.js @@ -376,6 +376,25 @@ function connect(profile, connection_id) profile_switch_to(connection_id); } } + + // New chat + if(data.mode == "new_chat") + { + console.log("New chat created"); + + // Set the data + g.chats.push({ + name: data.name, + messages: [] + }); + + // Update the screen if its active + if(active_profile == connection_id) + { + // Refresh this profile + profile_switch_to(connection_id); + } + } } }); });