search_slashdot (SlashdotPlugin)

    # File rbot/plugins/slashdot.rb, line 25
      def search_slashdot(m, search, max=4)
        begin
          xml = Utils.http_get("http://slashdot.org/search.pl?content_type=rss&query=#{search}")
        rescue URI::InvalidURIError, URI::BadURIError => e
          m.reply "illegal search string #{search}"
          return
        end
        unless xml
          m.reply "search for #{search} failed"
          return
        end
        doc = Document.new xml
        unless doc
          m.reply "search for #{search} failed"
          return
        end
        done = 0
        doc.elements.each("*/item") {|e|
          reply = sprintf("%32s / %s", e.elements["title"].text[0,32], e.elements["link"].text)
          m.reply reply
          done += 1
          break if done >= max
        }
      end