3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

utils.isOper: check for both umode +o and login status

Also, make commands.status show this isOper result.
This commit is contained in:
James Lu 2015-08-02 19:41:40 -07:00
parent 3646930d34
commit 880b59c2c1
2 changed files with 5 additions and 3 deletions

View File

@ -14,9 +14,10 @@ def status(irc, source, args):
Returns your current PyLink login status."""
identified = irc.users[source].identified
if identified:
utils.msg(irc, source, 'You are identified as %s.' % identified)
utils.msg(irc, source, 'You are identified as \x02%s\x02.' % identified)
else:
utils.msg(irc, source, 'You are not identified as anyone.')
utils.msg(irc, source, 'Operator access: \x02%s\x02' % bool(utils.isOper(irc, source)))
@utils.add_cmd
def identify(irc, source, args):

View File

@ -350,9 +350,10 @@ def isInternalServer(irc, sid):
def isOper(irc, uid):
"""<irc object> <UID>
Returns whether <UID> is an opered client.
Returns whether <UID> has operator status on PyLink. This can be achieved
by either identifying to PyLink as admin, or having user mode +o set.
"""
return (uid in irc.users and ("o", None) in irc.users[uid].modes)
return (uid in irc.users and (("o", None) in irc.users[uid].modes or irc.users[uid].identified))
def getHostmask(irc, user):
userobj = irc.users.get(user)