mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2025-01-12 02:19:31 +08:00
allow accepting any invitation by using an empty file
This commit is contained in:
parent
6864aafc12
commit
245e1414fc
@ -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
|
||||
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
|
||||
|
@ -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<uint64_t> 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<uint64_t> 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
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
---
|
||||
|
Loading…
x
Reference in New Issue
Block a user