+ def get_realm_status(realm_name)
+ begin
+ xmldoc = @bot.httputil.get("http://www.worldofwarcraft.com/realmstatus/status.xml", :cache => false)
+ raise "unable to retrieve realm status" unless xmldoc
+ realm_list = (REXML::Document.new xmldoc).root
+ realm_data = realm_list.get_elements("//r[@n=\"#{realm_name}\"]").first
+ if realm_data and realm_data.attributes.any? then
+ realm = Realm.new(
+ realm_data.attributes['n'],
+ realm_data.attributes['s'].to_i,
+ realm_data.attributes['t'].to_i,
+ realm_data.attributes['l'].to_i)
+ realm.to_s
+ else
+ "realm #{realm_name} not found."
+ end
+ rescue => err
+ "error retrieving realm status: #{err}"
+ end
+ end