use of org.jxmpp.jid.Jid 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;
}
use of org.jxmpp.jid.Jid in project Smack by igniterealtime.
the class MultiUserChatLightManager method unblockRooms.
/**
* Unblock rooms.
*
* @param mucLightService
* @param roomsJids
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
*/
public void unblockRooms(DomainBareJid mucLightService, List<Jid> roomsJids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
HashMap<Jid, Boolean> rooms = new HashMap<>();
for (Jid jid : roomsJids) {
rooms.put(jid, true);
}
sendUnblockRooms(mucLightService, rooms);
}
use of org.jxmpp.jid.Jid in project Smack by igniterealtime.
the class BlockContactsIQ method getIQChildElementBuilder.
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
xml.rightAngleBracket();
if (jids != null) {
for (Jid jid : jids) {
xml.halfOpenElement("item");
xml.attribute("jid", jid);
xml.closeEmptyElement();
}
}
return xml;
}
use of org.jxmpp.jid.Jid in project Smack by igniterealtime.
the class BlockListIQ method getIQChildElementBuilder.
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
if (jids.isEmpty()) {
xml.setEmptyElement();
} else {
xml.rightAngleBracket();
for (Jid jid : jids) {
xml.halfOpenElement("item");
xml.attribute("jid", jid);
xml.closeEmptyElement();
}
}
return xml;
}
use of org.jxmpp.jid.Jid in project Smack by igniterealtime.
the class BlockListIQProvider method parse.
@Override
public BlockListIQ parse(XmlPullParser parser, int initialDepth) throws Exception {
List<Jid> jids = null;
outerloop: while (true) {
int eventType = parser.next();
switch(eventType) {
case XmlPullParser.START_TAG:
if (parser.getName().equals("item")) {
if (jids == null) {
jids = new ArrayList<>();
}
Jid jid = ParserUtils.getJidAttribute(parser);
jids.add(jid);
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
BlockListIQ blockListIQ = new BlockListIQ(jids);
blockListIQ.setType(Type.result);
return blockListIQ;
}
Aggregations