From e21a4dfb76b8dbf7f769f0d763d9142ac3da3493 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 19 Jun 2011 23:56:54 -0400 Subject: [PATCH] converting four IRC command classes to use new config system; everything's been converted except for irc/watcher.py and everything in wiki/ --- irc/commands/afc_status.py | 3 +-- irc/commands/chanops.py | 4 ++-- irc/commands/git.py | 4 ++-- irc/commands/tasks.py | 12 ++++++------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/irc/commands/afc_status.py b/irc/commands/afc_status.py index 4b3553a..dd0248c 100644 --- a/irc/commands/afc_status.py +++ b/irc/commands/afc_status.py @@ -6,7 +6,6 @@ import json import re import urllib -from config.watcher import * from irc.base_command import BaseCommand class AFCStatus(BaseCommand): @@ -22,7 +21,7 @@ class AFCStatus(BaseCommand): data.command == "number" or data.command == "afc_status"): return True try: - if data.line[1] == "JOIN" and data.chan in AFC_CHANS: + if data.line[1] == "JOIN" and data.chan == "#wikipedia-en-afc": return True except IndexError: pass diff --git a/irc/commands/chanops.py b/irc/commands/chanops.py index e7b4683..a2a9cc6 100644 --- a/irc/commands/chanops.py +++ b/irc/commands/chanops.py @@ -3,7 +3,7 @@ # Voice/devoice/op/deop users in the channel. from irc.base_command import BaseCommand -from config.irc import * +from core import config class ChanOps(BaseCommand): def get_hooks(self): @@ -19,7 +19,7 @@ class ChanOps(BaseCommand): return False def process(self, data): - if data.host not in ADMINS: + if data.host not in config.irc.permissions["admins"]: self.connection.reply(data, "you must be a bot admin to use this command.") return diff --git a/irc/commands/git.py b/irc/commands/git.py index 7b76cf8..a919904 100644 --- a/irc/commands/git.py +++ b/irc/commands/git.py @@ -4,8 +4,8 @@ import shlex, subprocess, re -from config.irc import * from irc.base_command import BaseCommand +from core import config class Git(BaseCommand): def get_hooks(self): @@ -21,7 +21,7 @@ class Git(BaseCommand): def process(self, data): self.data = data - if data.host not in OWNERS: + if data.host not in config.irc.permissions["owners"]: self.connection.reply(data, "you must be a bot owner to use this command.") return diff --git a/irc/commands/tasks.py b/irc/commands/tasks.py index d1903bc..58050d0 100644 --- a/irc/commands/tasks.py +++ b/irc/commands/tasks.py @@ -2,13 +2,13 @@ # Manage wiki tasks from IRC, and check on thread status. -import threading, re +import threading +import re from irc.base_command import BaseCommand from irc.data import * from wiki import task_manager -from config.main import * -from config.irc import * +from core import config class Tasks(BaseCommand): def get_hooks(self): @@ -24,7 +24,7 @@ class Tasks(BaseCommand): def process(self, data): self.data = data - if data.host not in OWNERS: + if data.host not in config.irc.permissions["owners"]: self.connection.reply(data, "at this time, you must be a bot owner to use this command.") return @@ -116,9 +116,9 @@ class Tasks(BaseCommand): def get_main_thread_name(self): """Return the "proper" name of the MainThread; e.g. "irc-frontend" or "irc-watcher".""" - if enable_irc_frontend: + if config.components["irc_frontend"]: return "irc-frontend" - elif enable_wiki_schedule: + elif config.components["wiki_schedule"]: return "wiki-scheduler" else: return "irc-watcher"