def iplookup(m, params)
reply = ""
- if params[:domain]
+ if params[:domain].match(/^#{Regexp::Irc::HOSTADDR}$/)
+ ip = params[:domain]
+ else
begin
ip = Resolv.getaddress(params[:domain])
- reply += "#{params[:domain]} | "
+ reply << "#{params[:domain]} | "
rescue => e
m.reply "#{e.message}"
return
end
- else
- ip = params[:ip]
end
- reply += ArinWhois.lookup_info(ip)
+ reply << ArinWhois.lookup_info(ip)
+
m.reply reply
end
def userip(m, params)
+ m.reply "not implemented yet"
#users = @channels[m.channel].users
#m.reply "users = #{users.inspect}"
#m.reply @bot.sendq("WHO #{params[:user]}")
end
plugin = IPLookupPlugin.new
-plugin.map 'iplookup :ip', :action => 'iplookup', :requirements => {:ip => /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/}, :thread => true
-plugin.map 'iplookup :domain', :action => 'iplookup', :requirements => {:domain => /^[a-z0-9\.\-]{4,255}$/i}, :thread => true
+plugin.map 'iplookup :domain', :action => 'iplookup', :thread => true
plugin.map 'userip :user', :action => 'userip', :requirements => {:user => /\w+/}, :thread => true