Added hexip command.

This commit is contained in:
Jeremy Fincher 2003-08-27 22:43:29 +00:00
parent 550f0fb3de
commit d21d868b28

View File

@ -175,6 +175,22 @@ class FunCommands(callbacks.Privmsg):
(self.recvdMsgs, self.recvdBytes,
self.sentMsgs, self.sentBytes))
def hexip(self, irc, msg, args):
"""<ip>
Returns the hexadecimal IP for that IP.
"""
ip = privmsgs.getArgs(args)
if not ircutils.isIP(ip):
irc.error(msg, '%r is not a valid IP.' % ip)
return
quads = ip.split('.')
ret = ""
for quad in quads:
i = int(quad)
ret += '%02x' % i
irc.reply(msg, ret.upper())
def ord(self, irc, msg, args):
"""<letter>