summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-05 01:09:49 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-05 01:09:49 +0000
commit6fe052181de09dd4a618241e600e2473f6706343 (patch)
treeeda50b67baa1cbec084856cbff235c6eecfdb1ec /data/rbot
parent7f4e98a691ba6ee6f220fec982f17c900c929f1d (diff)
search plugin now exploits the new sendmsg improvements
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/search.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb
index 3e1066f7..27f9519c 100644
--- a/data/rbot/plugins/search.rb
+++ b/data/rbot/plugins/search.rb
@@ -5,14 +5,6 @@ Net::HTTP.version_1_2
GOOGLE_WAP_LINK = /<a accesskey="(\d)" href=".*?u=(.*?)">(.*?)<\/a>/im
class ::String
- def omissis_after(len)
- if self.length > len
- return self[0...len].sub(/\s+\S*$/,"...")
- else
- return self
- end
- end
-
def ircify_html
txt = self
@@ -107,7 +99,7 @@ class SearchPlugin < Plugin
"#{n}. #{Bold}#{t}#{Bold}: #{u}"
}.join(" | ")
- m.reply "Results for #{what}: #{results}"
+ m.reply "Results for #{what}: #{results}", :split_at => /\s+\|\s+/
first_pars = params[:firstpar] || @bot.config['google.first_par']
@@ -153,7 +145,7 @@ class SearchPlugin < Plugin
txt.replace @bot.plugins['url'].get_title_from_html(xml)
next if txt.empty?
end
- m.reply "[#{idx}] #{txt}".omissis_after(400)
+ m.reply "[#{idx}] #{txt}", :overlong => :truncate
first_pars -=1
end
end