fixed removal of WhiteBoardParticipant, use of containsKey instead of contains on the HashTable as it is more efficient, removed unnecessary cast

cusax-fix
Matthieu Casanova 16 years ago
parent 28bbbf74e2
commit 9c7243ccff

@ -288,7 +288,7 @@ public void participantStateChanged(WhiteboardParticipantChangeEvent evt)
if ((newValue== WhiteboardParticipantState.DISCONNECTED)
|| (newValue == WhiteboardParticipantState.FAILED))
{
removeWhiteboardParticipant((WhiteboardParticipantJabberImpl) evt
removeWhiteboardParticipant(evt
.getSourceWhiteboardParticipant());
}
}
@ -351,7 +351,7 @@ public void participantImageChanged(WhiteboardParticipantChangeEvent evt)
*/
public void addWhiteboardParticipant(WhiteboardParticipant wbParticipant)
{
if (wbParticipants.contains(wbParticipant))
if (wbParticipants.containsKey(wbParticipant.getContactAddress()))
return;
wbParticipant.addWhiteboardParticipantListener(this);
@ -376,10 +376,10 @@ public void addWhiteboardParticipant(WhiteboardParticipant wbParticipant)
*/
public void removeWhiteboardParticipant(WhiteboardParticipant wbParticipant)
{
if (!wbParticipants.contains(wbParticipant))
if (!wbParticipants.containsKey(wbParticipant.getContactAddress()))
return;
this.wbParticipants.remove(wbParticipant);
this.wbParticipants.remove(wbParticipant.getContactAddress());
if (wbParticipant instanceof WhiteboardParticipantJabberImpl)
((WhiteboardParticipantJabberImpl) wbParticipant)
@ -390,7 +390,7 @@ public void removeWhiteboardParticipant(WhiteboardParticipant wbParticipant)
fireWhiteboardParticipantEvent(wbParticipant,
WhiteboardParticipantEvent.WHITEBOARD_PARTICIPANT_REMOVED);
if (wbParticipants.size() == 0)
if (wbParticipants.isEmpty())
setWhiteboardSessionState(WhiteboardSessionState.WHITEBOARD_ENDED);
}

Loading…
Cancel
Save