예제 #1
0
        public CategoryWatcherHelperService(
            ILinkerService linkerService,
            IUrlShorteningService urlShorteningService,
            ISession session,
            ILogger logger,
            ICommandParser commandParser,
            IMediaWikiApiHelper apiHelper,
            IResponder responder)
        {
            this.linkerService        = linkerService;
            this.urlShorteningService = urlShorteningService;
            this.session   = session;
            this.logger    = logger;
            this.apiHelper = apiHelper;
            this.responder = responder;

            lock (this.session)
            {
                this.watchedCategories = this.session.CreateCriteria <WatchedCategory>().List <WatchedCategory>();

                this.ignoredPages = this.session.CreateCriteria <IgnoredPage>()
                                    .List <IgnoredPage>()
                                    .Select(x => x.Title)
                                    .ToList();
            }

            logger.DebugFormat("Registering CategoryWatcher keys in CommandParser");
            foreach (var category in this.watchedCategories)
            {
                commandParser.RegisterCommand(category.Keyword, typeof(ForceUpdateCommand));
            }
        }
예제 #2
0
 public DraftStatusCommand(
     string commandSource,
     IUser user,
     IList <string> arguments,
     ILogger logger,
     IFlagService flagService,
     IConfigurationProvider configurationProvider,
     IIrcClient client,
     AfcCategoryConfiguration categoryConfiguration,
     IMediaWikiApiHelper apiHelper,
     ISession databaseSession,
     IDraftStatusService draftStatusService, ILinkerService linkerService, IUrlShorteningService urlShorteningService) : base(
         commandSource,
         user,
         arguments,
         logger,
         flagService,
         configurationProvider,
         client)
 {
     this.categoryConfiguration = categoryConfiguration;
     this.apiHelper             = apiHelper;
     this.databaseSession       = databaseSession;
     this.draftStatusService    = draftStatusService;
     this.linkerService         = linkerService;
     this.urlShorteningService  = urlShorteningService;
 }
예제 #3
0
 public AfcCountCommand(
     string commandSource,
     IUser user,
     IList <string> arguments,
     ILogger logger,
     IFlagService flagService,
     IConfigurationProvider configurationProvider,
     IIrcClient client,
     ISession databaseSession,
     IMediaWikiApiHelper apiHelper,
     IDraftStatusService draftStatusService,
     IResponder responder
     ) : base(
         commandSource,
         user,
         arguments,
         logger,
         flagService,
         configurationProvider,
         client)
 {
     this.databaseSession    = databaseSession;
     this.apiHelper          = apiHelper;
     this.draftStatusService = draftStatusService;
     this.responder          = responder;
 }
예제 #4
0
 public InterwikiCommand(
     string commandSource,
     IUser user,
     IList <string> arguments,
     ILogger logger,
     IFlagService flagService,
     IConfigurationProvider configurationProvider,
     IIrcClient client,
     ISession session,
     IMediaWikiApiHelper apiHelper,
     IResponder responder,
     IInterwikiService interwikiService) : base(
         commandSource,
         user,
         arguments,
         logger,
         flagService,
         configurationProvider,
         client)
 {
     this.session          = session;
     this.apiHelper        = apiHelper;
     this.responder        = responder;
     this.interwikiService = interwikiService;
 }
예제 #5
0
 public UserInfoCommand(
     string commandSource,
     IUser user,
     IList <string> arguments,
     ILogger logger,
     IFlagService flagService,
     IConfigurationProvider configurationProvider,
     IIrcClient client,
     ISession databaseSession,
     ILinkerService linkerService,
     IUrlShorteningService urlShortener,
     IMediaWikiApiHelper apiHelper,
     IResponder responder) : base(
         commandSource,
         user,
         arguments,
         logger,
         flagService,
         configurationProvider,
         client)
 {
     this.databaseSession = databaseSession;
     this.linkerService   = linkerService;
     this.urlShortener    = urlShortener;
     this.apiHelper       = apiHelper;
     this.responder       = responder;
 }
예제 #6
0
        public BlockMonitoringService(
            ILogger logger,
            ILinkerService linkerService,
            IUrlShorteningService urlShorteningService,
            ISession globalSession,
            IMediaWikiApiHelper apiHelper,
            BotConfiguration botConfiguration,
            IWebServiceClient webServiceClient,
            IIrcClient client,
            ITrollMonitoringService trollMonitoringService)
        {
            this.logger                 = logger;
            this.linkerService          = linkerService;
            this.urlShorteningService   = urlShorteningService;
            this.globalSession          = globalSession;
            this.apiHelper              = apiHelper;
            this.botConfiguration       = botConfiguration;
            this.webServiceClient       = webServiceClient;
            this.client                 = client;
            this.trollMonitoringService = trollMonitoringService;

            this.trollMonitoringService.BlockMonitoringService = this;

            // initialise the store
            foreach (var blockMonitor in globalSession.CreateCriteria <BlockMonitor>().List <BlockMonitor>())
            {
                if (!this.monitors.ContainsKey(blockMonitor.MonitorChannel))
                {
                    this.monitors[blockMonitor.MonitorChannel] = new HashSet <string>();
                }

                this.monitors[blockMonitor.MonitorChannel].Add(blockMonitor.ReportChannel);
            }
        }
예제 #7
0
 /// <summary>
 /// Initialises a new instance of the <see cref="LinkerService"/> class.
 /// </summary>
 public LinkerService(
     IMediaWikiApiHelper apiHelper,
     ISession databaseSession,
     IIrcClient client,
     ILogger logger,
     IChannelManagementService channelManagementService)
 {
     this.apiHelper                = apiHelper;
     this.databaseSession          = databaseSession;
     this.client                   = client;
     this.logger                   = logger;
     this.channelManagementService = channelManagementService;
     this.lastLink                 = new Dictionary <string, string>();
 }
예제 #8
0
 public BlockInformationCommand(
     string commandSource,
     IUser user,
     IList <string> arguments,
     ILogger logger,
     IFlagService flagService,
     IConfigurationProvider configurationProvider,
     IIrcClient client,
     ISession databaseSession,
     IMediaWikiApiHelper apiHelper) : base(
         commandSource,
         user,
         arguments,
         logger,
         flagService,
         configurationProvider,
         client)
 {
     this.databaseSession = databaseSession;
     this.apiHelper       = apiHelper;
 }