client: display join/parts for PM tabs (regardless of global join/part setting)

This commit is contained in:
mappu 2017-02-05 18:13:45 +13:00
parent 56ced01e97
commit ceb7420e18

View File

@ -489,16 +489,25 @@ var tab_addHandlers = function() {
/* */
var writerFor = function(username) {
var tabid = "";
var maybeWriterFor = function(username) {
if (! username in pm_tabs || ! pm_tabs[username]) {
tabid = tab_new(next_tabid++, username);
pm_tabs[username] = tabid;
} else {
tabid = pm_tabs[username];
return null;
}
return write(tabid);
return write(pm_tabs[username]);
};
var writerFor = function(username) {
var ret = maybeWriterFor(username);
if (ret === null) {
// create new
tabid = tab_new(next_tabid++, username);
pm_tabs[username] = tabid;
return write(tabid);
}
return ret;
};
/* */
@ -924,6 +933,12 @@ window.onload = function() {
if (show_joins) {
write("tab-main").system("*** Parts: "+u.user); // sanitised
}
var targetTab = maybeWriterFor(u.user);
if (targetTab !== null) {
targetTab.system("*** Parts: "+u.user);
}
updateTitle();
});
sock.on('join', function(u) {
@ -931,6 +946,12 @@ window.onload = function() {
if (show_joins) {
write("tab-main").system("*** Joins: "+u.user);
}
var targetTab = maybeWriterFor(u.user);
if (targetTab !== null) {
targetTab.system("*** Joins: "+u.user);
}
updateTitle();
});
sock.on('info', function(u) {