mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
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)
|
name = callbacks.canonicalName(name)
|
||||||
if hasattr(self, name) and self.isCommand(name):
|
if hasattr(self, name) and self.isCommand(name):
|
||||||
self.aliases[name][1] = True
|
self.aliases[name][1] = True
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'There is no such alias.')
|
irc.error(msg, 'There is no such alias.')
|
||||||
lock = privmsgs.checkCapability(lock, 'admin')
|
lock = privmsgs.checkCapability(lock, 'admin')
|
||||||
@ -200,7 +200,7 @@ class Alias(callbacks.Privmsg):
|
|||||||
name = callbacks.canonicalName(name)
|
name = callbacks.canonicalName(name)
|
||||||
if hasattr(self, name) and self.isCommand(name):
|
if hasattr(self, name) and self.isCommand(name):
|
||||||
self.aliases[name][1] = False
|
self.aliases[name][1] = False
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'There is no such alias.')
|
irc.error(msg, 'There is no such alias.')
|
||||||
unlock = privmsgs.checkCapability(unlock, 'admin')
|
unlock = privmsgs.checkCapability(unlock, 'admin')
|
||||||
@ -259,7 +259,7 @@ class Alias(callbacks.Privmsg):
|
|||||||
self.addAlias(irc, name, alias)
|
self.addAlias(irc, name, alias)
|
||||||
self.log.info('Adding alias %r for %r (from %s)' %
|
self.log.info('Adding alias %r for %r (from %s)' %
|
||||||
(name, alias, msg.prefix))
|
(name, alias, msg.prefix))
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except AliasError, e:
|
except AliasError, e:
|
||||||
irc.error(msg, str(e))
|
irc.error(msg, str(e))
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ class Alias(callbacks.Privmsg):
|
|||||||
try:
|
try:
|
||||||
self.removeAlias(name)
|
self.removeAlias(name)
|
||||||
self.log.info('Removing alias %r (from %s)' % (name, msg.prefix))
|
self.log.info('Removing alias %r (from %s)' % (name, msg.prefix))
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except AliasError, e:
|
except AliasError, e:
|
||||||
irc.error(msg, str(e))
|
irc.error(msg, str(e))
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class Amazon(callbacks.Privmsg,configurable.Mixin):
|
|||||||
"""
|
"""
|
||||||
key = privmsgs.getArgs(args)
|
key = privmsgs.getArgs(args)
|
||||||
amazon.setLicense(key)
|
amazon.setLicense(key)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
licensekey = privmsgs.checkCapability(licensekey, 'admin')
|
licensekey = privmsgs.checkCapability(licensekey, 'admin')
|
||||||
|
|
||||||
def isbn(self, irc, msg, args):
|
def isbn(self, irc, msg, args):
|
||||||
|
@ -86,7 +86,7 @@ class BadWords(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
for word in words:
|
for word in words:
|
||||||
self._badwords.add(word)
|
self._badwords.add(word)
|
||||||
self.makeRegexp()
|
self.makeRegexp()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def remove(self, irc, msg, args):
|
def remove(self, irc, msg, args):
|
||||||
"""<word> [<word> ...]
|
"""<word> [<word> ...]
|
||||||
@ -97,7 +97,7 @@ class BadWords(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
for word in words:
|
for word in words:
|
||||||
self._badwords.discard(word)
|
self._badwords.discard(word)
|
||||||
self.makeRegexp()
|
self.makeRegexp()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
|
|
||||||
Class = BadWords
|
Class = BadWords
|
||||||
|
@ -153,7 +153,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
|
|||||||
url = url[:-1]
|
url = url[:-1]
|
||||||
self.db[name] = [url, description]
|
self.db[name] = [url, description]
|
||||||
self.shorthand = utils.abbrev(self.db.keys())
|
self.shorthand = utils.abbrev(self.db.keys())
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def remove(self, irc, msg, args):
|
def remove(self, irc, msg, args):
|
||||||
"""<abbreviation>
|
"""<abbreviation>
|
||||||
@ -166,7 +166,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
|
|||||||
name = self.shorthand[name]
|
name = self.shorthand[name]
|
||||||
del self.db[name]
|
del self.db[name]
|
||||||
self.shorthand = utils.abbrev(self.db.keys())
|
self.shorthand = utils.abbrev(self.db.keys())
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, replyNoBugzilla % name)
|
irc.error(msg, replyNoBugzilla % name)
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ class ChannelDB(plugins.ChannelDBHandler,
|
|||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("""INSERT INTO words VALUES (NULL, %s)""", word)
|
cursor.execute("""INSERT INTO words VALUES (NULL, %s)""", word)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def wordstats(self, irc, msg, args):
|
def wordstats(self, irc, msg, args):
|
||||||
"""[<channel>] [<user>] [<word>]
|
"""[<channel>] [<user>] [<word>]
|
||||||
|
@ -112,7 +112,7 @@ class Dunno(callbacks.Privmsg):
|
|||||||
VALUES(NULL, %s, %s, %s)""",
|
VALUES(NULL, %s, %s, %s)""",
|
||||||
id, int(time.time()), text)
|
id, int(time.time()), text)
|
||||||
self.db.commit()
|
self.db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def remove(self, irc, msg, args):
|
def remove(self, irc, msg, args):
|
||||||
"""<id>
|
"""<id>
|
||||||
@ -141,7 +141,7 @@ class Dunno(callbacks.Privmsg):
|
|||||||
return
|
return
|
||||||
cursor.execute("""DELETE FROM dunnos WHERE id = %s""" % dunno_id)
|
cursor.execute("""DELETE FROM dunnos WHERE id = %s""" % dunno_id)
|
||||||
self.db.commit()
|
self.db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def search(self, irc, msg, args):
|
def search(self, irc, msg, args):
|
||||||
"""<text>
|
"""<text>
|
||||||
|
@ -99,7 +99,7 @@ class Enforcer(callbacks.Privmsg, configurable.Mixin):
|
|||||||
self.started = True
|
self.started = True
|
||||||
for channel in irc.state.channels:
|
for channel in irc.state.channels:
|
||||||
irc.queueMsg(ircmsgs.topic(channel))
|
irc.queueMsg(ircmsgs.topic(channel))
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
start = privmsgs.checkCapability(start, 'admin')
|
start = privmsgs.checkCapability(start, 'admin')
|
||||||
|
|
||||||
def doJoin(self, irc, msg):
|
def doJoin(self, irc, msg):
|
||||||
|
@ -143,7 +143,7 @@ class Factoids(plugins.ChannelDBHandler,
|
|||||||
(NULL, %s, %s, %s, %s)""",
|
(NULL, %s, %s, %s, %s)""",
|
||||||
id, name, int(time.time()), factoid)
|
id, name, int(time.time()), factoid)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'That factoid is locked.')
|
irc.error(msg, 'That factoid is locked.')
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ class Factoids(plugins.ChannelDBHandler,
|
|||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("UPDATE keys SET locked=1 WHERE key LIKE %s", key)
|
cursor.execute("UPDATE keys SET locked=1 WHERE key LIKE %s", key)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyNoCapability % capability)
|
irc.error(msg, conf.replyNoCapability % capability)
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ class Factoids(plugins.ChannelDBHandler,
|
|||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("UPDATE keys SET locked=0 WHERE key LIKE %s", key)
|
cursor.execute("UPDATE keys SET locked=0 WHERE key LIKE %s", key)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyNoCapability % capability)
|
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 factoids WHERE key_id=%s""", id)
|
||||||
cursor.execute("""DELETE FROM keys WHERE key LIKE %s""", key)
|
cursor.execute("""DELETE FROM keys WHERE key LIKE %s""", key)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
if number is not None:
|
if number is not None:
|
||||||
results = cursor.fetchall()
|
results = cursor.fetchall()
|
||||||
@ -277,7 +277,7 @@ class Factoids(plugins.ChannelDBHandler,
|
|||||||
return
|
return
|
||||||
cursor.execute("DELETE FROM factoids WHERE id=%s", id)
|
cursor.execute("DELETE FROM factoids WHERE id=%s", id)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, '%s factoids have that key. ' \
|
irc.error(msg, '%s factoids have that key. ' \
|
||||||
'Please specify which one to remove, ' \
|
'Please specify which one to remove, ' \
|
||||||
@ -377,7 +377,7 @@ class Factoids(plugins.ChannelDBHandler,
|
|||||||
newfact = replacer(fact)
|
newfact = replacer(fact)
|
||||||
cursor.execute("UPDATE factoids SET fact=%s WHERE id=%s", newfact, id)
|
cursor.execute("UPDATE factoids SET fact=%s WHERE id=%s", newfact, id)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
_sqlTrans = string.maketrans('*?', '%_')
|
_sqlTrans = string.maketrans('*?', '%_')
|
||||||
def search(self, irc, msg, args):
|
def search(self, irc, msg, args):
|
||||||
|
@ -90,12 +90,12 @@ class Filter(callbacks.Privmsg):
|
|||||||
if command in self._filterCommands:
|
if command in self._filterCommands:
|
||||||
method = getattr(self, command)
|
method = getattr(self, command)
|
||||||
self.outFilters.setdefault(channel, []).append(method)
|
self.outFilters.setdefault(channel, []).append(method)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'That\'s not a valid filter command.')
|
irc.error(msg, 'That\'s not a valid filter command.')
|
||||||
else:
|
else:
|
||||||
self.outFilters[channel] = []
|
self.outFilters[channel] = []
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
outfilter = privmsgs.checkChannelCapability(outfilter, 'op')
|
outfilter = privmsgs.checkChannelCapability(outfilter, 'op')
|
||||||
|
|
||||||
def squish(self, irc, msg, args):
|
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
|
sql = """DELETE FROM %ss WHERE id=%%s""" % table
|
||||||
cursor.execute(sql, id)
|
cursor.execute(sql, id)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def change(self, irc, msg, args):
|
def change(self, irc, msg, args):
|
||||||
"""[<channel>] <lart|excuse|insult|praise> <id> <regexp>
|
"""[<channel>] <lart|excuse|insult|praise> <id> <regexp>
|
||||||
@ -237,7 +237,7 @@ class FunDB(callbacks.Privmsg, configurable.Mixin, plugins.ChannelDBHandler):
|
|||||||
(table, table)
|
(table, table)
|
||||||
cursor.execute(sql, new_entry, name, id)
|
cursor.execute(sql, new_entry, name, id)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def num(self, irc, msg, args):
|
def num(self, irc, msg, args):
|
||||||
"""[<channel>] <lart|excuse|insult|praise>
|
"""[<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.')
|
irc.error(msg, 'That doesn\'t seem to be a valid license key.')
|
||||||
return
|
return
|
||||||
google.setLicense(key)
|
google.setLicense(key)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
licensekey = privmsgs.checkCapability(licensekey, 'admin')
|
licensekey = privmsgs.checkCapability(licensekey, 'admin')
|
||||||
|
|
||||||
def google(self, irc, msg, args):
|
def google(self, irc, msg, args):
|
||||||
|
@ -173,7 +173,7 @@ class Herald(callbacks.Privmsg, configurable.Mixin):
|
|||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
return
|
return
|
||||||
self.db.setHerald(id, channel, herald)
|
self.db.setHerald(id, channel, herald)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def remove(self, irc, msg, args):
|
def remove(self, irc, msg, args):
|
||||||
"""[<channel>] <user|nick|hostmask>
|
"""[<channel>] <user|nick|hostmask>
|
||||||
@ -191,7 +191,7 @@ class Herald(callbacks.Privmsg, configurable.Mixin):
|
|||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
return
|
return
|
||||||
self.db.delHerald(id, channel)
|
self.db.delHerald(id, channel)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
|
|
||||||
Class = Herald
|
Class = Herald
|
||||||
|
@ -232,7 +232,7 @@ class Karma(callbacks.PrivmsgCommandAndRegexp,
|
|||||||
SET added=added+1
|
SET added=added+1
|
||||||
WHERE normalized=%s""", normalized)
|
WHERE normalized=%s""", normalized)
|
||||||
if self.configurables.get('karma-response', msg.args[0]):
|
if self.configurables.get('karma-response', msg.args[0]):
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def decreaseKarma(self, irc, msg, match):
|
def decreaseKarma(self, irc, msg, match):
|
||||||
r"^(\S+)--(|\s+)$"
|
r"^(\S+)--(|\s+)$"
|
||||||
@ -246,7 +246,7 @@ class Karma(callbacks.PrivmsgCommandAndRegexp,
|
|||||||
SET subtracted=subtracted+1
|
SET subtracted=subtracted+1
|
||||||
WHERE normalized=%s""", normalized)
|
WHERE normalized=%s""", normalized)
|
||||||
if self.configurables.get('karma-response', msg.args[0]):
|
if self.configurables.get('karma-response', msg.args[0]):
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
|
|
||||||
Class = Karma
|
Class = Karma
|
||||||
|
@ -122,7 +122,7 @@ class Lookup(callbacks.Privmsg):
|
|||||||
cursor.execute("""DROP TABLE %s""" % name)
|
cursor.execute("""DROP TABLE %s""" % name)
|
||||||
db.commit()
|
db.commit()
|
||||||
delattr(self.__class__, name)
|
delattr(self.__class__, name)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except sqlite.DatabaseError:
|
except sqlite.DatabaseError:
|
||||||
irc.error(msg, 'No such lookup exists.')
|
irc.error(msg, 'No such lookup exists.')
|
||||||
remove = privmsgs.checkCapability(remove, 'admin')
|
remove = privmsgs.checkCapability(remove, 'admin')
|
||||||
@ -148,7 +148,7 @@ class Lookup(callbacks.Privmsg):
|
|||||||
try:
|
try:
|
||||||
cursor.execute("""SELECT * FROM %s LIMIT 1""" % name)
|
cursor.execute("""SELECT * FROM %s LIMIT 1""" % name)
|
||||||
self.addCommand(name)
|
self.addCommand(name)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except sqlite.DatabaseError:
|
except sqlite.DatabaseError:
|
||||||
# Good, there's no such database.
|
# Good, there's no such database.
|
||||||
try:
|
try:
|
||||||
|
@ -271,7 +271,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
%s, 0)""",
|
%s, 0)""",
|
||||||
key, id, int(time.time()), fact)
|
key, id, int(time.time()), fact)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def changeFactoid(self, irc, msg, match):
|
def changeFactoid(self, irc, msg, match):
|
||||||
r"(.+)\s+=~\s+(.+)"
|
r"(.+)\s+=~\s+(.+)"
|
||||||
@ -307,7 +307,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
modified_at = %s WHERE key = %s""",
|
modified_at = %s WHERE key = %s""",
|
||||||
new_fact, id, int(time.time()), key)
|
new_fact, id, int(time.time()), key)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def augmentFactoid(self, irc, msg, match):
|
def augmentFactoid(self, irc, msg, match):
|
||||||
r"(.+?) is also (.+)"
|
r"(.+?) is also (.+)"
|
||||||
@ -338,7 +338,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
modified_at = %s WHERE key = %s""",
|
modified_at = %s WHERE key = %s""",
|
||||||
new_fact, id, int(time.time()), key)
|
new_fact, id, int(time.time()), key)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def replaceFactoid(self, irc, msg, match):
|
def replaceFactoid(self, irc, msg, match):
|
||||||
r"^no,?\s+(.+?)\s+is\s+(.+)"
|
r"^no,?\s+(.+?)\s+is\s+(.+)"
|
||||||
@ -377,7 +377,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
WHERE key = %s""",
|
WHERE key = %s""",
|
||||||
new_fact, id, int(time.time()), key)
|
new_fact, id, int(time.time()), key)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def literal(self, irc, msg, args):
|
def literal(self, irc, msg, args):
|
||||||
"""<factoid key>
|
"""<factoid key>
|
||||||
@ -487,7 +487,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
cursor.execute("""UPDATE factoids SET locked_at = %s, locked_by = %s
|
cursor.execute("""UPDATE factoids SET locked_at = %s, locked_by = %s
|
||||||
WHERE key = %s""", locked_at, id, key)
|
WHERE key = %s""", locked_at, id, key)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def lock(self, irc, msg, args):
|
def lock(self, irc, msg, args):
|
||||||
"""<factoid key>
|
"""<factoid key>
|
||||||
@ -656,7 +656,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
return
|
return
|
||||||
cursor.execute("""DELETE FROM factoids WHERE key = %s""", key)
|
cursor.execute("""DELETE FROM factoids WHERE key = %s""", key)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
Class = MoobotFactoids
|
Class = MoobotFactoids
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class News(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
cursor.execute("INSERT INTO news VALUES (NULL, %s, %s, %s, %s, %s)",
|
cursor.execute("INSERT INTO news VALUES (NULL, %s, %s, %s, %s, %s)",
|
||||||
subject[:-1], text, added_at, expires, name)
|
subject[:-1], text, added_at, expires, name)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
add = privmsgs.checkChannelCapability(add, 'news')
|
add = privmsgs.checkChannelCapability(add, 'news')
|
||||||
|
|
||||||
def _readnews(self, irc, msg, args):
|
def _readnews(self, irc, msg, args):
|
||||||
@ -190,7 +190,7 @@ class News(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
cursor.execute("""DELETE FROM news WHERE news.id = %s""", id)
|
cursor.execute("""DELETE FROM news WHERE news.id = %s""", id)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
remove = privmsgs.checkChannelCapability(remove, 'news')
|
remove = privmsgs.checkChannelCapability(remove, 'news')
|
||||||
|
|
||||||
def change(self, irc, msg, args, channel):
|
def change(self, irc, msg, args, channel):
|
||||||
@ -219,7 +219,7 @@ class News(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
(newSubject, newItem) = s.split(': ')
|
(newSubject, newItem) = s.split(': ')
|
||||||
cursor.execute("""UPDATE news SET subject=%s, item=%s WHERE id=%s""",
|
cursor.execute("""UPDATE news SET subject=%s, item=%s WHERE id=%s""",
|
||||||
newSubject, newItem, id)
|
newSubject, newItem, id)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
change = privmsgs.checkChannelCapability(change, 'news')
|
change = privmsgs.checkChannelCapability(change, 'news')
|
||||||
|
|
||||||
def old(self, irc, msg, args):
|
def old(self, irc, msg, args):
|
||||||
|
@ -181,7 +181,7 @@ class Note(callbacks.Privmsg):
|
|||||||
if not read:
|
if not read:
|
||||||
cursor.execute("""DELETE FROM notes WHERE id=%s""", id)
|
cursor.execute("""DELETE FROM notes WHERE id=%s""", id)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'That note has been read already.')
|
irc.error(msg, 'That note has been read already.')
|
||||||
else:
|
else:
|
||||||
|
@ -76,7 +76,7 @@ class Parter(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
channel = privmsgs.getArgs(args)
|
channel = privmsgs.getArgs(args)
|
||||||
self.channels.add(channel)
|
self.channels.add(channel)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
autopart = privmsgs.checkCapability(autopart, 'admin')
|
autopart = privmsgs.checkCapability(autopart, 'admin')
|
||||||
|
|
||||||
def removeautopart(self, irc, msg, args):
|
def removeautopart(self, irc, msg, args):
|
||||||
@ -86,7 +86,7 @@ class Parter(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
channel = privmsgs.getArgs(args)
|
channel = privmsgs.getArgs(args)
|
||||||
self.channels.discard(channel)
|
self.channels.discard(channel)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
removeautopart = privmsgs.checkCapability(removeautopart, 'admin')
|
removeautopart = privmsgs.checkCapability(removeautopart, 'admin')
|
||||||
|
|
||||||
def doJoin(self, irc, msg):
|
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.')
|
irc.error(msg, 'Id #%s is not an existing poll.')
|
||||||
return
|
return
|
||||||
cursor.execute("""UPDATE polls SET open=0 WHERE id=%s""", id)
|
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):
|
def add(self, irc, msg, args):
|
||||||
"""[<channel>] <id> <option text>
|
"""[<channel>] <id> <option text>
|
||||||
@ -217,7 +217,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
|||||||
cursor.execute("""INSERT INTO options VALUES
|
cursor.execute("""INSERT INTO options VALUES
|
||||||
(%s, %s, %s)""",
|
(%s, %s, %s)""",
|
||||||
option_id, poll_id, option)
|
option_id, poll_id, option)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def vote(self, irc, msg, args):
|
def vote(self, irc, msg, args):
|
||||||
"""[<channel>] <poll id> <option id>
|
"""[<channel>] <poll id> <option id>
|
||||||
@ -267,7 +267,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
|||||||
cursor.execute("""UPDATE votes SET option_id=%s
|
cursor.execute("""UPDATE votes SET option_id=%s
|
||||||
WHERE user_id=%s AND poll_id=%s""",
|
WHERE user_id=%s AND poll_id=%s""",
|
||||||
option_id, userId, poll_id)
|
option_id, userId, poll_id)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def results(self, irc, msg, args):
|
def results(self, irc, msg, args):
|
||||||
"""[<channel>] <id>
|
"""[<channel>] <id>
|
||||||
|
@ -161,7 +161,7 @@ class QuoteGrabs(plugins.ChannelDBHandler,
|
|||||||
for m in reviter(irc.state.history):
|
for m in reviter(irc.state.history):
|
||||||
if m.command == 'PRIVMSG' and ircutils.nickEqual(m.nick, nick):
|
if m.command == 'PRIVMSG' and ircutils.nickEqual(m.nick, nick):
|
||||||
self._grab(irc, m, msg.prefix)
|
self._grab(irc, m, msg.prefix)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
return
|
return
|
||||||
irc.error(msg, 'I couldn\'t find a proper message to grab.')
|
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:
|
if cursor.rowcount == 0:
|
||||||
irc.error(msg, 'There was no such quote.')
|
irc.error(msg, 'There was no such quote.')
|
||||||
else:
|
else:
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyNoCapability % capability)
|
irc.error(msg, conf.replyNoCapability % capability)
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class RSS(callbacks.Privmsg, configurable.Mixin):
|
|||||||
f.url = url # Used by __call__.
|
f.url = url # Used by __call__.
|
||||||
self.feedNames.add(name)
|
self.feedNames.add(name)
|
||||||
setattr(self.__class__, name, f)
|
setattr(self.__class__, name, f)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def remove(self, irc, msg, args):
|
def remove(self, irc, msg, args):
|
||||||
"""<name>
|
"""<name>
|
||||||
@ -190,7 +190,7 @@ class RSS(callbacks.Privmsg, configurable.Mixin):
|
|||||||
irc.error(msg, 'That\'s not a valid RSS feed command name.')
|
irc.error(msg, 'That\'s not a valid RSS feed command name.')
|
||||||
return
|
return
|
||||||
delattr(self.__class__, name)
|
delattr(self.__class__, name)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def rss(self, irc, msg, args):
|
def rss(self, irc, msg, args):
|
||||||
"""<url>
|
"""<url>
|
||||||
|
@ -174,7 +174,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||||||
self.ircstates[realIrc] = irclib.IrcState()
|
self.ircstates[realIrc] = irclib.IrcState()
|
||||||
self.lastmsg[realIrc] = ircmsgs.ping('this is just a fake message')
|
self.lastmsg[realIrc] = ircmsgs.ping('this is just a fake message')
|
||||||
self.started = True
|
self.started = True
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
start = privmsgs.checkCapability(start, 'owner')
|
start = privmsgs.checkCapability(start, 'owner')
|
||||||
|
|
||||||
def connect(self, irc, msg, args):
|
def connect(self, irc, msg, args):
|
||||||
@ -202,7 +202,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||||||
self.abbreviations[newIrc] = abbreviation
|
self.abbreviations[newIrc] = abbreviation
|
||||||
self.ircstates[newIrc] = irclib.IrcState()
|
self.ircstates[newIrc] = irclib.IrcState()
|
||||||
self.lastmsg[newIrc] = ircmsgs.ping('this is just a fake message')
|
self.lastmsg[newIrc] = ircmsgs.ping('this is just a fake message')
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
connect = privmsgs.checkCapability(connect, 'owner')
|
connect = privmsgs.checkCapability(connect, 'owner')
|
||||||
|
|
||||||
def disconnect(self, irc, msg, args):
|
def disconnect(self, irc, msg, args):
|
||||||
@ -220,7 +220,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||||||
world.ircs.remove(otherIrc)
|
world.ircs.remove(otherIrc)
|
||||||
del self.ircs[network]
|
del self.ircs[network]
|
||||||
del self.abbreviations[otherIrc]
|
del self.abbreviations[otherIrc]
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
disconnect = privmsgs.checkCapability(disconnect, 'owner')
|
disconnect = privmsgs.checkCapability(disconnect, 'owner')
|
||||||
|
|
||||||
def join(self, irc, msg, args):
|
def join(self, irc, msg, args):
|
||||||
@ -243,7 +243,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||||||
for otherIrc in self.ircs.itervalues():
|
for otherIrc in self.ircs.itervalues():
|
||||||
if channel not in otherIrc.state.channels:
|
if channel not in otherIrc.state.channels:
|
||||||
otherIrc.queueMsg(ircmsgs.join(channel))
|
otherIrc.queueMsg(ircmsgs.join(channel))
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
join = privmsgs.checkCapability(join, 'owner')
|
join = privmsgs.checkCapability(join, 'owner')
|
||||||
|
|
||||||
def part(self, irc, msg, args):
|
def part(self, irc, msg, args):
|
||||||
@ -264,7 +264,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||||||
for otherIrc in self.ircs.itervalues():
|
for otherIrc in self.ircs.itervalues():
|
||||||
if channel in otherIrc.state.channels:
|
if channel in otherIrc.state.channels:
|
||||||
otherIrc.queueMsg(ircmsgs.part(channel))
|
otherIrc.queueMsg(ircmsgs.part(channel))
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
part = privmsgs.checkCapability(part, 'owner')
|
part = privmsgs.checkCapability(part, 'owner')
|
||||||
|
|
||||||
def command(self, irc, msg, args):
|
def command(self, irc, msg, args):
|
||||||
@ -286,7 +286,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||||||
Owner = irc.getCallback('Owner')
|
Owner = irc.getCallback('Owner')
|
||||||
Owner.disambiguate(irc, args)
|
Owner.disambiguate(irc, args)
|
||||||
self.Proxy(otherIrc, msg, args)
|
self.Proxy(otherIrc, msg, args)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
command = privmsgs.checkCapability(command, 'admin')
|
command = privmsgs.checkCapability(command, 'admin')
|
||||||
|
|
||||||
def say(self, irc, msg, args):
|
def say(self, irc, msg, args):
|
||||||
|
@ -97,7 +97,7 @@ class Scheduler(callbacks.Privmsg):
|
|||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
schedule.removeEvent(id)
|
schedule.removeEvent(id)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, 'Invalid event id.')
|
irc.error(msg, 'Invalid event id.')
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class Scheduler(callbacks.Privmsg):
|
|||||||
f = self._makeCommandFunction(irc, msg, command)
|
f = self._makeCommandFunction(irc, msg, command)
|
||||||
id = schedule.addPeriodicEvent(f, seconds, name)
|
id = schedule.addPeriodicEvent(f, seconds, name)
|
||||||
# We don't reply because the command runs immediately.
|
# We don't reply because the command runs immediately.
|
||||||
# irc.reply(msg, conf.replySuccess)
|
# irc.replySuccess(msg)
|
||||||
|
|
||||||
|
|
||||||
Class = Scheduler
|
Class = Scheduler
|
||||||
|
@ -95,7 +95,7 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
self._ghosted = re.compile('(Ghost|%s).*killed' % self.nick, re.I)
|
self._ghosted = re.compile('(Ghost|%s).*killed' % self.nick, re.I)
|
||||||
self.sentGhost = False
|
self.sentGhost = False
|
||||||
self.log.info('Services started.')
|
self.log.info('Services started.')
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def _doIdentify(self, irc):
|
def _doIdentify(self, irc):
|
||||||
assert self.nickserv, 'Nickserv must not be empty.'
|
assert self.nickserv, 'Nickserv must not be empty.'
|
||||||
@ -186,7 +186,7 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
"""
|
"""
|
||||||
if self.nickserv:
|
if self.nickserv:
|
||||||
self._doIdentify(irc)
|
self._doIdentify(irc)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
s = 'This plugin must first be started via the start command.'
|
s = 'This plugin must first be started via the start command.'
|
||||||
irc.error(msg, s)
|
irc.error(msg, s)
|
||||||
|
@ -243,7 +243,7 @@ class Todo(callbacks.Privmsg):
|
|||||||
cursor.execute("""UPDATE todo SET active = 0 WHERE id = %s""",
|
cursor.execute("""UPDATE todo SET active = 0 WHERE id = %s""",
|
||||||
taskid)
|
taskid)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
_sqlTrans = string.maketrans('*?', '%_')
|
_sqlTrans = string.maketrans('*?', '%_')
|
||||||
def search(self, irc, msg, args):
|
def search(self, irc, msg, args):
|
||||||
@ -319,7 +319,7 @@ class Todo(callbacks.Privmsg):
|
|||||||
cursor.execute("""UPDATE todo SET priority = %s
|
cursor.execute("""UPDATE todo SET priority = %s
|
||||||
WHERE id = %s""", priority, id)
|
WHERE id = %s""", priority, id)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def change(self, irc, msg, args):
|
def change(self, irc, msg, args):
|
||||||
"""<task id> <regexp>
|
"""<task id> <regexp>
|
||||||
@ -350,7 +350,7 @@ class Todo(callbacks.Privmsg):
|
|||||||
cursor.execute("""UPDATE todo SET task = %s
|
cursor.execute("""UPDATE todo SET task = %s
|
||||||
WHERE id = %s""", newtext, taskid)
|
WHERE id = %s""", newtext, taskid)
|
||||||
db.commit()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
Class = Todo
|
Class = Todo
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ class Words(callbacks.Privmsg, configurable.Mixin):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
addWord(self.dbHandler.getDb(), word, commit=True)
|
addWord(self.dbHandler.getDb(), word, commit=True)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def crossword(self, irc, msg, args):
|
def crossword(self, irc, msg, args):
|
||||||
"""<word>
|
"""<word>
|
||||||
|
16
src/Admin.py
16
src/Admin.py
@ -190,7 +190,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
if command in conf.defaultCapabilities:
|
if command in conf.defaultCapabilities:
|
||||||
conf.defaultCapabilities.remove(command)
|
conf.defaultCapabilities.remove(command)
|
||||||
conf.defaultCapabilities.add(capability)
|
conf.defaultCapabilities.add(capability)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def enable(self, irc, msg, args):
|
def enable(self, irc, msg, args):
|
||||||
"""<command>
|
"""<command>
|
||||||
@ -205,7 +205,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
return
|
return
|
||||||
if anticapability in conf.defaultCapabilities:
|
if anticapability in conf.defaultCapabilities:
|
||||||
conf.defaultCapabilities.remove(anticapability)
|
conf.defaultCapabilities.remove(anticapability)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'That command wasn\'t disabled.')
|
irc.error(msg, 'That command wasn\'t disabled.')
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
user = ircdb.users.getUser(id)
|
user = ircdb.users.getUser(id)
|
||||||
user.addCapability(capability)
|
user.addCapability(capability)
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
else:
|
else:
|
||||||
@ -267,7 +267,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
try:
|
try:
|
||||||
user.removeCapability(capability)
|
user.removeCapability(capability)
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, 'That user doesn\'t have that capability.')
|
irc.error(msg, 'That user doesn\'t have that capability.')
|
||||||
return
|
return
|
||||||
@ -291,7 +291,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
irc.error(msg, 'I can\'t find a hostmask for %s' % arg)
|
irc.error(msg, 'I can\'t find a hostmask for %s' % arg)
|
||||||
return
|
return
|
||||||
conf.ignores.append(hostmask)
|
conf.ignores.append(hostmask)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def unignore(self, irc, msg, args):
|
def unignore(self, irc, msg, args):
|
||||||
"""<hostmask|nick>
|
"""<hostmask|nick>
|
||||||
@ -312,7 +312,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
conf.ignores.remove(hostmask)
|
conf.ignores.remove(hostmask)
|
||||||
while hostmask in conf.ignores:
|
while hostmask in conf.ignores:
|
||||||
conf.ignores.remove(hostmask)
|
conf.ignores.remove(hostmask)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
irc.error(msg, '%s wasn\'t in conf.ignores.' % hostmask)
|
irc.error(msg, '%s wasn\'t in conf.ignores.' % hostmask)
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
conf.prefixChars = s
|
conf.prefixChars = s
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def reportbug(self, irc, msg, args):
|
def reportbug(self, irc, msg, args):
|
||||||
"""<description>
|
"""<description>
|
||||||
@ -366,7 +366,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
['supybot-bugs@lists.sourceforge.net'],
|
['supybot-bugs@lists.sourceforge.net'],
|
||||||
email)
|
email)
|
||||||
smtp.quit()
|
smtp.quit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
reportbug = privmsgs.thread(reportbug)
|
reportbug = privmsgs.thread(reportbug)
|
||||||
|
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.lobotomized = True
|
c.lobotomized = True
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
lobotomize = privmsgs.checkChannelCapability(lobotomize, 'op')
|
lobotomize = privmsgs.checkChannelCapability(lobotomize, 'op')
|
||||||
|
|
||||||
def unlobotomize(self, irc, msg, args, channel):
|
def unlobotomize(self, irc, msg, args, channel):
|
||||||
@ -299,7 +299,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.lobotomized = False
|
c.lobotomized = False
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
unlobotomize = privmsgs.checkChannelCapability(unlobotomize, 'op')
|
unlobotomize = privmsgs.checkChannelCapability(unlobotomize, 'op')
|
||||||
|
|
||||||
def permban(self, irc, msg, args, channel):
|
def permban(self, irc, msg, args, channel):
|
||||||
@ -321,7 +321,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.addBan(banmask)
|
c.addBan(banmask)
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
permban = privmsgs.checkChannelCapability(permban, 'op')
|
permban = privmsgs.checkChannelCapability(permban, 'op')
|
||||||
|
|
||||||
def unpermban(self, irc, msg, args, channel):
|
def unpermban(self, irc, msg, args, channel):
|
||||||
@ -335,7 +335,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.removeBan(banmask)
|
c.removeBan(banmask)
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
unpermban = privmsgs.checkChannelCapability(unpermban, 'op')
|
unpermban = privmsgs.checkChannelCapability(unpermban, 'op')
|
||||||
|
|
||||||
def ignore(self, irc, msg, args, channel):
|
def ignore(self, irc, msg, args, channel):
|
||||||
@ -357,7 +357,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.addIgnore(banmask)
|
c.addIgnore(banmask)
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
ignore = privmsgs.checkChannelCapability(ignore, 'op')
|
ignore = privmsgs.checkChannelCapability(ignore, 'op')
|
||||||
|
|
||||||
def unignore(self, irc, msg, args, channel):
|
def unignore(self, irc, msg, args, channel):
|
||||||
@ -371,7 +371,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.removeIgnore(banmask)
|
c.removeIgnore(banmask)
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
unignore = privmsgs.checkChannelCapability(unignore, 'op')
|
unignore = privmsgs.checkChannelCapability(unignore, 'op')
|
||||||
|
|
||||||
def ignores(self, irc, msg, args, channel):
|
def ignores(self, irc, msg, args, channel):
|
||||||
@ -409,7 +409,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
user = ircdb.users.getUser(id)
|
user = ircdb.users.getUser(id)
|
||||||
user.addCapability(capability)
|
user.addCapability(capability)
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
addcapability = privmsgs.checkChannelCapability(addcapability,'op')
|
addcapability = privmsgs.checkChannelCapability(addcapability,'op')
|
||||||
@ -429,7 +429,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
user = ircdb.users.getUser(id)
|
user = ircdb.users.getUser(id)
|
||||||
user.removeCapability(capability)
|
user.removeCapability(capability)
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
removecapability = privmsgs.checkChannelCapability(removecapability, 'op')
|
removecapability = privmsgs.checkChannelCapability(removecapability, 'op')
|
||||||
@ -454,7 +454,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
irc.error(msg, s)
|
irc.error(msg, s)
|
||||||
return
|
return
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
setdefaultcapability = \
|
setdefaultcapability = \
|
||||||
privmsgs.checkChannelCapability(setdefaultcapability, 'op')
|
privmsgs.checkChannelCapability(setdefaultcapability, 'op')
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.addCapability(capability)
|
c.addCapability(capability)
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
setcapability = privmsgs.checkChannelCapability(setcapability, 'op')
|
setcapability = privmsgs.checkChannelCapability(setcapability, 'op')
|
||||||
|
|
||||||
def unsetcapability(self, irc, msg, args, channel):
|
def unsetcapability(self, irc, msg, args, channel):
|
||||||
@ -484,7 +484,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.removeCapability(capability)
|
c.removeCapability(capability)
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
unsetcapability = privmsgs.checkChannelCapability(unsetcapability, 'op')
|
unsetcapability = privmsgs.checkChannelCapability(unsetcapability, 'op')
|
||||||
|
|
||||||
def capabilities(self, irc, msg, args):
|
def capabilities(self, irc, msg, args):
|
||||||
|
26
src/Owner.py
26
src/Owner.py
@ -201,7 +201,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg,'I have no default plugin for that command.')
|
irc.error(msg,'I have no default plugin for that command.')
|
||||||
return
|
return
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def eval(self, irc, msg, args):
|
def eval(self, irc, msg, args):
|
||||||
"""<expression>
|
"""<expression>
|
||||||
@ -228,7 +228,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
s = privmsgs.getArgs(args)
|
s = privmsgs.getArgs(args)
|
||||||
try:
|
try:
|
||||||
exec s
|
exec s
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
irc.reply(msg, utils.exnToString(e))
|
irc.reply(msg, utils.exnToString(e))
|
||||||
else:
|
else:
|
||||||
@ -250,7 +250,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
irc.error(msg, utils.exnToString(e))
|
irc.error(msg, utils.exnToString(e))
|
||||||
return
|
return
|
||||||
setattr(conf, name, value)
|
setattr(conf, name, value)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
if name == 'allowEval':
|
if name == 'allowEval':
|
||||||
irc.error(msg, 'You can\'t set the value of 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))
|
irc.error(msg, str(e))
|
||||||
return
|
return
|
||||||
setattr(conf, name, value)
|
setattr(conf, name, value)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
elif name:
|
elif name:
|
||||||
typeNames = {conf.mystr: 'string',
|
typeNames = {conf.mystr: 'string',
|
||||||
conf.mybool: 'boolean',
|
conf.mybool: 'boolean',
|
||||||
@ -293,7 +293,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
"""
|
"""
|
||||||
capability = callbacks.canonicalName(privmsgs.getArgs(args))
|
capability = callbacks.canonicalName(privmsgs.getArgs(args))
|
||||||
conf.defaultCapabilities.add(capability)
|
conf.defaultCapabilities.add(capability)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def unsetdefaultcapability(self, irc, msg, args):
|
def unsetdefaultcapability(self, irc, msg, args):
|
||||||
"""<capability>
|
"""<capability>
|
||||||
@ -302,7 +302,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
"""
|
"""
|
||||||
capability = callbacks.canonicalName(privmsgs.getArgs(args))
|
capability = callbacks.canonicalName(privmsgs.getArgs(args))
|
||||||
conf.defaultCapabilities.remove(capability)
|
conf.defaultCapabilities.remove(capability)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def ircquote(self, irc, msg, args):
|
def ircquote(self, irc, msg, args):
|
||||||
"""<string to be sent to the server>
|
"""<string to be sent to the server>
|
||||||
@ -339,7 +339,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
Runs all the periodic flushers in world.flushers.
|
Runs all the periodic flushers in world.flushers.
|
||||||
"""
|
"""
|
||||||
world.flush()
|
world.flush()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def upkeep(self, irc, msg, args):
|
def upkeep(self, irc, msg, args):
|
||||||
"""takes no arguments
|
"""takes no arguments
|
||||||
@ -361,7 +361,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
"""
|
"""
|
||||||
(name, value) = privmsgs.getArgs(args, optional=1)
|
(name, value) = privmsgs.getArgs(args, optional=1)
|
||||||
world.tempvars[name] = value
|
world.tempvars[name] = value
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def unset(self, irc, msg, args):
|
def unset(self, irc, msg, args):
|
||||||
"""<name>
|
"""<name>
|
||||||
@ -371,7 +371,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
name = privmsgs.getArgs(args)
|
name = privmsgs.getArgs(args)
|
||||||
try:
|
try:
|
||||||
del world.tempvars[name]
|
del world.tempvars[name]
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, 'That variable wasn\'t set.')
|
irc.error(msg, 'That variable wasn\'t set.')
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
irc.error(msg, utils.exnToString(e))
|
irc.error(msg, utils.exnToString(e))
|
||||||
return
|
return
|
||||||
loadPluginClass(irc, module)
|
loadPluginClass(irc, module)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def reload(self, irc, msg, args):
|
def reload(self, irc, msg, args):
|
||||||
"""<plugin>
|
"""<plugin>
|
||||||
@ -419,7 +419,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
del callback
|
del callback
|
||||||
gc.collect()
|
gc.collect()
|
||||||
callback = loadPluginClass(irc, module)
|
callback = loadPluginClass(irc, module)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
for callback in callbacks:
|
for callback in callbacks:
|
||||||
irc.addCallback(callback)
|
irc.addCallback(callback)
|
||||||
@ -440,7 +440,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
callback.die()
|
callback.die()
|
||||||
del callback
|
del callback
|
||||||
gc.collect()
|
gc.collect()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'There was no callback %s' % name)
|
irc.error(msg, 'There was no callback %s' % name)
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
"""
|
"""
|
||||||
ircdb.users.reload()
|
ircdb.users.reload()
|
||||||
ircdb.channels.reload()
|
ircdb.channels.reload()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
|
|
||||||
Class = Owner
|
Class = Owner
|
||||||
|
16
src/User.py
16
src/User.py
@ -117,7 +117,7 @@ class User(callbacks.Privmsg):
|
|||||||
user.setPassword(password, hashed=hashed)
|
user.setPassword(password, hashed=hashed)
|
||||||
user.addHostmask(msg.prefix)
|
user.addHostmask(msg.prefix)
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def unregister(self, irc, msg, args):
|
def unregister(self, irc, msg, args):
|
||||||
"""<name> <password>
|
"""<name> <password>
|
||||||
@ -134,7 +134,7 @@ class User(callbacks.Privmsg):
|
|||||||
return
|
return
|
||||||
if user.checkPassword(password):
|
if user.checkPassword(password):
|
||||||
ircdb.users.delUser(id)
|
ircdb.users.delUser(id)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyIncorrectAuth)
|
irc.error(msg, conf.replyIncorrectAuth)
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ class User(callbacks.Privmsg):
|
|||||||
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
||||||
user.name = newname
|
user.name = newname
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def addhostmask(self, irc, msg, args):
|
def addhostmask(self, irc, msg, args):
|
||||||
"""<name> <hostmask> [<password>]
|
"""<name> <hostmask> [<password>]
|
||||||
@ -199,7 +199,7 @@ class User(callbacks.Privmsg):
|
|||||||
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
||||||
user.addHostmask(hostmask)
|
user.addHostmask(hostmask)
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyIncorrectAuth)
|
irc.error(msg, conf.replyIncorrectAuth)
|
||||||
return
|
return
|
||||||
@ -227,7 +227,7 @@ class User(callbacks.Privmsg):
|
|||||||
irc.error(msg, 'There was no such hostmask.')
|
irc.error(msg, 'There was no such hostmask.')
|
||||||
return
|
return
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyIncorrectAuth)
|
irc.error(msg, conf.replyIncorrectAuth)
|
||||||
return
|
return
|
||||||
@ -256,7 +256,7 @@ class User(callbacks.Privmsg):
|
|||||||
if user.checkPassword(oldpassword):
|
if user.checkPassword(oldpassword):
|
||||||
user.setPassword(newpassword, hashed=hashed)
|
user.setPassword(newpassword, hashed=hashed)
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyIncorrectAuth)
|
irc.error(msg, conf.replyIncorrectAuth)
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ class User(callbacks.Privmsg):
|
|||||||
try:
|
try:
|
||||||
user.setAuth(msg.prefix)
|
user.setAuth(msg.prefix)
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
irc.error(msg, 'Your secure flag is true and your hostmask '
|
irc.error(msg, 'Your secure flag is true and your hostmask '
|
||||||
'doesn\'t match any of your known hostmasks.')
|
'doesn\'t match any of your known hostmasks.')
|
||||||
@ -360,7 +360,7 @@ class User(callbacks.Privmsg):
|
|||||||
return
|
return
|
||||||
user.unsetAuth()
|
user.unsetAuth()
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
|
|
||||||
def whoami(self, irc, msg, args):
|
def whoami(self, irc, msg, args):
|
||||||
"""takes no arguments
|
"""takes no arguments
|
||||||
|
@ -65,9 +65,6 @@ import irclib
|
|||||||
import ircmsgs
|
import ircmsgs
|
||||||
import ircutils
|
import ircutils
|
||||||
|
|
||||||
###
|
|
||||||
# Privmsg: handles privmsg commands in a standard fashion.
|
|
||||||
###
|
|
||||||
def addressed(nick, msg):
|
def addressed(nick, msg):
|
||||||
"""If msg is addressed to 'name', returns the portion after the address.
|
"""If msg is addressed to 'name', returns the portion after the address.
|
||||||
Otherwise returns the empty string.
|
Otherwise returns the empty string.
|
||||||
@ -289,8 +286,41 @@ def checkCommandCapability(msg, command):
|
|||||||
ircdb.checkCapability(msg.prefix, command) or \
|
ircdb.checkCapability(msg.prefix, command) or \
|
||||||
ircdb.checkCapability(msg.prefix, chancap)
|
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)."
|
"A proxy object to allow proper nested of commands (even threaded ones)."
|
||||||
def __init__(self, irc, msg, args):
|
def __init__(self, irc, msg, args):
|
||||||
log.debug('IrcObjectProxy.__init__: %s' % args)
|
log.debug('IrcObjectProxy.__init__: %s' % args)
|
||||||
@ -471,21 +501,6 @@ class IrcObjectProxy:
|
|||||||
self.args[self.counter] = s
|
self.args[self.counter] = s
|
||||||
self.evalArgs()
|
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):
|
def error(self, msg, s, private=False):
|
||||||
"""error(msg, text) -> replies to msg with an error message of text.
|
"""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)
|
self.irc.error(self.msg, s)
|
||||||
|
|
||||||
|
|
||||||
class ConfigIrcProxy(object):
|
class ConfigIrcProxy(RichReplyMethods):
|
||||||
"""Used as a proxy Irc object during configuration. """
|
"""Used as a proxy Irc object during configuration. """
|
||||||
def __init__(self, irc):
|
def __init__(self, irc):
|
||||||
self.__dict__['irc'] = irc
|
self.__dict__['irc'] = irc
|
||||||
@ -713,7 +728,7 @@ class Privmsg(irclib.IrcCallback):
|
|||||||
self.log.info('%s took %s seconds', name, elapsed)
|
self.log.info('%s took %s seconds', name, elapsed)
|
||||||
|
|
||||||
|
|
||||||
class IrcObjectProxyRegexp(object):
|
class IrcObjectProxyRegexp(RichReplyMethods):
|
||||||
def __init__(self, irc, *args):
|
def __init__(self, irc, *args):
|
||||||
self.irc = irc
|
self.irc = irc
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ class Mixin(object):
|
|||||||
if ircdb.checkCapability(msg.prefix, capability):
|
if ircdb.checkCapability(msg.prefix, capability):
|
||||||
try:
|
try:
|
||||||
self.configurables.set(name, value, channel)
|
self.configurables.set(name, value, channel)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except Error, e:
|
except Error, e:
|
||||||
irc.error(msg, str(e))
|
irc.error(msg, str(e))
|
||||||
else:
|
else:
|
||||||
@ -304,7 +304,7 @@ class Mixin(object):
|
|||||||
if ircdb.checkCapability(msg.prefix, 'admin'):
|
if ircdb.checkCapability(msg.prefix, 'admin'):
|
||||||
try:
|
try:
|
||||||
self.globalConfigurables.set(name, value, channel)
|
self.globalConfigurables.set(name, value, channel)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.replySuccess(msg)
|
||||||
except Error, e:
|
except Error, e:
|
||||||
irc.error(msg, str(e))
|
irc.error(msg, str(e))
|
||||||
else:
|
else:
|
||||||
|
@ -218,7 +218,7 @@ def isAction(msg):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
_unactionre = re.compile(r'^\x01ACTION (.*)\x01$')
|
_unactionre = re.compile(r'^\x01ACTION\s+(.*)\x01$')
|
||||||
def unAction(msg):
|
def unAction(msg):
|
||||||
"""Returns the payload (i.e., non-ACTION text) of an ACTION msg."""
|
"""Returns the payload (i.e., non-ACTION text) of an ACTION msg."""
|
||||||
assert isAction(msg)
|
assert isAction(msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user