Additional error checking on user record deletion
This commit is contained in:
parent
f0fff7c958
commit
aa54759337
|
@ -108,14 +108,17 @@ def addUser(name, channel, nick, user):
|
||||||
p.sadd(chanspace, channel)
|
p.sadd(chanspace, channel)
|
||||||
p.execute()
|
p.execute()
|
||||||
|
|
||||||
def delUser(name, channel, nick, user):
|
def delUser(name, channel, nick, user):
|
||||||
gnamespace, namespace, chanspace = getNamespace(name, channel, nick)
|
gnamespace, namespace, chanspace = getNamespace(name, channel, nick)
|
||||||
p = main.r.pipeline()
|
p = main.r.pipeline()
|
||||||
channels = main.r.smembers(chanspace)
|
channels = main.r.smembers(chanspace)
|
||||||
p.srem(namespace, nick)
|
p.srem(namespace, nick)
|
||||||
if channels == {channel.encode()}:
|
if channels == {channel.encode()}:
|
||||||
p.delete(chanspace)
|
p.delete(chanspace)
|
||||||
p.srem(gnamespace, user)
|
if user:
|
||||||
|
p.srem(gnamespace, user)
|
||||||
|
else:
|
||||||
|
warn("Attempt to delete nonexistent user: %s" % user)
|
||||||
else:
|
else:
|
||||||
p.srem(chanspace, channel)
|
p.srem(chanspace, channel)
|
||||||
p.execute()
|
p.execute()
|
||||||
|
|
Loading…
Reference in New Issue