public ApiService( ILogger logger, IIrcClient client, ICommandParser commandParser, BotConfiguration botConfiguration, IIrcConfiguration ircConfiguration, ILoginTokenService loginTokenService, ISessionFactory sessionFactory, IResponseManager responseManager) { this.logger = logger; this.client = client; this.commandParser = commandParser; this.botConfiguration = botConfiguration; this.ircConfiguration = ircConfiguration; this.loginTokenService = loginTokenService; this.sessionFactory = sessionFactory; this.responseManager = responseManager; }
/// <summary> /// Initialises a new instance of the <see cref="IrcClient"/> class. /// </summary> /// <param name="client"> /// The client. /// </param> /// <param name="logger"> /// The logger. /// </param> /// <param name="ircConfiguration"> /// The configuration Helper. /// </param> /// <param name="password"> /// The password. /// </param> public IrcClient(INetworkClient client, ILogger logger, IIrcConfiguration ircConfiguration, string password) { this.nickname = ircConfiguration.Nickname; this.networkClient = client; this.logger = logger; this.syncLogger = logger.CreateChildLogger("Sync"); this.username = ircConfiguration.Username; this.realName = ircConfiguration.RealName; this.password = password; this.networkClient.DataReceived += this.NetworkClientOnDataReceived; this.ReceivedMessage += this.OnMessageReceivedEvent; this.clientCapabilities = new List<string> { "sasl", "account-notify", "extended-join", "multi-prefix" }; this.authToServices = ircConfiguration.AuthToServices; if (!this.authToServices) { this.logger.Warn("Services authentication is disabled!"); this.clientCapabilities.Remove("sasl"); this.clientCapabilities.Remove("account-notify"); this.clientCapabilities.Remove("extended-join"); } this.userCache = new Dictionary<string, IrcUser>(); this.channels = new Dictionary<string, IrcChannel>(); this.connectionRegistrationSemaphore = new Semaphore(0, 1); this.syncLogger.Debug("ctor() acquired connectionRegistration semaphore."); this.RegisterConnection(null); }