Now I set the invite instead of adding it.

You should send a lobby invite or a rich invite, but not both.
This commit is contained in:
Nemirtingas 2019-08-02 23:01:24 +02:00
parent 73fa7b50b5
commit 2a373bbf79
3 changed files with 10 additions and 6 deletions

View File

@ -1037,7 +1037,7 @@ void Callback(Common_Message *msg)
PRINT_DEBUG("Steam_Friends Got Lobby Invite\n");
//TODO: the user should accept the invite first but we auto accept it because there's no gui yet
// Then we will handle it !
overlay->AddLobbyInvite(*find_friend(msg->source_id()), msg->friend_messages().lobby_id());
overlay->SetLobbyInvite(*find_friend(msg->source_id()), msg->friend_messages().lobby_id());
//GameLobbyJoinRequested_t data;
//data.m_steamIDLobby = CSteamID((uint64)msg->friend_messages().lobby_id());
@ -1049,7 +1049,7 @@ void Callback(Common_Message *msg)
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
// Then we will handle it !
overlay->AddRichInvite(*find_friend(msg->source_id()), msg->friend_messages().connect_str().c_str());
overlay->SetRichInvite(*find_friend(msg->source_id()), msg->friend_messages().connect_str().c_str());
//std::string const& connect_str = msg->friend_messages().connect_str();
//GameRichPresenceJoinRequested_t data = {};

View File

@ -230,7 +230,7 @@ void Steam_Overlay::ShowOverlay(bool state)
overlay_state_changed = true;
}
void Steam_Overlay::AddLobbyInvite(Friend friendId, uint64 lobbyId)
void Steam_Overlay::SetLobbyInvite(Friend friendId, uint64 lobbyId)
{
std::lock_guard<std::recursive_mutex> lock(global_mutex);
auto i = friends.find(friendId);
@ -239,10 +239,12 @@ void Steam_Overlay::AddLobbyInvite(Friend friendId, uint64 lobbyId)
auto& frd = i->second;
frd.lobbyId = lobbyId;
frd.window_state |= window_state_lobby_invite;
// Make sure don't have rich presence invite and a lobby invite (it should not happen but who knows)
frd.window_state &= ~window_state_rich_invite;
}
}
void Steam_Overlay::AddRichInvite(Friend friendId, const char* connect_str)
void Steam_Overlay::SetRichInvite(Friend friendId, const char* connect_str)
{
std::lock_guard<std::recursive_mutex> lock(global_mutex);
auto i = friends.find(friendId);
@ -251,6 +253,8 @@ void Steam_Overlay::AddRichInvite(Friend friendId, const char* connect_str)
auto& frd = i->second;
strncpy(frd.connect, connect_str, k_cchMaxRichPresenceValueLength - 1);
frd.window_state |= window_state_rich_invite;
// Make sure don't have rich presence invite and a lobby invite (it should not happen but who knows)
frd.window_state &= ~window_state_lobby_invite;
}
}

View File

@ -102,8 +102,8 @@ public:
void ShowOverlay(bool state);
void AddLobbyInvite(Friend friendId, uint64 lobbyId);
void AddRichInvite(Friend friendId, const char* connect_str);
void SetLobbyInvite(Friend friendId, uint64 lobbyId);
void SetRichInvite(Friend friendId, const char* connect_str);
void FriendConnect(Friend _friend);
void FriendDisconnect(Friend _friend);