diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cb1600a..e28b0942 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ -* addded new `auto_accept_invite.txt` setting to automatically accept game/lobby invites from this list, each SteamID64 on a separate line +* addded new `auto_accept_invite.txt` setting to automatically accept game/lobby invites from this list, each SteamID64 on a separate line + also you can leave the file empty to accept invitations from anyone * fixed the condition of `warn_forced_setting`, previously it may be reset back to `false` accidentally * deprecated `disable_overlay_warning.txt` in `steam_settings` folder in favor of new options/files * added new `disable_overlay_warning_*.txt` settings to disable certain or all warnings in the overlay diff --git a/dll/dll/settings.h b/dll/dll/settings.h index 67b26086..9579fc0a 100644 --- a/dll/dll/settings.h +++ b/dll/dll/settings.h @@ -151,12 +151,19 @@ class Settings { bool create_unknown_leaderboards; uint16 port; + // whether to auto accept any overlay invites + bool auto_accept_any_overlay_invites = false; + // list of user steam IDs to auto-accept invites from + std::set auto_accept_overlay_invites_friends{}; + public: + #ifdef LOBBY_CONNECT static const bool is_lobby_connect = true; #else static const bool is_lobby_connect = false; #endif + static std::string sanitize(std::string name); Settings(CSteamID steam_id, CGameID game_id, std::string name, std::string language, bool offline); CSteamID get_local_steam_id(); @@ -279,8 +286,12 @@ public: // can use GC token for generation bool use_gc_token = false; - // list of user steam IDs to auto-accept invites from - std::unordered_set auto_accept_invites{}; + // overlay auto accept stuff + void acceptAnyOverlayInvites(bool value); + void addFriendToOverlayAutoAccept(uint64_t friend_id); + bool hasOverlayAutoAcceptInviteFromFriend(uint64_t friend_id) const; + size_t overlayAutoAcceptInvitesCount() const; + }; #endif diff --git a/dll/settings.cpp b/dll/settings.cpp index ec1b8142..29b63e7e 100644 --- a/dll/settings.cpp +++ b/dll/settings.cpp @@ -296,3 +296,27 @@ bool Settings::appIsInstalled(AppId_t appID) return true; } + + +void Settings::acceptAnyOverlayInvites(bool value) +{ + auto_accept_any_overlay_invites = value; +} + +void Settings::addFriendToOverlayAutoAccept(uint64_t friend_id) +{ + auto_accept_overlay_invites_friends.insert(friend_id); +} + +bool Settings::hasOverlayAutoAcceptInviteFromFriend(uint64_t friend_id) const +{ + if (auto_accept_any_overlay_invites) { + return true; + } + return !!auto_accept_overlay_invites_friends.count(friend_id); +} + +size_t Settings::overlayAutoAcceptInvitesCount() const +{ + return auto_accept_overlay_invites_friends.size(); +} diff --git a/dll/settings_parser.cpp b/dll/settings_parser.cpp index 2b317427..0058e5cb 100644 --- a/dll/settings_parser.cpp +++ b/dll/settings_parser.cpp @@ -1072,6 +1072,7 @@ static void parse_auto_accept_invite(class Settings *settings_client, Settings * std::string auto_accept_list_path = Local_Storage::get_game_settings_path() + "auto_accept_invite.txt"; std::ifstream input( utf8_decode(auto_accept_list_path) ); if (input.is_open()) { + bool accept_any_invite = true; consume_bom(input); for( std::string line; getline( input, line ); ) { @@ -1082,14 +1083,22 @@ static void parse_auto_accept_invite(class Settings *settings_client, Settings * : line.substr(start, end - start + 1); if (!line.empty()) { + accept_any_invite = false; try { auto friend_id = std::stoull(line); - settings_client->auto_accept_invites.insert((uint64_t)friend_id); - settings_server->auto_accept_invites.insert((uint64_t)friend_id); - PRINT_DEBUG("Auto accepting invitations from user with ID (SteamID64) = " "%" PRIu64 "\n", friend_id); + settings_client->addFriendToOverlayAutoAccept((uint64_t)friend_id); + settings_server->addFriendToOverlayAutoAccept((uint64_t)friend_id); + PRINT_DEBUG("Auto accepting overlay invitations from user with ID (SteamID64) = %llu\n", friend_id); } catch (...) {} } } + + if (accept_any_invite) { + PRINT_DEBUG("Auto accepting any overlay invitation\n"); + settings_client->acceptAnyOverlayInvites(true); + } else { + settings_client->acceptAnyOverlayInvites(false); + } } } diff --git a/post_build/README.release.md b/post_build/README.release.md index 3a21dab6..94e96a0d 100644 --- a/post_build/README.release.md +++ b/post_build/README.release.md @@ -440,6 +440,8 @@ Check the exaxmple files in the `steam_settings` folder When the overlay is enabled and working, you can bypass it and auto-accept invites (lobby or game) from a list of Steam IDs (SteamID64 format). The configuration file `auto_accept_invite.txt` allows you to do that, add each SteamID64 on a separate line. +Also you can auto-accept invites from anyone by leaving the file empty. + Check the exaxmple file in the `steam_settings` folder ---