Browse Source

display IPv4 addresses in dotted-quad notation

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
4757723857
  1. 2
      pyweb/mumble/mmobjects.py

2
pyweb/mumble/mmobjects.py

@ -201,6 +201,8 @@ class mmPlayer( object ):
def getIpAsString( self ): def getIpAsString( self ):
""" Get the client's IPv6 address, in a pretty format. """ """ Get the client's IPv6 address, in a pretty format. """
ip = self.player_obj.address; ip = self.player_obj.address;
if max( ip[:10] ) == 0 and ip[10:12] == (255, 255):
return "%d.%d.%d.%d" % tuple( ip[12:] );
# colon-separated string: # colon-separated string:
ipstr = ':'.join([ ("%02x%02x" % (int(ip[idx]), int(ip[idx+1]))) ipstr = ':'.join([ ("%02x%02x" % (int(ip[idx]), int(ip[idx+1])))
for idx in range(0, len(ip), 2) ]); for idx in range(0, len(ip), 2) ]);

Loading…
Cancel
Save