use of org.jxmpp.jid.EntityBareJid in project Smack by igniterealtime.
the class MultiUserChatManager method getRoomsHostedBy.
/**
* Returns a Map of HostedRooms where each HostedRoom has the XMPP address of the room and the room's name.
* Once discovered the rooms hosted by a chat service it is possible to discover more detailed room information or
* join the room.
*
* @param serviceName the service that is hosting the rooms to discover.
* @return a map from the room's address to its HostedRoom information.
* @throws XMPPErrorException if there was an XMPP error returned.
* @throws NoResponseException if there was no response from the remote entity.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
* @throws NotAMucServiceException if the entity is not a MUC serivce.
* @since 4.3.1
*/
public Map<EntityBareJid, HostedRoom> getRoomsHostedBy(DomainBareJid serviceName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotAMucServiceException {
if (!providesMucService(serviceName)) {
throw new NotAMucServiceException(serviceName);
}
DiscoverItems discoverItems = serviceDiscoveryManager.discoverItems(serviceName);
List<DiscoverItems.Item> items = discoverItems.getItems();
Map<EntityBareJid, HostedRoom> answer = new HashMap<>(items.size());
for (DiscoverItems.Item item : items) {
HostedRoom hostedRoom = new HostedRoom(item);
HostedRoom previousRoom = answer.put(hostedRoom.getJid(), hostedRoom);
assert previousRoom == null;
}
return answer;
}
Aggregations