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);