Summary description for XmppClient.
Наследование: XmppConnection
Пример #1
0
 public Client()
 {
     Xmpp = new XmppClientConnection("skylabsonline.com");
     Xmpp.OnRegistered += XmppOnOnRegistered;
     Xmpp.OnRegisterError += XmppOnOnRegisterError;
     Xmpp.OnXmppConnectionStateChanged += XmppOnOnXmppConnectionStateChanged;
     Xmpp.OnLogin += XmppOnOnLogin;
     Xmpp.OnAuthError += XmppOnOnAuthError;
     Xmpp.OnRosterItem += XmppOnOnRosterItem;
     Xmpp.OnRosterEnd += XmppOnOnRosterEnd;
     Xmpp.OnRosterStart += XmppOnOnRosterStart;
     Xmpp.OnMessage += XmppOnOnMessage;
     Xmpp.OnPresence += XmppOnOnPresence;
     Xmpp.OnAgentItem += XmppOnOnAgentItem;
     Xmpp.OnIq += XmppOnOnIq;
     Xmpp.OnReadXml += XmppOnOnReadXml;
     Notifications = new List<Notification>();
     Friends = new List<NewUser>();
     //GroupChats = new List<NewUser>();
     myPresence = new Presence();
     Chatting = new Chat(this,Xmpp);
     CurrentHostedGamePort = -1;
     _games = new List<HostedGameData>();
     agsXMPP.Factory.ElementFactory.AddElementType("gameitem", "octgn:gameitem", typeof(HostedGameData));
 }
Пример #2
0
        public override Task Run()
        {
            _xmppConnection = new XmppClientConnection
            {
                Server = _host,
                ConnectServer = _connectHost,
                AutoResolveConnectServer = true,
                Username = _username,
                Password = _password,
            };

            _xmppConnection.OnLogin += OnLogin;
            _xmppConnection.OnError += OnError;
            _xmppConnection.OnMessage += OnMessage;
            _xmppConnection.OnPresence += XmppConnectionOnOnPresence;
            _xmppConnection.OnRosterItem += OnClientRosterItem;

            

            CancelPreviousLogin();

            _loginTcs = new TaskCompletionSource<bool>();

            _xmppConnection.Open();

            //return _loginTcs == null ? Task.FromResult(false) :  _loginTcs.Task;
            return Task.FromResult(false);
        }
Пример #3
0
		public override void Init(XmppClientConnection con)
		{
            base.XmppClientConnection = con;			

            DoClientAuth();
            
		}
Пример #4
0
 public XMPPClient()
 {
     _connection = new XmppClientConnection(XMPPServer);
     _connection.OnLogin += ConnectionOnLogin;
     _connection.OnMessage += OnMessage;
     ConnectToXmppServer();
 }
        public void Conectar(string user, string password)
        {
            XmppClientConnection xmpp = new XmppClientConnection("pvp.net");
            xmpp.UseSSL = true;
            xmpp.Port = 5223;
            xmpp.Resource = "xiff";
            xmpp.AutoResolveConnectServer = false;
            xmpp.ConnectServer = "chat.euw1.lol.riotgames.com";
            //Presence p = new Presence(ShowType.chat, "Online");
            //p.Type = PresenceType.available;
            //xmpp.Send(p);
            xmpp.OnRosterItem += new XmppClientConnection.RosterHandler( xmpp_OnRosterItem);
            xmpp.OnPresence += new PresenceHandler(xmpp_OnPresence);
            xmpp.Open(user, "AIR_" + password);

            //xmpp.OnLogin += delegate (object o) { MessageBox.Show("Logged in as " + xmpp.Username); };
            System.Threading.Thread.Sleep(2000);
            foreach (string nome in Contactos_Todos)
                    {

                Offline_Friends.Items.Add(nome);
                       
                    }
            foreach (string nome in Contactos)
            {

                Online_Friends.Items.Add(nome);

            }
            button.Background = Brushes.Green;
            button.IsEnabled = false;
            button.Content = "CONECTED!";
            
        }
