mirror of https://github.com/Mikaela/Limnoria.git
Changed over to the cool new RichReplyMethods stuff, mostly.
This commit is contained in:
parent
2fce1dcf13
commit
aa7408c09b
|
@ -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))
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
"""<word> [<word> ...]
|
||||
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
"""<abbreviation>
|
||||
|
@ -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)
|
||||
|
||||
|
|
|
@ -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):
|
||||
"""[<channel>] [<user>] [<word>]
|
||||
|
|
|
@ -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):
|
||||
"""<id>
|
||||
|
@ -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):
|
||||
"""<text>
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
"""[<channel>] <lart|excuse|insult|praise> <id> <regexp>
|
||||
|
@ -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):
|
||||
"""[<channel>] <lart|excuse|insult|praise>
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
"""[<channel>] <user|nick|hostmask>
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
"""<factoid key>
|
||||
|
@ -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):
|
||||
"""<factoid key>
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
"""[<channel>] <id> <option text>
|
||||
|
@ -217,7 +217,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
|||
cursor.execute("""INSERT INTO options VALUES
|
||||
(%s, %s, %s)""",
|
||||
option_id, poll_id, option)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def vote(self, irc, msg, args):
|
||||
"""[<channel>] <poll id> <option id>
|
||||
|
@ -267,7 +267,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
|||
cursor.execute("""UPDATE votes SET option_id=%s
|
||||
WHERE user_id=%s AND poll_id=%s""",
|
||||
option_id, userId, poll_id)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def results(self, irc, msg, args):
|
||||
"""[<channel>] <id>
|
||||
|
|
|
@ -161,7 +161,7 @@ class QuoteGrabs(plugins.ChannelDBHandler,
|
|||
for m in reviter(irc.state.history):
|
||||
if m.command == 'PRIVMSG' and ircutils.nickEqual(m.nick, nick):
|
||||
self._grab(irc, m, msg.prefix)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
return
|
||||
irc.error(msg, 'I couldn\'t find a proper message to grab.')
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||
if cursor.rowcount == 0:
|
||||
irc.error(msg, 'There was no such quote.')
|
||||
else:
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
else:
|
||||
irc.error(msg, conf.replyNoCapability % capability)
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ class RSS(callbacks.Privmsg, configurable.Mixin):
|
|||
f.url = url # Used by __call__.
|
||||
self.feedNames.add(name)
|
||||
setattr(self.__class__, name, f)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def remove(self, irc, msg, args):
|
||||
"""<name>
|
||||
|
@ -190,7 +190,7 @@ class RSS(callbacks.Privmsg, configurable.Mixin):
|
|||
irc.error(msg, 'That\'s not a valid RSS feed command name.')
|
||||
return
|
||||
delattr(self.__class__, name)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def rss(self, irc, msg, args):
|
||||
"""<url>
|
||||
|
|
|
@ -174,7 +174,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||
self.ircstates[realIrc] = irclib.IrcState()
|
||||
self.lastmsg[realIrc] = ircmsgs.ping('this is just a fake message')
|
||||
self.started = True
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
start = privmsgs.checkCapability(start, 'owner')
|
||||
|
||||
def connect(self, irc, msg, args):
|
||||
|
@ -202,7 +202,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||
self.abbreviations[newIrc] = abbreviation
|
||||
self.ircstates[newIrc] = irclib.IrcState()
|
||||
self.lastmsg[newIrc] = ircmsgs.ping('this is just a fake message')
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
connect = privmsgs.checkCapability(connect, 'owner')
|
||||
|
||||
def disconnect(self, irc, msg, args):
|
||||
|
@ -220,7 +220,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||
world.ircs.remove(otherIrc)
|
||||
del self.ircs[network]
|
||||
del self.abbreviations[otherIrc]
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
disconnect = privmsgs.checkCapability(disconnect, 'owner')
|
||||
|
||||
def join(self, irc, msg, args):
|
||||
|
@ -243,7 +243,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||
for otherIrc in self.ircs.itervalues():
|
||||
if channel not in otherIrc.state.channels:
|
||||
otherIrc.queueMsg(ircmsgs.join(channel))
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
join = privmsgs.checkCapability(join, 'owner')
|
||||
|
||||
def part(self, irc, msg, args):
|
||||
|
@ -264,7 +264,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||
for otherIrc in self.ircs.itervalues():
|
||||
if channel in otherIrc.state.channels:
|
||||
otherIrc.queueMsg(ircmsgs.part(channel))
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
part = privmsgs.checkCapability(part, 'owner')
|
||||
|
||||
def command(self, irc, msg, args):
|
||||
|
@ -286,7 +286,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||
Owner = irc.getCallback('Owner')
|
||||
Owner.disambiguate(irc, args)
|
||||
self.Proxy(otherIrc, msg, args)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
command = privmsgs.checkCapability(command, 'admin')
|
||||
|
||||
def say(self, irc, msg, args):
|
||||
|
|
|
@ -97,7 +97,7 @@ class Scheduler(callbacks.Privmsg):
|
|||
pass
|
||||
try:
|
||||
schedule.removeEvent(id)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except KeyError:
|
||||
irc.error(msg, 'Invalid event id.')
|
||||
|
||||
|
@ -118,7 +118,7 @@ class Scheduler(callbacks.Privmsg):
|
|||
f = self._makeCommandFunction(irc, msg, command)
|
||||
id = schedule.addPeriodicEvent(f, seconds, name)
|
||||
# We don't reply because the command runs immediately.
|
||||
# irc.reply(msg, conf.replySuccess)
|
||||
# irc.replySuccess(msg)
|
||||
|
||||
|
||||
Class = Scheduler
|
||||
|
|
|
@ -95,7 +95,7 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
|
|||
self._ghosted = re.compile('(Ghost|%s).*killed' % self.nick, re.I)
|
||||
self.sentGhost = False
|
||||
self.log.info('Services started.')
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def _doIdentify(self, irc):
|
||||
assert self.nickserv, 'Nickserv must not be empty.'
|
||||
|
@ -186,7 +186,7 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
|
|||
"""
|
||||
if self.nickserv:
|
||||
self._doIdentify(irc)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
else:
|
||||
s = 'This plugin must first be started via the start command.'
|
||||
irc.error(msg, s)
|
||||
|
|
|
@ -243,7 +243,7 @@ class Todo(callbacks.Privmsg):
|
|||
cursor.execute("""UPDATE todo SET active = 0 WHERE id = %s""",
|
||||
taskid)
|
||||
db.commit()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
_sqlTrans = string.maketrans('*?', '%_')
|
||||
def search(self, irc, msg, args):
|
||||
|
@ -319,7 +319,7 @@ class Todo(callbacks.Privmsg):
|
|||
cursor.execute("""UPDATE todo SET priority = %s
|
||||
WHERE id = %s""", priority, id)
|
||||
db.commit()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def change(self, irc, msg, args):
|
||||
"""<task id> <regexp>
|
||||
|
@ -350,7 +350,7 @@ class Todo(callbacks.Privmsg):
|
|||
cursor.execute("""UPDATE todo SET task = %s
|
||||
WHERE id = %s""", newtext, taskid)
|
||||
db.commit()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
Class = Todo
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ class Words(callbacks.Privmsg, configurable.Mixin):
|
|||
return
|
||||
else:
|
||||
addWord(self.dbHandler.getDb(), word, commit=True)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def crossword(self, irc, msg, args):
|
||||
"""<word>
|
||||
|
|
16
src/Admin.py
16
src/Admin.py
|
@ -190,7 +190,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||
if command in conf.defaultCapabilities:
|
||||
conf.defaultCapabilities.remove(command)
|
||||
conf.defaultCapabilities.add(capability)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def enable(self, irc, msg, args):
|
||||
"""<command>
|
||||
|
@ -205,7 +205,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||
return
|
||||
if anticapability in conf.defaultCapabilities:
|
||||
conf.defaultCapabilities.remove(anticapability)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
else:
|
||||
irc.error(msg, 'That command wasn\'t disabled.')
|
||||
|
||||
|
@ -242,7 +242,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||
user = ircdb.users.getUser(id)
|
||||
user.addCapability(capability)
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except KeyError:
|
||||
irc.error(msg, conf.replyNoUser)
|
||||
else:
|
||||
|
@ -267,7 +267,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||
try:
|
||||
user.removeCapability(capability)
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except KeyError:
|
||||
irc.error(msg, 'That user doesn\'t have that capability.')
|
||||
return
|
||||
|
@ -291,7 +291,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||
irc.error(msg, 'I can\'t find a hostmask for %s' % arg)
|
||||
return
|
||||
conf.ignores.append(hostmask)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def unignore(self, irc, msg, args):
|
||||
"""<hostmask|nick>
|
||||
|
@ -312,7 +312,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||
conf.ignores.remove(hostmask)
|
||||
while hostmask in conf.ignores:
|
||||
conf.ignores.remove(hostmask)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except ValueError:
|
||||
irc.error(msg, '%s wasn\'t in conf.ignores.' % hostmask)
|
||||
|
||||
|
@ -339,7 +339,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||
return
|
||||
else:
|
||||
conf.prefixChars = s
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def reportbug(self, irc, msg, args):
|
||||
"""<description>
|
||||
|
@ -366,7 +366,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||
['supybot-bugs@lists.sourceforge.net'],
|
||||
email)
|
||||
smtp.quit()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
reportbug = privmsgs.thread(reportbug)
|
||||
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ class Channel(callbacks.Privmsg):
|
|||
c = ircdb.channels.getChannel(channel)
|
||||
c.lobotomized = True
|
||||
ircdb.channels.setChannel(channel, c)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
lobotomize = privmsgs.checkChannelCapability(lobotomize, 'op')
|
||||
|
||||
def unlobotomize(self, irc, msg, args, channel):
|
||||
|
@ -299,7 +299,7 @@ class Channel(callbacks.Privmsg):
|
|||
c = ircdb.channels.getChannel(channel)
|
||||
c.lobotomized = False
|
||||
ircdb.channels.setChannel(channel, c)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
unlobotomize = privmsgs.checkChannelCapability(unlobotomize, 'op')
|
||||
|
||||
def permban(self, irc, msg, args, channel):
|
||||
|
@ -321,7 +321,7 @@ class Channel(callbacks.Privmsg):
|
|||
c = ircdb.channels.getChannel(channel)
|
||||
c.addBan(banmask)
|
||||
ircdb.channels.setChannel(channel, c)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
permban = privmsgs.checkChannelCapability(permban, 'op')
|
||||
|
||||
def unpermban(self, irc, msg, args, channel):
|
||||
|
@ -335,7 +335,7 @@ class Channel(callbacks.Privmsg):
|
|||
c = ircdb.channels.getChannel(channel)
|
||||
c.removeBan(banmask)
|
||||
ircdb.channels.setChannel(channel, c)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
unpermban = privmsgs.checkChannelCapability(unpermban, 'op')
|
||||
|
||||
def ignore(self, irc, msg, args, channel):
|
||||
|
@ -357,7 +357,7 @@ class Channel(callbacks.Privmsg):
|
|||
c = ircdb.channels.getChannel(channel)
|
||||
c.addIgnore(banmask)
|
||||
ircdb.channels.setChannel(channel, c)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
ignore = privmsgs.checkChannelCapability(ignore, 'op')
|
||||
|
||||
def unignore(self, irc, msg, args, channel):
|
||||
|
@ -371,7 +371,7 @@ class Channel(callbacks.Privmsg):
|
|||
c = ircdb.channels.getChannel(channel)
|
||||
c.removeIgnore(banmask)
|
||||
ircdb.channels.setChannel(channel, c)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
unignore = privmsgs.checkChannelCapability(unignore, 'op')
|
||||
|
||||
def ignores(self, irc, msg, args, channel):
|
||||
|
@ -409,7 +409,7 @@ class Channel(callbacks.Privmsg):
|
|||
user = ircdb.users.getUser(id)
|
||||
user.addCapability(capability)
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except KeyError:
|
||||
irc.error(msg, conf.replyNoUser)
|
||||
addcapability = privmsgs.checkChannelCapability(addcapability,'op')
|
||||
|
@ -429,7 +429,7 @@ class Channel(callbacks.Privmsg):
|
|||
user = ircdb.users.getUser(id)
|
||||
user.removeCapability(capability)
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except KeyError:
|
||||
irc.error(msg, conf.replyNoUser)
|
||||
removecapability = privmsgs.checkChannelCapability(removecapability, 'op')
|
||||
|
@ -454,7 +454,7 @@ class Channel(callbacks.Privmsg):
|
|||
irc.error(msg, s)
|
||||
return
|
||||
ircdb.channels.setChannel(channel, c)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
setdefaultcapability = \
|
||||
privmsgs.checkChannelCapability(setdefaultcapability, 'op')
|
||||
|
||||
|
@ -469,7 +469,7 @@ class Channel(callbacks.Privmsg):
|
|||
c = ircdb.channels.getChannel(channel)
|
||||
c.addCapability(capability)
|
||||
ircdb.channels.setChannel(channel, c)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
setcapability = privmsgs.checkChannelCapability(setcapability, 'op')
|
||||
|
||||
def unsetcapability(self, irc, msg, args, channel):
|
||||
|
@ -484,7 +484,7 @@ class Channel(callbacks.Privmsg):
|
|||
c = ircdb.channels.getChannel(channel)
|
||||
c.removeCapability(capability)
|
||||
ircdb.channels.setChannel(channel, c)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
unsetcapability = privmsgs.checkChannelCapability(unsetcapability, 'op')
|
||||
|
||||
def capabilities(self, irc, msg, args):
|
||||
|
|
26
src/Owner.py
26
src/Owner.py
|
@ -201,7 +201,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
except KeyError:
|
||||
irc.error(msg,'I have no default plugin for that command.')
|
||||
return
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def eval(self, irc, msg, args):
|
||||
"""<expression>
|
||||
|
@ -228,7 +228,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
s = privmsgs.getArgs(args)
|
||||
try:
|
||||
exec s
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except Exception, e:
|
||||
irc.reply(msg, utils.exnToString(e))
|
||||
else:
|
||||
|
@ -250,7 +250,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
irc.error(msg, utils.exnToString(e))
|
||||
return
|
||||
setattr(conf, name, value)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
else:
|
||||
if name == 'allowEval':
|
||||
irc.error(msg, 'You can\'t set the value of allowEval.')
|
||||
|
@ -266,7 +266,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
irc.error(msg, str(e))
|
||||
return
|
||||
setattr(conf, name, value)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
elif name:
|
||||
typeNames = {conf.mystr: 'string',
|
||||
conf.mybool: 'boolean',
|
||||
|
@ -293,7 +293,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
"""
|
||||
capability = callbacks.canonicalName(privmsgs.getArgs(args))
|
||||
conf.defaultCapabilities.add(capability)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def unsetdefaultcapability(self, irc, msg, args):
|
||||
"""<capability>
|
||||
|
@ -302,7 +302,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
"""
|
||||
capability = callbacks.canonicalName(privmsgs.getArgs(args))
|
||||
conf.defaultCapabilities.remove(capability)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def ircquote(self, irc, msg, args):
|
||||
"""<string to be sent to the server>
|
||||
|
@ -339,7 +339,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
Runs all the periodic flushers in world.flushers.
|
||||
"""
|
||||
world.flush()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def upkeep(self, irc, msg, args):
|
||||
"""takes no arguments
|
||||
|
@ -361,7 +361,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
"""
|
||||
(name, value) = privmsgs.getArgs(args, optional=1)
|
||||
world.tempvars[name] = value
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def unset(self, irc, msg, args):
|
||||
"""<name>
|
||||
|
@ -371,7 +371,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
name = privmsgs.getArgs(args)
|
||||
try:
|
||||
del world.tempvars[name]
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except KeyError:
|
||||
irc.error(msg, 'That variable wasn\'t set.')
|
||||
|
||||
|
@ -396,7 +396,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
irc.error(msg, utils.exnToString(e))
|
||||
return
|
||||
loadPluginClass(irc, module)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def reload(self, irc, msg, args):
|
||||
"""<plugin>
|
||||
|
@ -419,7 +419,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
del callback
|
||||
gc.collect()
|
||||
callback = loadPluginClass(irc, module)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except ImportError:
|
||||
for callback in callbacks:
|
||||
irc.addCallback(callback)
|
||||
|
@ -440,7 +440,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
callback.die()
|
||||
del callback
|
||||
gc.collect()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
else:
|
||||
irc.error(msg, 'There was no callback %s' % name)
|
||||
|
||||
|
@ -452,7 +452,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||
"""
|
||||
ircdb.users.reload()
|
||||
ircdb.channels.reload()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
|
||||
Class = Owner
|
||||
|
|
16
src/User.py
16
src/User.py
|
@ -117,7 +117,7 @@ class User(callbacks.Privmsg):
|
|||
user.setPassword(password, hashed=hashed)
|
||||
user.addHostmask(msg.prefix)
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def unregister(self, irc, msg, args):
|
||||
"""<name> <password>
|
||||
|
@ -134,7 +134,7 @@ class User(callbacks.Privmsg):
|
|||
return
|
||||
if user.checkPassword(password):
|
||||
ircdb.users.delUser(id)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
else:
|
||||
irc.error(msg, conf.replyIncorrectAuth)
|
||||
|
||||
|
@ -163,7 +163,7 @@ class User(callbacks.Privmsg):
|
|||
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
||||
user.name = newname
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def addhostmask(self, irc, msg, args):
|
||||
"""<name> <hostmask> [<password>]
|
||||
|
@ -199,7 +199,7 @@ class User(callbacks.Privmsg):
|
|||
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
||||
user.addHostmask(hostmask)
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
else:
|
||||
irc.error(msg, conf.replyIncorrectAuth)
|
||||
return
|
||||
|
@ -227,7 +227,7 @@ class User(callbacks.Privmsg):
|
|||
irc.error(msg, 'There was no such hostmask.')
|
||||
return
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
else:
|
||||
irc.error(msg, conf.replyIncorrectAuth)
|
||||
return
|
||||
|
@ -256,7 +256,7 @@ class User(callbacks.Privmsg):
|
|||
if user.checkPassword(oldpassword):
|
||||
user.setPassword(newpassword, hashed=hashed)
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
else:
|
||||
irc.error(msg, conf.replyIncorrectAuth)
|
||||
|
||||
|
@ -340,7 +340,7 @@ class User(callbacks.Privmsg):
|
|||
try:
|
||||
user.setAuth(msg.prefix)
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except ValueError:
|
||||
irc.error(msg, 'Your secure flag is true and your hostmask '
|
||||
'doesn\'t match any of your known hostmasks.')
|
||||
|
@ -360,7 +360,7 @@ class User(callbacks.Privmsg):
|
|||
return
|
||||
user.unsetAuth()
|
||||
ircdb.users.setUser(id, user)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
|
||||
def whoami(self, irc, msg, args):
|
||||
"""takes no arguments
|
||||
|
|
|
@ -65,9 +65,6 @@ import irclib
|
|||
import ircmsgs
|
||||
import ircutils
|
||||
|
||||
###
|
||||
# Privmsg: handles privmsg commands in a standard fashion.
|
||||
###
|
||||
def addressed(nick, msg):
|
||||
"""If msg is addressed to 'name', returns the portion after the address.
|
||||
Otherwise returns the empty string.
|
||||
|
@ -289,8 +286,41 @@ def checkCommandCapability(msg, command):
|
|||
ircdb.checkCapability(msg.prefix, command) or \
|
||||
ircdb.checkCapability(msg.prefix, chancap)
|
||||
|
||||
|
||||
class RichReplyMethods(object):
|
||||
"""This is a mixin so these replies need only be defined once."""
|
||||
def _makeReply(self, prefix, s):
|
||||
if s:
|
||||
s = '%s %s' % (prefix, s)
|
||||
else:
|
||||
s = prefix
|
||||
return s
|
||||
|
||||
def replySuccess(self, msg, s='', **kwargs):
|
||||
self.reply(msg, self._makeReply(conf.replySuccess, s), **kwargs)
|
||||
|
||||
def replyNoCapability(self, msg, capability, s='', **kwargs):
|
||||
s = self._makeReply(conf.replyNoCapability % s, s)
|
||||
self.reply(msg, s, **kwargs)
|
||||
|
||||
def replyNotRegistered(self, msg, s='', **kwargs):
|
||||
self.reply(msg, self._makeReply(conf.replyNotRegistered, s), **kwargs)
|
||||
|
||||
def replyPossibleBug(self, msg, s='', **kwargs):
|
||||
self.reply(msg, self._makeReply(conf.replyPossibleBug, s), **kwargs)
|
||||
|
||||
def replyNoUser(self, msg, s='', **kwargs):
|
||||
self.reply(msg, self._makeReply(conf.replyNoUser, s), **kwargs)
|
||||
|
||||
def replyRequiresPrivacy(self, msg, s='', **kwargs):
|
||||
s = self._makeReply(conf.replyRequiresPrivacy, s)
|
||||
self.reply(msg, s, **kwargs)
|
||||
|
||||
def replyError(self, msg, s='', **kwargs):
|
||||
self.reply(msg, self._makeReply(conf.replyError, s), **kwargs)
|
||||
|
||||
|
||||
class IrcObjectProxy:
|
||||
class IrcObjectProxy(RichReplyMethods):
|
||||
"A proxy object to allow proper nested of commands (even threaded ones)."
|
||||
def __init__(self, irc, msg, args):
|
||||
log.debug('IrcObjectProxy.__init__: %s' % args)
|
||||
|
@ -471,21 +501,6 @@ class IrcObjectProxy:
|
|||
self.args[self.counter] = s
|
||||
self.evalArgs()
|
||||
|
||||
def replySuccess(self, msg, s='', **kwargs):
|
||||
if s:
|
||||
s = '%s %s' % (conf.replySuccess, s)
|
||||
else:
|
||||
s = conf.replySuccess
|
||||
self.reply(msg, s, **kwargs)
|
||||
|
||||
def replyNoCapability(self, msg, capability, s='', **kwargs):
|
||||
if s:
|
||||
s = '%s %s' % (conf.replyNoCapability % capability, s)
|
||||
else:
|
||||
s = conf.replyNoCapability % capability
|
||||
self.reply(msg, s, **kwargs)
|
||||
|
||||
|
||||
def error(self, msg, s, private=False):
|
||||
"""error(msg, text) -> replies to msg with an error message of text.
|
||||
|
||||
|
@ -559,7 +574,7 @@ class CommandThread(threading.Thread):
|
|||
self.irc.error(self.msg, s)
|
||||
|
||||
|
||||
class ConfigIrcProxy(object):
|
||||
class ConfigIrcProxy(RichReplyMethods):
|
||||
"""Used as a proxy Irc object during configuration. """
|
||||
def __init__(self, irc):
|
||||
self.__dict__['irc'] = irc
|
||||
|
@ -713,7 +728,7 @@ class Privmsg(irclib.IrcCallback):
|
|||
self.log.info('%s took %s seconds', name, elapsed)
|
||||
|
||||
|
||||
class IrcObjectProxyRegexp(object):
|
||||
class IrcObjectProxyRegexp(RichReplyMethods):
|
||||
def __init__(self, irc, *args):
|
||||
self.irc = irc
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ class Mixin(object):
|
|||
if ircdb.checkCapability(msg.prefix, capability):
|
||||
try:
|
||||
self.configurables.set(name, value, channel)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except Error, e:
|
||||
irc.error(msg, str(e))
|
||||
else:
|
||||
|
@ -304,7 +304,7 @@ class Mixin(object):
|
|||
if ircdb.checkCapability(msg.prefix, 'admin'):
|
||||
try:
|
||||
self.globalConfigurables.set(name, value, channel)
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
irc.replySuccess(msg)
|
||||
except Error, e:
|
||||
irc.error(msg, str(e))
|
||||
else:
|
||||
|
|
|
@ -218,7 +218,7 @@ def isAction(msg):
|
|||
else:
|
||||
return False
|
||||
|
||||
_unactionre = re.compile(r'^\x01ACTION (.*)\x01$')
|
||||
_unactionre = re.compile(r'^\x01ACTION\s+(.*)\x01$')
|
||||
def unAction(msg):
|
||||
"""Returns the payload (i.e., non-ACTION text) of an ACTION msg."""
|
||||
assert isAction(msg)
|
||||
|
|
Loading…
Reference in New Issue