restored missing files! why!

This commit is contained in:
otavepto 2023-12-29 08:41:34 +02:00
parent 628d5001a6
commit 6864aafc12
6 changed files with 40 additions and 4 deletions

View File

@ -1,6 +1,7 @@
* addded new `auto_accept_invite.txt` setting to automatically accept game/lobby invites from this list, each SteamID64 on a separate line
* 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
* new `disable_overlay_warning_*.txt` settings to disable certain or all warnings in the overlay
* added new `disable_overlay_warning_*.txt` settings to disable certain or all warnings in the overlay
* `disable_overlay_warning_forced_setting.txt`:
- disable the warning for the usage of any file `force_*.txt` in the overlay
- unlocks the settigs menu, this may result in an undesirable output

View File

@ -278,6 +278,9 @@ public:
bool enable_new_app_ticket = false;
// 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{};
};
#endif

View File

@ -1241,7 +1241,7 @@ void Callback(Common_Message *msg)
data.m_ulGameID = f->appid();
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
if (overlay->Ready())
if (overlay->Ready() && !settings->auto_accept_invites.count(msg->source_id()))
{
//TODO: the user should accept the invite first but we auto accept it because there's no gui yet
// Then we will handle it !
@ -1260,7 +1260,7 @@ void Callback(Common_Message *msg)
if (msg->friend_messages().type() == Friend_Messages::GAME_INVITE) {
PRINT_DEBUG("Steam_Friends Got Game Invite\n");
//TODO: I'm pretty sure that the user should accept the invite before this is posted but we do like above
if (overlay->Ready())
if (overlay->Ready() && !settings->auto_accept_invites.count(msg->source_id()))
{
// Then we will handle it !
overlay->SetRichInvite(*find_friend(static_cast<uint64>(msg->source_id())), msg->friend_messages().connect_str().c_str());

View File

@ -1066,6 +1066,33 @@ static void parse_crash_printer_location()
}
}
// auto_accept_invite.txt
static void parse_auto_accept_invite(class Settings *settings_client, Settings *settings_server)
{
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()) {
consume_bom(input);
for( std::string line; getline( input, line ); ) {
size_t start = line.find_first_not_of(whitespaces);
size_t end = line.find_last_not_of(whitespaces);
line = start == end
? std::string()
: line.substr(start, end - start + 1);
if (!line.empty()) {
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);
} catch (...) {}
}
}
}
}
uint32 create_localstorage_settings(Settings **settings_client_out, Settings **settings_server_out, Local_Storage **local_storage_out)
{
std::string program_path = Local_Storage::get_program_path();
@ -1268,6 +1295,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
load_gamecontroller_settings(settings_client);
parse_auto_accept_invite(settings_client, settings_server);
*settings_client_out = settings_client;
*settings_server_out = settings_server;
*local_storage_out = local_storage;

View File

@ -242,7 +242,7 @@ void Steam_Overlay::OpenOverlayInvite(CSteamID lobbyId)
void Steam_Overlay::OpenOverlay(const char* pchDialog)
{
// TODO: Show pages depending on pchDialog
if ((strcmp(pchDialog, "Friends") == 0) && (settings->auto_accept_invites.size() > 0)) {
if ((strncmp(pchDialog, "Friends", sizeof("Friends") - 1) == 0) && (settings->auto_accept_invites.size() > 0)) {
PRINT_DEBUG("Not opening overlay's friends list because some friends are defined in the auto accept list\n");
AddAutoAcceptInviteNotification();
} else {

View File

@ -0,0 +1,3 @@
76561197960287930
76561197960271227
76561197960276863