Issue #2798 - Fix user presence messages and settings
Peer review comments Change-Id: I615edc12a7fe93540b5e62cf673b92829cac3dfa Former-commit-id:ec892bb7a7
[formerly25425a4268
] [formerlye97e745b61
] [formerlyec892bb7a7
[formerly25425a4268
] [formerlye97e745b61
] [formerly9c873e6dd9
[formerlye97e745b61
[formerly b087558dce4e19596c93d47e986af50fae806a74]]]] Former-commit-id:9c873e6dd9
Former-commit-id:b88162e504
[formerly0251ad5bca
] [formerly acfecc3a2b5c6336080649496608081ffae17a97 [formerlyc0bf150e15
]] Former-commit-id: 96b5f8c7c3c165fba26eb85059fdf5317d2287b5 [formerly15c32a1513
] Former-commit-id:8a798710c5
This commit is contained in:
parent
222c9cce6d
commit
f061ae43a1
6 changed files with 93 additions and 36 deletions
|
@ -21,10 +21,8 @@ package com.raytheon.uf.viz.collaboration.comm.provider.info;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
|
@ -51,6 +49,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
||||||
* Jan 28, 2014 2698 bclement removed getInfo, added methods to replace
|
* Jan 28, 2014 2698 bclement removed getInfo, added methods to replace
|
||||||
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, getSubject never returns null
|
* Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, getSubject never returns null
|
||||||
* Feb 13, 2014 2751 bclement changed to use VenueParticipant handle instead of alias
|
* Feb 13, 2014 2751 bclement changed to use VenueParticipant handle instead of alias
|
||||||
|
* Mar 05, 2014 2798 mpduff Get Presence from MUC.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -61,8 +60,6 @@ public class Venue implements IVenue {
|
||||||
|
|
||||||
private final MultiUserChat muc;
|
private final MultiUserChat muc;
|
||||||
|
|
||||||
private Map<String, Presence> presenceMap = new HashMap<String, Presence>();
|
|
||||||
|
|
||||||
public Venue(XMPPConnection conn, MultiUserChat muc) {
|
public Venue(XMPPConnection conn, MultiUserChat muc) {
|
||||||
this.muc = muc;
|
this.muc = muc;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +77,7 @@ public class Venue implements IVenue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Presence getPresence(VenueParticipant user) {
|
public Presence getPresence(VenueParticipant user) {
|
||||||
Presence presence = presenceMap.get(user.getHandle());
|
Presence presence = muc.getOccupantPresence(user.getFQName());
|
||||||
if (presence == null) {
|
if (presence == null) {
|
||||||
presence = new Presence(Type.unavailable);
|
presence = new Presence(Type.unavailable);
|
||||||
presence.setMode(Mode.away);
|
presence.setMode(Mode.away);
|
||||||
|
@ -88,10 +85,6 @@ public class Venue implements IVenue {
|
||||||
return presence;
|
return presence;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handlePresenceUpdated(VenueParticipant fromID, Presence presence) {
|
|
||||||
presenceMap.put(fromID.getHandle(), presence);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -100,6 +100,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
||||||
* Feb 18, 2014 2751 bclement Fixed history message 'from' type
|
* Feb 18, 2014 2751 bclement Fixed history message 'from' type
|
||||||
* Feb 18, 2014 2751 bclement log privilege changes instead of spamming chat window
|
* Feb 18, 2014 2751 bclement log privilege changes instead of spamming chat window
|
||||||
* Feb 24, 2014 2751 bclement added isRoomOwner()
|
* Feb 24, 2014 2751 bclement added isRoomOwner()
|
||||||
|
* Mar 05, 2014 2798 mpduff Don't handle Presence, get from MUC instead..
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -107,7 +108,6 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent
|
* @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.provider.TextMessage
|
* @see com.raytheon.uf.viz.collaboration.comm.provider.TextMessage
|
||||||
* @see com.raytheon.uf.viz.collaboration.comm.provider.CollaborationMessage
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class VenueSession extends BaseSession implements IVenueSession {
|
public class VenueSession extends BaseSession implements IVenueSession {
|
||||||
|
@ -519,7 +519,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
||||||
logParticipantEvent(participant, ParticipantEventType.UPDATED,
|
logParticipantEvent(participant, ParticipantEventType.UPDATED,
|
||||||
"is now an admin.");
|
"is now an admin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logParticipantEvent(String participant,
|
private void logParticipantEvent(String participant,
|
||||||
ParticipantEventType type, String desciption) {
|
ParticipantEventType type, String desciption) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -537,6 +537,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
||||||
VenueParticipantEvent event = new VenueParticipantEvent(user,
|
VenueParticipantEvent event = new VenueParticipantEvent(user,
|
||||||
type);
|
type);
|
||||||
event.setEventDescription(desciption);
|
event.setEventDescription(desciption);
|
||||||
|
|
||||||
postEvent(event);
|
postEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +552,6 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
||||||
String fromID = p.getFrom();
|
String fromID = p.getFrom();
|
||||||
VenueParticipant user = IDConverter.convertFromRoom(muc,
|
VenueParticipant user = IDConverter.convertFromRoom(muc,
|
||||||
fromID);
|
fromID);
|
||||||
venue.handlePresenceUpdated(user, p);
|
|
||||||
postEvent(new VenueParticipantEvent(user, p,
|
postEvent(new VenueParticipantEvent(user, p,
|
||||||
ParticipantEventType.PRESENCE_UPDATED));
|
ParticipantEventType.PRESENCE_UPDATED));
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,7 @@ import com.raytheon.viz.ui.views.CaveFloatingView;
|
||||||
* Feb 12, 2014 2799 bclement fixed double click chat not working for roster entries
|
* Feb 12, 2014 2799 bclement fixed double click chat not working for roster entries
|
||||||
* Feb 24, 2014 2632 mpduff Add Notifier actions.
|
* Feb 24, 2014 2632 mpduff Add Notifier actions.
|
||||||
* Mar 05, 2014 2837 bclement separate rename action for groups, added more icons
|
* Mar 05, 2014 2837 bclement separate rename action for groups, added more icons
|
||||||
|
* Mar 05, 2014 2798 mpduff Add getter for displayFeedAction.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -950,4 +951,11 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the displayFeedAction
|
||||||
|
*/
|
||||||
|
public DisplayFeedAction getDisplayFeedAction() {
|
||||||
|
return displayFeedAction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,8 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 1, 2012 rferrel Initial creation
|
* Mar 1, 2012 rferrel Initial creation
|
||||||
|
* Mar 05, 2014 2798 mpduff Don't create a new DisplayFeedAction
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -58,6 +59,9 @@ public class CollaborationGroupAction extends AbstractHandler {
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
// this opens the collaboration group view
|
// this opens the collaboration group view
|
||||||
try {
|
try {
|
||||||
|
// If connection is null then user has not logged in
|
||||||
|
boolean initialExecutionFlag = CollaborationConnection
|
||||||
|
.getConnection() == null;
|
||||||
new LoginAction().run();
|
new LoginAction().run();
|
||||||
CollaborationConnection connection = CollaborationConnection
|
CollaborationConnection connection = CollaborationConnection
|
||||||
.getConnection();
|
.getConnection();
|
||||||
|
@ -66,15 +70,18 @@ public class CollaborationGroupAction extends AbstractHandler {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
CaveWorkbenchPageManager.getActiveInstance().showView(
|
CollaborationGroupView view = (CollaborationGroupView) CaveWorkbenchPageManager
|
||||||
CollaborationGroupView.ID);
|
.getActiveInstance().showView(CollaborationGroupView.ID);
|
||||||
|
|
||||||
// if autojoin is selected (to join the default room)
|
// Is this is the first log in
|
||||||
if (Activator.getDefault().getPreferenceStore()
|
if (initialExecutionFlag) {
|
||||||
.getBoolean(CollabPrefConstants.AUTO_JOIN)) {
|
// if autojoin is selected (to join the default room)
|
||||||
DisplayFeedAction displayFeed = new DisplayFeedAction();
|
if (Activator.getDefault().getPreferenceStore()
|
||||||
displayFeed.setChecked(true);
|
.getBoolean(CollabPrefConstants.AUTO_JOIN)) {
|
||||||
displayFeed.run();
|
DisplayFeedAction action = view.getDisplayFeedAction();
|
||||||
|
action.setChecked(true);
|
||||||
|
action.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (PartInitException e) {
|
} catch (PartInitException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
|
|
@ -20,7 +20,10 @@
|
||||||
package com.raytheon.uf.viz.collaboration.ui.session;
|
package com.raytheon.uf.viz.collaboration.ui.session;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
|
@ -66,6 +69,7 @@ import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||||
* Feb 13, 2014 2751 bclement VenueParticipant refactor
|
* Feb 13, 2014 2751 bclement VenueParticipant refactor
|
||||||
* Feb 18, 2014 2631 mpduff Add processJoinAlert()
|
* Feb 18, 2014 2631 mpduff Add processJoinAlert()
|
||||||
* Feb 19, 2014 2751 bclement add change color icon, fix NPE when user cancels change color
|
* Feb 19, 2014 2751 bclement add change color icon, fix NPE when user cancels change color
|
||||||
|
* Mar 05, 2014 2798 mpduff Changed how messages are processed for the feed view.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -91,6 +95,12 @@ public class SessionFeedView extends SessionView {
|
||||||
|
|
||||||
private List<SiteColor> colors;
|
private List<SiteColor> colors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set of users logged in.
|
||||||
|
*/
|
||||||
|
private final Set<String> enabledUsers = Collections
|
||||||
|
.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -382,17 +392,7 @@ public class SessionFeedView extends SessionView {
|
||||||
@Override
|
@Override
|
||||||
protected void sendParticipantSystemMessage(VenueParticipant participant,
|
protected void sendParticipantSystemMessage(VenueParticipant participant,
|
||||||
String message) {
|
String message) {
|
||||||
Presence presence = session.getVenue().getPresence(participant);
|
super.sendParticipantSystemMessage(participant, message);
|
||||||
Object siteObj = presence.getProperty(SiteConfigInformation.SITE_NAME);
|
|
||||||
String siteName = siteObj == null ? "" : siteObj.toString();
|
|
||||||
// only show sites you care about
|
|
||||||
if (enabledSites.contains(siteName)
|
|
||||||
|| userEnabledSites.contains(siteName)) {
|
|
||||||
super.sendParticipantSystemMessage(participant, message);
|
|
||||||
} else {
|
|
||||||
usersTable.setInput(session.getVenue().getParticipants());
|
|
||||||
usersTable.refresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -406,8 +406,56 @@ public class SessionFeedView extends SessionView {
|
||||||
@Override
|
@Override
|
||||||
protected void participantPresenceUpdated(VenueParticipant participant,
|
protected void participantPresenceUpdated(VenueParticipant participant,
|
||||||
Presence presence) {
|
Presence presence) {
|
||||||
setColorForSite(participant, presence);
|
usersTable.refresh();
|
||||||
super.participantPresenceUpdated(participant, presence);
|
|
||||||
|
// Verify we have properties
|
||||||
|
if (!presence.getPropertyNames().contains(
|
||||||
|
SiteConfigInformation.SITE_NAME)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object roleObj = presence.getProperty(SiteConfigInformation.ROLE_NAME);
|
||||||
|
String roleName = roleObj == null ? "" : roleObj.toString();
|
||||||
|
Object siteObj = presence.getProperty(SiteConfigInformation.SITE_NAME);
|
||||||
|
String siteName = siteObj == null ? "" : siteObj.toString();
|
||||||
|
String user = participant.getName();
|
||||||
|
|
||||||
|
// only show sites you care about
|
||||||
|
if (enabledSites.contains(siteName)
|
||||||
|
|| userEnabledSites.contains(siteName)) {
|
||||||
|
if (!enabledUsers.contains(user) && presence.isAvailable()) {
|
||||||
|
// New user
|
||||||
|
enabledUsers.add(user);
|
||||||
|
StringBuilder message = new StringBuilder();
|
||||||
|
message.append(user);
|
||||||
|
message.append(" ").append(roleName).append(" ")
|
||||||
|
.append(siteName);
|
||||||
|
setColorForSite(participant, presence);
|
||||||
|
sendSystemMessage(message);
|
||||||
|
processJoinAlert();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No operation for Session Feed View
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void participantArrived(VenueParticipant participant,
|
||||||
|
String description) {
|
||||||
|
usersTable.setInput(session.getVenue().getParticipants());
|
||||||
|
usersTable.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void participantDeparted(VenueParticipant participant,
|
||||||
|
String description) {
|
||||||
|
if (enabledUsers.remove(participant.getName())) {
|
||||||
|
super.participantDeparted(participant, description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -102,6 +102,8 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
|
||||||
* Feb 13, 2014 2751 bclement VenueParticipant refactor
|
* Feb 13, 2014 2751 bclement VenueParticipant refactor
|
||||||
* Feb 18, 2014 2631 mpduff Add processJoinAlert()
|
* Feb 18, 2014 2631 mpduff Add processJoinAlert()
|
||||||
* Feb 24, 2014 2632 mpduff Move playSound to CollaborationUtils
|
* Feb 24, 2014 2632 mpduff Move playSound to CollaborationUtils
|
||||||
|
* Mar 05, 2014 2798 mpduff Moved processJoinAlert() call from participantHandler
|
||||||
|
* to participantArrived.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -632,7 +634,6 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ARRIVED:
|
case ARRIVED:
|
||||||
participantArrived(participant, description);
|
participantArrived(participant, description);
|
||||||
processJoinAlert();
|
|
||||||
break;
|
break;
|
||||||
case DEPARTED:
|
case DEPARTED:
|
||||||
participantDeparted(participant, description);
|
participantDeparted(participant, description);
|
||||||
|
@ -671,6 +672,7 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
||||||
String message = description != null ? description
|
String message = description != null ? description
|
||||||
: "has entered the room.";
|
: "has entered the room.";
|
||||||
sendParticipantSystemMessage(participant, message);
|
sendParticipantSystemMessage(participant, message);
|
||||||
|
processJoinAlert();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -728,7 +730,6 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
||||||
protected SessionMsgArchive createMessageArchive() {
|
protected SessionMsgArchive createMessageArchive() {
|
||||||
String sessionName = getSessionName();
|
String sessionName = getSessionName();
|
||||||
UserId me = CollaborationConnection.getConnection().getUser();
|
UserId me = CollaborationConnection.getConnection().getUser();
|
||||||
// UserId me = session.getUserID();
|
|
||||||
return new SessionMsgArchive(me.getHost(), me.getName(), sessionName);
|
return new SessionMsgArchive(me.getHost(), me.getName(), sessionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue