예제 #1
0
 public XmppClient(string url, string username, string password)
 {
     _url      = url;
     _username = username;
     _password = password;
     Messanger = new Messanger();
 }
예제 #2
0
        private void RemakeXmpp()
        {
            if (Xmpp != null)
            {
                Xmpp.OnXmppConnectionStateChanged -= XmppOnOnXmppConnectionStateChanged;
                Xmpp.Close();
                Xmpp = null;
            }
            Xmpp = new XmppClientConnection(_url);
            //ElementFactory.AddElementType("hostgamerequest", "octgn:hostgamerequest", typeof(HostGameRequest));

            Xmpp.RegisterAccount               = false;
            Xmpp.AutoAgents                    = true;
            Xmpp.AutoPresence                  = true;
            Xmpp.AutoRoster                    = true;
            Xmpp.Username                      = _username;
            Xmpp.Password                      = _password;
            Xmpp.Priority                      = 1;
            Xmpp.OnError                      += XmppOnOnError;
            Xmpp.OnAuthError                  += Xmpp_OnAuthError;
            Xmpp.OnStreamError                += XmppOnOnStreamError;
            Xmpp.OnLogin                      += XmppOnLogin;
            Xmpp.KeepAlive                     = true;
            Xmpp.KeepAliveInterval             = 60;
            Xmpp.OnAgentStart                 += XmppOnOnAgentStart;
            Xmpp.OnXmppConnectionStateChanged += XmppOnOnXmppConnectionStateChanged;
            Xmpp.Open();
            OnResetXmpp();
            Messanger.OnResetXmpp(Xmpp);
        }
예제 #3
0
 public virtual void Dispose()
 {
     if (Xmpp != null)
     {
         Xmpp.OnError       -= XmppOnOnError;
         Xmpp.OnAuthError   -= Xmpp_OnAuthError;
         Xmpp.OnStreamError -= XmppOnOnStreamError;
         Xmpp.OnAgentStart  -= XmppOnOnAgentStart;
         Xmpp.OnXmppConnectionStateChanged -= XmppOnOnXmppConnectionStateChanged;
         Xmpp.OnLogin -= XmppOnLogin;
         try { Xmpp.Close(); }
         catch { }
     }
     if (Messanger != null)
     {
         Messanger.Dispose();
     }
 }