summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-06 14:31:26 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-06 14:31:26 +0000
commit64689811ca5ee4e190d1837463675c68f9a094ff (patch)
tree9d2e5ec828df367d111f159a65504d63b28b575a /data
parent68f403cd6d9d37a9e47c8e06cca1414038bc66cf (diff)
Move extensions to standard classes into a specific extends.rb util module
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/rss.rb6
-rw-r--r--data/rbot/plugins/salut.rb11
-rw-r--r--data/rbot/plugins/search.rb33
3 files changed, 0 insertions, 50 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb
index 08b2c775..acebda9c 100644
--- a/data/rbot/plugins/rss.rb
+++ b/data/rbot/plugins/rss.rb
@@ -19,12 +19,6 @@ require 'rss/dublincore'
# warning "Unable to load RSS libraries, RSS plugin functionality crippled"
# end
-class ::String
- def riphtml
- self.gsub(/<[^>]+>/, '').gsub(/&amp;/,'&').gsub(/&quot;/,'"').gsub(/&lt;/,'<').gsub(/&gt;/,'>').gsub(/&ellip;/,'...').gsub(/&apos;/, "'").gsub("\n",'')
- end
-end
-
class ::RssBlob
attr_accessor :url
attr_accessor :handle
diff --git a/data/rbot/plugins/salut.rb b/data/rbot/plugins/salut.rb
index e4295a06..b0bf67e7 100644
--- a/data/rbot/plugins/salut.rb
+++ b/data/rbot/plugins/salut.rb
@@ -4,17 +4,6 @@
# TODO *REMEMBER* to set @changed to true after edit
# TODO or changes won't be saved
-unless Array.new.respond_to?(:pick_one)
- debug "Defining the pick_one method for Array"
- class ::Array
- def pick_one
- return nil if self.empty?
- self[rand(self.length)]
- end
- end
-end
-
-
class SalutPlugin < Plugin
BotConfig.register BotConfigBooleanValue.new('salut.all_languages',
:default => true,
diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb
index 27f9519c..6fb1959a 100644
--- a/data/rbot/plugins/search.rb
+++ b/data/rbot/plugins/search.rb
@@ -4,39 +4,6 @@ Net::HTTP.version_1_2
GOOGLE_WAP_LINK = /<a accesskey="(\d)" href=".*?u=(.*?)">(.*?)<\/a>/im
-class ::String
- def ircify_html
- txt = self
-
- # bold and strong -> bold
- txt.gsub!(/<\/?(?:b|strong)\s*>/, "#{Bold}")
-
- # italic, emphasis and underline -> underline
- txt.gsub!(/<\/?(?:i|em|u)\s*>/, "#{Underline}")
-
- ## This would be a nice addition, but the results are horrible
- ## Maybe make it configurable?
- # txt.gsub!(/<\/?a( [^>]*)?>/, "#{Reverse}")
-
- # Paragraph and br tags are converted to whitespace.
- txt.gsub!(/<\/?(p|br)\s*\/?\s*>/, ' ')
- txt.gsub!("\n", ' ')
-
- # All other tags are just removed
- txt.gsub!(/<[^>]+>/, '')
-
- # Remove double formatting options, since they only waste bytes
- txt.gsub!(/#{Bold}\s*#{Bold}/,"")
- txt.gsub!(/#{Underline}\s*#{Underline}/,"")
-
- # And finally whitespace is squeezed
- txt.gsub!(/\s+/, ' ')
-
- # Decode entities and strip whitespace
- return Utils.decode_html_entities(txt).strip!
- end
-end
-
class SearchPlugin < Plugin
BotConfig.register BotConfigIntegerValue.new('google.hits',
:default => 3,