mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 12:12:54 +01:00
Fix User.hostmasks so it correctly checks capability and doesn't display
the hostmasks as an IrcSet
This commit is contained in:
parent
9246b169e1
commit
69d98609fc
13
src/User.py
13
src/User.py
@ -302,22 +302,25 @@ class User(callbacks.Privmsg):
|
|||||||
Returns the hostmasks of the user specified by <name>; if <name> isn't
|
Returns the hostmasks of the user specified by <name>; if <name> isn't
|
||||||
specified, returns the hostmasks of the user calling the command.
|
specified, returns the hostmasks of the user calling the command.
|
||||||
"""
|
"""
|
||||||
|
def getHostmasks(user):
|
||||||
|
hostmasks = map(repr, user.hostmasks)
|
||||||
|
hostmasks.sort()
|
||||||
|
return utils.commaAndify(hostmasks)
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(msg.prefix)
|
user = ircdb.users.getUser(msg.prefix)
|
||||||
if name:
|
if name:
|
||||||
if name != user.name and not user.checkCapability('owner'):
|
if name != user.name and \
|
||||||
|
not ircdb.checkCapability(msg.prefix, 'owner'):
|
||||||
irc.error('You may only retrieve your own hostmasks.',
|
irc.error('You may only retrieve your own hostmasks.',
|
||||||
Raise=True)
|
Raise=True)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(name)
|
user = ircdb.users.getUser(name)
|
||||||
hostmasks = map(repr, user.hostmasks)
|
irc.reply(getHostmasks(user))
|
||||||
hostmasks.sort()
|
|
||||||
irc.reply(utils.commaAndify(hostmasks))
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.errorNoUser()
|
irc.errorNoUser()
|
||||||
else:
|
else:
|
||||||
irc.reply(repr(user.hostmasks))
|
irc.reply(getHostmasks(user))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.errorNotRegistered()
|
irc.errorNotRegistered()
|
||||||
hostmasks = wrap(hostmasks, ['private', additional('something')])
|
hostmasks = wrap(hostmasks, ['private', additional('something')])
|
||||||
|
Loading…
Reference in New Issue
Block a user