Пример #6
0
        public static void RemakeXmpp()
        {
            if (Xmpp != null)
            {
                Xmpp.OnXmppConnectionStateChanged -= XmppOnOnXmppConnectionStateChanged;
                Xmpp.Close();
                Xmpp = null;
            }
            Xmpp = new XmppClientConnection(ServerPath);

            Xmpp.RegisterAccount = false;
            Xmpp.AutoAgents = true;
            Xmpp.AutoPresence = true;
            Xmpp.AutoRoster = true;
            Xmpp.Username = XmppUsername;
            Xmpp.Password = XmppPassword;
            Xmpp.Priority = 1;
            Xmpp.OnMessage += XmppOnOnMessage;
            Xmpp.OnError += XmppOnOnError;
            Xmpp.OnAuthError += new XmppElementHandler(Xmpp_OnAuthError);
            Xmpp.OnStreamError += XmppOnOnStreamError;
            Xmpp.KeepAlive = true;
            Xmpp.KeepAliveInterval = 60;
            Xmpp.OnAgentStart += XmppOnOnAgentStart;
            Xmpp.OnXmppConnectionStateChanged += XmppOnOnXmppConnectionStateChanged;
            Xmpp.Open();
        }
Пример #7
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            XmppConnection = new XmppClientConnection();
            XmppConnection.AutoResolveConnectServer = true;
        }
Пример #8
0
        public frmLogin(XmppClientConnection con)
        {
            InitializeComponent();

            this.DialogResult = DialogResult.Cancel;
            _xmppCon = con;
        }
Пример #9
0
        public frmMain()
        {
            InitializeComponent();

            // initialize Combo Status
            InitStatusCombo();

            // initilaize XmppConnection and setup all event handlers
            XmppCon = new XmppClientConnection();

            XmppCon.OnReadXml += new XmlHandler(XmppCon_OnReadXml);
            XmppCon.OnWriteXml += new XmlHandler(XmppCon_OnWriteXml);

            XmppCon.OnRosterStart += new ObjectHandler(XmppCon_OnRosterStart);
            XmppCon.OnRosterEnd += new ObjectHandler(XmppCon_OnRosterEnd);
            XmppCon.OnRosterItem += new agsXMPP.XmppClientConnection.RosterHandler(XmppCon_OnRosterItem);

            XmppCon.OnAgentStart += new ObjectHandler(XmppCon_OnAgentStart);
            XmppCon.OnAgentEnd += new ObjectHandler(XmppCon_OnAgentEnd);
            XmppCon.OnAgentItem += new agsXMPP.XmppClientConnection.AgentHandler(XmppCon_OnAgentItem);

            XmppCon.OnLogin += new ObjectHandler(XmppCon_OnLogin);
            XmppCon.OnClose += new ObjectHandler(XmppCon_OnClose);
            XmppCon.OnError += new ErrorHandler(XmppCon_OnError);
            XmppCon.OnPresence += new PresenceHandler(XmppCon_OnPresence);
            XmppCon.OnMessage += new MessageHandler(XmppCon_OnMessage);
            XmppCon.OnIq += new IqHandler(XmppCon_OnIq);

            XmppCon.ClientSocket.OnReceive += new agsXMPP.net.ClientSocket.OnSocketDataHandler(ClientSocket_OnReceive);
            XmppCon.ClientSocket.OnSend += new agsXMPP.net.ClientSocket.OnSocketDataHandler(ClientSocket_OnSend);
        }
        public void Login(string username, string password)
        {
            if (!LoggedIn)
            {
                try
                {
                    _xmppClient = new XmppClientConnection("chat.facebook.com", 5222);
                    _xmppClient.OnXmppConnectionStateChanged += (sender, state) =>
                    {
                        if (OnConnectionStateChanged != null) OnConnectionStateChanged(state.ToString());
                    };
                    _xmppClient.UseStartTLS = true;
                    _xmppClient.OnPresence += UpdateContactList;
                    _xmppClient.OnLogin += OnLogin;
                    _xmppClient.OnAuthError += (sender, element) =>
                    {
                        if (OnAuthError != null) OnAuthError(element.ToString());
                    };

                   _xmppClient.Open(username, password);
                }
                catch
                {
                    if (OnLoginResult != null)
                        OnLoginResult(false);
                }
            }
        }
