示例#1
0
 /**
  * Get the Discover Information send by your own connection.
  *
  * @return your own DiscoverInfo
  */
 private DiscoverInfo getOwnInformation() {
   DiscoverInfo result = new DiscoverInfo();
   DiscoverInfo.Identity id =
       new DiscoverInfo.Identity("client", ServiceDiscoveryManager.getIdentityName());
   id.setType(ServiceDiscoveryManager.getIdentityType());
   result.addIdentity(id);
   Iterator<String> it = mSdm.getFeatures();
   while (it.hasNext()) {
     result.addFeature(it.next());
   }
   return result;
 }
示例#2
0
  /**
   * Add discover info response data.
   *
   * @param response the discover info response packet
   */
  public void addDiscoverInfoTo(DiscoverInfo response) {
    // Set this client identity
    DiscoverInfo.Identity identity = new DiscoverInfo.Identity("client", getIdentityName());
    identity.setType(getIdentityType());
    response.addIdentity(identity);
    // Add the registered features to the response
    synchronized (features) {
      // Add Entity Capabilities (XEP-0115) feature node.
      response.addFeature("http://jabber.org/protocol/caps");

      for (Iterator<String> it = getFeatures(); it.hasNext(); ) {
        response.addFeature(it.next());
      }
      if (extendedInfo != null) {
        response.addExtension(extendedInfo);
      }
    }
  }