From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 123641382C5 for ; Sat, 19 Jun 2021 05:25:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2793FE088F; Sat, 19 Jun 2021 05:25:46 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9D7D8E088F for ; Sat, 19 Jun 2021 05:25:45 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3376B340B1E for ; Sat, 19 Jun 2021 05:25:44 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 684937A4 for ; Sat, 19 Jun 2021 05:25:42 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1624080325.b7dd157b41e1c3a57c098a6a5402899784b2041f.robbat2@gentoo> Subject: [gentoo-commits] proj/rbot-bugzilla:master commit in: / X-VCS-Repository: proj/rbot-bugzilla X-VCS-Files: bugzilla.rb X-VCS-Directories: / X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: b7dd157b41e1c3a57c098a6a5402899784b2041f X-VCS-Branch: master Date: Sat, 19 Jun 2021 05:25:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9b8777d5-a694-4ee8-92d4-e5a799098f85 X-Archives-Hash: 678733c4f20d71741666c1ba58b6c845 commit: b7dd157b41e1c3a57c098a6a5402899784b2041f Author: Robin H. Johnson gentoo org> AuthorDate: Sat Jun 19 05:25:25 2021 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Sat Jun 19 05:25:25 2021 +0000 URL: https://gitweb.gentoo.org/proj/rbot-bugzilla.git/commit/?id=b7dd157b bugzilla: support bug aliases Closes: https://bugs.gentoo.org/356123 Signed-off-by: Robin H. Johnson gentoo.org> bugzilla.rb | 32 +++++++++++++++++++++++++------- 1 file 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