From 640c2cdf92da788f9d60e91ff53ae1b890cfa851 Mon Sep 17 00:00:00 2001 From: Holly Date: Tue, 10 Oct 2023 16:03:55 +0100 Subject: [PATCH] Send friends list info after login --- server/LoginProcess.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/LoginProcess.ts b/server/LoginProcess.ts index 6a729be..0238b94 100644 --- a/server/LoginProcess.ts +++ b/server/LoginProcess.ts @@ -183,14 +183,21 @@ export default async function LoginProcess(req:IncomingMessage, res:ServerRespon if (shared.users.getById(friendId) === undefined) { continue; } const friendPresence = UserPresence(shared, friendId); - if (friendPresence === undefined) { continue; } + if (friendPresence === undefined) { + continue; + } friendsPresence = Buffer.concat([ friendsPresence, friendPresence ], friendsPresence.length + friendPresence.length); } - osuPacketWriter.FriendsList(friendsArray); + // Write this to the user's queue rather than just sending it back so we + // don't get the weird `Loading..., Loading...` etc on friends after login. + const friendsPacketWriter = osu.Bancho.Writer(); + friendsPacketWriter.FriendsList(friendsArray); + const friendData = friendsPacketWriter.toBuffer; + newUser.addActionToQueue(Buffer.concat([friendData, friendsPresence], friendData.length + friendsPresence.length)); // After sending the user their friends list send them the online users UserPresenceBundle(newUser);