aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bugzilla.rb32
1 files changed, 25 insertions, 7 deletions
diff --git a/bugzilla.rb b/bugzilla.rb
index d9af38f..a1f0e6a 100644
--- a/bugzilla.rb
+++ b/bugzilla.rb
@@ -533,13 +533,31 @@ class BugzillaPlugin < Plugin
def listen(m)
return if m.address?
return unless lurk?(m)
- return if m.message !~ /\bbug(?:[[:space:]]*)?#?([0-9]+)(?:(?:#c| comment #?)([0-9]+))?/i
- bugno = $1
- comment = $2 || ""
- bugno.gsub!(/^#/,'')
- comment.gsub!(/^#c?/,'')
- zilla = get_zilla(m)
- m.reply zilla.summary(bugno, comment)
+ # bug 1234
+ # bug 1234#c1234
+ # bug 1234 comment 1234
+ # bug 1234 comment #1234
+ # bug #1234
+ # bug #1234#c1234
+ # bug #1234 comment 1234
+ # bug #1234 comment #1234
+ # bug #gcc
+ # bug #gcc#c1234
+ # bug #gcc comment 1234
+ # bug #gcc comment #1234
+ #
+ # bug aliases can contain
+ # 0-9, a-z, A-Z
+ # and then every punctuation except ","
+ message_re = /\bbug(?:[[:space:]]*)(?:#?([0-9]+|#[-[:alnum:]~`!@#$%^&*()_+={}\]\[\\/|:;\'"<>.?]{3,40}))(?:(?:#c| comment #?)([0-9]+))?/i
+ message.scan(message_re).each do |bug_comment|
+ bugno = bug_comment[0]
+ comment = bug_comment[1] || ""
+ bugno.gsub!(/^#/,'')
+ comment.gsub!(/^#c?/,'')
+ zilla = get_zilla(m)
+ m.reply zilla.summary(bugno, comment)
+ end
end
# Function checking when a new channel is joined