Exemple #1
0
        public void Stop()
        {
            ActualTimers.Stop();

            Canceller.Cancel();
            DisconnectOrWhatever();
            IrcThread.Join();
        }
Exemple #2
0
        public static bool Start() {
            if (!IrcNickRegex.IsMatch(botNick)) {
                Logger.Log(LogType.Error, "IRC: Unacceptable bot nick.");
                return false;
            }

            int threadCount = ConfigKey.IRCThreads.GetInt();

            if (threadCount == 1) {
                IrcThread thread = new IrcThread(botNick);
                if (thread.Start(true)) {
                    threads = new[] {
                        thread
                    };
                }
            } else {
                List<IrcThread> threadTemp = new List<IrcThread>();
                for (int i = 0; i < threadCount; i++) {
                    IrcThread temp = new IrcThread(botNick + (i + 1));
                    if (temp.Start((threadTemp.Count == 0))) {
                        threadTemp.Add(temp);
                    }
                }
                threads = threadTemp.ToArray();
            }

            if (threads.Length > 0) {
                HookUpHandlers();
                return true;
            } else {
                Logger.Log(LogType.IrcStatus, "IRC: Set IRCThreads to 1.");
                return false;
            }
        }
 /// <summary>
 /// Starts the IRC master thread
 /// </summary>
 public void StartIrcClient()
 {
     IrcThread.Start();
 }