From 6a07f0bdff54ab361e2e93c961b776324684eb42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eli=C3=A1n=20Hanisch?= Date: Sun, 12 Dec 2010 13:33:52 -0300 Subject: [PATCH] allow unauthorised edits if they made in #ubuntu-ops. --- Encyclopedia/config.py | 4 ++++ Encyclopedia/plugin.py | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Encyclopedia/config.py b/Encyclopedia/config.py index 12e8b64..2490a30 100644 --- a/Encyclopedia/config.py +++ b/Encyclopedia/config.py @@ -158,6 +158,10 @@ conf.registerChannelValue(Encyclopedia, 'database', conf.registerChannelValue(Encyclopedia, 'relaychannel', registry.String('#ubuntu-ops', 'Relay channel for unauthorized edits')) +conf.registerGlobalValue(Encyclopedia, 'editchannel', + registry.SpaceSeparatedListOfStrings(['#ubuntu-ops'], + 'Channels where unauthorised edits are allowed.')) + conf.registerGlobalValue(Encyclopedia, 'notfoundmsg', registry.String('Factoid %s not found', 'Reply when factoid isn\'t found')) diff --git a/Encyclopedia/plugin.py b/Encyclopedia/plugin.py index 8922632..80c5d14 100644 --- a/Encyclopedia/plugin.py +++ b/Encyclopedia/plugin.py @@ -480,7 +480,8 @@ class Encyclopedia(callbacks.Plugin): ret = self.search_factoid(lower_text[7:].strip(), channel) elif (' is ' in lower_text and lower_text[:3] in ('no ', 'no,')) or '' in lower_text or '=~' in lower_text \ or '~=' in lower_text or '' in lower_text or lower_text.startswith('forget') or lower_text.startswith('unforget'): - if not capab(msg.prefix, 'editfactoids'): + if not capab(msg.prefix, 'editfactoids') and \ + channel not in self.registryValue('editchannel'): irc.reply("Your edit request has been forwarded to %s. Thank you for your attention to detail" % self.registryValue('relaychannel',channel),private=True) irc.queueMsg(ircmsgs.privmsg(self.registryValue('relaychannel',channel), "In %s, %s said: %s" % @@ -489,7 +490,8 @@ class Encyclopedia(callbacks.Plugin): return ret = self.factoid_edit(text, channel, msg.prefix) elif (' is ' in lower_text and '|' in lower_text and lower_text.index('|') > lower_text.index(' is ')) or (' is ' in lower_text and '|' not in lower_text): - if not capab(msg.prefix, 'editfactoids'): + if not capab(msg.prefix, 'editfactoids') and \ + channel not in self.registryValue('editchannel'): if len(text[:text.find('is')]) > 15: irc.error("I am only a bot, please don't think I'm intelligent :)") else: