Small improvements to last commit.

merge-requests/8/head
Mr_Goldberg 2019-07-10 08:03:40 -04:00
parent b034ee8781
commit aa9e3c0c46
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
1 changed files with 8 additions and 3 deletions

View File

@ -776,6 +776,10 @@ void RequestFriendRichPresence( CSteamID steamIDFriend )
bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString )
{ {
PRINT_DEBUG("Steam_Friends::InviteUserToGame\n"); PRINT_DEBUG("Steam_Friends::InviteUserToGame\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
Friend *f = find_friend(steamIDFriend);
if (!f) return false;
Common_Message msg; Common_Message msg;
Friend_Messages *friend_messages = new Friend_Messages(); Friend_Messages *friend_messages = new Friend_Messages();
friend_messages->set_type(Friend_Messages::GAME_INVITE); friend_messages->set_type(Friend_Messages::GAME_INVITE);
@ -1031,10 +1035,11 @@ void Callback(Common_Message *msg)
if (msg->friend_messages().type() == Friend_Messages::GAME_INVITE) { if (msg->friend_messages().type() == Friend_Messages::GAME_INVITE) {
PRINT_DEBUG("Steam_Friends Got Game Invite\n"); 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
std::string const& connect_str = msg->friend_messages().connect_str(); std::string const& connect_str = msg->friend_messages().connect_str();
GameRichPresenceJoinRequested_t data; GameRichPresenceJoinRequested_t data = {};
data.m_steamIDFriend = CSteamID((uint64)msg->source_id()); data.m_steamIDFriend = CSteamID((uint64)msg->source_id());
strncpy(data.m_rgchConnect, connect_str.c_str(), k_cchMaxRichPresenceValueLength); strncpy(data.m_rgchConnect, connect_str.c_str(), k_cchMaxRichPresenceValueLength - 1);
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data)); callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
} }
} }