private void OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { if (state == XmppConnectionState.Disconnected) { Client.State = ClientState.Disconnected; } }
private void ConnectiOnXmppConnectionStateChanged(object sender, XmppConnectionState state) { if (GetChatClientState(state) == ChatClientState.Disconnected) { OnDisconnected(); } }
private static ChatClientState GetChatClientState(XmppConnectionState state) { switch (state) { case XmppConnectionState.Disconnected: { return(ChatClientState.Disconnected); } case XmppConnectionState.Connecting: case XmppConnectionState.Authenticating: case XmppConnectionState.Binding: case XmppConnectionState.StartSession: case XmppConnectionState.StartCompression: case XmppConnectionState.Compressed: case XmppConnectionState.SessionStarted: case XmppConnectionState.Securing: case XmppConnectionState.Registering: case XmppConnectionState.Registered: { return(ChatClientState.Connecting); } case XmppConnectionState.Connected: case XmppConnectionState.Authenticated: case XmppConnectionState.Binded: { return(ChatClientState.Connected); } } return(ChatClientState.Disconnected); }
private void XmppCon_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Dispatcher.BeginInvoke(new Action(() => { loader.stat.Text = state.ToString(); })); }
/// <summary> /// Initializes the connection instance /// </summary> private void Initialize() { state = XmppConnectionState.Opening; initializedStreamEvent = new AutoResetEvent(false); streamFeaturesEvent = new AutoResetEvent(false); bindResourceEvent = new AutoResetEvent(false); }
private void OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Console.WriteLine("Conn State Changed: " + state.ToString()); if (state == XmppConnectionState.Disconnected) { // Reconnect here } }
private static void XmppOnOnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Trace.WriteLine("[Bot]ConState:" + state.ToString()); if (state == XmppConnectionState.Disconnected) { RemakeXmpp(); } }
private void XmppOnOnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Log.InfoFormat("[Bot]Connection State Changed To {0}", state); if (state == XmppConnectionState.Disconnected) { RemakeXmpp(); } }
/// <summary> /// The lobby client on on state changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="state"> /// The state. /// </param> private void LobbyClientOnOnStateChanged(object sender, XmppConnectionState state) { this.ConnectMessage = state == XmppConnectionState.Disconnected ? string.Empty : state.ToString(); if (state == XmppConnectionState.Disconnected) { this.SetStateOffline(); } }
void objXmpp_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Console.WriteLine("1." + state.ToString()); if (state.ToString() == "Disconnected") { Login("test1", "qweqwe123"); } }
void XmppCon_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { if (InvokeRequired) { BeginInvoke(new XmppConnectionStateHandler(XmppCon_OnXmppConnectionStateChanged), new object[] { sender, state }); return; } AddLog("OnXmppConnectionStateChanged: " + state.ToString()); }
/// <summary> /// 状态发生改变使用该函数 /// </summary> /// <param name="state"></param> private void DoChangeXmppConnectionState(XmppConnectionState state) { m_ConnectionState = state; if (OnXmppConnectionStateChanged != null) { OnXmppConnectionStateChanged(this, state); } }
internal void DoChangeXmppConnectionState(XmppConnectionState state) { XmppConnectionState = state; if (OnXmppConnectionStateChanged != null) { OnXmppConnectionStateChanged(this, state); } }
//状态改变 void objXmpp_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { lib.LogTrace(state.ToString()); if (state.ToString() == "Disconnected") { ConnectChange("Disconnected"); if (thSendMessage.ThreadState == ThreadState.Running) { thSendMessage.Suspend(); } Login(); } }
private void XmppOnOnXmppConnectionStateChanged(object sender, XmppConnectionState state) { try { Log.InfoFormat("[Bot]Connection State Changed To {0}", state); if (state == XmppConnectionState.Disconnected) { RemakeXmpp(); } } catch (Exception e) { Log.Error("XmppOnOnXmppConnectionStateChanged", e); } }
private void XmppOnOnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Trace.WriteLine("[Xmpp]State: " + state.ToString()); if (OnStateChanged != null) { OnStateChanged.Invoke(this, state.ToString()); } if (state == XmppConnectionState.Disconnected) { if (OnDisconnect != null) { OnDisconnect.Invoke(this, null); } } }
/// <summary> /// The xmpp on on xmpp connection state changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="state"> /// The state. /// </param> private void XmppOnOnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Log.InfoFormat("Xmpp Connection State Changed To {0}", state); Trace.WriteLine("[Xmpp]State: " + state.ToString()); if (this.OnStateChanged != null) { this.OnStateChanged.Invoke(this, state); } if (state == XmppConnectionState.Disconnected) { if (this.OnDisconnect != null) { this.OnDisconnect.Invoke(this, null); } } }
private void OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { if (state == XmppConnectionState.Disconnected) { Logger.Warn("XMPP connection is disconnected"); if (_loginTcs.Task.IsCompleted) { lock (_connectSync) { AttemptReconnect(); } } } else if (state != XmppConnectionState.Connecting) { Logger.Info("XMPP connection changed - " + state.GetDescription()); } }
public XmppWebSocketConnection(JID jid, string password, string websocketUri) : base(jid, password) { Capabilities = new CapabilitiesManager { Identity = new Identity { Category = "client", IdentityType = "mobile", IdentityName = "SharpXMPP" }, Node = "http://bggg.net.ru/caps", Features = new List <string> { Namespaces.DiscoInfo, Namespaces.DiscoItems } }; IqTracker = new XMPP.Client.IqHandler(this) { ResponseHandlers = new Dictionary <string, ResponseHandler>(), PayloadHandlers = new List <PayloadHandler> { new InfoHandler(Capabilities), new ItemsHandler() } }; Iq += (sender, iq) => IqTracker.Handle(iq); // ReSharper disable RedundantArgumentDefaultValue _connection = new WebSocket(websocketUri, "xmpp", cookies: (List <KeyValuePair <string, string> >)null); // ReSharper restore RedundantArgumentDefaultValue _connection.Opened += (sender, args) => { _currentState = XmppConnectionState.Connected; RestartStream(); }; _connection.MessageReceived += (sender, args) => { if (_currentState == XmppConnectionState.Connected) { ReadStreamStart(args.Message); _currentState = XmppConnectionState.StreamInitiated; } else if (_currentState == XmppConnectionState.StreamAuthenticated) { ReadStreamStart(args.Message); _currentState = XmppConnectionState.StreamResourceBindingRequest; } else { var currentStanza = Stanza.Parse(args.Message); OnElement(new ElementArgs { IsInput = false, Stanza = currentStanza }); var error = Stanza.Parse <StreamError>(currentStanza); if (error != null) { OnConnectionFailed(new ConnFailedArgs { Message = error.Value }); return; } switch (_currentState) { case XmppConnectionState.StreamInitiated: var features = Stanza.Parse <Features>(currentStanza); authenticator = SASLHandler.Create(features.SaslMechanisms, Jid, Password); if (authenticator == null) { OnConnectionFailed(new ConnFailedArgs { Message = "supported sasl mechanism not available" }); return; } var auth = new SASLAuth(); auth.SetAttributeValue("mechanism", authenticator.SASLMethod); var authInit = authenticator.Initiate(); if (!string.IsNullOrEmpty(authInit)) { auth.SetValue(authInit); } Send(auth); _currentState = XmppConnectionState.StreamAuthenticating; break; case XmppConnectionState.StreamAuthenticating: switch (currentStanza.Name.LocalName) { case "success": _currentState = XmppConnectionState.StreamAuthenticated; RestartStream(); break; case "failure": OnConnectionFailed(new ConnFailedArgs { Message = currentStanza.Value }); _currentState = XmppConnectionState.Disconnected; return; case "challenge": var response = new SASLResponse(); response.SetValue( authenticator.NextChallenge(currentStanza.Value)); Send(response); break; } break; case XmppConnectionState.StreamResourceBindingRequest: // todo: parse features of negotiated stream //Stanza.Parse<Features>(currentStanza); var bind = new Bind(Jid.Resource); var iq = new Iq(XMPP.Client.Elements.Iq.IqTypes.set); iq.Add(bind); Send(iq); _currentState = XmppConnectionState.StreamResourceBindingResponse; break; case XmppConnectionState.StreamResourceBindingResponse: var bindedJid = currentStanza.Element( XNamespace.Get(Namespaces.XmppBind) + "bind"); if (bindedJid == null) { OnConnectionFailed(new ConnFailedArgs { Message = "bind failed" }); _currentState = XmppConnectionState.Disconnected; } else { var sess = new XElement( XNamespace.Get(Namespaces.XmppSession) + "session"); var sessIq = new Iq(XMPP.Client.Elements.Iq.IqTypes.set); sessIq.Add(sess); Send(sessIq); _currentState = XmppConnectionState.StreamSessionNoOp; Jid = new JID( bindedJid.Element( XNamespace.Get(Namespaces.XmppBind) + "jid") .Value); } break; case XmppConnectionState.StreamSessionNoOp: OnSignedIn(new SignedInArgs { Jid = Jid }); Roster.Query(this); var initPresence = new Presence(Capabilities); Send(initPresence); _currentState = XmppConnectionState.StreamNegotiated; break; case XmppConnectionState.StreamNegotiated: if (currentStanza.Name.LocalName.Equals("iq")) { OnIq(Stanza.Parse <Iq>(currentStanza)); } if (currentStanza.Name.LocalName.Equals("message")) { OnMessage(Stanza.Parse <Message>(currentStanza)); } break; default: throw new IOException("Invalid state"); } } }; }
/// <summary> /// Closes the connection /// </summary> public void Close() { if (state != XmppConnectionState.Closed) { if (ConnectionClosing != null) { ConnectionClosing(this, new EventArgs()); } try { state = XmppConnectionState.Closing; if (transport != null) { transport.Close(); } } catch { } finally { if (initializedStreamEvent != null) { initializedStreamEvent.Set(); initializedStreamEvent = null; } if (streamFeaturesEvent != null) { streamFeaturesEvent.Set(); streamFeaturesEvent = null; } if (bindResourceEvent != null) { bindResourceEvent.Set(); bindResourceEvent = null; } if (initializedStreamEvent != null) { initializedStreamEvent.Close(); initializedStreamEvent = null; } if (streamFeaturesEvent != null) { streamFeaturesEvent.Close(); streamFeaturesEvent = null; } if (bindResourceEvent != null) { bindResourceEvent.Close(); bindResourceEvent = null; } if (transportMessageSubscription != null) { transportMessageSubscription.Dispose(); transportMessageSubscription = null; } if (transportStreamInitializedSubscription != null) { transportStreamInitializedSubscription.Dispose(); transportStreamInitializedSubscription = null; } if (transportStreamClosedSubscription != null) { transportStreamClosedSubscription.Dispose(); transportStreamClosedSubscription = null; } if (transport != null) { transport = null; } streamFeatures = streamFeatures & (~streamFeatures); state = XmppConnectionState.Closed; connectionString = null; userId = null; } if (ConnectionClosed != null) { ConnectionClosed(this, new EventArgs()); } } }
public override Task ConnectAsync(CancellationToken token) { return(Task.Run(async() => { if (string.IsNullOrEmpty(websocketUri)) { var lookup = new LookupClient(); var response = await lookup.QueryAsync("_xmppconnect." + Jid.Domain, QueryType.TXT); if (response.Answers.TxtRecords().Any()) { foreach (var srv in response.Answers.TxtRecords()) { foreach (var addr in srv.Text) { if (addr.StartsWith("_xmpp-client-websocket")) { websocketUri = addr.Split('=')[1]; break; } } } } } if (string.IsNullOrEmpty(websocketUri)) { OnConnectionFailed(new ConnFailedArgs { Message = "WebSocket URI is not resolved or set." }); return; } _connection = new WebSocket(websocketUri, "xmpp", WebSocketVersion.Rfc6455); _connection.Opened += (sender, args) => { _currentState = XmppConnectionState.Connected; RestartStream(); }; _connection.MessageReceived += (sender, args) => { OnElement(new ElementArgs { IsInput = true, Stanza = XElement.Parse(args.Message) }); if (_currentState == XmppConnectionState.Connected) { ReadStreamStart(args.Message); _currentState = XmppConnectionState.StreamInitiated; } else if (_currentState == XmppConnectionState.StreamAuthenticated) { ReadStreamStart(args.Message); _currentState = XmppConnectionState.StreamResourceBindingRequest; } else { var currentStanza = XElement.Parse(args.Message); var error = Stanza.Parse <StreamError>(currentStanza); if (error != null) { OnConnectionFailed(new ConnFailedArgs { Message = error.Value }); return; } switch (_currentState) { case XmppConnectionState.StreamInitiated: var features = Stanza.Parse <Features>(currentStanza); authenticator = SASLHandler.Create(features.SaslMechanisms, Jid, Password); if (authenticator == null) { OnConnectionFailed(new ConnFailedArgs { Message = "supported sasl mechanism not available" }); return; } var auth = new SASLAuth(); auth.SetAttributeValue("mechanism", authenticator.SASLMethod); var authInit = authenticator.Initiate(); if (!string.IsNullOrEmpty(authInit)) { auth.SetValue(authInit); } Send(auth); _currentState = XmppConnectionState.StreamAuthenticating; break; case XmppConnectionState.StreamAuthenticating: switch (currentStanza.Name.LocalName) { case "success": _currentState = XmppConnectionState.StreamAuthenticated; RestartStream(); break; case "failure": OnConnectionFailed(new ConnFailedArgs { Message = currentStanza.Value }); _currentState = XmppConnectionState.Disconnected; return; case "challenge": var response = new SASLResponse(); response.SetValue( authenticator.NextChallenge(currentStanza.Value)); Send(response); break; } break; case XmppConnectionState.StreamResourceBindingRequest: // todo: parse features of negotiated stream //Stanza.Parse<Features>(currentStanza); var bind = new Bind(Jid.Resource); var iq = new XMPPIq(XMPPIq.IqTypes.set); iq.Add(bind); Send(iq); _currentState = XmppConnectionState.StreamResourceBindingResponse; break; case XmppConnectionState.StreamResourceBindingResponse: var bindedJid = currentStanza.Element( XNamespace.Get(Namespaces.XmppBind) + "bind"); if (bindedJid == null) { OnConnectionFailed(new ConnFailedArgs { Message = "bind failed" }); _currentState = XmppConnectionState.Disconnected; } else { var sess = new XElement( XNamespace.Get(Namespaces.XmppSession) + "session"); var sessIq = new XMPPIq(XMPPIq.IqTypes.set); sessIq.Add(sess); Send(sessIq); _currentState = XmppConnectionState.StreamSessionNoOp; Jid = new JID( bindedJid.Element( XNamespace.Get(Namespaces.XmppBind) + "jid") .Value); } break; case XmppConnectionState.StreamSessionNoOp: OnSignedIn(new SignedInArgs { Jid = Jid }); _currentState = XmppConnectionState.StreamNegotiated; break; case XmppConnectionState.StreamNegotiated: if (currentStanza.Name.LocalName.Equals("iq")) { OnIq(Stanza.Parse <XMPPIq>(currentStanza)); } if (currentStanza.Name.LocalName.Equals("message")) { OnMessage(Stanza.Parse <XMPPMessage>(currentStanza)); } if (currentStanza.Name.LocalName.Equals("presence")) { OnPresence(Stanza.Parse <XMPPPresence>(currentStanza)); } break; default: throw new IOException("Invalid state"); } } }; _connection.Open(); })); }
private void XmppOnOnXmppConnectionStateChanged(object sender, XmppConnectionState state) { if (OnStateChanged != null) OnStateChanged.Invoke(this, state.ToString()); }
private void xmpp_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { _logger.Debug("OnXmppConnectionStateChanged : Connection State - {0}", state); }
private void XmppCon_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Console.WriteLine("OnXmppConnectionStateChanged: " + state.ToString()); if (base.InvokeRequired) { base.BeginInvoke(new OnXmppConnectionStateChangedDelegate(this.XmppCon_OnXmppConnectionStateChanged), new object[] { sender, state }); } else { XmppConnectionState state2 = state; if (state2 != 0) { if (state2 == 4) { this.statusBar1.Text = "在线"; } } else { this.statusBar1.Text = "离线"; } } }
private void OnStatusChange(object sender, XmppConnectionState state) { Status = state.ToString(); }
void _xmppConnection_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Trace.WriteLine(String.Format("XMPPConnection State: {0}", state)); }
private void XmppOnOnXmppConnectionStateChanged(object sender , XmppConnectionState state) { Log.InfoFormat("[Bot]Connection State Changed To {0}",state); if(state == XmppConnectionState.Disconnected) RemakeXmpp(); }
/// <summary> /// Opens the connection /// </summary> /// <param name = "connectionString">The connection string used for authentication.</param> public void Open(string connectionString) { if (state == XmppConnectionState.Open) { throw new XmppException("Connection must be closed first."); } try { // Initialization Initialize(); // Build the connection string this.connectionString = new XmppConnectionString(connectionString); userId = this.connectionString.UserId; // Connect to the server if (this.connectionString.UseHttpBinding) { transport = new HttpTransport(); } else { transport = new TcpTransport(); } transportMessageSubscription = transport .OnMessageReceived .Subscribe(message => OnTransportMessageReceived(message)); transportStreamInitializedSubscription = transport .OnXmppStreamInitialized .Subscribe(message => OnTransportXmppStreamInitialized(message)); transportStreamClosedSubscription = transport .OnXmppStreamClosed .Subscribe(message => OnTransportXmppStreamClosed(message)); transport.Open(this.connectionString); // Initialize XMPP Stream InitializeXmppStream(); // Wait until we receive the Stream features WaitForStreamFeatures(); if (transport is ISecureTransport) { if (this.connectionString.PortNumber != 443 && this.connectionString.PortNumber != 5223) { if (SupportsFeature(XmppStreamFeatures.SecureConnection)) { ((ISecureTransport)transport).OpenSecureConnection(); // Wait until we receive the Stream features WaitForStreamFeatures(); } } } // Perform authentication bool authenticationDone = Authenticate(); if (authenticationDone) { // Resource Binding. BindResource(); // Open the session OpenSession(); // Update state state = XmppConnectionState.Open; } } catch (Exception ex) { if (AuthenticationFailiure != null) { AuthenticationFailiure(this, new XmppAuthenticationFailiureEventArgs(ex.ToString())); } Close(); } }
void connection_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { //if(state == XmppConnectionState.SessionStarted) // this.connection.RequestRoster(); }
private static void OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { //Log("Xmpp state changed, new state: " + state); }
/// <summary> /// Opens the connection /// </summary> /// <param name = "connectionString">The connection string used for authentication.</param> public void Open(string connectionString) { if (state == XmppConnectionState.Open) { throw new XmppException("Connection must be closed first."); } try { // Initialization Initialize(); // Build the connection string this.connectionString = new XmppConnectionString(connectionString); userId = this.connectionString.UserId; // Connect to the server if (this.connectionString.UseHttpBinding) { transport = new HttpTransport(); } else { transport = new TcpTransport(); } transportMessageSubscription = transport .OnMessageReceived .Subscribe(message => OnTransportMessageReceived(message)); transportStreamInitializedSubscription = transport .OnXmppStreamInitialized .Subscribe(message => OnTransportXmppStreamInitialized(message)); transportStreamClosedSubscription = transport .OnXmppStreamClosed .Subscribe(message => OnTransportXmppStreamClosed(message)); transport.Open(this.connectionString); // Initialize XMPP Stream InitializeXmppStream(); // Wait until we receive the Stream features WaitForStreamFeatures(); if (transport is ISecureTransport) { if (this.connectionString.PortNumber != 443 && this.connectionString.PortNumber != 5223) { if (SupportsFeature(XmppStreamFeatures.SecureConnection)) { ((ISecureTransport) transport).OpenSecureConnection(); // Wait until we receive the Stream features WaitForStreamFeatures(); } } } // Perform authentication bool authenticationDone = Authenticate(); if (authenticationDone) { // Resource Binding. BindResource(); // Open the session OpenSession(); // Update state state = XmppConnectionState.Open; } } catch (Exception ex) { if (AuthenticationFailiure != null) { AuthenticationFailiure(this, new XmppAuthenticationFailiureEventArgs(ex.ToString())); } Close(); } }
private void XmppOnOnXmppConnectionStateChanged(object sender, XmppConnectionState state) { try { Log.InfoFormat("[Bot]Connection State Changed To {0}", state); if (state == XmppConnectionState.Disconnected) RemakeXmpp(); } catch (Exception e) { Log.Error("XmppOnOnXmppConnectionStateChanged", e); } }
private void HandleConnectionState(XmppConnectionState connectionState) { if (connectionState == XmppConnectionState.Disconnected && disconnectCount <= MAXDISCONNECTS) { disconnectCount++; xmpp.Open(); messageStack.Push("I reconnected"); } else if (disconnectCount > MAXDISCONNECTS) { this.CloseTarget(); } }
private void XmppOnXmppConnectionStateChanged(object sender, XmppConnectionState state) => Trace();
public void xmpp_OnConnectionStatusChanged(object sender, XmppConnectionState state) { string text = state.ToString(); SetTextInLabel("Status: " + text, statusLabel); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="state"></param> private void XmppConnectionStateHandler(object sender, XmppConnectionState state) { Trace.WriteLine("XMPP state change: " + state.ToString()); }
internal void DoChangeXmppConnectionState(XmppConnectionState state) { this.m_ConnectionState = state; OnXmppConnectionStateChanged?.Invoke(this, state); }
private void OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { _log.InfoFormat("State changed client {0} state {1}", Client.Id, state); if (state == XmppConnectionState.Disconnected) { State = ClientState.Disconnected; } else if (state == XmppConnectionState.SessionStarted) { State = ClientState.Connected; } else { State = ClientState.Connecting; } }
void _xmppCon_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { this.EventLog.WriteEntry("Status changed : " + state.ToString()); }
private void XmppCon_OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Console.WriteLine("OnXmppConnectionStateChanged: " + state.ToString()); }
void OnXmppConnectionStateChanged(object sender, XmppConnectionState state) { ConnectionState = state; }
/// <summary> /// handles the OnLogin-event and updates the Presence of the user /// </summary> /// <param name="oSender">The object which sent the event.</param> private void onLogin(object oSender) { try { m_IsAuthenticated = m_ClientConnection.Authenticated; m_ConnectionState = m_ClientConnection.XmppConnectionState; //check if user is authenticated if (m_IsAuthenticated && m_ConnectionState == XmppConnectionState.Authenticated) { m_IsLoggedIn = true; m_Logger.log(ELogLevel.LVL_INFO, "Xmpp user is logged in", m_sModuleName); } else { m_Logger.log(ELogLevel.LVL_INFO, "Xmpp user could not be authenticated or is not connected.", m_sModuleName); m_ClientConnection.Open(m_JidSender.User, m_AuthInfo.m_sPassword); return; } m_Presence = new Presence (ShowType.chat, "Online"); m_Presence.Type = PresenceType.available; m_ConversationManager.m_OwnJid = this.m_JidSender; m_ClientConnection.Send(m_Presence); m_ClientConnection.OnRosterItem += new XmppClientConnection.RosterHandler(onRosterItem); m_ClientConnection.OnMessage += new MessageHandler(handleMessage); m_OtrSessionManager = new OTRSessionManager(m_JidSender); m_OtrSessionManager.OnOTREvent += new OTREventHandler(OnOTREvent); } catch(Exception e) { m_Logger.log(ELogLevel.LVL_WARNING, "onLogin: " + e.Message, m_sModuleName); } }
private static void XmppOnOnXmppConnectionStateChanged(object sender , XmppConnectionState state) { Trace.WriteLine("[Bot]ConState:" + state.ToString()); if(state == XmppConnectionState.Disconnected) RemakeXmpp(); }
private void LobbyClientOnOnStateChanged(object sender, XmppConnectionState state) { cState = state; Dispatcher.Invoke(new Action(() => { tbConnect.Content = state.ToString(); })); }
internal void DoChangeXmppConnectionState(XmppConnectionState state) { m_ConnectionState = state; if (OnXmppConnectionStateChanged!=null) OnXmppConnectionStateChanged(this, state); }
/// <summary> /// Closes the connection /// </summary> public void Close() { if (this.state != XmppConnectionState.Closed) { if (this.ConnectionClosing != null) { this.ConnectionClosing(this, new EventArgs()); } try { this.state = XmppConnectionState.Closing; if (this.transport != null) { this.transport.Close(); } } catch { } finally { if (this.initializedStreamEvent != null) { this.initializedStreamEvent.Set(); this.initializedStreamEvent = null; } if (this.streamFeaturesEvent != null) { this.streamFeaturesEvent.Set(); this.streamFeaturesEvent = null; } if (this.bindResourceEvent != null) { this.bindResourceEvent.Set(); this.bindResourceEvent = null; } if (this.initializedStreamEvent != null) { this.initializedStreamEvent.Close(); this.initializedStreamEvent = null; } if (this.streamFeaturesEvent != null) { this.streamFeaturesEvent.Close(); this.streamFeaturesEvent = null; } if (this.bindResourceEvent != null) { this.bindResourceEvent.Close(); this.bindResourceEvent = null; } if (this.transportMessageSubscription != null) { this.transportMessageSubscription.Dispose(); this.transportMessageSubscription = null; } if (this.transportStreamInitializedSubscription != null) { this.transportStreamInitializedSubscription.Dispose(); this.transportStreamInitializedSubscription = null; } if (this.transportStreamClosedSubscription != null) { this.transportStreamClosedSubscription.Dispose(); this.transportStreamClosedSubscription = null; } if (this.transport != null) { this.transport = null; } this.streamFeatures = this.streamFeatures & (~this.streamFeatures); this.state = XmppConnectionState.Closed; this.connectionString = null; this.userId = null; } if (this.ConnectionClosed != null) { this.ConnectionClosed(this, new EventArgs()); } } }
private void XmppOnOnXmppConnectionStateChanged(object sender, XmppConnectionState state) { Trace.WriteLine("[Xmpp]State: " + state.ToString()); if (OnStateChanged != null) OnStateChanged.Invoke(this, state.ToString()); if(state == XmppConnectionState.Disconnected) if(OnDisconnect != null)OnDisconnect.Invoke(this,null); }