From 7b5dbde7a6e2ee30a02289d3f31438fc66f77a8d Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 5 Feb 2017 19:43:23 +1300 Subject: [PATCH] client: add disconnected/reconnected messages into PM windows --- client/dcwebui.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/dcwebui.js b/client/dcwebui.js index 9a7ebc7..90b6e79 100644 --- a/client/dcwebui.js +++ b/client/dcwebui.js @@ -207,6 +207,12 @@ var write = function(tab) { }; }; +var write_system_message_in_all_pm_tabs = function(system_message) { + for (var k in pm_tabs) { + writerFor(k).system(system_message); + } +}; + /* Userlist */ var switchToPM = function(u) { @@ -984,6 +990,7 @@ window.onload = function() { }); sock.on('hello', function() { transition(STATE_ACTIVE); + write_system_message_in_all_pm_tabs("Reconnected."); }); sock.on('part', function(u) { userlist.del(u.user); @@ -1020,10 +1027,12 @@ window.onload = function() { sock.on('close', function() { transition(STATE_DISCONNECTED); write("tab-main").system("Connection closed by remote host."); + write_system_message_in_all_pm_tabs("Disconnected."); }); sock.on('disconnect', function() { transition(STATE_DISCONNECTED); write("tab-main").system("Lost connection to the server."); + write_system_message_in_all_pm_tabs("Disconnected."); }); sock.on('usercommand', function(data) { process_usercommand(data);