Пример #11
0
        public void Start()
        {
            AppDomain.CurrentDomain.AssemblyResolve += (o, args) =>
            {
                var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
                return loadedAssemblies.FirstOrDefault(asm => asm.FullName == args.Name);
            };

            string pluginsDirectory = Environment.CurrentDirectory + "\\plugins\\";
            if (!Directory.Exists(pluginsDirectory))
            {
                Directory.CreateDirectory(pluginsDirectory);
            }

            _catalog = new DirectoryCatalog(Environment.CurrentDirectory + "\\plugins\\");
            _catalog.Changed += new EventHandler<ComposablePartCatalogChangeEventArgs>(_catalog_Changed);
            LoadPlugins();

            _client = new XmppClientConnection(ConfigurationManager.AppSettings["Server"]);

            //_client.ConnectServer = "talk.google.com"; //necessary if connecting to Google Talk
            _client.AutoResolveConnectServer = false;

            _client.OnLogin += new ObjectHandler(xmpp_OnLogin);
            _client.OnMessage += new MessageHandler(xmpp_OnMessage);
            _client.OnError += new ErrorHandler(_client_OnError);

            Console.WriteLine("Connecting...");
            _client.Resource = ConfigurationManager.AppSettings["Resource"];
            _client.Open(ConfigurationManager.AppSettings["User"], ConfigurationManager.AppSettings["Password"]);
            Console.WriteLine("Connected.");

            _client.OnRosterStart += new ObjectHandler(_client_OnRosterStart);
            _client.OnRosterItem += new XmppClientConnection.RosterHandler(_client_OnRosterItem);
        }
Пример #12
0
    public RiotChat() {
      xmpp = new XmppClientConnection {
        Server = "pvp.net",
        Port = 5223,
        ConnectServer = Session.Region.ChatServer,
        AutoResolveConnectServer = false,
        Resource = "xiff",
        UseSSL = true,
        KeepAliveInterval = 10,
        KeepAlive = true,
        UseCompression = true,
        AutoPresence = true,
        Status = new LeagueStatus(StatusMessage, Status).ToXML(),
        Show = ShowType.chat,
        Priority = 0
      };
      xmpp.OnMessage += Xmpp_OnMessage;
      xmpp.OnAuthError += (o, e) => Session.Log(e);
      xmpp.OnError += (o, e) => Session.Log(e);
      xmpp.OnLogin += o => Session.Log("Connected to chat server");
      xmpp.Open(Session.Current.Account.LoginSession.AccountSummary.Username, "AIR_" + Session.Current.Account.LoginSession.Password);

      presence = new PresenceManager(xmpp);
      roster = new RosterManager(xmpp);
      lobby = new MucManager(xmpp);

      xmpp.OnRosterEnd += o => connected = true;
      xmpp.OnRosterItem += Xmpp_OnRosterItem;
      xmpp.OnPresence += Xmpp_OnPresence;

      timer = new Timer(1000) { AutoReset = true };
      timer.Elapsed += UpdateProc;
      timer.Start();
    }
Пример #13
0
 public FormConferention(string _roomJid, string _roomName, bool _savingHistory, bool _persistRoom, string _roomDesc = "", List<string> users = null )
 {
     InitializeComponent();
     roomJid = new Jid(_roomJid);
     roomName = _roomName;
     this.Text = _roomName;
     roomDesc = _roomDesc;
     mainJid = Settings.jid;
     nickname = Settings.nickname;
     xmpp = Settings.xmpp;
     muc = new MucManager(xmpp);
     savingHistory = _savingHistory ? "1" : "0";
     persistRoom = _persistRoom ? "1" : "0";
     //muc.AcceptDefaultConfiguration(roomJid, new IqCB(OnGetFieldsResult));
     muc.CreateReservedRoom(roomJid);
     muc.GrantOwnershipPrivileges(roomJid, new Jid(mainJid));
     muc.JoinRoom(roomJid, nickname);
     initMucConfig();
     xmpp.MesagageGrabber.Add(roomJid, new BareJidComparer(), new MessageCB(MessageCallback), null);
     xmpp.PresenceGrabber.Add(roomJid, new BareJidComparer(), new PresenceCB(PresenceCallback), null);
     muc.Invite(users.ConvertAll<Jid>(
         delegate(string jid)
         {
             return new Jid(jid);
         }
     ).ToArray(), roomJid, "Вы приглашены в конференцию Конф.");
 }
