diff options
author | 2008-06-05 22:48:03 -0400 | |
---|---|---|
committer | 2008-06-05 22:48:03 -0400 | |
commit | 4393967b306278f3aeb9e31207f6b626d4f9d725 (patch) | |
tree | 9585d8bae40ba82c3caf1d197c1813201d656a3c /gentoo-data.rb | |
parent | Mark the TODOs clearly (diff) | |
download | rbot-gentoo-4393967b306278f3aeb9e31207f6b626d4f9d725.tar.gz rbot-gentoo-4393967b306278f3aeb9e31207f6b626d4f9d725.tar.bz2 rbot-gentoo-4393967b306278f3aeb9e31207f6b626d4f9d725.zip |
Add in 404 handling for glsas
Diffstat (limited to 'gentoo-data.rb')
-rw-r--r-- | gentoo-data.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/gentoo-data.rb b/gentoo-data.rb index 6490a3c..0d0b316 100644 --- a/gentoo-data.rb +++ b/gentoo-data.rb @@ -145,17 +145,21 @@ class GentooPlugin < Plugin def glsa(m, params) # TODO: 404 checking res = @bot.httputil.get("http://www.gentoo.org/security/en/glsa/glsa-#{params[:glsa_id]}.xml?passthru=1") - glsa_body = REXML::Document.new(res) - refs = nil - for ref in glsa_body.get_elements('/glsa/references/uri') - if refs.nil? - refs = '' - refs << ref.text - else - refs << ', ' << ref.text + if res + glsa_body = REXML::Document.new(res) + refs = nil + for ref in glsa_body.get_elements('/glsa/references/uri') + if refs.nil? + refs = '' + refs << ref.text + else + refs << ', ' << ref.text + end end + m.reply "#{glsa_body.get_elements("/glsa/title")[0].text} #{refs}" + else + m.reply "Unable to find GLSA #{params[:glsa_id]}" end - m.reply "#{glsa_body.get_elements("/glsa/title")[0].text} #{refs}" end def glsa_search(m, params) |