diff options
-rw-r--r-- | bugzilla.rb | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/bugzilla.rb b/bugzilla.rb index f39f7a9..f867401 100644 --- a/bugzilla.rb +++ b/bugzilla.rb @@ -43,7 +43,7 @@ VALID_RESO = ['FIXED', 'INVALID', 'WONTFIX', 'LATER', 'REMIND', 'DUPLICATE', 'W # Each zilla instance may have these parameters OPTIONS = [ 'name', 'baseurl', 'dataurl', 'showbugurl', 'reporturl' ] - + # Now life gets fun, these are regular expresses to check the above arrays _STATUS_INPUT = (DONE_STATUS+OPEN_STATUS+['ALL']).uniq.join('|') STATUS_INPUT_1 = /^(?:#{_STATUS_INPUT})$/ @@ -130,7 +130,7 @@ class BugzillaPlugin < Plugin def baseurl @registry["zilla.#{name}.baseurl"] end - + def baseurl=(val) val = val[0..-2] if val[-1].chr == '/' @registry["zilla.#{name}.baseurl"] = val @@ -139,21 +139,21 @@ class BugzillaPlugin < Plugin def dataurl @dataurl = @registry["zilla.#{name}.dataurl"] unless @dataurl - + unless @dataurl guess_dataurl end return @dataurl end - + def dataurl=(val) @dataurl = @registry["zilla.#{name}.dataurl"] = val end def showbugurl @showbugurl = @registry["zilla.#{name}.showbugurl"] unless @showbugurl - + unless @showbugurl guess_showbugurl end @@ -167,7 +167,7 @@ class BugzillaPlugin < Plugin def reporturl @reporturl = @registry["zilla.#{name}.reporturl"] unless @reporturl - + unless @reporturl guess_reporturl end @@ -208,7 +208,7 @@ class BugzillaPlugin < Plugin def delete @registry["zillas"] = (@registry["zillas"] - [@name]) - + OPTIONS.each do |s| @registry.delete("zilla.#{name}.#{s}") end @@ -226,7 +226,7 @@ class BugzillaPlugin < Plugin @showbugurl += "/" unless baseurl[-1..-1] == "/" @showbugurl += "show_bug.cgi?id=@BUGNO@" end - + # Guess at the URL for the XML format of any given bug. # # We don't need to know a correct bug number for this as we can @@ -258,7 +258,7 @@ class BugzillaPlugin < Plugin @dataurl = nil end - + # Guess at the default URL to use for generating CSV tables format out of reports. def guess_reporturl @reporturl = "#{baseurl}/report.cgi?action=wrap&ctype=csv&format=table" @@ -287,7 +287,7 @@ class BugzillaPlugin < Plugin # as document element. bugxml = bugdata.root.get_elements("bug")[0] bugxml = bugdata.root.get_elements("issue")[0] unless bugxml - + raise EErrorParsing.new(name, bugno) unless bugxml if bugxml.attribute("status_code").to_s == "404" or @@ -328,7 +328,7 @@ class BugzillaPlugin < Plugin def announce return unless @registry["zilla.#{@name}.announcements"] - + buglist_url = baseurl + "/buglist.cgi?ctype=csv&order=bugs.bug_id" @@ -364,7 +364,7 @@ class BugzillaPlugin < Plugin # def initialize super - + @zillas = {} if @registry["zillas"] @@ -417,7 +417,7 @@ class BugzillaPlugin < Plugin return @zillas[@defaults[replyto][:zilla]] end - # Should we be lurking here to watch for bugs? + # Should we be lurking here to watch for bugs? def lurk?(m) replyto = m.replyto.to_s return false unless @defaults[replyto] @@ -445,7 +445,7 @@ class BugzillaPlugin < Plugin return unless m.address? channel_defaults_reload(m) end - + # Answer to a bug information request # # This is the main function of the plugin, answering to bug @@ -488,14 +488,14 @@ class BugzillaPlugin < Plugin begin status = params[:status] reso = params[:reso] - - # rbot gets the assignment order wrong sometimes + + # rbot gets the assignment order wrong sometimes if reso and status.nil? status = reso reso = nil end - # Now the real defaults + # Now the real defaults status = 'ALL' unless status reso = '' unless reso @@ -536,7 +536,7 @@ class BugzillaPlugin < Plugin status.uniq! status.delete('DONE') end - + # Build our URL query = 'x_axis_field=rep_platform' status.each { |s| query += "&bug_status=#{s}" } @@ -553,7 +553,7 @@ class BugzillaPlugin < Plugin return end results = zilla.report(query) - + # Remove the CSV header results.shift @@ -595,7 +595,7 @@ class BugzillaPlugin < Plugin begin # This is to save us from having an 'unset' command params[:value] = nil if params[:value].match(/^nil$/) - + # We are evil @zillas[params[:zilla]].send("#{params[:setting]}=", params[:value]) @@ -628,7 +628,7 @@ class BugzillaPlugin < Plugin def instance_show(m, params) begin check_zilla(params[:zilla]) - + msg = "#{params[:zilla]}" for s in OPTIONS if params[:full] == 'full' @@ -669,7 +669,7 @@ class BugzillaPlugin < Plugin end end end - + # Helper function only def _channel_defaults_reload_set(chan, defaults) @defaults[chan] = { @@ -714,7 +714,7 @@ class BugzillaPlugin < Plugin m.reply e.message end end - + # Show the default for a given channel/user def channel_defaults_show(m, params) begin @@ -775,7 +775,7 @@ class BugzillaPlugin < Plugin end end end - + # Help strings to give the users when they are asking for it. @@help_zilla = { "bug" => "bug #{Bold}[bugzilla]#{Bold} #{Bold}number#{Bold} : show the data about given bugzilla's bug.", @@ -841,7 +841,7 @@ plugin.map 'archstats :zilla :status :reso', :resolution => RESO_INPUT_N, :zilla => /^[^ ]+$/ }, - :defaults => { + :defaults => { :zilla => nil, :status => nil, :resolution => nil, |