From 5af92474c39118f7fe42522ea6ab23431cbc0667 Mon Sep 17 00:00:00 2001 From: George Politis Date: Wed, 3 Dec 2014 12:36:52 +0100 Subject: [PATCH] Attempts to prevent ghost contacts from appearing in the contact list. --- app.js | 1 + videolayout.js | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index a6df82708..fa51f4968 100644 --- a/app.js +++ b/app.js @@ -824,6 +824,7 @@ $(document).bind('left.muc', function (event, jid) { var container = document.getElementById( 'participant_' + Strophe.getResourceFromJid(jid)); if (container) { + ContactList.removeContact(jid); VideoLayout.removeConnectionIndicator(jid); // hide here, wait for video to close before removing $(container).hide(); diff --git a/videolayout.js b/videolayout.js index 358bce47d..761da0a45 100644 --- a/videolayout.js +++ b/videolayout.js @@ -535,8 +535,21 @@ var VideoLayout = (function (my) { VideoLayout.removeRemoteStreamElement( stream, isVideo, container); - if (peerJid) - ContactList.removeContact(peerJid); + // NOTE(gp) it seems that under certain circumstances, the + // onended event is not fired and thus the contact list is not + // updated. + // + // The onended event of a stream should be fired when the SSRCs + // corresponding to that stream are removed from the SDP; but + // this doesn't seem to always be the case, resulting in ghost + // contacts. + // + // In an attempt to fix the ghost contacts problem, I'm moving + // the removeContact() method call in app.js, inside the + // 'muc.left' event handler. + + //if (peerJid) + // ContactList.removeContact(peerJid); }; // Add click handler.