Пример #14
0
 public XmppChatClient(Jid jid, string password)
 {
     conn = CreateXmppConnection(jid.Server);
     OnChatMessageReceived += delegate { };
     this.jid = jid;
     this.password = password;
 }
Пример #15
0
 public Chat(Client c, XmppClientConnection xmpp)
 {
     _client = c;
     Rooms = new ThreadSafeList<NewChatRoom>();
     _xmpp = xmpp;
     _xmpp.OnMessage += XmppOnOnMessage;
 }
Пример #16
0
        public event MessageHandler Messages;//消息事件

        public XMPPClass(string strUserName, string strPassword, string strServer)
        {
            objXmpp = new agsXMPP.XmppClientConnection();

            if (strUserName.Split('@').Length == 1)
            {
                strUserName = strUserName + "@" + strServer;
            }

            agsXMPP.Jid jid = new agsXMPP.Jid(strUserName);
            objXmpp.Password = strPassword;
            objXmpp.Username = jid.User;
            objXmpp.Server   = jid.Server;
            objXmpp.AutoResolveConnectServer = true;

            try
            {
                objXmpp.OnLogin      += new ObjectHandler(objXmpp_OnLogin);                              //登录
                objXmpp.OnAuthError  += new XmppElementHandler(objXmpp_OnAuthError);                     //验证出错
                objXmpp.OnMessage    += new agsXMPP.protocol.client.MessageHandler(objXmpp_OnMessage);   //消息处理
                objXmpp.OnPresence   += new agsXMPP.protocol.client.PresenceHandler(objXmpp_OnPresence); //状态处理
                objXmpp.OnRosterItem += new XmppClientConnection.RosterHandler(objXmpp_OnRosterItem);    //加载好友列表

                objXmpp.Resource = "Maitiam IM";                                                         //客户端版本信息
                objXmpp.Open();
            }
            catch (System.Exception ex)
            {
                LogError(ex.ToString());
            }
        }
Пример #17
0
        /// <summary>
        /// 断线重登陆
        /// </summary>
        private void Login()
        {
            string strUserName      = this._UserName;
            string strPassword      = this._strPassword;
            string strServer        = this._strServer;
            string strServerName    = this._strServerName;
            string strMonitorServer = this._strMonitorServer;

            objXmpp = new agsXMPP.XmppClientConnection();

            if (strUserName.Split('@').Length == 1)
            {
                strUserName = strUserName + "@" + strServer;
            }

            agsXMPP.Jid jid = new agsXMPP.Jid(strUserName);
            objXmpp.Password = strPassword;
            objXmpp.Username = jid.User;
            objXmpp.Server   = jid.Server;
            objXmpp.AutoResolveConnectServer = true;

            objXmpp.OnLogin      += new ObjectHandler(objXmpp_OnLogin);                              //登录
            objXmpp.OnAuthError  += new XmppElementHandler(objXmpp_OnAuthError);                     //验证出错
            objXmpp.OnMessage    += new agsXMPP.protocol.client.MessageHandler(objXmpp_OnMessage);   //消息处理
            objXmpp.OnPresence   += new agsXMPP.protocol.client.PresenceHandler(objXmpp_OnPresence); //状态处理
            objXmpp.OnRosterItem += new XmppClientConnection.RosterHandler(objXmpp_OnRosterItem);    //加载好友列表
            objXmpp.OnRosterEnd  += new ObjectHandler(objXmpp_OnRosterEnd);                          //好友列表加载完成
            objXmpp.OnXmppConnectionStateChanged += new XmppConnectionStateHandler(objXmpp_OnXmppConnectionStateChanged);
            objXmpp.OnSocketError += new ErrorHandler(objXmpp_OnSocketError);
            objXmpp.OnError       += new ErrorHandler(objXmpp_OnError);
            objXmpp.Resource       = "Maitiam IM";//客户端版本信息
            objXmpp.ClientVersion  = "1.0";
            objXmpp.Status         = strServerName;
            objXmpp.Open();
        }
