This commit is contained in:
Jeremy Fincher 2004-08-05 18:45:09 +00:00
parent d134a2d9ac
commit 3fc03d2fa5
2 changed files with 14 additions and 8 deletions

View File

@ -301,12 +301,13 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
'-' in capability:
try:
id = ircdb.users.getUserId(name)
except KeyError:
irc.errorNoUser()
return
user = ircdb.users.getUser(id)
user.addCapability(capability)
ircdb.users.setUser(id, user)
irc.replySuccess()
except KeyError:
irc.errorNoUser()
else:
s = 'You can\'t add capabilities you don\'t have.'
irc.error(s)

View File

@ -564,12 +564,17 @@ class Channel(callbacks.Privmsg):
capability = ircdb.makeChannelCapability(channel, capability)
try:
id = ircdb.users.getUserId(name)
user = ircdb.users.getUser(id)
user.removeCapability(capability)
ircdb.users.setUser(id, user)
irc.replySuccess()
except KeyError:
irc.errorNoUser()
return
user = ircdb.users.getUser(id)
try:
user.removeCapability(capability)
except KeyError:
irc.error('That user doesn\'t have the %s capability.'%capability)
return
ircdb.users.setUser(id, user)
irc.replySuccess()
removecapability = privmsgs.checkChannelCapability(removecapability, 'op')
def setdefaultcapability(self, irc, msg, args, channel):