mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
User configuration stuff can wait until later.
This commit is contained in:
parent
c51a9db841
commit
f53058e5c7
68
src/User.py
68
src/User.py
@ -458,41 +458,41 @@ class User(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
irc.error(conf.supybot.replies.incorrectAuthentication())
|
irc.error(conf.supybot.replies.incorrectAuthentication())
|
||||||
|
|
||||||
def config(self, irc, msg, args):
|
## def config(self, irc, msg, args):
|
||||||
"""[--list] <name> [<value>]
|
## """[--list] <name> [<value>]
|
||||||
|
|
||||||
Sets the user configuration variable <name> to <value>, if given. If
|
## Sets the user configuration variable <name> to <value>, if given. If
|
||||||
<value> is not given, returns the current value of <name> for the user
|
## <value> is not given, returns the current value of <name> for the user
|
||||||
giving the command. If --list is given, lists the values in <name>.
|
## giving the command. If --list is given, lists the values in <name>.
|
||||||
"""
|
## """
|
||||||
try:
|
## try:
|
||||||
id = ircdb.users.getUserId(msg.prefix)
|
## id = ircdb.users.getUserId(msg.prefix)
|
||||||
except KeyError:
|
## except KeyError:
|
||||||
irc.errorNoUser()
|
## irc.errorNoUser()
|
||||||
return
|
## return
|
||||||
list = False
|
## list = False
|
||||||
(optlist, args) = getopt.getopt(args, '', ['list'])
|
## (optlist, args) = getopt.getopt(args, '', ['list'])
|
||||||
for (option, arg) in optlist:
|
## for (option, arg) in optlist:
|
||||||
if option == '--list':
|
## if option == '--list':
|
||||||
list = True
|
## list = True
|
||||||
if len(args) >= 2:
|
## if len(args) >= 2:
|
||||||
# We're setting.
|
## # We're setting.
|
||||||
pass
|
## pass
|
||||||
else:
|
## else:
|
||||||
# We're getting.
|
## # We're getting.
|
||||||
name = privmsgs.getArgs(args)
|
## name = privmsgs.getArgs(args)
|
||||||
if not name.startswith('users.'):
|
## if not name.startswith('users.'):
|
||||||
name = 'users.' + name
|
## name = 'users.' + name
|
||||||
try:
|
## try:
|
||||||
wrapper = Config.getWrapper(name)
|
## wrapper = Config.getWrapper(name)
|
||||||
wrapper = wrapper.get(str(id))
|
## wrapper = wrapper.get(str(id))
|
||||||
except InvalidRegistryValue, e:
|
## except InvalidRegistryValue, e:
|
||||||
irc.error('%r is not a valid configuration variable.' % name)
|
## irc.error('%r is not a valid configuration variable.' % name)
|
||||||
return
|
## return
|
||||||
if list:
|
## if list:
|
||||||
pass
|
## pass
|
||||||
else:
|
## else:
|
||||||
irc.reply(str(wrapper))
|
## irc.reply(str(wrapper))
|
||||||
|
|
||||||
Class = User
|
Class = User
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user