Send friends list info after login

This commit is contained in:
Holly Stubbs 2023-10-10 16:03:55 +01:00
parent 9d53d82997
commit 640c2cdf92

View file

@ -183,14 +183,21 @@ export default async function LoginProcess(req:IncomingMessage, res:ServerRespon
if (shared.users.getById(friendId) === undefined) { continue; } if (shared.users.getById(friendId) === undefined) { continue; }
const friendPresence = UserPresence(shared, friendId); const friendPresence = UserPresence(shared, friendId);
if (friendPresence === undefined) { continue; } if (friendPresence === undefined) {
continue;
}
friendsPresence = Buffer.concat([ friendsPresence = Buffer.concat([
friendsPresence, friendsPresence,
friendPresence friendPresence
], friendsPresence.length + friendPresence.length); ], 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 // After sending the user their friends list send them the online users
UserPresenceBundle(newUser); UserPresenceBundle(newUser);