3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-28 21:52:38 +01:00

utils.getHostmask: add option to return IP address

This commit is contained in:
James Lu 2016-03-05 09:52:00 -08:00
parent 5fed4629a6
commit 14388d932f

View File

@ -490,10 +490,12 @@ def isManipulatableClient(irc, uid):
"""
return irc.isInternalClient(uid) and irc.users[uid].manipulatable
def getHostmask(irc, user, realhost=False):
def getHostmask(irc, user, realhost=False, ip=False):
"""
Returns the hostmask of the given user, if present. If the realhost option
is given, return the real host of the user instead of the displayed host."""
is given, return the real host of the user instead of the displayed host.
If the ip option is given, return the IP address of the user (this overrides
realhost)."""
userobj = irc.users.get(user)
try:
@ -507,7 +509,9 @@ def getHostmask(irc, user, realhost=False):
ident = '<unknown-ident>'
try:
if realhost:
if ip:
host = userobj.ip
elif realhost:
host = userobj.realhost
else:
host = userobj.host