X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sid%2Fbts.py;h=fa882444aa4c32e0bc25fdf1e0969892d05fe0c6;hb=eca792ae03ea7ce6321aaabd6f1c818627eab083;hp=2835efff9127701d4d8b4724ad992717bde0f348;hpb=4a7f23317ab2236a85c3a17a00a52ac034c9bad7;p=sid.git diff --git a/sid/bts.py b/sid/bts.py index 2835eff..fa88244 100644 --- a/sid/bts.py +++ b/sid/bts.py @@ -1,20 +1,11 @@ # -*- coding: utf-8 -*- +# SPDX-FileCopyrightText: 2015, 2021 kaliko +# SPDX-FileCopyrightText: 2010, 2011 Anaël Verrier +# SPDX-License-Identifier: GPL-3.0-or-later +"""Intercepts bugs numbers in MUC messages and send info about it -# Copyright (C) 2010, 2011 Anaël Verrier -# Copyright (C) 2015, 2020 kaliko - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 only. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - +>>> from sid.bts import Bugs +""" from re import compile as re_compile @@ -29,7 +20,9 @@ class Bugs(Plugin): .. note:: This plugin depends on external module: **python-debianbts** """ - re_bugs = re_compile(r'(?<=#)(\d{6,7})') + #: Bug id regexp, intercepts bug id in strings : "#629234", "bugs.debian.org/629234" and "bugreport.cgi?bug=629234" + re_bugs = re_compile(r'(?:(?<=#)|(?<=bugreport\.cgi\?bug=)|(?<=bugs\.debian\.org/))(\d{6,7})') + #: Package name regexp re_pkg = re_compile(r'(?P[0-9a-z.+-]+)$') def __init__(self, bot): @@ -45,8 +38,6 @@ class Bugs(Plugin): # Does not reply to myself if msg['mucnick'] == self.bot.nick: return - if '#' not in msg['body']: - return bugs = list() for bug_id in set(Bugs.re_bugs.findall(msg['body'].strip())): self.log.debug('got bug id: %s', bug_id)