コード例 #1
0
        public override void Quit(string quitMessage)
        {
            base.Quit(quitMessage);

            _ircClient.Quit(quitMessage ?? "Quitting...");
            WebHostCancellationTokenHolder.CancellationTokenSource.Cancel();
        }
コード例 #2
0
ファイル: IrcBot.cs プロジェクト: Homesweethome/SwagCore
 public void Dispose()
 {
     if (_ircClient != null)
     {
         _ircClient.Quit(_clientTimeout, QuitMessage);
         _ircClient.Dispose();
     }
     GC.SuppressFinalize(this);
 }
コード例 #3
0
ファイル: IrcManager.cs プロジェクト: syncore/SST
 /// <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;
     }
 }
コード例 #4
0
        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();
            }
        }
コード例 #5
0
        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;
        }
コード例 #6
0
ファイル: IrcLayer.cs プロジェクト: shatteredbeam/FIDO
        public async Task Disconnect()
        {
            if (irc?.IsConnected != true)
            {
                return;
            }

            try
            {
                {
                    cancellationTokenSource.Cancel();
                    await Task.WhenAll(messageDispatchers);
                }

                irc.Quit("QQ");
            }
            catch (Exception)
            {
                // ignored
            }
        }