|
|
@ -1217,18 +1217,31 @@ MessengerUI, Messages, Pages) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getFancyGuestName = function (name, uid) {
|
|
|
|
|
|
|
|
name = UI.getDisplayName(name);
|
|
|
|
|
|
|
|
if (name === Messages.anonymous && uid) {
|
|
|
|
|
|
|
|
var animal = MT.getPseudorandomAnimal(uid);
|
|
|
|
|
|
|
|
if (animal) {
|
|
|
|
|
|
|
|
name = animal + ' ' + name;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return name;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Notifications
|
|
|
|
// Notifications
|
|
|
|
var initNotifications = function (toolbar, config) {
|
|
|
|
var initNotifications = function (toolbar, config) {
|
|
|
|
// Display notifications when users are joining/leaving the session
|
|
|
|
// Display notifications when users are joining/leaving the session
|
|
|
|
var oldUserData;
|
|
|
|
var oldUserData;
|
|
|
|
if (!config.metadataMgr) { return; }
|
|
|
|
if (!config.metadataMgr) { return; }
|
|
|
|
var metadataMgr = config.metadataMgr;
|
|
|
|
var metadataMgr = config.metadataMgr;
|
|
|
|
var notify = function(type, name, oldname) {
|
|
|
|
var notify = function(type, name, oldname, uid) {
|
|
|
|
if (toolbar.isAlone) { return; }
|
|
|
|
if (toolbar.isAlone) { return; }
|
|
|
|
// type : 1 (+1 user), 0 (rename existing user), -1 (-1 user)
|
|
|
|
// type : 1 (+1 user), 0 (rename existing user), -1 (-1 user)
|
|
|
|
if (typeof name === "undefined") { return; }
|
|
|
|
if (typeof name === "undefined") { return; }
|
|
|
|
name = name || Messages.anonymous;
|
|
|
|
|
|
|
|
if (Config.disableUserlistNotifications) { return; }
|
|
|
|
if (Config.disableUserlistNotifications) { return; }
|
|
|
|
|
|
|
|
name = getFancyGuestName(name, uid);
|
|
|
|
|
|
|
|
oldname = getFancyGuestName(oldname, uid);
|
|
|
|
|
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
switch(type) {
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
UI.log(Messages._getKey("notifyJoined", [name]));
|
|
|
|
UI.log(Messages._getKey("notifyJoined", [name]));
|
|
|
@ -1277,7 +1290,7 @@ MessengerUI, Messages, Pages) {
|
|
|
|
delete oldUserData[u];
|
|
|
|
delete oldUserData[u];
|
|
|
|
if (temp && newdata[userNetfluxId] && temp.uid === newdata[userNetfluxId].uid) { return; }
|
|
|
|
if (temp && newdata[userNetfluxId] && temp.uid === newdata[userNetfluxId].uid) { return; }
|
|
|
|
if (userPresent(u, temp, newdata || oldUserData) < 1) {
|
|
|
|
if (userPresent(u, temp, newdata || oldUserData) < 1) {
|
|
|
|
notify(-1, temp.name);
|
|
|
|
notify(-1, temp.name, undefined, temp.uid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1297,10 +1310,10 @@ MessengerUI, Messages, Pages) {
|
|
|
|
if (typeof oldUserData[k] === "undefined") {
|
|
|
|
if (typeof oldUserData[k] === "undefined") {
|
|
|
|
// if the same uid is already present in the userdata, don't notify
|
|
|
|
// if the same uid is already present in the userdata, don't notify
|
|
|
|
if (!userPresent(k, newdata[k], oldUserData)) {
|
|
|
|
if (!userPresent(k, newdata[k], oldUserData)) {
|
|
|
|
notify(1, newdata[k].name);
|
|
|
|
notify(1, newdata[k].name, undefined, newdata[k].uid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (oldUserData[k].name !== newdata[k].name) {
|
|
|
|
} else if (oldUserData[k].name !== newdata[k].name) {
|
|
|
|
notify(0, newdata[k].name, oldUserData[k].name);
|
|
|
|
notify(0, newdata[k].name, oldUserData[k].name, newdata[k].uid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|