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:
parent
5fed4629a6
commit
14388d932f
10
utils.py
10
utils.py
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user