Converted to use commands.wrap.

This commit is contained in:
Jeremy Fincher 2004-10-24 16:16:30 +00:00
parent f2fa10fc00
commit 8c4d17433a

View File

@ -40,19 +40,17 @@ import socket
import telnetlib import telnetlib
import supybot.utils as utils import supybot.utils as utils
from supybot.commands import wrap
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.privmsgs as privmsgs
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
class Internet(callbacks.Privmsg): class Internet(callbacks.Privmsg):
threaded = True threaded = True
def dns(self, irc, msg, args): def dns(self, irc, msg, args, host):
"""<host|ip> """<host|ip>
Returns the ip of <host> or the reverse DNS hostname of <ip>. Returns the ip of <host> or the reverse DNS hostname of <ip>.
""" """
host = privmsgs.getArgs(args)
if utils.isIP(host): if utils.isIP(host):
hostname = socket.getfqdn(host) hostname = socket.getfqdn(host)
if hostname == host: if hostname == host:
@ -68,6 +66,7 @@ class Internet(callbacks.Privmsg):
irc.reply(ip) irc.reply(ip)
except socket.error: except socket.error:
irc.reply('Host not found.') irc.reply('Host not found.')
dns = wrap(dns, ['something'])
_tlds = sets.Set(['com', 'net', 'edu']) _tlds = sets.Set(['com', 'net', 'edu'])
_domain = ['Domain Name', 'Server Name'] _domain = ['Domain Name', 'Server Name']
@ -77,12 +76,11 @@ class Internet(callbacks.Privmsg):
_created = ['Created On', 'Domain Registration Date', 'Creation Date'] _created = ['Created On', 'Domain Registration Date', 'Creation Date']
_expires = ['Expiration Date', 'Domain Expiration Date'] _expires = ['Expiration Date', 'Domain Expiration Date']
_status = ['Status', 'Domain Status', 'status'] _status = ['Status', 'Domain Status', 'status']
def whois(self, irc, msg, args): def whois(self, irc, msg, args, domain):
"""<domain> """<domain>
Returns WHOIS information on the registration of <domain>. Returns WHOIS information on the registration of <domain>.
""" """
domain = privmsgs.getArgs(args).lower()
usertld = domain.split('.')[-1] usertld = domain.split('.')[-1]
if '.' not in domain: if '.' not in domain:
irc.error('<domain> must be in .com, .net, .edu, or .org.') irc.error('<domain> must be in .com, .net, .edu, or .org.')
@ -160,6 +158,7 @@ class Internet(callbacks.Privmsg):
irc.reply(s) irc.reply(s)
else: else:
irc.error('I couldn\'t find such a domain.') irc.error('I couldn\'t find such a domain.')
whois = wrap(whois, ['lowered'])
Class = Internet Class = Internet