.BANCHO. Send userPanel and userStats packets to restricted users
This commit is contained in:
parent
d957356f67
commit
799fe7dc25
|
@ -84,12 +84,12 @@ def onlineUsers():
|
|||
def userLogout(userID):
|
||||
return packetHelper.buildPacket(packetIDs.server_userLogout, [[userID, dataTypes.sInt32], [0, dataTypes.byte]])
|
||||
|
||||
def userPanel(userID):
|
||||
def userPanel(userID, force = False):
|
||||
# Connected and restricted check
|
||||
userToken = glob.tokens.getTokenFromUserID(userID)
|
||||
if userToken == None:
|
||||
return bytes()
|
||||
if userToken.restricted == True:
|
||||
if userToken.restricted == True and force == False:
|
||||
return bytes()
|
||||
|
||||
# Get user data
|
||||
|
@ -126,12 +126,12 @@ def userPanel(userID):
|
|||
])
|
||||
|
||||
|
||||
def userStats(userID):
|
||||
def userStats(userID, force = False):
|
||||
# Get userID's token from tokens list
|
||||
userToken = glob.tokens.getTokenFromUserID(userID)
|
||||
if userToken == None:
|
||||
return bytes() # NOTE: ???
|
||||
if userToken.restricted == True:
|
||||
if userToken.restricted == True and force == False:
|
||||
return bytes()
|
||||
# Stats are cached in token object
|
||||
#rankedScore = userHelper.getRankedScore(userID, userToken.gameMode)
|
||||
|
|
|
@ -49,12 +49,10 @@ def handle(userToken, packetData):
|
|||
token = glob.tokens.getTokenFromUserID(i)
|
||||
|
||||
if token != None:
|
||||
token.enqueue(serverPackets.userPanel(userID))
|
||||
token.enqueue(serverPackets.userStats(userID))
|
||||
|
||||
# TODO: Enqueue all if we've changed game mode, (maybe not needed because it's cached)
|
||||
#glob.tokens.enqueueAll(serverPackets.userPanel(userID))
|
||||
#glob.tokens.enqueueAll(serverPackets.userStats(userID))
|
||||
# Force our own packet
|
||||
force = True if token.userID == userID else False
|
||||
token.enqueue(serverPackets.userPanel(userID, force))
|
||||
token.enqueue(serverPackets.userStats(userID, force))
|
||||
|
||||
# Send osu!direct alert if needed
|
||||
# NOTE: Remove this when osu!direct will be fixed
|
||||
|
|
Loading…
Reference in New Issue
Block a user