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

commands.showuser: show home server and TS as "N/A" if they are spoofed values

This commit is contained in:
James Lu 2018-05-26 01:13:45 -07:00
parent b72420a8aa
commit 2df3dc280c

View File

@ -61,12 +61,14 @@ def showuser(irc, source, args):
serverobj = irc.servers[sid]
ts = userobj.ts
# Show connected server & nick TS
f('\x02Home server\x02: %s (%s); \x02Nick TS:\x02 %s [UTC] (%s)' % \
(serverobj.name, sid, time.asctime(time.gmtime(int(ts))), ts))
if verbose: # Oper only data: user modes, channels on, account info, etc.
# Show connected server & nick TS if available
serverinfo = '%s[%s]' % (serverobj.name, sid) \
if irc.has_cap('can-track-servers') else 'N/A'
tsinfo = '%s [UTC] (%s)' % (time.asctime(time.gmtime(int(ts))), ts) \
if irc.has_cap('has-ts') else 'N/A'
f('\x02Home server\x02: %s; \x02Nick TS:\x02 %s' % (serverinfo, tsinfo))
if verbose: # Oper/self only data: user modes, channels in, account info, etc.
f('\x02User modes\x02: %s' % irc.join_modes(userobj.modes, sort=True))
f('\x02Protocol UID\x02: %s; \x02Real host\x02: %s; \x02IP\x02: %s' % \
(u, userobj.realhost, userobj.ip))