/**
   * Add discover info response data.
   *
   * @see <a href="http://xmpp.org/extensions/xep-0030.html#info-basic">XEP-30 Basic Protocol;
   *     Example 2</a>
   * @param response the discover info response packet
   */
  public void addDiscoverInfoTo(DiscoverInfo response) {
    // First add the identities of the connection
    response.addIdentities(getIdentities());

    // Add the registered features to the response
    synchronized (features) {
      for (Iterator<String> it = getFeatures(); it.hasNext(); ) {
        response.addFeature(it.next());
      }
      response.addExtension(extendedInfo);
    }
  }
Пример #2
0
  /**
   * Add discover info response data.
   *
   * @see <a href="http://xmpp.org/extensions/xep-0030.html#info-basic">XEP-30 Basic Protocol;
   *     Example 2</a>
   * @param response the discover info response packet
   */
  public void addDiscoverInfoTo(DiscoverInfo response) {
    // First add the identities of the connection
    response.addIdentities(getIdentities());

    // Add the registered features to the response
    synchronized (features) {
      for (String feature : getFeatures()) {
        response.addFeature(feature);
      }
      response.addExtension(extendedInfo);
    }
  }
Пример #3
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());
    }
  }
Пример #4
0
 /**
  * Adds a collection of features to the packet. Does noting if featuresToAdd is null.
  *
  * @param featuresToAdd
  */
 public void addFeatures(Collection<String> featuresToAdd) {
   if (featuresToAdd == null) return;
   for (String feature : featuresToAdd) {
     addFeature(feature);
   }
 }