diff options
-rw-r--r-- | bugzilla.rb | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/bugzilla.rb b/bugzilla.rb index 6300de2..dbe21c8 100644 --- a/bugzilla.rb +++ b/bugzilla.rb @@ -556,29 +556,25 @@ class BugzillaPlugin < Plugin channel_defaults_reload(m) end - # Answer to a bug information request + # This is the main function of the plugin, answering to bug information + # requests from users. We provide a form that takes a zilla instance name, as + # well as a form that just figures out the zilla name based on the channel or + # user. They DO however have seperate commands, because the automatic logic + # can be easily confused: + # <@GentooDev> !bug 240182 <--- hey SomeGuy, look at this one + # In both cases, bug aliases are supported. # - # This is the main function of the plugin, answering to bug - # information requests from users. If the user provides a named - # zilla, use that, otherwise see if the channel the user asked in - # has a default. - def bug(m, params) + # Answer to a bug information request, long form. + def buglong(m, params) begin bugno = params[:number].chomp("#") bugno.gsub!(/^#/,'') - - if params[:number].nil? and params[:zilla] - params[:number] = params[:zilla] - params[:zilla] = nil - end - + if params[:zilla] and bugno check_zilla(params[:zilla]) zilla = @zillas[params[:zilla]] - elsif get_zilla(m) - zilla = get_zilla(m) else - m.reply "Wrong parameters, see 'help bug' for help." + m.reply "Wrong parameters - unknown zilla, see 'help bug' for help." return end m.reply zilla.summary(bugno) @@ -587,6 +583,21 @@ class BugzillaPlugin < Plugin end end + # Answer to a bug information request, short form. + def bug(m, params) + begin + bugno = params[:number].chomp("#") + bugno.gsub!(/^#/,'') + zilla = get_zilla(m) + if not zilla + m.reply "Wrong parameters - unknown zilla, see 'help bug' for help." + end + m.reply zilla.summary(bugno) + rescue ::Exception => e + m.reply e.message + end + end + # Produce support of all bug status counts def bugstats(m, params) begin @@ -968,7 +979,8 @@ class BugzillaPlugin < Plugin @@help_zilla = { "bugzilla" => "Bugzilla IRC interface: #{Bold}bug#{Bold}|#{Bold}archstats#{Bold}|#{Bold}zilla#{Bold} (zilla contains all admin and info tools)", - "bug" => "bug #{Bold}[bugzilla]#{Bold} #{Bold}number#{Bold} : show the data about given bugzilla's bug.", + "bug" => "bug #{Bold}number#{Bold} : show the data about given bugzilla's bug # or alias. See also #{Bold}!bugl#{Bold}", + "bugl" => "bug #{Bold}bugzilla#{Bold} #{Bold}number#{Bold} : show the data about given bugzilla's bug # or alias.", "archstats" => "archstats #{Bold}[bugzilla]#{Bold} #{Bold}[status]#{Bold} #{Bold}[reso]#{Bold} : show architecture summaries for given bug statuses.", @@ -1017,16 +1029,23 @@ plugin = BugzillaPlugin.new plugin.default_auth( 'modify', false ) plugin.default_auth( 'view', true ) -plugin.map 'bug :zilla :number', +plugin.map 'bug :number', :requirements => { - :number => /^#?\d+$|^\S+$/, - :zilla => /^[^ ]+$/ + :number => /^[^ ]+$/, }, - :defaults => { :zilla => nil }, :action => 'bug', :thread => 'yes', :auth_path => 'view' +plugin.map 'bugl :zilla :number', + :requirements => { + :number => /^[^ ]+$/, + :zilla => /^[^ ]+$/ + }, + :action => 'buglong', + :thread => 'yes', + :auth_path => 'view' + plugin.map 'bugstats :zilla', :requirements => { :zilla => /^[^ ]+$/, |