Пример #1
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();
        }
Пример #2
0
        public void RemakeXmpp()
        {
            if (Xmpp != null)
            {
                Xmpp.OnXmppConnectionStateChanged -= XmppOnOnXmppConnectionStateChanged;
                Xmpp.OnMessage     -= XmppOnOnMessage;
                Xmpp.OnError       -= XmppOnOnError;
                Xmpp.OnAuthError   -= Xmpp_OnAuthError;
                Xmpp.OnStreamError -= XmppOnOnStreamError;
                Xmpp.OnAgentStart  -= XmppOnOnAgentStart;
                Xmpp.Close();
                Xmpp = null;
            }
            Xmpp = new XmppClientConnection(AppConfig.Instance.ServerPath);
            ElementFactory.AddElementType("hostgamerequest", "octgn:hostgamerequest", typeof(HostGameRequest));

            Xmpp.RegisterAccount               = false;
            Xmpp.AutoAgents                    = true;
            Xmpp.AutoPresence                  = true;
            Xmpp.AutoRoster                    = true;
            Xmpp.Username                      = AppConfig.Instance.XmppUsername;
            Xmpp.Password                      = AppConfig.Instance.XmppPassword;
            Xmpp.Priority                      = 1;
            Xmpp.OnMessage                    += XmppOnOnMessage;
            Xmpp.OnError                      += XmppOnOnError;
            Xmpp.OnAuthError                  += Xmpp_OnAuthError;
            Xmpp.OnStreamError                += XmppOnOnStreamError;
            Xmpp.KeepAlive                     = true;
            Xmpp.KeepAliveInterval             = 60;
            Xmpp.OnAgentStart                 += XmppOnOnAgentStart;
            Xmpp.OnXmppConnectionStateChanged += XmppOnOnXmppConnectionStateChanged;
            Xmpp.Open();
        }
Пример #3
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     if (Xmpp != null)
     {
         Xmpp.OnMessage     -= XmppOnOnMessage;
         Xmpp.OnError       -= XmppOnOnError;
         Xmpp.OnAuthError   -= Xmpp_OnAuthError;
         Xmpp.OnStreamError -= XmppOnOnStreamError;
         Xmpp.OnAgentStart  -= XmppOnOnAgentStart;
         Xmpp.OnXmppConnectionStateChanged -= XmppOnOnXmppConnectionStateChanged;
         try { Xmpp.Close(); }
         catch { }
     }
     userRequests.Dispose();
     refreshGamesTimer.Elapsed -= RefreshGamesTimerOnElapsed;
 }
Пример #4
0
        public static void RemakeXmpp()
        {
            if (Xmpp != null)
            {
                Xmpp.OnXmppConnectionStateChanged -= XmppOnOnXmppConnectionStateChanged;
                Xmpp.Close();
                Xmpp = null;
            }
            Xmpp = new XmppClientConnection(ServerPath);
            //#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                      = XmppUsername;
            Xmpp.Password                      = XmppPassword;//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.OnStreamError                += XmppOnOnStreamError;
            Xmpp.KeepAlive                     = true;
            Xmpp.KeepAliveInterval             = 60;
            Xmpp.OnAgentStart                 += XmppOnOnAgentStart;
            Xmpp.OnXmppConnectionStateChanged += XmppOnOnXmppConnectionStateChanged;
            _userList                          = new ThreadSafeList <Jid>();
            Xmpp.Open();
        }