public override void Quit(string quitMessage) { base.Quit(quitMessage); _ircClient.Quit(quitMessage ?? "Quitting..."); WebHostCancellationTokenHolder.CancellationTokenSource.Cancel(); }
public void Dispose() { if (_ircClient != null) { _ircClient.Quit(_clientTimeout, QuitMessage); _ircClient.Dispose(); } GC.SuppressFinalize(this); }
/// <summary> /// Disconnects the client from the IRC server. /// </summary> public void Disconnect() { try { Log.Write("Closing IRC client connection.", _logClassType, _logPrefix); _client.Quit(_quitMessage); } catch (Exception) { // IrcDotNet: Client might already be disposed } finally { _reconnectTries = MaxReconnectionTries; StopIrcThread(); IsConnectedToIrc = false; } }
public void HandleCommands(string commandstring) { ConnectMethod(commandstring); if (commandstring.StartsWith("#/joinc")) { var channelname = commandstring.Replace("#/joinc", "").Trim(); var selected = myclient.Channels.First(item => item.Name == channelname); selected.MessageReceived += RecieveMessage; selected.NoticeReceived += (sender, args) => { OutputLog += args.GetText(); }; myclient.Channels.Join(channelname); } if (commandstring == ("#/quit")) { myclient.Quit("exiting"); myclient.Dispose(); } }
private void DisposeClient() { if (_client == null) { return; } if (_client.IsConnected) { _client.Quit(1000, "I'm outta here"); } _client.ErrorMessageReceived -= OnClientErrorMessageReceived; _client.Connected -= OnClientConnected; _client.ConnectFailed -= OnClientConnectFailed; _client.Disconnected -= OnClientDisconnected; _client.Registered -= OnClientRegistered; _client.Error += OnError; _client.Dispose(); _client = null; }
public async Task Disconnect() { if (irc?.IsConnected != true) { return; } try { { cancellationTokenSource.Cancel(); await Task.WhenAll(messageDispatchers); } irc.Quit("QQ"); } catch (Exception) { // ignored } }