]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
search plugin now exploits the new sendmsg improvements
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 5 Feb 2007 01:09:49 +0000 (01:09 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 5 Feb 2007 01:09:49 +0000 (01:09 +0000)
data/rbot/plugins/search.rb

index 3e1066f784fcad18fdcb2879ea1b83b0b9099c68..27f9519c37b4d5e3bec5bbda080380526371bed9 100644 (file)
@@ -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