use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class IoTProvisioningManager method findProvisioningServerComponent.
/**
* Try to find a provisioning server component.
*
* @return the XMPP address of the provisioning server component if one was found.
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @see <a href="http://xmpp.org/extensions/xep-0324.html#servercomponent">XEP-0324 ยง 3.1.2 Provisioning Server as a server component</a>
*/
public DomainBareJid findProvisioningServerComponent() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final XMPPConnection connection = connection();
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
List<DiscoverInfo> discoverInfos = sdm.findServicesDiscoverInfo(Constants.IOT_PROVISIONING_NAMESPACE, true, true);
if (discoverInfos.isEmpty()) {
return null;
}
Jid jid = discoverInfos.get(0).getFrom();
assert (jid.isDomainBareJid());
return jid.asDomainBareJid();
}
use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class MultiUserChatLightManager method getUsersBlocked.
/**
* Get users blocked.
*
* @param mucLightService
* @return the list of users blocked
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
*/
public List<Jid> getUsersBlocked(DomainBareJid mucLightService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightBlockingIQ muclIghtBlockingIQResult = getBlockingList(mucLightService);
List<Jid> jids = new ArrayList<>();
if (muclIghtBlockingIQResult.getUsers() != null) {
jids.addAll(muclIghtBlockingIQResult.getUsers().keySet());
}
return jids;
}
use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class MultiUserChatLightManager method blockRooms.
/**
* Block rooms.
*
* @param mucLightService
* @param roomsJids
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
*/
public void blockRooms(DomainBareJid mucLightService, List<Jid> roomsJids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
HashMap<Jid, Boolean> rooms = new HashMap<>();
for (Jid jid : roomsJids) {
rooms.put(jid, false);
}
sendBlockRooms(mucLightService, rooms);
}
use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class MultiUserChatLightManager method getUsersAndRoomsBlocked.
/**
* Get users and rooms blocked.
*
* @param mucLightService
* @return the list of users and rooms blocked
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
*/
public List<Jid> getUsersAndRoomsBlocked(DomainBareJid mucLightService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCLightBlockingIQ muclIghtBlockingIQResult = getBlockingList(mucLightService);
List<Jid> jids = new ArrayList<>();
if (muclIghtBlockingIQResult.getRooms() != null) {
jids.addAll(muclIghtBlockingIQResult.getRooms().keySet());
}
if (muclIghtBlockingIQResult.getUsers() != null) {
jids.addAll(muclIghtBlockingIQResult.getUsers().keySet());
}
return jids;
}
use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class MultiUserChatLightManager method getOccupiedRooms.
/**
* Returns a List of the rooms the user occupies.
*
* @param mucLightService
* @return a List of the rooms the user occupies.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
* @throws InterruptedException
*/
public List<Jid> getOccupiedRooms(DomainBareJid mucLightService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
DiscoverItems result = ServiceDiscoveryManager.getInstanceFor(connection()).discoverItems(mucLightService);
List<DiscoverItems.Item> items = result.getItems();
List<Jid> answer = new ArrayList<>(items.size());
for (DiscoverItems.Item item : items) {
Jid mucLight = item.getEntityID();
answer.add(mucLight);
}
return answer;
}
Aggregations