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: '-' in capability:
try: try:
id = ircdb.users.getUserId(name) id = ircdb.users.getUserId(name)
except KeyError:
irc.errorNoUser()
return
user = ircdb.users.getUser(id) user = ircdb.users.getUser(id)
user.addCapability(capability) user.addCapability(capability)
ircdb.users.setUser(id, user) ircdb.users.setUser(id, user)
irc.replySuccess() irc.replySuccess()
except KeyError:
irc.errorNoUser()
else: else:
s = 'You can\'t add capabilities you don\'t have.' s = 'You can\'t add capabilities you don\'t have.'
irc.error(s) irc.error(s)

View File

@ -564,12 +564,17 @@ class Channel(callbacks.Privmsg):
capability = ircdb.makeChannelCapability(channel, capability) capability = ircdb.makeChannelCapability(channel, capability)
try: try:
id = ircdb.users.getUserId(name) id = ircdb.users.getUserId(name)
user = ircdb.users.getUser(id)
user.removeCapability(capability)
ircdb.users.setUser(id, user)
irc.replySuccess()
except KeyError: except KeyError:
irc.errorNoUser() 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') removecapability = privmsgs.checkChannelCapability(removecapability, 'op')
def setdefaultcapability(self, irc, msg, args, channel): def setdefaultcapability(self, irc, msg, args, channel):