Merge "Omaha #3061 only shared display capable clients get payload in invite" into omaha_14.4.1
Former-commit-id:7d11e31b06
[formerly dee25d151cecf83f23d2ef9df20146c68069e957] Former-commit-id:596b5268d0
This commit is contained in:
commit
bad26fdd7d
2 changed files with 56 additions and 15 deletions
|
@ -59,6 +59,7 @@ import com.raytheon.uf.common.xmpp.ext.ChangeAffiliationExtension;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.packet.SessionPayload;
|
||||
import com.raytheon.uf.viz.collaboration.comm.packet.SessionPayload.PayloadType;
|
||||
|
@ -101,6 +102,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
|||
* Apr 21, 2014 2822 bclement removed use of resources in topicSubscribers, added skipCache
|
||||
* Apr 22, 2014 2903 bclement added connection test to closePubSub() method
|
||||
* Apr 23, 2014 2822 bclement added formatInviteAddress()
|
||||
* Apr 29, 2014 3061 bclement added createInviteMessage()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -804,6 +806,39 @@ public class SharedDisplaySession extends VenueSession implements
|
|||
return rval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see ContactsManager#getSharedDisplayEnabledResource(UserId)
|
||||
* @param user
|
||||
* @return null if none found
|
||||
*/
|
||||
private String getSharedDisplayResource(UserId user) {
|
||||
CollaborationConnection manager = getConnection();
|
||||
ContactsManager cm = manager.getContactsManager();
|
||||
return cm.getSharedDisplayEnabledResource(user);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.comm.provider.session.VenueSession#
|
||||
* createInviteMessage
|
||||
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId,
|
||||
* com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite)
|
||||
*/
|
||||
@Override
|
||||
protected Message createInviteMessage(UserId id, VenueInvite invite) {
|
||||
Message rval = super.createInviteMessage(id, invite);
|
||||
/* only send shared display invite if we know the user supports it */
|
||||
if (getSharedDisplayResource(id) != null) {
|
||||
SessionPayload payload = new SessionPayload(PayloadType.Invitation,
|
||||
invite);
|
||||
rval.addExtension(payload);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -814,9 +849,7 @@ public class SharedDisplaySession extends VenueSession implements
|
|||
*/
|
||||
@Override
|
||||
protected String formatInviteAddress(UserId id) {
|
||||
CollaborationConnection manager = getConnection();
|
||||
ContactsManager cm = manager.getContactsManager();
|
||||
String resource = cm.getSharedDisplayEnabledResource(id);
|
||||
String resource = getSharedDisplayResource(id);
|
||||
/*
|
||||
* resource will be null if we can't find a resource that supports
|
||||
* shared displays for this user
|
||||
|
|
|
@ -52,8 +52,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventTyp
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
|
||||
import com.raytheon.uf.viz.collaboration.comm.packet.SessionPayload;
|
||||
import com.raytheon.uf.viz.collaboration.comm.packet.SessionPayload.PayloadType;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationConnection;
|
||||
|
@ -111,6 +109,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
|||
* Apr 21, 2014 2822 bclement added hasMultipleHandles()
|
||||
* Apr 22, 2014 2903 bclement added connection test to close method
|
||||
* Apr 23, 2014 2822 bclement added formatInviteAddress()
|
||||
* Apr 29, 2014 3061 bclement moved invite payload to shared display session
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -223,22 +222,31 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
@Override
|
||||
public void sendInvitation(UserId id, VenueInvite invite)
|
||||
throws CollaborationException {
|
||||
SessionPayload payload = new SessionPayload(PayloadType.Invitation,
|
||||
invite);
|
||||
Message msg = new Message();
|
||||
UserId user = getAccount();
|
||||
msg.setFrom(user.getNormalizedId());
|
||||
msg.setType(Type.normal);
|
||||
msg.addExtension(payload);
|
||||
Message msg = createInviteMessage(id, invite);
|
||||
String reason = "";
|
||||
if (!StringUtils.isBlank(invite.getMessage())) {
|
||||
reason = invite.getMessage();
|
||||
} else if (!StringUtils.isBlank(invite.getSubject())) {
|
||||
if (!StringUtils.isBlank(invite.getSubject())) {
|
||||
reason = invite.getSubject();
|
||||
} else if (!StringUtils.isBlank(invite.getMessage())) {
|
||||
reason = invite.getMessage();
|
||||
}
|
||||
muc.invite(msg, formatInviteAddress(id), reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create message object for session invitation
|
||||
*
|
||||
* @param id
|
||||
* recipient of invite
|
||||
* @param invite
|
||||
* @return
|
||||
*/
|
||||
protected Message createInviteMessage(UserId id, VenueInvite invite) {
|
||||
Message msg = new Message();
|
||||
msg.setType(Type.normal);
|
||||
msg.setBody(invite.getMessage());
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* format invite address for user
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue