Announce participant joins and leaves
This commit is contained in:
+10
-3
@@ -1876,19 +1876,26 @@ function delUser(id) {
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} kind
|
||||
* @param {user|null} userinfo
|
||||
*/
|
||||
function gotUser(id, kind) {
|
||||
function gotUser(id, kind, userinfo) {
|
||||
let username = userinfo && userinfo.username ? userinfo.username : '(anon)';
|
||||
let isRemote = id !== serverConnection.id;
|
||||
switch(kind) {
|
||||
case 'add':
|
||||
addUser(id, serverConnection.users[id]);
|
||||
if(userNotificationSoundsReady && id !== serverConnection.id)
|
||||
if(userNotificationSoundsReady && isRemote) {
|
||||
localMessage(`${username} joined the hall.`);
|
||||
playNotificationSound('user-joined');
|
||||
}
|
||||
if(Object.keys(serverConnection.users).length == 3)
|
||||
reconsiderSendParameters();
|
||||
break;
|
||||
case 'delete':
|
||||
if(userNotificationSoundsReady && id !== serverConnection.id)
|
||||
if(userNotificationSoundsReady && isRemote) {
|
||||
localMessage(`${username} left the hall.`);
|
||||
playNotificationSound('user-left');
|
||||
}
|
||||
delUser(id);
|
||||
if(Object.keys(serverConnection.users).length < 3)
|
||||
scheduleReconsiderParameters();
|
||||
|
||||
Reference in New Issue
Block a user