.BANCHO. Add userpanel packets

This commit is contained in:
Nyo
2016-06-17 17:43:49 +02:00
parent 3fe7907cf1
commit f5827f6b8b
7 changed files with 32 additions and 5 deletions

View File

@@ -152,9 +152,9 @@ def handle(tornadoRequest):
if userHelper.getCountry(userID) == "XX":
userHelper.setCountry(userID, countryLetters)
# Send to everyone our userpanel and userStats (so they now we have logged in)
# Send to everyone our userpanel
glob.tokens.enqueueAll(serverPackets.userPanel(userID))
glob.tokens.enqueueAll(serverPackets.userStats(userID))
#glob.tokens.enqueueAll(serverPackets.userStats(userID))
# Set reponse data to right value and reset our queue
responseData = responseToken.queue

View File

@@ -0,0 +1,17 @@
from constants import clientPackets
from constants import serverPackets
from helpers import logHelper as log
def handle(userToken, packetData):
# Read userIDs list
packetData = clientPackets.userPanelRequest(packetData)
# Process lists with length <= 32
if len(packetData) > 256:
log.warning("Received userPanelRequest with length > 256")
return
for i in packetData["users"]:
# Enqueue userpanel packets relative to this user
log.debug("Sending panel for user {}".format(i))
userToken.enqueue(serverPackets.userPanel(i))