Beispiel #1
0
        /// <summary>
        /// Listens for connections from the XMPP server and is used for components only.
        /// </summary>
        protected virtual void Accept()
        {
            if ((m_stanzas == null) || (!m_stanzas.Acceptable))
                m_stanzas = StanzaStream.Create(this.Connection, this);

            lock (StateLock)
            {
                this.State = AcceptingState.Instance;
                m_reconnect = ((int)this[Options.RECONNECT_TIMEOUT] >= 0);
            }
            m_stanzas.Accept();
        }
Beispiel #2
0
        /// <summary>
        /// Starts connecting to the XMPP server.  This is done asyncronously.
        /// </summary>
        public virtual void Connect()
        {
            this[Options.CURRENT_KEEP_ALIVE] = -1;
            m_stanzas = StanzaStream.Create(this.Connection, this);

            lock (StateLock)
            {
                State = ConnectingState.Instance;
                m_reconnect = ((int)this[Options.RECONNECT_TIMEOUT] >= 0);
            }
            m_stanzas.Connect();
        }
Beispiel #3
0
        void IStanzaEventListener.Closed()
        {
            lock (StateLock)
            {
                State = ClosedState.Instance;

                if ((m_stanzas != null) && (!m_stanzas.Acceptable))
                    m_stanzas = null;

                m_sslOn = false;
                m_compressionOn = false;
            }

            if (OnDisconnect != null)
            {
                if (InvokeRequired)
                    CheckedInvoke(OnDisconnect, new object[] { this });
                else
                    OnDisconnect(this);
            }

            TryReconnect();
        }
Beispiel #4
0
        void IStanzaEventListener.Errored(Exception ex)
        {
            m_reconnect = false;

            lock (m_stateLock)
            {
                State = ClosedState.Instance;

                if ((m_stanzas != null) && (!m_stanzas.Acceptable))
                    m_stanzas = null;
            }

            if (OnError != null)
            {
                if (InvokeRequired)
                    CheckedInvoke(OnError, new object[] { this, ex });
                else
                    OnError(this, ex);
            }

            // TODO: Figure out what the "good" errors are, and try to
            // reconnect.  There are too many "bad" errors to just let this fly.
            //TryReconnect();
        }
Beispiel #5
0
 static void jc_OnConnect(object sender, StanzaStream stream)
 {
     Console.WriteLine("Connected");
 }
Beispiel #6
0
        /*
        private void mnuOffline_Click(object sender, EventArgs e)
        {
            if (jc.IsAuthenticated)
                jc.Close();
        }
         */

        void jc_OnConnect(object sender, StanzaStream stream)
        {
            m_err = false;
            m_connected = true;
        }