FAForever / server

The servercode for the Forged Alliance Forever lobby
http://www.faforever.com
GNU General Public License v3.0
66 stars 61 forks source link

Newly foed/friended players don't receive necessary game_info messages #1002

Closed Askaholic closed 3 weeks ago

Askaholic commented 10 months ago

Scenario 1 - Adding a foe

Imagine you are hosting a game, a player joins the lobby who is just trolling and you don't want them in the game so you kick them. But they keep joining back into the lobby, so you add them as a foe to keep them out of the lobby. The server will now consider the game to be 'invisible' to that player and will prevent them from joining. But because the game is 'invisible' to them, they will stop receiving updates about the game including the updates that say the game has launched or ended and should be removed from the games view. The lobby will stick around on their client until they re-log.

Scenario 2 - Adding a friend

Similarly, imagine you hosted a game for 'friends only'. Now you want to let someone join who wasn't on your friends list yet, so you add them as a friend. The server now considers the game to be visible to them, however it will not actually send them the game_info message needed to display the game in their client until an update is naturally triggered via another player joining/leaving or the game settings being changed.

Log messages

This can cause the following log message to appear:

Client error: You cannot join games hosted by this player.

Reproduce

Scenario 1

  1. Player 1 host a game
  2. Player 1 add player 2 as a foe

Scenario 2

  1. Player 1 host a game with visibility set to 'friends'
  2. Player 1 add player 2 as a friend

Solution

The social_add command should check if the current player is hosting a game, and if so immediately send a game_info message to the added player as follows:

If the player was foed and the game was previously visible to the player:

benjamin-lawson commented 2 months ago

@Askaholic I think I am close to a solution on this. I have made the change to send the subject of the social add or remove a game list update. However, I'll need to check that the client can handle that additional information since it appears it is only sent on login at the moment.