.BANCHO. Add userpanel packets
This commit is contained in:
parent
3fe7907cf1
commit
f5827f6b8b
|
@ -18,6 +18,8 @@ def userActionChange(stream):
|
|||
def userStatsRequest(stream):
|
||||
return packetHelper.readPacketData(stream, [["users", dataTypes.intList]])
|
||||
|
||||
def userPanelRequest(stream):
|
||||
return packetHelper.readPacketData(stream, [["users", dataTypes.intList]])
|
||||
|
||||
|
||||
""" Client chat packets """
|
||||
|
|
|
@ -96,7 +96,7 @@ client_specialMatchInfoRequest = 93
|
|||
server_userSilenced = 94
|
||||
server_userPresenceSingle = 95
|
||||
server_userPresenceBundle = 96
|
||||
client_userPresenceRequest = 97
|
||||
client_userPanelRequest = 97
|
||||
client_userPresenceRequestAll = 98
|
||||
client_userToggleBlockNonFriendPM = 99
|
||||
server_userPMBlocked = 100
|
||||
|
|
|
@ -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
|
||||
|
|
17
events/userPanelRequestEvent.py
Normal file
17
events/userPanelRequestEvent.py
Normal 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))
|
|
@ -46,6 +46,7 @@ from events import matchInviteEvent
|
|||
from events import matchChangeTeamEvent
|
||||
from events import userStatsRequestEvent
|
||||
from events import requestStatusUpdateEvent
|
||||
from events import userPanelRequestEvent
|
||||
|
||||
# Exception tracking
|
||||
import tornado.web
|
||||
|
@ -152,6 +153,7 @@ class handler(SentryMixin, requestHelper.asyncRequestHandler):
|
|||
packetIDs.client_matchChangeTeam: handleEvent(matchChangeTeamEvent),
|
||||
packetIDs.client_userStatsRequest: handleEvent(userStatsRequestEvent),
|
||||
packetIDs.client_requestStatusUpdate: handleEvent(requestStatusUpdateEvent),
|
||||
packetIDs.client_userPanelRequest: handleEvent(userPanelRequestEvent),
|
||||
}
|
||||
|
||||
if packetID != 4:
|
||||
|
|
|
@ -16,7 +16,13 @@ def connect():
|
|||
token = glob.tokens.addToken(999)
|
||||
token.actionID = actions.idle
|
||||
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():
|
||||
"""Remove FokaBot from connected users"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user