Bantracker: add some convenience functions to Ban class

IRCLogin: Make the Launchpad team configurable
This commit is contained in:
Terence Simpson 2009-11-04 03:50:49 +00:00
parent 55f88b5a60
commit 31c41dac21
3 changed files with 9 additions and 1 deletions

View File

@ -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 <command>' for commands"""

View File

@ -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))

View File

@ -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: