Skip to content

Commit

Permalink
wesnothd: restore functionality to notify users in games about lobby …
Browse files Browse the repository at this point in the history
…joins

needed to let clients in games know when users in their friend list log
on
  • Loading branch information
loonycyborg committed Aug 22, 2019
1 parent 33d6742 commit f137de4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/server/server.cpp
Expand Up @@ -803,6 +803,16 @@ bool server::is_login_allowed(socket_ptr socket, const simple_wml::node* const l
LOG_SERVER << client_address(socket) << "\t" << username << "\thas logged on"
<< (registered ? " to a registered account" : "") << "\n";

std::shared_ptr<game> last_sent;
for(const auto& record : player_connections_.get<game_t>()) {
auto g_ptr { record.get_game() };
if(g_ptr != last_sent) {
// Note: This string is parsed by the client to identify lobby join messages!
record.get_game()->send_server_message_to_all(username + " has logged into the lobby");
last_sent = g_ptr;
}
}

if(is_moderator) {
LOG_SERVER << "Admin automatically recognized: IP: " << client_address(socket) << "\tnick: " << username
<< std::endl;
Expand Down

0 comments on commit f137de4

Please sign in to comment.