From aa7408c09bea05e3b57ef293e2b85018d60cf16d Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 7 Jan 2004 19:09:24 +0000 Subject: [PATCH] Changed over to the cool new RichReplyMethods stuff, mostly. --- plugins/Alias.py | 8 +++--- plugins/Amazon.py | 2 +- plugins/BadWords.py | 4 +-- plugins/Bugzilla.py | 4 +-- plugins/ChannelDB.py | 2 +- plugins/Dunno.py | 4 +-- plugins/Enforcer.py | 2 +- plugins/Factoids.py | 12 ++++----- plugins/Filter.py | 4 +-- plugins/FunDB.py | 4 +-- plugins/Google.py | 2 +- plugins/Herald.py | 4 +-- plugins/Karma.py | 4 +-- plugins/Lookup.py | 4 +-- plugins/MoobotFactoids.py | 12 ++++----- plugins/News.py | 6 ++--- plugins/Note.py | 2 +- plugins/Parter.py | 4 +-- plugins/Poll.py | 6 ++--- plugins/QuoteGrabs.py | 2 +- plugins/Quotes.py | 2 +- plugins/RSS.py | 4 +-- plugins/Relay.py | 12 ++++----- plugins/Scheduler.py | 4 +-- plugins/Services.py | 4 +-- plugins/Todo.py | 6 ++--- plugins/Words.py | 2 +- src/Admin.py | 16 +++++------ src/Channel.py | 22 +++++++-------- src/Owner.py | 26 +++++++++--------- src/User.py | 16 +++++------ src/callbacks.py | 57 ++++++++++++++++++++++++--------------- src/configurable.py | 4 +-- src/ircmsgs.py | 2 +- 34 files changed, 142 insertions(+), 127 deletions(-) diff --git a/plugins/Alias.py b/plugins/Alias.py index 6398943d6..8f3f4a8e8 100644 --- a/plugins/Alias.py +++ b/plugins/Alias.py @@ -186,7 +186,7 @@ class Alias(callbacks.Privmsg): name = callbacks.canonicalName(name) if hasattr(self, name) and self.isCommand(name): self.aliases[name][1] = True - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) else: irc.error(msg, 'There is no such alias.') lock = privmsgs.checkCapability(lock, 'admin') @@ -200,7 +200,7 @@ class Alias(callbacks.Privmsg): name = callbacks.canonicalName(name) if hasattr(self, name) and self.isCommand(name): self.aliases[name][1] = False - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) else: irc.error(msg, 'There is no such alias.') unlock = privmsgs.checkCapability(unlock, 'admin') @@ -259,7 +259,7 @@ class Alias(callbacks.Privmsg): self.addAlias(irc, name, alias) self.log.info('Adding alias %r for %r (from %s)' % (name, alias, msg.prefix)) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) except AliasError, e: irc.error(msg, str(e)) @@ -272,7 +272,7 @@ class Alias(callbacks.Privmsg): try: self.removeAlias(name) self.log.info('Removing alias %r (from %s)' % (name, msg.prefix)) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) except AliasError, e: irc.error(msg, str(e)) diff --git a/plugins/Amazon.py b/plugins/Amazon.py index 308c3950b..5a1b1bf1e 100644 --- a/plugins/Amazon.py +++ b/plugins/Amazon.py @@ -112,7 +112,7 @@ class Amazon(callbacks.Privmsg,configurable.Mixin): """ key = privmsgs.getArgs(args) amazon.setLicense(key) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) licensekey = privmsgs.checkCapability(licensekey, 'admin') def isbn(self, irc, msg, args): diff --git a/plugins/BadWords.py b/plugins/BadWords.py index 750c8f9be..248fb3d0e 100644 --- a/plugins/BadWords.py +++ b/plugins/BadWords.py @@ -86,7 +86,7 @@ class BadWords(privmsgs.CapabilityCheckingPrivmsg): for word in words: self._badwords.add(word) self.makeRegexp() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def remove(self, irc, msg, args): """ [ ...] @@ -97,7 +97,7 @@ class BadWords(privmsgs.CapabilityCheckingPrivmsg): for word in words: self._badwords.discard(word) self.makeRegexp() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) Class = BadWords diff --git a/plugins/Bugzilla.py b/plugins/Bugzilla.py index 9da944f1a..fa8cf107c 100644 --- a/plugins/Bugzilla.py +++ b/plugins/Bugzilla.py @@ -153,7 +153,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin): url = url[:-1] self.db[name] = [url, description] self.shorthand = utils.abbrev(self.db.keys()) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def remove(self, irc, msg, args): """ @@ -166,7 +166,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin): name = self.shorthand[name] del self.db[name] self.shorthand = utils.abbrev(self.db.keys()) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) except KeyError: irc.error(msg, replyNoBugzilla % name) diff --git a/plugins/ChannelDB.py b/plugins/ChannelDB.py index 6b31adcd8..e5113d61c 100644 --- a/plugins/ChannelDB.py +++ b/plugins/ChannelDB.py @@ -496,7 +496,7 @@ class ChannelDB(plugins.ChannelDBHandler, cursor = db.cursor() cursor.execute("""INSERT INTO words VALUES (NULL, %s)""", word) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def wordstats(self, irc, msg, args): """[] [] [] diff --git a/plugins/Dunno.py b/plugins/Dunno.py index 02543b396..813af9026 100644 --- a/plugins/Dunno.py +++ b/plugins/Dunno.py @@ -112,7 +112,7 @@ class Dunno(callbacks.Privmsg): VALUES(NULL, %s, %s, %s)""", id, int(time.time()), text) self.db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def remove(self, irc, msg, args): """ @@ -141,7 +141,7 @@ class Dunno(callbacks.Privmsg): return cursor.execute("""DELETE FROM dunnos WHERE id = %s""" % dunno_id) self.db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def search(self, irc, msg, args): """ diff --git a/plugins/Enforcer.py b/plugins/Enforcer.py index 875be1ec3..3cf16080f 100644 --- a/plugins/Enforcer.py +++ b/plugins/Enforcer.py @@ -99,7 +99,7 @@ class Enforcer(callbacks.Privmsg, configurable.Mixin): self.started = True for channel in irc.state.channels: irc.queueMsg(ircmsgs.topic(channel)) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) start = privmsgs.checkCapability(start, 'admin') def doJoin(self, irc, msg): diff --git a/plugins/Factoids.py b/plugins/Factoids.py index d96b5aab3..4902609a4 100644 --- a/plugins/Factoids.py +++ b/plugins/Factoids.py @@ -143,7 +143,7 @@ class Factoids(plugins.ChannelDBHandler, (NULL, %s, %s, %s, %s)""", id, name, int(time.time()), factoid) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) else: irc.error(msg, 'That factoid is locked.') @@ -206,7 +206,7 @@ class Factoids(plugins.ChannelDBHandler, cursor = db.cursor() cursor.execute("UPDATE keys SET locked=1 WHERE key LIKE %s", key) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) else: irc.error(msg, conf.replyNoCapability % capability) @@ -225,7 +225,7 @@ class Factoids(plugins.ChannelDBHandler, cursor = db.cursor() cursor.execute("UPDATE keys SET locked=0 WHERE key LIKE %s", key) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) else: irc.error(msg, conf.replyNoCapability % capability) @@ -266,7 +266,7 @@ class Factoids(plugins.ChannelDBHandler, cursor.execute("""DELETE FROM factoids WHERE key_id=%s""", id) cursor.execute("""DELETE FROM keys WHERE key LIKE %s""", key) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) else: if number is not None: results = cursor.fetchall() @@ -277,7 +277,7 @@ class Factoids(plugins.ChannelDBHandler, return cursor.execute("DELETE FROM factoids WHERE id=%s", id) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) else: irc.error(msg, '%s factoids have that key. ' \ 'Please specify which one to remove, ' \ @@ -377,7 +377,7 @@ class Factoids(plugins.ChannelDBHandler, newfact = replacer(fact) cursor.execute("UPDATE factoids SET fact=%s WHERE id=%s", newfact, id) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) _sqlTrans = string.maketrans('*?', '%_') def search(self, irc, msg, args): diff --git a/plugins/Filter.py b/plugins/Filter.py index 13b38437d..041607215 100644 --- a/plugins/Filter.py +++ b/plugins/Filter.py @@ -90,12 +90,12 @@ class Filter(callbacks.Privmsg): if command in self._filterCommands: method = getattr(self, command) self.outFilters.setdefault(channel, []).append(method) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) else: irc.error(msg, 'That\'s not a valid filter command.') else: self.outFilters[channel] = [] - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) outfilter = privmsgs.checkChannelCapability(outfilter, 'op') def squish(self, irc, msg, args): diff --git a/plugins/FunDB.py b/plugins/FunDB.py index deb0a4f00..4ca492b35 100755 --- a/plugins/FunDB.py +++ b/plugins/FunDB.py @@ -189,7 +189,7 @@ class FunDB(callbacks.Privmsg, configurable.Mixin, plugins.ChannelDBHandler): sql = """DELETE FROM %ss WHERE id=%%s""" % table cursor.execute(sql, id) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def change(self, irc, msg, args): """[] @@ -237,7 +237,7 @@ class FunDB(callbacks.Privmsg, configurable.Mixin, plugins.ChannelDBHandler): (table, table) cursor.execute(sql, new_entry, name, id) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def num(self, irc, msg, args): """[] diff --git a/plugins/Google.py b/plugins/Google.py index 5e564f9a2..06c09d600 100644 --- a/plugins/Google.py +++ b/plugins/Google.py @@ -192,7 +192,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin): irc.error(msg, 'That doesn\'t seem to be a valid license key.') return google.setLicense(key) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) licensekey = privmsgs.checkCapability(licensekey, 'admin') def google(self, irc, msg, args): diff --git a/plugins/Herald.py b/plugins/Herald.py index d0e74dec5..7e2386a5e 100644 --- a/plugins/Herald.py +++ b/plugins/Herald.py @@ -173,7 +173,7 @@ class Herald(callbacks.Privmsg, configurable.Mixin): irc.error(msg, conf.replyNoUser) return self.db.setHerald(id, channel, herald) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def remove(self, irc, msg, args): """[] @@ -191,7 +191,7 @@ class Herald(callbacks.Privmsg, configurable.Mixin): irc.error(msg, conf.replyNoUser) return self.db.delHerald(id, channel) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) Class = Herald diff --git a/plugins/Karma.py b/plugins/Karma.py index 32954c217..32bc2f8be 100644 --- a/plugins/Karma.py +++ b/plugins/Karma.py @@ -232,7 +232,7 @@ class Karma(callbacks.PrivmsgCommandAndRegexp, SET added=added+1 WHERE normalized=%s""", normalized) if self.configurables.get('karma-response', msg.args[0]): - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def decreaseKarma(self, irc, msg, match): r"^(\S+)--(|\s+)$" @@ -246,7 +246,7 @@ class Karma(callbacks.PrivmsgCommandAndRegexp, SET subtracted=subtracted+1 WHERE normalized=%s""", normalized) if self.configurables.get('karma-response', msg.args[0]): - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) Class = Karma diff --git a/plugins/Lookup.py b/plugins/Lookup.py index 08d4b6377..569d4fe5a 100644 --- a/plugins/Lookup.py +++ b/plugins/Lookup.py @@ -122,7 +122,7 @@ class Lookup(callbacks.Privmsg): cursor.execute("""DROP TABLE %s""" % name) db.commit() delattr(self.__class__, name) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) except sqlite.DatabaseError: irc.error(msg, 'No such lookup exists.') remove = privmsgs.checkCapability(remove, 'admin') @@ -148,7 +148,7 @@ class Lookup(callbacks.Privmsg): try: cursor.execute("""SELECT * FROM %s LIMIT 1""" % name) self.addCommand(name) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) except sqlite.DatabaseError: # Good, there's no such database. try: diff --git a/plugins/MoobotFactoids.py b/plugins/MoobotFactoids.py index 4ca262863..819dee269 100644 --- a/plugins/MoobotFactoids.py +++ b/plugins/MoobotFactoids.py @@ -271,7 +271,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp): %s, 0)""", key, id, int(time.time()), fact) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def changeFactoid(self, irc, msg, match): r"(.+)\s+=~\s+(.+)" @@ -307,7 +307,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp): modified_at = %s WHERE key = %s""", new_fact, id, int(time.time()), key) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def augmentFactoid(self, irc, msg, match): r"(.+?) is also (.+)" @@ -338,7 +338,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp): modified_at = %s WHERE key = %s""", new_fact, id, int(time.time()), key) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def replaceFactoid(self, irc, msg, match): r"^no,?\s+(.+?)\s+is\s+(.+)" @@ -377,7 +377,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp): WHERE key = %s""", new_fact, id, int(time.time()), key) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def literal(self, irc, msg, args): """ @@ -487,7 +487,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp): cursor.execute("""UPDATE factoids SET locked_at = %s, locked_by = %s WHERE key = %s""", locked_at, id, key) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def lock(self, irc, msg, args): """ @@ -656,7 +656,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp): return cursor.execute("""DELETE FROM factoids WHERE key = %s""", key) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) Class = MoobotFactoids diff --git a/plugins/News.py b/plugins/News.py index a91600c25..d5d335979 100644 --- a/plugins/News.py +++ b/plugins/News.py @@ -115,7 +115,7 @@ class News(plugins.ChannelDBHandler, callbacks.Privmsg): cursor.execute("INSERT INTO news VALUES (NULL, %s, %s, %s, %s, %s)", subject[:-1], text, added_at, expires, name) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) add = privmsgs.checkChannelCapability(add, 'news') def _readnews(self, irc, msg, args): @@ -190,7 +190,7 @@ class News(plugins.ChannelDBHandler, callbacks.Privmsg): else: cursor.execute("""DELETE FROM news WHERE news.id = %s""", id) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) remove = privmsgs.checkChannelCapability(remove, 'news') def change(self, irc, msg, args, channel): @@ -219,7 +219,7 @@ class News(plugins.ChannelDBHandler, callbacks.Privmsg): (newSubject, newItem) = s.split(': ') cursor.execute("""UPDATE news SET subject=%s, item=%s WHERE id=%s""", newSubject, newItem, id) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) change = privmsgs.checkChannelCapability(change, 'news') def old(self, irc, msg, args): diff --git a/plugins/Note.py b/plugins/Note.py index 490a58576..d80c8a654 100644 --- a/plugins/Note.py +++ b/plugins/Note.py @@ -181,7 +181,7 @@ class Note(callbacks.Privmsg): if not read: cursor.execute("""DELETE FROM notes WHERE id=%s""", id) db.commit() - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) else: irc.error(msg, 'That note has been read already.') else: diff --git a/plugins/Parter.py b/plugins/Parter.py index b030426e0..c6dcb333f 100644 --- a/plugins/Parter.py +++ b/plugins/Parter.py @@ -76,7 +76,7 @@ class Parter(callbacks.Privmsg): """ channel = privmsgs.getArgs(args) self.channels.add(channel) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) autopart = privmsgs.checkCapability(autopart, 'admin') def removeautopart(self, irc, msg, args): @@ -86,7 +86,7 @@ class Parter(callbacks.Privmsg): """ channel = privmsgs.getArgs(args) self.channels.discard(channel) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) removeautopart = privmsgs.checkCapability(removeautopart, 'admin') def doJoin(self, irc, msg): diff --git a/plugins/Poll.py b/plugins/Poll.py index 540d452cd..db71f6ce8 100644 --- a/plugins/Poll.py +++ b/plugins/Poll.py @@ -170,7 +170,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler): irc.error(msg, 'Id #%s is not an existing poll.') return cursor.execute("""UPDATE polls SET open=0 WHERE id=%s""", id) - irc.reply(msg, conf.replySuccess) + irc.replySuccess(msg) def add(self, irc, msg, args): """[]