aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-06-28 23:27:16 -0400
committerB. Watson <yalhcru@gmail.com>2021-06-28 23:27:16 -0400
commit30b238ef6db7c5b5b6d80c1e51aa2600e896abe2 (patch)
tree35522f8fb48b9a9fe3e4e6242a9ee4b5c0960768
parent86dd0265a979b65ea1053430d470c6b77cb32406 (diff)
downloadlimnoria.slackfacts.plugins-30b238ef6db7c5b5b6d80c1e51aa2600e896abe2.tar.gz
SBoTools: add sbomaint (maintainer search)
-rw-r--r--SBoTools/plugin.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/SBoTools/plugin.py b/SBoTools/plugin.py
index 47fc28b..7ffd824 100644
--- a/SBoTools/plugin.py
+++ b/SBoTools/plugin.py
@@ -220,4 +220,47 @@ class SBoTools(callbacks.Plugin):
sboinfo = thread(wrap(sboinfo, ['somethingWithoutSpaces']))
+ def sbomaint(self, irc, msg, args, terms):
+ """ <name-or-email>
+
+ Show list of SBo builds whose maintainers match the search term.
+ """
+
+ term = str.join(' ', terms)
+ like = '%' + term + '%'
+
+ maxdeps = self.getMaxDeps(msg)
+
+ db = self.InitDB();
+ cursor = db.cursor()
+ cursor.execute("select c.name, b.name, m.name, e.addr from categories c, builds b, maintainers m, emails e where c.id=b.category and b.maintainer=m.id and b.email=e.id and (m.name like ? or e.addr like ?) order by m.name, e.addr, b.id", (like, like,))
+ result = cursor.fetchall()
+
+ if(len(result) == 0):
+ irc.reply("No matching maintainer names or email addresses")
+ return
+
+ lines = []
+
+ toomany = (len(result) > maxdeps)
+ if(toomany):
+ lines.append(str(len(result)) + " results, showing " + str(maxdeps) + ".")
+ del result[maxdeps:]
+
+ oldnamemail = ""
+ for (cat, build, maint, email) in result:
+ namemail = maint + " <" + email + ">"
+ if(namemail != oldnamemail):
+ if(oldnamemail != ""):
+ lines.append("|")
+ lines.append(namemail + ":")
+ oldnamemail = namemail
+ lines.append(ircutils.bold(cat + "/" + build))
+ if(toomany):
+ lines.append("...")
+
+ irc.replies(lines, joiner=" ")
+
+ sbomaint = thread(wrap(sbomaint, [many('somethingWithoutSpaces')]))
+
Class = SBoTools