public static bool Start() { int threadCount = ConfigKey.IRCThreads.GetInt(); if (threadCount == 1) { IRCThread thread = new IRCThread(); if (thread.Start(botNick, true)) { threads = new[] { thread }; } } else { List <IRCThread> threadTemp = new List <IRCThread>(); for (int i = 0; i < threadCount; i++) { IRCThread temp = new IRCThread(); if (temp.Start(botNick + (i + 1), (threadTemp.Count == 0))) { threadTemp.Add(temp); } } threads = threadTemp.ToArray(); } if (threads.Length > 0) { HookUpHandlers(); return(true); } else { Logger.Log("IRC functionality disabled.", LogType.IRC); return(false); } }
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(); if( thread.Start( botNick, true ) ) { threads = new[] { thread }; } } else { List<IRCThread> threadTemp = new List<IRCThread>(); for( int i = 0; i < threadCount; i++ ) { IRCThread temp = new IRCThread(); if( temp.Start( botNick + (i + 1), (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; } }
public static bool Start() { int threadCount = ConfigKey.IRCThreads.GetInt(); if( threadCount == 1 ) { IRCThread thread = new IRCThread(); if( thread.Start( botNick, true ) ) { threads = new[] { thread }; } } else { List<IRCThread> threadTemp = new List<IRCThread>(); for( int i = 0; i < threadCount; i++ ) { IRCThread temp = new IRCThread(); if( temp.Start( botNick + (i + 1), (threadTemp.Count == 0) ) ) { threadTemp.Add( temp ); } } threads = threadTemp.ToArray(); } if( threads.Length > 0 ) { HookUpHandlers(); return true; } else { Logger.Log( LogType.IRCStatus, "IRC functionality disabled." ); return false; } }