summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/bash.rb3
-rw-r--r--data/rbot/plugins/dict.rb6
-rw-r--r--data/rbot/plugins/fish.rb2
-rw-r--r--data/rbot/plugins/freshmeat.rb8
-rw-r--r--data/rbot/plugins/games/azgame.rb4
-rw-r--r--data/rbot/plugins/imdb.rb2
-rw-r--r--data/rbot/plugins/lastfm.rb6
-rw-r--r--data/rbot/plugins/search.rb4
-rw-r--r--data/rbot/plugins/slashdot.rb14
-rw-r--r--data/rbot/plugins/urban.rb4
-rw-r--r--data/rbot/plugins/weather.rb4
11 files changed, 22 insertions, 35 deletions
diff --git a/data/rbot/plugins/bash.rb b/data/rbot/plugins/bash.rb
index 520346be..93d9c3f2 100644
--- a/data/rbot/plugins/bash.rb
+++ b/data/rbot/plugins/bash.rb
@@ -17,7 +17,6 @@
# TODO allow selection of only quotes with vote > 0
require 'rexml/document'
-require 'uri/common'
class ::BashQuote
attr_accessor :num, :text, :vote
@@ -56,7 +55,7 @@ class BashPlugin < Plugin
end
def search(m, params)
- esc = URI.escape(params[:words].to_s)
+ esc = CGI.escape(params[:words].to_s)
html = @bot.httputil.get("http://bash.org/?search=#{esc}")
html_bash(m, :html => html)
end
diff --git a/data/rbot/plugins/dict.rb b/data/rbot/plugins/dict.rb
index ef162215..30cfc5fe 100644
--- a/data/rbot/plugins/dict.rb
+++ b/data/rbot/plugins/dict.rb
@@ -54,7 +54,7 @@ class DictPlugin < Plugin
justcheck = params[:justcheck]
word = params[:word].downcase
- url = @dmwapurl % URI.escape(word)
+ url = @dmwapurl % CGI.escape(word)
xml = nil
info = @bot.httputil.get_response(url) rescue nil
xml = info.body if info
@@ -106,7 +106,7 @@ class DictPlugin < Plugin
word = params[:word].join
[word, word + "_1"].each { |check|
- url = @oxurl % URI.escape(check)
+ url = @oxurl % CGI.escape(check)
h = @bot.httputil.head(url, :max_redir => 5)
if h
m.reply("#{word} found: #{url}") unless justcheck
@@ -126,7 +126,7 @@ class DictPlugin < Plugin
justcheck = params[:justcheck]
word = params[:word].to_s.downcase
- url = @chambersurl % URI.escape(word)
+ url = @chambersurl % CGI.escape(word)
xml = nil
info = @bot.httputil.get_response(url) rescue nil
xml = info.body if info
diff --git a/data/rbot/plugins/fish.rb b/data/rbot/plugins/fish.rb
index 140c9570..dcd4a0e3 100644
--- a/data/rbot/plugins/fish.rb
+++ b/data/rbot/plugins/fish.rb
@@ -31,7 +31,7 @@ class BabelPlugin < Plugin
return
end
- data_text = URI.escape trans_text
+ data_text = CGI.escape trans_text
trans_pair = "#{trans_from}_#{trans_to}"
if (trans_text =~ /^http:\/\//) && (URI.parse(trans_text) rescue nil)
diff --git a/data/rbot/plugins/freshmeat.rb b/data/rbot/plugins/freshmeat.rb
index 5a045123..49e73e0d 100644
--- a/data/rbot/plugins/freshmeat.rb
+++ b/data/rbot/plugins/freshmeat.rb
@@ -1,5 +1,4 @@
require 'rexml/document'
-require 'uri/common'
class FreshmeatPlugin < Plugin
include REXML
@@ -11,12 +10,7 @@ class FreshmeatPlugin < Plugin
max = params[:limit].to_i
search = params[:search].to_s
max = 8 if max > 8
- begin
- xml = @bot.httputil.get("http://freshmeat.net/search-xml/?orderby=locate_projectname_full_DESC&q=#{URI.escape(search)}")
- rescue URI::InvalidURIError, URI::BadURIError => e
- m.reply "illegal search string #{search}"
- return
- end
+ xml = @bot.httputil.get("http://freshmeat.net/search-xml/?orderby=locate_projectname_full_DESC&q=#{CGI.escape(search)}")
unless xml
m.reply "search for #{search} failed"
return
diff --git a/data/rbot/plugins/games/azgame.rb b/data/rbot/plugins/games/azgame.rb
index f62232c0..66646e73 100644
--- a/data/rbot/plugins/games/azgame.rb
+++ b/data/rbot/plugins/games/azgame.rb
@@ -446,7 +446,7 @@ class AzGamePlugin < Plugin
wc = @wordcache[:english]
return true if wc.key?(word.to_sym)
rules = @rules[:english]
- p = @bot.httputil.get(rules[:url] % URI.escape(word))
+ p = @bot.httputil.get(rules[:url] % CGI.escape(word))
if not p
error "could not connect!"
return false
@@ -497,7 +497,7 @@ class AzGamePlugin < Plugin
ll = ('a'..'z').to_a[rand(26)]
random = [l,ll].join('*') + '*'
debug "getting random word from dictionary, matching #{random}"
- p = @bot.httputil.get(rules[:url] % URI.escape(random))
+ p = @bot.httputil.get(rules[:url] % CGI.escape(random))
debug p
lemmi = Array.new
good = rules[:good]
diff --git a/data/rbot/plugins/imdb.rb b/data/rbot/plugins/imdb.rb
index 240ded86..0464ba3a 100644
--- a/data/rbot/plugins/imdb.rb
+++ b/data/rbot/plugins/imdb.rb
@@ -32,7 +32,7 @@ class Imdb
end
def search(rawstr, rawopts={})
- str = URI.escape(rawstr)
+ str = CGI.escape(rawstr)
str << ";site=aka" if @bot.config['imdb.aka']
opts = rawopts.dup
opts[:type] = :both unless opts[:type]
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index 46b140ff..6e7d4c71 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -70,10 +70,10 @@ class LastFmPlugin < Plugin
spec = location ? "in #{location}" : "by #{artist}"
begin
if location
- esc = URI.escape(location)
+ esc = CGI.escape(location)
page = @bot.httputil.get "#{LASTFM}/events/?findloc=#{esc}"
else
- esc = URI.escape(artist)
+ esc = CGI.escape(artist)
page = @bot.httputil.get "#{LASTFM}/events?s=#{esc}&findloc="
end
@@ -131,7 +131,7 @@ class LastFmPlugin < Plugin
artist = params[:who].to_s
page = nil
begin
- esc = URI.escape(artist)
+ esc = URI.escape(CGI.escape(artist))
page = @bot.httputil.get "#{LASTFM}/music/#{esc}"
if page
if page.match(/<h1 class="h1artist"><a href="([^"]+)">(.*?)<\/a><\/h1>/)
diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb
index da98dd08..c733c815 100644
--- a/data/rbot/plugins/search.rb
+++ b/data/rbot/plugins/search.rb
@@ -45,7 +45,7 @@ class SearchPlugin < Plugin
def google(m, params)
what = params[:words].to_s
- searchfor = URI.escape what
+ searchfor = CGI.escape what
# This method is also called by other methods to restrict searching to some sites
if params[:site]
site = "site:#{params[:site]}+"
@@ -93,7 +93,7 @@ class SearchPlugin < Plugin
def gcalc(m, params)
what = params[:words].to_s
- searchfor = URI.escape(what).sub('+','%2B')
+ searchfor = CGI.escape(what)
debug "Getting gcalc thing: #{searchfor.inspect}"
url = "http://www.google.com/search?q=#{searchfor}"
diff --git a/data/rbot/plugins/slashdot.rb b/data/rbot/plugins/slashdot.rb
index fa1338bd..c9e35b9e 100644
--- a/data/rbot/plugins/slashdot.rb
+++ b/data/rbot/plugins/slashdot.rb
@@ -1,5 +1,4 @@
require 'rexml/document'
-require 'uri/common'
class SlashdotPlugin < Plugin
include REXML
@@ -8,15 +7,10 @@ class SlashdotPlugin < Plugin
end
def search_slashdot(m, params)
- max = params[:limit].to_i
- search = params[:search].to_s
+ max = params[:limit].to_i
+ search = params[:search].to_s
- begin
- xml = @bot.httputil.get("http://slashdot.org/search.pl?content_type=rss&query=#{URI.escape(search)}")
- rescue URI::InvalidURIError, URI::BadURIError => e
- m.reply "illegal search string #{search}"
- return
- end
+ xml = @bot.httputil.get("http://slashdot.org/search.pl?content_type=rss&query=#{CGI.escape(search)}")
unless xml
m.reply "search for #{search} failed"
return
@@ -39,7 +33,7 @@ class SlashdotPlugin < Plugin
doc.elements.each("*/item") {|e|
desc = e.elements["title"].text
desc.gsub!(/(.{150}).*/, '\1..')
- reply = sprintf("%s | %s", e.elements["link"].text, desc)
+ reply = sprintf("%s | %s", e.elements["link"].text, desc.ircify_html)
m.reply reply
done += 1
break if done >= max
diff --git a/data/rbot/plugins/urban.rb b/data/rbot/plugins/urban.rb
index 1a4b9d74..9b547644 100644
--- a/data/rbot/plugins/urban.rb
+++ b/data/rbot/plugins/urban.rb
@@ -16,7 +16,7 @@ class UrbanPlugin < Plugin
end
end
# we give a very high 'skip' because this will allow us to get the number of definitions by retrieving the previous definition
- uri = "http://www.urbanwap.com/search.php?term=#{URI.escape words}&skip=65536"
+ uri = "http://www.urbanwap.com/search.php?term=#{CGI.escape words}&skip=65536"
page = @bot.httputil.get(uri)
if page.nil?
m.reply "Couldn't retrieve an urban dictionary definition of #{words}"
@@ -37,7 +37,7 @@ class UrbanPlugin < Plugin
n = numdefs
end
if n < numdefs
- uri = "http://www.urbanwap.com/search.php?term=#{URI.escape words}&skip=#{n-1}"
+ uri = "http://www.urbanwap.com/search.php?term=#{CGI.escape words}&skip=#{n-1}"
page = @bot.httputil.get(uri)
if page.nil?
case n % 10
diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb
index da6a2116..4edcc963 100644
--- a/data/rbot/plugins/weather.rb
+++ b/data/rbot/plugins/weather.rb
@@ -164,7 +164,7 @@ class WeatherPlugin < Plugin
def wu_station(m, where, units)
begin
- xml = @bot.httputil.get(@wu_station_url % [units, URI.escape(where)])
+ xml = @bot.httputil.get(@wu_station_url % [units, CGI.escape(where)])
case xml
when nil
m.reply "couldn't retrieve weather information, sorry"
@@ -186,7 +186,7 @@ class WeatherPlugin < Plugin
def wu_weather(m, where, units)
begin
- xml = @bot.httputil.get(@wu_url % [units, URI.escape(where)])
+ xml = @bot.httputil.get(@wu_url % [units, CGI.escape(where)])
case xml
when nil
m.reply "couldn't retrieve weather information, sorry"