/// <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(); }
/// <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(); }
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(); }
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(); }
/* 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; }
private void m_stream_OnConnect(object sender, StanzaStream stream) { // I think this is right. Double check. rtDebug.Clear(); }