Merge "Issue #3020 fixed error message when attempting to create already accessible room" into development

Former-commit-id: fc8880c642201685feefbf3eb14cb4f1a7c962b1
This commit is contained in:
Nate Jensen 2014-04-16 16:30:46 -05:00 committed by Gerrit Code Review
commit 2ea1878403

View file

@ -107,6 +107,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* moved muc close logic to closeMuc() * moved muc close logic to closeMuc()
* handle is now set in constructor * handle is now set in constructor
* Apr 11, 2014 2903 bclement made constructor public b/c connection code moved packages * Apr 11, 2014 2903 bclement made constructor public b/c connection code moved packages
* Apr 16, 2014 3020 bclement added check for invited rooms in roomExistsOnServer()
* *
* *
* </pre> * </pre>
@ -147,9 +148,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
* @param container * @param container
* @param eventBus * @param eventBus
*/ */
public VenueSession(EventBus externalBus, public VenueSession(EventBus externalBus, CollaborationConnection manager,
CollaborationConnection manager, String venueName, String handle, String venueName, String handle, String sessionId) {
String sessionId) {
super(externalBus, manager, sessionId); super(externalBus, manager, sessionId);
this.venueName = venueName; this.venueName = venueName;
this.handle = handle; this.handle = handle;
@ -160,8 +160,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
* @param container * @param container
* @param eventBus * @param eventBus
*/ */
public VenueSession(EventBus externalBus, public VenueSession(EventBus externalBus, CollaborationConnection manager,
CollaborationConnection manager, CreateSessionData data) { CreateSessionData data) {
super(externalBus, manager); super(externalBus, manager);
this.venueName = data.getName(); this.venueName = data.getName();
this.handle = data.getHandle(); this.handle = data.getHandle();
@ -433,10 +433,11 @@ public class VenueSession extends BaseSession implements IVenueSession {
public static boolean roomExistsOnServer(XMPPConnection conn, String roomId) public static boolean roomExistsOnServer(XMPPConnection conn, String roomId)
throws XMPPException { throws XMPPException {
String host = Tools.parseHost(roomId); String host = Tools.parseHost(roomId);
/* check for public rooms */
ServiceDiscoveryManager serviceDiscoveryManager = new ServiceDiscoveryManager( ServiceDiscoveryManager serviceDiscoveryManager = new ServiceDiscoveryManager(
conn); conn);
DiscoverItems result = serviceDiscoveryManager.discoverItems(host); DiscoverItems result = serviceDiscoveryManager.discoverItems(host);
for (Iterator<DiscoverItems.Item> items = result.getItems(); items for (Iterator<DiscoverItems.Item> items = result.getItems(); items
.hasNext();) { .hasNext();) {
DiscoverItems.Item item = items.next(); DiscoverItems.Item item = items.next();
@ -444,6 +445,19 @@ public class VenueSession extends BaseSession implements IVenueSession {
return true; return true;
} }
} }
/* check for private rooms that we have access to */
try {
MultiUserChat.getRoomInfo(conn, roomId);
/* getRoomInfo only returns if the room was found */
return true;
} catch (XMPPException e) {
/*
* getRoomInfo throws a 404 if the room does exist or is private and
* we don't have access. In either case, we can't say that the room
* exists
*/
}
return false; return false;
} }