Package com.kolakcc.loljclient.model

Source Code of com.kolakcc.loljclient.model.XMPPWrapper

package com.kolakcc.loljclient.model;

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;

import com.gvaneyck.rtmp.DummySSLSocketFactory;
import com.sun.corba.se.spi.activation.Server;

public class XMPPWrapper {
  private static XMPPConnection connection;

  public static XMPPConnection getConnection() {
    if (connection == null) {
      //Connection.DEBUG_ENABLED = true;
      ConnectionConfiguration config = new ConnectionConfiguration(
          ServerInfo.currentServerInfo.XMPPserver, 5223);
      config.setSecurityMode(SecurityMode.enabled);
      config.setSocketFactory(new DummySSLSocketFactory());
      config.setCompressionEnabled(true);
      config.setServiceName("pvp.net");
      connection = new XMPPConnection(config);
     
    }
    return connection;
  }

  public static void login(String username, String password)
      throws XMPPException {
    if (ServerInfo.currentServerInfo.XMPPserver != null) {
      getConnection().connect();
      getConnection().login(username, "AIR_" + password);
    }
  }
}
TOP

Related Classes of com.kolakcc.loljclient.model.XMPPWrapper

TOP
Copyright © 2018 www.massapi.com. 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.