Issue #3038 added initialized flag to session feed view

differentiates between roster population and new joins


Former-commit-id: 717cdf4280 [formerly 717cdf4280 [formerly 9b6c20ac39765120efc523c03a3d11d4b21c1748]]
Former-commit-id: ef61a7c281
Former-commit-id: 295ff106b6
This commit is contained in:
Brian Clements 2014-04-22 10:01:27 -05:00
parent 04e617706c
commit fb24e315bf

View file

@ -74,6 +74,7 @@ import com.raytheon.uf.viz.core.icon.IconUtil;
* Mar 24, 2014 2936 mpduff Remove join alerts from feed view.
* Mar 25, 2014 2938 mpduff Show status message for site and role changes.
* Apr 01, 2014 2938 mpduff Update logic for site and role changes.
* Apr 22, 2014 3038 bclement added initialized flag to differentiate between roster population and new joins
*
* </pre>
*
@ -104,6 +105,8 @@ public class SessionFeedView extends SessionView {
*/
private final ConcurrentHashMap<String, Presence> enabledUsers = new ConcurrentHashMap<String, Presence>();
private volatile boolean initialized = false;
/**
*
*/
@ -409,6 +412,18 @@ public class SessionFeedView extends SessionView {
@Override
protected void participantPresenceUpdated(VenueParticipant participant,
Presence presence) {
/*
* when we join, the room will send presence for everyone in the room,
* then send us our own presence to signify that the list is done and we
* have been initialized.
*/
if (!initialized && session.getUserID().isSameUser(participant)) {
initialized = true;
/*
* continue and print the message for ourselves joining which will
* serve as a delimiter between historical messages and new messages
*/
}
// Verify we have properties
if (!presence.getPropertyNames().contains(
SiteConfigInformation.SITE_NAME)) {
@ -425,7 +440,9 @@ public class SessionFeedView extends SessionView {
String roleName = getRoleName(presence);
if (presence.isAvailable()) {
if (prev == null || hasPresenceChanged(prev, presence)) {
/* only print announcements after we are initialized */
if (initialized
&& (prev == null || hasPresenceChanged(prev, presence))) {
StringBuilder message = getMessage(roleName, siteName, user);
sendSystemMessage(message);
}