aboutsummaryrefslogtreecommitdiffstats
path: root/local
diff options
context:
space:
mode:
authorkongr45gpen <electrovesta@gmail.com>2016-09-16 16:32:05 +0300
committerkongr45gpen <electrovesta@gmail.com>2016-09-16 16:32:05 +0300
commitf161a009ceeb3970f5bed2bc569bb0696e2001c8 (patch)
tree19a641889714c5f96eb6aed500ccb06575bac726 /local
parentaf9f6faad73a4cc0e75394d4ff99134619164c05 (diff)
downloadsupybot_github-f161a009ceeb3970f5bed2bc569bb0696e2001c8.tar.gz
supybot_github-f161a009ceeb3970f5bed2bc569bb0696e2001c8.tar.bz2
supybot_github-f161a009ceeb3970f5bed2bc569bb0696e2001c8.zip
Allow using supybot to override config values for each channel
Diffstat (limited to 'local')
-rw-r--r--local/globals.py2
-rw-r--r--local/handler/GithubHandler.py2
-rw-r--r--local/utility.py17
3 files changed, 17 insertions, 4 deletions
diff --git a/local/globals.py b/local/globals.py
index 57037f9..a05105d 100644
--- a/local/globals.py
+++ b/local/globals.py
@@ -4,9 +4,11 @@ def init():
global travisStatuses
global secretDB
global shownIssues
+ global channel
messageList = []
configOverrides = {}
travisStatuses = {}
secretDB = None
shownIssues = {}
+ channel = None
diff --git a/local/handler/GithubHandler.py b/local/handler/GithubHandler.py
index ed44de4..6b2dd30 100644
--- a/local/handler/GithubHandler.py
+++ b/local/handler/GithubHandler.py
@@ -24,6 +24,7 @@ import supybot.ircutils as ircutils
import supybot.registry as registry
import supybot.callbacks as callbacks
+from ..globals import *
from ..utility import *
import PingHandler
@@ -92,6 +93,7 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
addConfigOverride(explosion[0], explosion[1])
i+=1
+ globals.channel = channel
try:
s.send_response(200)
diff --git a/local/utility.py b/local/utility.py
index b16646f..e84ea28 100644
--- a/local/utility.py
+++ b/local/utility.py
@@ -5,6 +5,7 @@ import string
import urllib2
from datetime import datetime, timedelta
+import supybot.log as log
import supybot.conf as conf
import supybot.world as world
import supybot.ircutils as ircutils
@@ -18,10 +19,14 @@ def registryValue(plugin, name, channel=None, value=True):
for name in names:
group = group.get(name)
if channel is not None:
- if ircutils.isChannel(channel):
- group = group.get(channel)
- else:
- self.log.debug('registryValue got channel=%r', channel)
+ try:
+ if ircutils.isChannel(channel):
+ group = group.get(channel)
+ else:
+ log.debug('registryValue got channel=%r', channel)
+ except registry.NonExistentRegistryEntry:
+ log.debug('non existent registry entry %r for channel %r', name, channel)
+ pass
if value:
return group()
else:
@@ -30,6 +35,10 @@ def registryValue(plugin, name, channel=None, value=True):
def configValue(name, channel=None, repo=None, type=None, module=None):
if globals.configOverrides and name.lower() in globals.configOverrides:
return globals.configOverrides[name.lower()]
+
+ if channel == None and name not in ['channel', 'passcode', 'disallowChannelOverride', 'disallowConfigOverride']:
+ channel = globals.channel
+
return registryValue("Github", name, channel)
def addConfigOverride(name, value):

© 2014-2024 Faster IT GmbH | imprint | privacy policy