mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-27 21:22:39 +01:00
Updated replyNotRegistered stuff.
This commit is contained in:
parent
2846b4ab2f
commit
845142e688
@ -104,7 +104,7 @@ class Dunno(callbacks.Privmsg):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
text = privmsgs.getArgs(args, required=1)
|
||||
cursor = self.db.cursor()
|
||||
@ -123,7 +123,7 @@ class Dunno(callbacks.Privmsg):
|
||||
try:
|
||||
user_id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
dunno_id = privmsgs.getArgs(args, required=1)
|
||||
cursor = self.db.cursor()
|
||||
|
@ -107,14 +107,15 @@ class Factoids(plugins.ChannelDBHandler,
|
||||
db.commit()
|
||||
return db
|
||||
|
||||
def learn(self, irc, msg, args, channel):
|
||||
def learn(self, irc, msg, args):
|
||||
"""[<channel>] <key> as <value>
|
||||
|
||||
Associates <key> with <value>. <channel> is only necessary if the
|
||||
message isn't sent on the channel itself. The word "as" is necessary
|
||||
message isn't sent on the channel itself. The word 'as' is necessary
|
||||
to separate the key from the value. It can be changed to another
|
||||
word via the learn-separator configurable.
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
try:
|
||||
separator = self.configurables.get('learn-separator', channel)
|
||||
i = args.index(separator)
|
||||
@ -189,13 +190,14 @@ class Factoids(plugins.ChannelDBHandler,
|
||||
irc.error('That\'s not a valid number for this key.')
|
||||
return
|
||||
|
||||
def lock(self, irc, msg, args, channel):
|
||||
def lock(self, irc, msg, args):
|
||||
"""[<channel>] <key>
|
||||
|
||||
Locks the factoid(s) associated with <key> so that they cannot be
|
||||
removed or added to. <channel> is only necessary if the message isn't
|
||||
sent in the channel itself.
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
key = privmsgs.getArgs(args)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
@ -203,13 +205,14 @@ class Factoids(plugins.ChannelDBHandler,
|
||||
db.commit()
|
||||
irc.replySuccess()
|
||||
|
||||
def unlock(self, irc, msg, args, channel):
|
||||
def unlock(self, irc, msg, args):
|
||||
"""[<channel>] <key>
|
||||
|
||||
Unlocks the factoid(s) associated with <key> so that they can be
|
||||
removed or added to. <channel> is only necessary if the message isn't
|
||||
sent in the channel itself.
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
key = privmsgs.getArgs(args)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
@ -217,7 +220,7 @@ class Factoids(plugins.ChannelDBHandler,
|
||||
db.commit()
|
||||
irc.replySuccess()
|
||||
|
||||
def forget(self, irc, msg, args, channel):
|
||||
def forget(self, irc, msg, args):
|
||||
"""[<channel>] <key> [<number>|*]
|
||||
|
||||
Removes the factoid <key> from the factoids database. If there are
|
||||
@ -226,6 +229,7 @@ class Factoids(plugins.ChannelDBHandler,
|
||||
factoids associated with a key. <channel> is only necessary if
|
||||
the message isn't sent in the channel itself.
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
if args[-1].isdigit():
|
||||
number = int(args.pop())
|
||||
number -= 1
|
||||
@ -324,12 +328,13 @@ class Factoids(plugins.ChannelDBHandler,
|
||||
utils.nItems('factoid', counter), factoids)
|
||||
irc.reply(s)
|
||||
|
||||
def change(self, irc, msg, args, channel):
|
||||
def change(self, irc, msg, args):
|
||||
"""[<channel>] <key> <number> <regexp>
|
||||
|
||||
Changes the factoid #<number> associated with <key> according to
|
||||
<regexp>.
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
(key, number, regexp) = privmsgs.getArgs(args, required=3)
|
||||
try:
|
||||
replacer = utils.perlReToReplacer(regexp)
|
||||
|
@ -138,7 +138,7 @@ class FunDB(callbacks.Privmsg, configurable.Mixin, plugins.ChannelDBHandler):
|
||||
try:
|
||||
name = ircdb.users.getUser(msg.prefix).name
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
if table == "lart" or table == "praise":
|
||||
if '$who' not in s:
|
||||
@ -173,7 +173,7 @@ class FunDB(callbacks.Privmsg, configurable.Mixin, plugins.ChannelDBHandler):
|
||||
try:
|
||||
ircdb.users.getUser(msg.prefix).name
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
try:
|
||||
id = int(id)
|
||||
@ -206,7 +206,7 @@ class FunDB(callbacks.Privmsg, configurable.Mixin, plugins.ChannelDBHandler):
|
||||
try:
|
||||
name = ircdb.users.getUser(msg.prefix).name
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
try:
|
||||
id = int(id)
|
||||
|
@ -251,7 +251,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
key, fact = match.groups()
|
||||
# These are okay, unless there's an _is_ in there, in which case
|
||||
@ -279,7 +279,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
key, regexp = match.groups()
|
||||
db = self.dbHandler.getDb()
|
||||
@ -315,7 +315,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
key, new_text = match.groups()
|
||||
db = self.dbHandler.getDb()
|
||||
@ -346,7 +346,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
key, new_fact = match.groups()
|
||||
# These are okay, unless there's an _is_ in there, in which case
|
||||
@ -450,7 +450,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
key = privmsgs.getArgs(args, required=1)
|
||||
db = self.dbHandler.getDb()
|
||||
@ -640,7 +640,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
|
||||
try:
|
||||
ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
key = privmsgs.getArgs(args, required=1)
|
||||
db = self.dbHandler.getDb()
|
||||
|
@ -139,7 +139,7 @@ class Note(callbacks.Privmsg):
|
||||
try:
|
||||
fromId = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
if ircutils.isChannel(msg.args[0]):
|
||||
public = 1
|
||||
@ -168,7 +168,7 @@ class Note(callbacks.Privmsg):
|
||||
try:
|
||||
userid = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
db = self.dbHandler.getDb()
|
||||
cursor = db.cursor()
|
||||
@ -197,7 +197,7 @@ class Note(callbacks.Privmsg):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
try:
|
||||
noteid = int(noteid)
|
||||
@ -247,7 +247,7 @@ class Note(callbacks.Privmsg):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
db = self.dbHandler.getDb()
|
||||
cursor = db.cursor()
|
||||
@ -270,7 +270,7 @@ class Note(callbacks.Privmsg):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
db = self.dbHandler.getDb()
|
||||
cursor = db.cursor()
|
||||
|
@ -138,7 +138,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
||||
try:
|
||||
userId = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
@ -187,7 +187,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
||||
try:
|
||||
userId = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
@ -237,7 +237,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
||||
try:
|
||||
userId = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
|
@ -125,7 +125,7 @@ class Todo(callbacks.Privmsg):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
cursor.execute("""SELECT id, task FROM todo
|
||||
WHERE userid = %s AND active = 1
|
||||
@ -186,7 +186,7 @@ class Todo(callbacks.Privmsg):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
(optlist, rest) = getopt.getopt(args, '', ['priority='])
|
||||
priority = 0
|
||||
@ -218,7 +218,7 @@ class Todo(callbacks.Privmsg):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
taskids = privmsgs.getArgs(args)
|
||||
tasks = taskids.split()
|
||||
@ -256,7 +256,7 @@ class Todo(callbacks.Privmsg):
|
||||
try:
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
(optlist, rest) = getopt.getopt(args, '', ['regexp='])
|
||||
if not optlist and not rest:
|
||||
@ -301,7 +301,7 @@ class Todo(callbacks.Privmsg):
|
||||
try:
|
||||
user_id = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
(id, priority) = privmsgs.getArgs(args, required=2)
|
||||
db = self.dbHandler.getDb()
|
||||
@ -329,7 +329,7 @@ class Todo(callbacks.Privmsg):
|
||||
try:
|
||||
userid = ircdb.users.getUserId(msg.prefix)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
taskid, regexp = privmsgs.getArgs(args, required=2)
|
||||
# Check the regexp first, it's easier and doesn't require a db query
|
||||
|
@ -303,7 +303,7 @@ class User(callbacks.Privmsg):
|
||||
else:
|
||||
irc.reply(repr(user.hostmasks))
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
|
||||
def capabilities(self, irc, msg, args):
|
||||
"""[<name>]
|
||||
@ -371,7 +371,7 @@ class User(callbacks.Privmsg):
|
||||
user = ircdb.users.getUser(msg.prefix)
|
||||
irc.reply(user.name)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
|
||||
def setsecure(self, irc, msg, args):
|
||||
"""<password> [<True|False>]
|
||||
@ -389,7 +389,7 @@ class User(callbacks.Privmsg):
|
||||
id = ircdb.users.getUserId(msg.prefix)
|
||||
user = ircdb.users.getUser(id)
|
||||
except KeyError:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
if value == '':
|
||||
value = not user.secure
|
||||
elif value.lower() in ('true', 'false'):
|
||||
|
@ -271,7 +271,7 @@ def formatArgumentError(method, name=None):
|
||||
else:
|
||||
return 'Invalid arguments for %s.' % method.__name__
|
||||
|
||||
def checkCommandCapability(msg, command):
|
||||
def checkCommandCapability(msg, cb, command):
|
||||
anticap = ircdb.makeAntiCapability(command)
|
||||
if ircdb.checkCapability(msg.prefix, anticap):
|
||||
log.info('Preventing because of anticap: %s', msg.prefix)
|
||||
@ -409,8 +409,8 @@ class IrcObjectProxy(RichReplyMethods):
|
||||
else:
|
||||
del self.args[0]
|
||||
cb = cbs[0]
|
||||
if not checkCommandCapability(self.msg, name):
|
||||
self.error(conf.replyNoCapability % name)
|
||||
if not checkCommandCapability(self.msg, cb, name):
|
||||
self.errorNoCapability(name)
|
||||
return
|
||||
command = getattr(cb, name)
|
||||
Privmsg.handled = True
|
||||
@ -636,8 +636,8 @@ class Privmsg(irclib.IrcCallback):
|
||||
if name == canonicalName(self.name()):
|
||||
handleBadArgs()
|
||||
elif self.isCommand(name):
|
||||
if not checkCommandCapability(msg, name):
|
||||
irc.error(conf.replyNoCapability % name)
|
||||
if not checkCommandCapability(msg, self, name):
|
||||
irc.errorNoCapability(name)
|
||||
return
|
||||
del args[0]
|
||||
method = getattr(self, name)
|
||||
|
@ -143,7 +143,7 @@ def name(f):
|
||||
name = ircdb.users.getUser(msg.prefix).name
|
||||
except KeyError:
|
||||
if conf.requireRegistration:
|
||||
irc.error(conf.replyNotRegistered)
|
||||
irc.errorNotRegistered()
|
||||
return
|
||||
else:
|
||||
name = msg.prefix
|
||||
|
Loading…
Reference in New Issue
Block a user