.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

@ -18,6 +18,8 @@ def userActionChange(stream):
def userStatsRequest(stream): def userStatsRequest(stream):
return packetHelper.readPacketData(stream, [["users", dataTypes.intList]]) return packetHelper.readPacketData(stream, [["users", dataTypes.intList]])
def userPanelRequest(stream):
return packetHelper.readPacketData(stream, [["users", dataTypes.intList]])
""" Client chat packets """ """ Client chat packets """

View File

@ -96,7 +96,7 @@ client_specialMatchInfoRequest = 93
server_userSilenced = 94 server_userSilenced = 94
server_userPresenceSingle = 95 server_userPresenceSingle = 95
server_userPresenceBundle = 96 server_userPresenceBundle = 96
client_userPresenceRequest = 97 client_userPanelRequest = 97
client_userPresenceRequestAll = 98 client_userPresenceRequestAll = 98
client_userToggleBlockNonFriendPM = 99 client_userToggleBlockNonFriendPM = 99
server_userPMBlocked = 100 server_userPMBlocked = 100

View File

@ -152,9 +152,9 @@ def handle(tornadoRequest):
if userHelper.getCountry(userID) == "XX": if userHelper.getCountry(userID) == "XX":
userHelper.setCountry(userID, countryLetters) 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.userPanel(userID))
glob.tokens.enqueueAll(serverPackets.userStats(userID)) #glob.tokens.enqueueAll(serverPackets.userStats(userID))
# Set reponse data to right value and reset our queue # Set reponse data to right value and reset our queue
responseData = responseToken.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))

View File

@ -46,6 +46,7 @@ from events import matchInviteEvent
from events import matchChangeTeamEvent from events import matchChangeTeamEvent
from events import userStatsRequestEvent from events import userStatsRequestEvent
from events import requestStatusUpdateEvent from events import requestStatusUpdateEvent
from events import userPanelRequestEvent
# Exception tracking # Exception tracking
import tornado.web import tornado.web
@ -152,6 +153,7 @@ class handler(SentryMixin, requestHelper.asyncRequestHandler):
packetIDs.client_matchChangeTeam: handleEvent(matchChangeTeamEvent), packetIDs.client_matchChangeTeam: handleEvent(matchChangeTeamEvent),
packetIDs.client_userStatsRequest: handleEvent(userStatsRequestEvent), packetIDs.client_userStatsRequest: handleEvent(userStatsRequestEvent),
packetIDs.client_requestStatusUpdate: handleEvent(requestStatusUpdateEvent), packetIDs.client_requestStatusUpdate: handleEvent(requestStatusUpdateEvent),
packetIDs.client_userPanelRequest: handleEvent(userPanelRequestEvent),
} }
if packetID != 4: if packetID != 4:

View File

@ -16,7 +16,13 @@ def connect():
token = glob.tokens.addToken(999) token = glob.tokens.addToken(999)
token.actionID = actions.idle token.actionID = actions.idle
glob.tokens.enqueueAll(serverPackets.userPanel(999)) glob.tokens.enqueueAll(serverPackets.userPanel(999))
glob.tokens.enqueueAll(serverPackets.userStats(999)) ####glob.tokens.enqueueAll(serverPackets.userStats(999))
# NOTE: Debug thing to set all users as connected
#users = glob.db.fetchAll("SELECT id FROM users")
#for i in users:
# t = glob.tokens.addToken(i["id"])
# t.actionID = actions.idle
def disconnect(): def disconnect():
"""Remove FokaBot from connected users""" """Remove FokaBot from connected users"""

View File

@ -1 +1 @@
1.3.1 1.3.2