Пример #18
0
 public Form1(XmppClientConnection con)
 {
     InitializeComponent();
     connection = con;
     Jid jid_ = new Jid(tb_login.Text, tb_ip.Text, connection.Resource);
     jid = jid_.ToString();
 }
Пример #19
0
        public DiscoHelper(XmppClientConnection con)
        {
            xmppCon = con;
            con.OnIq += new IqHandler(con_OnIq);

            m_Features.Add(agsXMPP.Uri.DISCO_INFO);
        }
Пример #20
0
        public frmFileTransfer(XmppClientConnection XmppCon, IQ iq)
        {
            InitializeComponent();
            cmdSend.Enabled = false;
            this.Text = "Receive File from " + iq.From.ToString();

            siIq = iq;
            si = iq.SelectSingleElement(typeof(agsXMPP.protocol.extensions.si.SI)) as agsXMPP.protocol.extensions.si.SI;
            // get SID for file transfer
            m_Sid = si.Id;
            m_From = iq.From;

            file = si.File;

            if (file != null)
            {
                m_lFileLength = file.Size;

                this.lblDescription.Text    = file.Description;
                this.lblFileName.Text       = file.Name;
                this.lblFileSize.Text       = HRSize(m_lFileLength);
                this.txtDescription.Visible = false;
            }

            m_XmppCon = XmppCon;

            this.progress.Maximum = 100;
            //this.Text += iq.From.ToString();

            //this.tbFileSize.Text = FileTransferUtils.ConvertToByteString(m_lFileLength);

            XmppCon.OnIq += new IqHandler(XmppCon_OnIq);
        }
