From c6b232b58810d67b12d057bee5006b56570d6c55 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 3 Dec 2003 21:19:49 +0000 Subject: [PATCH] Made to require admin capabilities to add/remove lookups. --- plugins/Lookup.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/Lookup.py b/plugins/Lookup.py index 30c63f62a..62054df7e 100644 --- a/plugins/Lookup.py +++ b/plugins/Lookup.py @@ -40,6 +40,7 @@ import plugins import os import re import sys +import sets import types import sqlite @@ -90,6 +91,7 @@ class LookupDB(plugins.DBHandler): class Lookup(callbacks.Privmsg): def __init__(self): callbacks.Privmsg.__init__(self) + self.domains = sets.Set() self.dbHandler = LookupDB(name=os.path.join(conf.dataDir, 'Lookup')) def die(self): @@ -101,6 +103,10 @@ class Lookup(callbacks.Privmsg): Removes the lookup for . """ name = privmsgs.getArgs(args) + name = callbacks.canonicalName(name) + if name not in self.domains: + irc.error(msg, 'That\'s not a valid lookup to remove.') + return db = self.dbHandler.getDb() cursor = db.cursor() try: @@ -110,6 +116,7 @@ class Lookup(callbacks.Privmsg): irc.reply(msg, conf.replySuccess) except sqlite.DatabaseError: irc.error(msg, 'No such lookup exists.') + remove = privmsgs.checkCapability(remove, 'admin') _splitRe = re.compile(r'(?