Пример #1
0
 /**
  * Discover node information in standard {@link DiscoverInfo} format.
  *
  * @return The discovery information about the node.
  * @throws XMPPErrorException
  * @throws NoResponseException if there was no response from the server.
  * @throws NotConnectedException
  */
 public DiscoverInfo discoverInfo()
     throws NoResponseException, XMPPErrorException, NotConnectedException {
   DiscoverInfo info = new DiscoverInfo();
   info.setTo(to);
   info.setNode(getId());
   return (DiscoverInfo) con.createPacketCollectorAndSend(info).nextResultOrThrow();
 }
Пример #2
0
  /**
   * Returns the discovered information of a given XMPP entity addressed by its JID and note
   * attribute. Use this message only when trying to query information which is not directly
   * addressable.
   *
   * @see <a href="http://xmpp.org/extensions/xep-0030.html#info-basic">XEP-30 Basic Protocol</a>
   * @see <a href="http://xmpp.org/extensions/xep-0030.html#info-nodes">XEP-30 Info Nodes</a>
   * @param entityID the address of the XMPP entity.
   * @param node the optional attribute that supplements the 'jid' attribute.
   * @return the discovered information.
   * @throws XMPPErrorException if the operation failed for some reason.
   * @throws NoResponseException if there was no response from the server.
   * @throws NotConnectedException
   */
  public DiscoverInfo discoverInfo(String entityID, String node)
      throws NoResponseException, XMPPErrorException, NotConnectedException {
    // Discover the entity's info
    DiscoverInfo disco = new DiscoverInfo();
    disco.setType(IQ.Type.get);
    disco.setTo(entityID);
    disco.setNode(node);

    Packet result = connection().createPacketCollectorAndSend(disco).nextResultOrThrow();

    return (DiscoverInfo) result;
  }
  /**
   * Returns the discovered information of a given XMPP entity addressed by its JID and note
   * attribute. Use this message only when trying to query information which is not directly
   * addressable.
   *
   * @see <a href="http://xmpp.org/extensions/xep-0030.html#info-basic">XEP-30 Basic Protocol</a>
   * @see <a href="http://xmpp.org/extensions/xep-0030.html#info-nodes">XEP-30 Info Nodes</a>
   * @param entityID the address of the XMPP entity.
   * @param node the optional attribute that supplements the 'jid' attribute.
   * @return the discovered information.
   * @throws XMPPException if the operation failed for some reason.
   */
  public DiscoverInfo discoverInfo(String entityID, String node) throws XMPPException {
    Connection connection = ServiceDiscoveryManager.this.connection.get();
    if (connection == null) throw new XMPPException("Connection instance already gc'ed");

    // Discover the entity's info
    DiscoverInfo disco = new DiscoverInfo();
    disco.setType(IQ.Type.GET);
    disco.setTo(entityID);
    disco.setNode(node);

    Packet result = connection.createPacketCollectorAndSend(disco).nextResultOrThrow();

    return (DiscoverInfo) result;
  }
Пример #4
0
  /**
   * Copy constructor.
   *
   * @param d
   */
  public DiscoverInfo(DiscoverInfo d) {
    super(d);

    // Set node
    setNode(d.getNode());

    // Copy features
    for (Feature f : d.features) {
      addFeature(f.clone());
    }

    // Copy identities
    for (Identity i : d.identities) {
      addIdentity(i.clone());
    }
  }