Пример #21
0
        public static void InitInstance(Jid client, string password)
        {
            RPCWrapper.con = new XmppClientConnection();
            RPCWrapper.client = client;

            RPCWrapper.con.Password = password;
            RPCWrapper.con.Username = client.User;
            RPCWrapper.con.Server = client.Server;
            RPCWrapper.con.AutoAgents = false;
            RPCWrapper.con.AutoPresence = true;
            RPCWrapper.con.AutoRoster = true;
            RPCWrapper.con.AutoResolveConnectServer = true;

            try
            {
                RPCWrapper.con.OnRosterStart += new ObjectHandler(RPCWrapper.OnRosterStart);
                RPCWrapper.con.OnRosterItem += new XmppClientConnection.RosterHandler(RPCWrapper.OnRosterItem);
                RPCWrapper.con.OnRosterEnd += new ObjectHandler(RPCWrapper.OnRosterEnd);
                RPCWrapper.con.OnPresence += new PresenceHandler(RPCWrapper.OnPresence);
                RPCWrapper.con.OnMessage += new MessageHandler(RPCWrapper.OnMessage);
                RPCWrapper.con.OnLogin += new ObjectHandler(RPCWrapper.OnLogin);

                RPCWrapper.con.Open();

            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Wait();

        }
Пример #22
0
        public RiotChat(string user, string pass)
        {
            xmpp = new XmppClientConnection();
            roster = new List<Presence>();

            xmpp.Username = user;
            xmpp.Password = "******" + pass;

            xmpp.Server = "pvp.net";
            xmpp.ConnectServer = "chat.na1.lol.riotgames.com";
            xmpp.Port = 5223;
            xmpp.AutoResolveConnectServer = false;
            xmpp.UseCompression = false;
            xmpp.UseStartTLS = false;
            xmpp.UseSSL = true;

            xmpp.OnAuthError += new XmppElementHandler(xmpp_OnEleError);
            xmpp.OnError += new ErrorHandler(xmpp_OnError);
            xmpp.OnStreamError += new XmppElementHandler(xmpp_OnEleError);
            xmpp.OnSocketError += new ErrorHandler(xmpp_OnError);

            xmpp.OnLogin += new ObjectHandler(xmpp_OnLogin);
            xmpp.OnPresence += new PresenceHandler(xmpp_OnPresence);
            xmpp.OnReadXml += new XmlHandler(xmpp_OnReadXML);
            xmpp.OnWriteXml += new XmlHandler(xmpp_OnWriteXML);
            xmpp.OnMessage += new MessageHandler(xmpp_OnMessage);

            xmpp.Open();
        }
 public GtalkCommunication(MainWindow _mw, ChatWindows _cw)
 {
     cm = ContactManager.getInstance();
     xmppCon = new XmppClientConnection();
     mW = _mw;
     cW = _cw;
 }
Пример #24
0
        public override void Init(XmppClientConnection con)
        {
            m_XmppClient = con;

            // <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">$Message</auth>
            m_XmppClient.Send(new protocol.sasl.Auth(protocol.sasl.MechanismType.PLAIN, Message()));
        }
Пример #25
0
        public frmGroupChat(XmppClientConnection xmppCon, Jid roomJid)
        {
            InitializeComponent();
            this.rtfSend.Select();
            _roomJid = roomJid;
            _xmppCon = xmppCon;
            this.groupChatServerLabel.Text = "Room Name: " + _roomJid.User;
            frmInputBox input = new frmInputBox("Nickname", "Nickname");

            if (!Util.GroupChatForms.Contains(roomJid.Bare) && input.ShowDialog() == DialogResult.OK)
            {
                _nickname = input.Result;
                Util.GroupChatForms.Add(roomJid.Bare.ToLower(), this);
                this.Show();
            }
            else
            {
                return;
            }

            // Setup new Message Callback
            _xmppCon.MessageGrabber.Add(roomJid, new BareJidComparer(), new MessageCB(MessageCallback), null);

            // Setup new Presence Callback
            _xmppCon.PresenceGrabber.Add(roomJid, new BareJidComparer(), new PresenceCB(PresenceCallback), null);
        }
Пример #26
0
        public FileTransfer(XmppClientConnection xmppCon, IQ iq, IContact from)
            : base(from)
        {
            _siIq = iq;
            _si = iq.SelectSingleElement(typeof (SI)) as SI;

            if (_si != null)
            {
                // get SID for file transfer
                _sid = _si.Id;
                _file = _si.File;

                Contact = from;

                if (_file != null)
                {
                    _fileLength = _file.Size;

                    FileDescription = _file.Description;
                    FileName = _file.Name;
                }

                _xmppConnection = xmppCon;
            }
        }
Пример #27
0
 public RosterObesrver(Client client, XmppClientConnection connection)
 {
     _dispatcher = Dispatcher.CurrentDispatcher;
     _connection = connection;
     _listHandler = new RosterListHandler(client);
     _itemHandler = new RosterItemHandler(client);
 }
Пример #28
0
        public FileTransfer(XmppClientConnection xmppCon, IContact recipient, string filename)
            : base(recipient, filename)
        {
            _xmppConnection = xmppCon;

            _fileLength = new FileInfo(filename).Length;
        }
 public XmppTournamentManagerHost(RoundRobinTournamentManager tournamentManager, XmppClientConnection xmppConnection)
     : base(xmppConnection)
 {
     TournamentManager = tournamentManager;
     TournamentManager = tournamentManager;
     TournamentManager.TournamentStarted += TournamentStartedHandler;
     TournamentManager.GameBotCreated += GameBotCreatedHandler;
 }
Пример #30
0
        public ServiceDiscvoryManager(XmppClientConnection client, Action<Jid> callback)
        {
            this.callback = callback;
            discoManager = new DiscoManager(client);

            search = new Queue<Jid>();
            search.Enqueue(new Jid(client.Server));
        }
Пример #31
0
 public ClientContext(Client client)
 {
     Client = client;
     _connection = AppServices
             .Get<IConnectionManager>()
             .GetOrCreateConnection(Client)
             .Connection;
 }
Пример #32
0
        /// <summary>
        /// 登录CTALK
        /// </summary>
        /// <param name="strUserName"></param>
        /// <param name="strPassword"></param>
        public void Login(string strUserName, string strPassword)
        {
            objXmpp = new agsXMPP.XmppClientConnection();

            if (strUserName.Split('@').Length == 1)
            {
                strUserName = strUserName + "@ishow.xba.com.cn";
            }

            agsXMPP.Jid jid = new agsXMPP.Jid(strUserName);
            objXmpp.Password = strPassword;
            objXmpp.Username = jid.User;
            objXmpp.Server   = jid.Server;
            objXmpp.AutoResolveConnectServer = true;

            try
            {
                objXmpp.OnLogin           += new agsXMPP.ObjectHandler(objXmpp_OnLogin);                    //登录
                objXmpp.OnAuthError       += new agsXMPP.XmppElementHandler(objXmpp_OnAuthError);           //验证出错
                objXmpp.OnMessage         += new agsXMPP.protocol.client.MessageHandler(objXmpp_OnMessage); //接收消息
                objXmpp.OnPresence        += new PresenceHandler(objXmpp_OnPresence);                       //状态处理
                objXmpp.OnRosterItem      += new XmppClientConnection.RosterHandler(objXmpp_OnRosterItem);  //加载好友列表
                objXmpp.OnReadSocketData  += new agsXMPP.net.BaseSocket.OnSocketDataHandler(objXmpp_OnReadSocketData);
                objXmpp.OnWriteSocketData += new agsXMPP.net.BaseSocket.OnSocketDataHandler(objXmpp_OnWriteSocketData);
                objXmpp.OnRosterEnd       += new ObjectHandler(objXmpp_OnRosterEnd);
                objXmpp.OnIq          += new IqHandler(objXmpp_OnIq);
                objXmpp.OnSocketError += new ErrorHandler(objXmpp_OnSocketError);
                objXmpp.OnStreamError += new XmppElementHandler(objXmpp_OnStreamError);
                objXmpp.OnXmppConnectionStateChanged += new XmppConnectionStateHandler(objXmpp_OnXmppConnectionStateChanged);
                objXmpp.Resource = "Maitiam IM";//客户端版本信息
                objXmpp.Open();

                G_Status("Login", "【正在登陆】");
            }
            catch (System.Exception ex)
            {
                G_Status("Error", ex.ToString());
            }
        }
Пример #33
0
 public void init(agsXMPP.XmppClientConnection client)
 {
     this.conn    = client;
     client.OnIq += OnJingleIq;
 }
Пример #34
-1
        static GameBot()
        {
            //#if(DEBUG)
            Xmpp = new XmppClientConnection("skylabsonline.com");
            //#else
            //            Xmpp = new XmppClientConnection();
            //            Xmpp.ConnectServer = "127.0.0.1";
            //            Xmpp.AutoResolveConnectServer = false;
            //#endif

            Xmpp.RegisterAccount = false;
            Xmpp.AutoAgents = true;
            Xmpp.AutoPresence = true;
            Xmpp.AutoRoster = true;
            Xmpp.Username = "******";
            Xmpp.Password = "******";//Don't commit real password

            Xmpp.Priority = 1;
            Xmpp.OnLogin += XmppOnOnLogin;
            Xmpp.OnMessage += XmppOnOnMessage;
            Xmpp.OnIq += XmppOnOnIq;
            Xmpp.OnError += XmppOnOnError;
            Xmpp.OnAuthError += new XmppElementHandler(Xmpp_OnAuthError);
            Xmpp.OnReadXml += XmppOnOnReadXml;
            Xmpp.OnPresence += XmppOnOnPresence;
            Xmpp.OnWriteXml += XmppOnOnWriteXml;
            Xmpp.OnXmppConnectionStateChanged += XmppOnOnXmppConnectionStateChanged;
            _userList = new ThreadSafeList<Jid>();
            Xmpp.Open();
        }