示例#1
0
  static {
    registerSmackProviders();
    DNSUtil.setDNSResolver(DNSJavaResolver.getInstance());

    // initialize smack defaults before any connections are created
    SmackConfiguration.setPacketReplyTimeout(PACKET_TIMEOUT);
    SmackConfiguration.setDefaultPingInterval(0);
  }
 private boolean checkIfPrivacyIsSupported(XMPPConnection conn) {
   ServiceDiscoveryManager servDisc = ServiceDiscoveryManager.getInstanceFor(conn);
   DiscoverInfo info = null;
   try {
     String xmppHost = DNSUtil.resolveXMPPDomain(conn.getServiceName()).getHost();
     info = servDisc.discoverInfo(xmppHost);
   } catch (XMPPException e) {
     // We could not query the server
     return false;
   }
   if (info != null) {
     for (Iterator<Feature> i = info.getFeatures(); i.hasNext(); ) {
       String s = i.next().getVar();
       if (s.contains("jabber:iq:privacy")) {
         return true;
       }
     }
   }
   return false;
 }
 void maybeResolveDns() throws Exception {
   if (!useDnsSrvRr) return;
   hostAddresses = DNSUtil.resolveXMPPDomain(serviceName);
 }
示例#4
0
 static {
   registerSmackProviders();
   DNSUtil.setDNSResolver(DNSJavaResolver.getInstance());
   SmackConfiguration.setPacketReplyTimeout(PACKET_TIMEOUT);
   SmackConfiguration.setDefaultPingInterval(0);
 }