From 31c41dac2193d8c7767772a7af1c868baf0c3505 Mon Sep 17 00:00:00 2001 From: Terence Simpson Date: Wed, 4 Nov 2009 03:50:49 +0000 Subject: [PATCH] Bantracker: add some convenience functions to Ban class IRCLogin: Make the Launchpad team configurable --- Bantracker/plugin.py | 6 ++++++ IRCLogin/config.py | 2 ++ IRCLogin/plugin.py | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Bantracker/plugin.py b/Bantracker/plugin.py index 840abbe..f0d671c 100644 --- a/Bantracker/plugin.py +++ b/Bantracker/plugin.py @@ -138,6 +138,12 @@ class Ban(object): def __repr__(self): return '<%s object "%s" at 0x%x>' % (self.__class__.__name__, self, id(self)) + def op(self): + return self.mask.split('!')[0] + + def time(self): + return datetime.datetime.fromtimestamp(self.when) + class Bantracker(callbacks.Plugin): """Plugin to manage bans. See '@list Bantracker' and '@help ' for commands""" diff --git a/IRCLogin/config.py b/IRCLogin/config.py index 81a9222..9ae767d 100644 --- a/IRCLogin/config.py +++ b/IRCLogin/config.py @@ -22,3 +22,5 @@ def configure(advanced): IRCLogin = conf.registerPlugin('IRCLogin') conf.registerGlobalValue(IRCLogin, 'UserList', registry.String('', """Filename of file with list of users""",private=True)) +conf.registerGloblalValue(IRCLogin, "teamname", + registry.String('ubuntu-irc', "Name of the Launchpad team to get users from", private=True)) diff --git a/IRCLogin/plugin.py b/IRCLogin/plugin.py index a9dc3a2..6507ba4 100644 --- a/IRCLogin/plugin.py +++ b/IRCLogin/plugin.py @@ -77,7 +77,7 @@ launchpad""" irc.reply('Running...') user2nick = {} nick2user = {} - users = lp.getUsers() + users = lp.getUsers(self.registryValue("teamname")) for user in users: lpuser = lp.getIRCNick(user, False) if not lpuser: