use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class MultiUserChatLightManager method getRoomsBlocked.
/**
* Get rooms blocked.
*
* @param mucLightService
* @return the list of rooms blocked
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
*/
public List<Jid> getRoomsBlocked(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());
}
return jids;
}
use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class MultiUserChatLightManager method unblockUsers.
/**
* Unblock users.
*
* @param mucLightService
* @param usersJids
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
*/
public void unblockUsers(DomainBareJid mucLightService, List<Jid> usersJids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
HashMap<Jid, Boolean> users = new HashMap<>();
for (Jid jid : usersJids) {
users.put(jid, true);
}
sendUnblockUsers(mucLightService, users);
}
use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class MultipleRecipientManager method sendThroughService.
private static void sendThroughService(XMPPConnection connection, Stanza packet, Collection<? extends Jid> to, Collection<? extends Jid> cc, Collection<? extends Jid> bcc, Jid replyTo, Jid replyRoom, boolean noReply, DomainBareJid serviceAddress) throws NotConnectedException, InterruptedException {
// Create multiple recipient extension
MultipleAddresses multipleAddresses = new MultipleAddresses();
if (to != null) {
for (Jid jid : to) {
multipleAddresses.addAddress(MultipleAddresses.Type.to, jid, null, null, false, null);
}
}
if (cc != null) {
for (Jid jid : cc) {
multipleAddresses.addAddress(MultipleAddresses.Type.to, jid, null, null, false, null);
}
}
if (bcc != null) {
for (Jid jid : bcc) {
multipleAddresses.addAddress(MultipleAddresses.Type.bcc, jid, null, null, false, null);
}
}
if (noReply) {
multipleAddresses.setNoReply();
} else {
if (replyTo != null) {
multipleAddresses.addAddress(MultipleAddresses.Type.replyto, replyTo, null, null, false, null);
}
if (replyRoom != null) {
multipleAddresses.addAddress(MultipleAddresses.Type.replyroom, replyRoom, null, null, false, null);
}
}
// Set the multiple recipient service address as the target address
packet.setTo(serviceAddress);
// Add extension to packet
packet.addExtension(multipleAddresses);
// Send the packet
connection.sendStanza(packet);
}
use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class Workgroup method isEmailAvailable.
/**
* The workgroup service may be configured to send email. This queries the Workgroup Service
* to see if the email service has been configured and is available.
*
* @return true if the email service is available, otherwise return false.
* @throws SmackException
* @throws InterruptedException
*/
public boolean isEmailAvailable() throws SmackException, InterruptedException {
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
try {
DomainBareJid workgroupService = workgroupJID.asDomainBareJid();
DiscoverInfo infoResult = discoManager.discoverInfo(workgroupService);
return infoResult.containsFeature("jive:email:provider");
} catch (XMPPException e) {
return false;
}
}
use of org.jxmpp.jid.DomainBareJid in project Smack by igniterealtime.
the class XmppTools method createAccount.
public static boolean createAccount(String xmppDomain, String username, String password) throws KeyManagementException, NoSuchAlgorithmException, SmackException, IOException, XMPPException, InterruptedException {
DomainBareJid xmppDomainJid = JidCreate.domainBareFrom(xmppDomain);
Localpart localpart = Localpart.from(username);
return createAccount(xmppDomainJid, localpart, password);
}
Aggregations