- # TODO: might want to add a check here to validate the url
- # if they call 'rubyurl help' backwards, don't return a lame link
-
- if (m.params == "help")
- m.reply "Try again. Correct usage is: " + help(m.plugin)
- return false
+ url = params[:url]
+ begin
+ to_uri = URI.parse(url)
+ # We don't accept 'generic' URLs because almost everything gets in there
+ raise URI::InvalidURIError if to_uri.class == URI::Generic
+ rescue URI::InvalidURIError
+ m.reply "#{url} doesn't look like an URL to me ..."
+ return