Reformat legacy project
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from twisted.internet.threads import deferToThread
|
||||
|
||||
import main
|
||||
from modules import chankeep
|
||||
from twisted.internet.threads import deferToThread
|
||||
from utils.logging.debug import debug, trace
|
||||
from utils.logging.log import warn
|
||||
from utils.parsing import parsen
|
||||
@@ -175,7 +174,9 @@ 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
|
||||
@@ -200,7 +201,10 @@ 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)
|
||||
@@ -230,10 +234,18 @@ 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:
|
||||
@@ -299,6 +311,8 @@ def delChannels(net, channels): # we have left a channel
|
||||
if channel in dupes[net]:
|
||||
if dupes[net][channel] != 0:
|
||||
channels.remove(channel)
|
||||
debug(f"Not removing channel {channel} as {net} has {dupes[net][channel]} other relays covering it")
|
||||
debug(
|
||||
f"Not removing channel {channel} as {net} has {dupes[net][channel]} other relays covering it"
|
||||
)
|
||||
deferToThread(_delChannels, net, channels)
|
||||
# d.addCallback(testCallback)
|
||||
|
||||
Reference in New Issue
Block a user