2 #Needs xmlsimple from http://www.maik-schmidt.de/xml-simple.html
8 class KDEBugPlugin < Plugin
10 s.gsub(/<[^>]+>/, '').gsub(/&/,'&').gsub(/"/,'"').gsub(/</,'<').gsub(/>/,'>').gsub(/&ellip;/,'...').gsub(/'/, "'").gsub("\n",'')
14 def help(plugin,topic="")
15 "bug #<number> - displays bugs.kde.org information for given bug number"
20 m.reply("incorrect usage: "+help(m.plugin))
23 a = m.params.scan(/^#?([0-9]+)/)
25 m.reply("You called the wrong number...")
28 # m.reply("Please wait, querying...")
30 h = Net::HTTP.new("bugs.kde.org", 80)
31 resp = h.get("/xml.cgi?id=#{a}", nil)
32 if resp.message == "OK"
33 bug = XmlSimple.xml_in(resp.body)
34 if bug['bug'][0]['error'] == 'NotFound'
35 m.reply("Bug #{a} was not found in Bugzilla.")
37 str = "PRODUCT: #{bug['bug'][0]['product']}"
38 str += " / #{bug['bug'][0]['component']}" if bug['bug'][0]['component']
39 str += " | STATUS: #{bug['bug'][0]['bug_status']}"
40 str += " | RESOLUTION: #{bug['bug'][0]['resolution']}" if bug['bug'][0]['resolution']
41 str += " | URL: http://bugs.kde.org/show_bug.cgi?id=#{a} | DESCRIPTION: #{riphtml(bug['bug'][0]['short_desc'].to_s)}"
45 m.reply("Request to bugs.kde.org failed. Message not OK.")
48 m.reply("Request to bugs.kde.org failed")
53 plugin = KDEBugPlugin.new
54 plugin.register("bug")