Revert "Reformat project"

This reverts commit 64e3e1160aa76d191740342ab3edc68807f890fb.
This commit is contained in:
2022-07-21 13:40:01 +01:00
parent da678617d8
commit 27cafa1def
57 changed files with 214 additions and 519 deletions

View File

@@ -1,10 +1,9 @@
from twisted.internet.threads import deferToThread
from string import digits
from twisted.internet.threads import deferToThread
import main
from utils.logging.debug import debug, trace
from utils.logging.log import *
from utils.logging.debug import debug, trace
from utils.parsing import parsen
@@ -146,9 +145,7 @@ def delUser(name, channel, nick, user):
p.srem(namespace, nick)
if channels == {channel.encode()}: # can we only see them on this channel?
p.delete(chanspace) # remove channel tracking entry
p.hdel(
"live.prefix." + name + "." + channel, nick
) # remove prefix tracking entry
p.hdel("live.prefix." + name + "." + channel, nick) # remove prefix tracking entry
p.hdel(mapspace, nick) # remove nick mapping entry
if user:
p.srem(gnamespace, user) # remove global userinfo entry
@@ -173,10 +170,7 @@ def getUserByNick(name, nick):
if main.r.hexists(mapspace, nick):
return main.r.hget(mapspace, nick)
else:
warn(
"Entry doesn't exist: %s on %s - attempting auxiliary lookup"
% (nick, mapspace)
)
warn("Entry doesn't exist: %s on %s - attempting auxiliary lookup" % (nick, mapspace))
# return False
# legacy code below - remove when map is reliable
usermatch = main.r.sscan(gnamespace, match=escape(nick) + "!*", count=999999999)
@@ -206,18 +200,10 @@ def renameUser(name, oldnick, olduser, newnick, newuser):
p.sadd("live.who." + name + "." + i, newnick)
p.hdel(mapspace, oldnick)
p.hset(mapspace, newnick, newuser)
if main.r.exists(
"live.prefix." + name + "." + i
): # if there's a prefix entry for the channel
if main.r.hexists(
"live.prefix." + name + "." + i, oldnick
): # if the old nick is in it
mode = main.r.hget(
"live.prefix." + name + "." + i, oldnick
) # retrieve old modes
p.hset(
"live.prefix." + name + "." + i, newnick, mode
) # set old modes to new nickname
if main.r.exists("live.prefix." + name + "." + i): # if there's a prefix entry for the channel
if main.r.hexists("live.prefix." + name + "." + i, oldnick): # if the old nick is in it
mode = main.r.hget("live.prefix." + name + "." + i, oldnick) # retrieve old modes
p.hset("live.prefix." + name + "." + i, newnick, mode) # set old modes to new nickname
if main.r.exists(chanspace):
p.rename(chanspace, newchanspace)
else: