diff options
-rw-r--r-- | SBoTools/plugin.py | 43 |
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 |