Search in sources :

Example 6 with DomainBareJid

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;
}
Also used : Jid(org.jxmpp.jid.Jid) DomainBareJid(org.jxmpp.jid.DomainBareJid) EntityBareJid(org.jxmpp.jid.EntityBareJid) MUCLightBlockingIQ(org.jivesoftware.smackx.muclight.element.MUCLightBlockingIQ) ArrayList(java.util.ArrayList)

Example 7 with DomainBareJid

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);
}
Also used : Jid(org.jxmpp.jid.Jid) DomainBareJid(org.jxmpp.jid.DomainBareJid) EntityBareJid(org.jxmpp.jid.EntityBareJid) HashMap(java.util.HashMap) WeakHashMap(java.util.WeakHashMap)

Example 8 with DomainBareJid

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);
}
Also used : MultipleAddresses(org.jivesoftware.smackx.address.packet.MultipleAddresses) Jid(org.jxmpp.jid.Jid) EntityFullJid(org.jxmpp.jid.EntityFullJid) DomainBareJid(org.jxmpp.jid.DomainBareJid) EntityBareJid(org.jxmpp.jid.EntityBareJid)

Example 9 with DomainBareJid

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;
    }
}
Also used : DiscoverInfo(org.jivesoftware.smackx.disco.packet.DiscoverInfo) XMPPException(org.jivesoftware.smack.XMPPException) DomainBareJid(org.jxmpp.jid.DomainBareJid) ServiceDiscoveryManager(org.jivesoftware.smackx.disco.ServiceDiscoveryManager)

Example 10 with DomainBareJid

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);
}
Also used : Localpart(org.jxmpp.jid.parts.Localpart) DomainBareJid(org.jxmpp.jid.DomainBareJid)

Aggregations

DomainBareJid (org.jxmpp.jid.DomainBareJid)19 Jid (org.jxmpp.jid.Jid)11 EntityBareJid (org.jxmpp.jid.EntityBareJid)10 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)4 WeakHashMap (java.util.WeakHashMap)4 DiscoverInfo (org.jivesoftware.smackx.disco.packet.DiscoverInfo)4 MUCLightBlockingIQ (org.jivesoftware.smackx.muclight.element.MUCLightBlockingIQ)3 NoResponseException (org.jivesoftware.smack.SmackException.NoResponseException)2 XMPPErrorException (org.jivesoftware.smack.XMPPException.XMPPErrorException)2 ServiceDiscoveryManager (org.jivesoftware.smackx.disco.ServiceDiscoveryManager)2 DiscoverItems (org.jivesoftware.smackx.disco.packet.DiscoverItems)2 EntityFullJid (org.jxmpp.jid.EntityFullJid)2 CallbackHandler (javax.security.auth.callback.CallbackHandler)1 SmackIntegrationTest (org.igniterealtime.smack.inttest.SmackIntegrationTest)1 TestNotPossibleException (org.igniterealtime.smack.inttest.TestNotPossibleException)1 FeatureNotSupportedException (org.jivesoftware.smack.SmackException.FeatureNotSupportedException)1 NotConnectedException (org.jivesoftware.smack.SmackException.NotConnectedException)1 XMPPConnection (org.jivesoftware.smack.XMPPConnection)1 XMPPException (org.jivesoftware.smack.XMPPException)1