Package org.jivesoftware.smackx.packet

Examples of org.jivesoftware.smackx.packet.DiscoverInfo


                serviceAddress = (String) services.get(serviceName);
                if (serviceAddress == null) {

                    // Send the disco packet to the server itself
                    try {
                        DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection)
                                .discoverInfo(serviceName);
                        // Check if the server supports JEP-33
                        if (info.containsFeature("http://jabber.org/protocol/address")) {
                            serviceAddress = serviceName;
                        }
                        else {
                            // Get the disco items and send the disco packet to each server item
                            DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection)
                                    .discoverItems(serviceName);
                            for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
                                DiscoverItems.Item item = it.next();
                                info = ServiceDiscoveryManager.getInstanceFor(connection)
                                        .discoverInfo(item.getEntityID(), item.getNode());
                                if (info.containsFeature("http://jabber.org/protocol/address")) {
                                    serviceAddress = serviceName;
                                    break;
                                }
                            }
View Full Code Here


     *         otherwise <code>false</code>
     * @throws XMPPException if there was an error querying target for supported features
     */
    private boolean supportsSocks5(String targetJID) throws XMPPException {
        ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(this.connection);
        DiscoverInfo discoverInfo = serviceDiscoveryManager.discoverInfo(targetJID);
        return discoverInfo.containsFeature(NAMESPACE);
    }
View Full Code Here

            if (this.proxyBlacklist.contains(item.getEntityID())) {
                continue;
            }

            try {
                DiscoverInfo proxyInfo;
                proxyInfo = serviceDiscoveryManager.discoverInfo(item.getEntityID());
                Iterator<Identity> identities = proxyInfo.getIdentities();

                // item must have category "proxy" and type "bytestream"
                while (identities.hasNext()) {
                    Identity identity = identities.next();
View Full Code Here

     * @param jid
     * @return true if supported
     */
    public boolean isSupported(String jid) {
        try {
            DiscoverInfo result =
                ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(jid);
            return result.containsFeature(DeliveryReceipt.NAMESPACE);
        }
        catch (XMPPException e) {
            return false;
        }
    }
View Full Code Here

     * @param jid The id of the entity the query is being sent to
     * @return true if it supports ping, false otherwise.
     * @throws XMPPException An XMPP related error occurred during the request
     */
    public boolean isPingSupported(String jid) throws XMPPException {
        DiscoverInfo result = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(jid);
        return result.containsFeature(Ping.NAMESPACE);
    }
View Full Code Here

        DiscoverItems items = discoManager.discoverItems(con.getServiceName());
        Iterator<DiscoverItems.Item> iter = items.getItems();
        while (iter.hasNext()) {
            DiscoverItems.Item item = iter.next();
            try {
                DiscoverInfo info;
                try {
                    info = discoManager.discoverInfo(item.getEntityID());
                }
                catch (XMPPException e) {
                    // Ignore Case
                    continue;
                }

                if (info.containsFeature("jabber:iq:search")) {
                    searchServices.add(item.getEntityID());
                }
            }
            catch (Exception e) {
                // No info found.
View Full Code Here

     *
     * @return a boolean indicating if the server supports Flexible Offline Message Retrieval.
     * @throws XMPPException If the user is not allowed to make this request.
     */
    public boolean supportsFlexibleRetrieval() throws XMPPException {
        DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(null);
        return info.containsFeature(namespace);
    }
View Full Code Here

     * @return the number of offline messages for the user of the connection.
     * @throws XMPPException If the user is not allowed to make this request or the server does
     *                       not support offline message retrieval.
     */
    public int getMessageCount() throws XMPPException {
        DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(null,
                namespace);
        Form extendedInfo = Form.getFormFrom(info);
        if (extendedInfo != null) {
            String value = extendedInfo.getField("number_of_messages").getValues().next();
            return Integer.parseInt(value);
View Full Code Here

   * @throws XMPPException
   */
  public DiscoverInfo discoverInfo()
    throws XMPPException
  {
    DiscoverInfo info = new DiscoverInfo();
    info.setTo(to);
    info.setNode(getId());
    return (DiscoverInfo)SyncPacketSend.getReply(con, info);
  }
View Full Code Here

    public boolean isEmailAvailable() {
        ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);

        try {
            String workgroupService = StringUtils.parseServer(workgroupJID);
            DiscoverInfo infoResult = discoManager.discoverInfo(workgroupService);
            return infoResult.containsFeature("jive:email:provider");
        }
        catch (XMPPException e) {
            return false;
        }
    }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.packet.DiscoverInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.