Fix bug in Channel.addcapability.

This commit is contained in:
Jeremy Fincher 2004-12-20 03:05:09 +00:00
parent 3552a1374c
commit f69f1cf652

View File

@ -547,19 +547,14 @@ class Channel(callbacks.Privmsg):
irc.reply(utils.commaAndify(imap(repr, L))) irc.reply(utils.commaAndify(imap(repr, L)))
ignores = wrap(ignores, [('checkChannelCapability', 'op')]) ignores = wrap(ignores, [('checkChannelCapability', 'op')])
def addcapability(self, irc, msg, args, channel, hostmask, capabilities): def addcapability(self, irc, msg, args, channel, user, capabilities):
"""[<channel>] <name|hostmask> <capability> [<capability> ...] """[<channel>] <nick|username> <capability> [<capability> ...]
If you have the #channel,op capability, this will give the user If you have the #channel,op capability, this will give the user
currently identified as <name> (or the user to whom <hostmask> maps) <name> (or the user to whom <nick> maps)
the capability <capability> in the channel. <channel> is only necessary the capability <capability> in the channel. <channel> is only necessary
if the message isn't sent in the channel itself. if the message isn't sent in the channel itself.
""" """
try:
id = ircdb.users.getUserId(hostmask)
user = ircdb.users.getUser(id)
except KeyError:
irc.errorNoUser(Raise=True)
for c in capabilities.split(): for c in capabilities.split():
c = ircdb.makeChannelCapability(channel, c) c = ircdb.makeChannelCapability(channel, c)
user.addCapability(c) user.addCapability(c)
@ -568,7 +563,7 @@ class Channel(callbacks.Privmsg):
addcapability = wrap(addcapability, [('checkChannelCapability', 'op'), addcapability = wrap(addcapability, [('checkChannelCapability', 'op'),
'otherUser', 'capability']) 'otherUser', 'capability'])
def removecapability(self, irc, msg, args, channel, hostmask, capabilities): def removecapability(self, irc, msg, args, channel, user, capabilities):
"""[<channel>] <name|hostmask> <capability> [<capability> ...] """[<channel>] <name|hostmask> <capability> [<capability> ...]
If you have the #channel,op capability, this will take from the user If you have the #channel,op capability, this will take from the user
@ -576,11 +571,6 @@ class Channel(callbacks.Privmsg):
the capability <capability> in the channel. <channel> is only necessary the capability <capability> in the channel. <channel> is only necessary
if the message isn't sent in the channel itself. if the message isn't sent in the channel itself.
""" """
try:
id = ircdb.users.getUserId(hostmask)
except KeyError:
irc.errorNoUser(Raise=True)
user = ircdb.users.getUser(id)
fail = [] fail = []
for c in capabilities.split(): for c in capabilities.split():
cap = ircdb.makeChannelCapability(channel, c) cap = ircdb.makeChannelCapability(channel, c)