Merge pull request #417 from diamante0018/fix/persona-state

[Friends] Remove code that forces you to be busy on Steam
This commit is contained in:
Dss0 2022-08-10 11:57:23 +02:00 committed by GitHub
commit c6690d1d8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 34 deletions

View File

@ -126,22 +126,14 @@ namespace Components
} }
} }
void Friends::UpdateState(bool force) void Friends::UpdateState()
{ {
if (Friends::CLAnonymous.get<bool>() || Friends::IsInvisible() || !Steam::Enabled()) return; if (Friends::CLAnonymous.get<bool>() || Friends::IsInvisible() || !Steam::Enabled())
{
return;
}
if (force) Friends::TriggerUpdate = true;
{
if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamFriends)
{
int state = Steam::Proxy::SteamFriends->GetPersonaState();
Steam::Proxy::ClientFriends.invoke<void>("SetPersonaState", (state == 1 ? 2 : 1));
}
}
else
{
Friends::TriggerUpdate = true;
}
} }
void Friends::UpdateServer(Network::Address server, const std::string& hostname, const std::string& mapname) void Friends::UpdateServer(Network::Address server, const std::string& hostname, const std::string& mapname)
@ -660,7 +652,7 @@ namespace Components
if (Friends::TriggerUpdate) if (Friends::TriggerUpdate)
{ {
Friends::TriggerUpdate = false; Friends::TriggerUpdate = false;
Friends::UpdateState(true); Friends::UpdateState();
} }
} }

View File

@ -83,7 +83,7 @@ namespace Components
static bool IsClientInParty(int controller, int clientNum); static bool IsClientInParty(int controller, int clientNum);
static void UpdateUserInfo(SteamID user); static void UpdateUserInfo(SteamID user);
static void UpdateState(bool force = false); static void UpdateState();
static void SortList(bool force = false); static void SortList(bool force = false);
static void SortIndividualList(std::vector<Friend>* list); static void SortIndividualList(std::vector<Friend>* list);

View File

@ -6,7 +6,7 @@ STEAM_IGNORE_WARNINGS_START
namespace Steam namespace Steam
{ {
const char *Friends::GetPersonaName() const char* Friends::GetPersonaName()
{ {
return Dvar::Var("name").get<const char*>(); return Dvar::Var("name").get<const char*>();
} }
@ -28,7 +28,7 @@ namespace Steam
SteamID Friends::GetFriendByIndex(int iFriend, int iFriendFlags) SteamID Friends::GetFriendByIndex(int iFriend, int iFriendFlags)
{ {
return SteamID(); return {};
} }
int Friends::GetFriendRelationship(SteamID steamIDFriend) int Friends::GetFriendRelationship(SteamID steamIDFriend)
@ -41,7 +41,7 @@ namespace Steam
return 0; return 0;
} }
const char *Friends::GetFriendPersonaName(SteamID steamIDFriend) const char* Friends::GetFriendPersonaName(SteamID steamIDFriend)
{ {
return ""; return "";
} }
@ -56,7 +56,7 @@ namespace Steam
return false; return false;
} }
const char *Friends::GetFriendPersonaNameHistory(SteamID steamIDFriend, int iPersonaName) const char* Friends::GetFriendPersonaNameHistory(SteamID steamIDFriend, int iPersonaName)
{ {
return ""; return "";
} }
@ -88,7 +88,7 @@ namespace Steam
SteamID Friends::GetFriendFromSourceByIndex(SteamID steamIDSource, int iFriend) SteamID Friends::GetFriendFromSourceByIndex(SteamID steamIDSource, int iFriend)
{ {
return SteamID(); return {};
} }
bool Friends::IsUserInSource(SteamID steamIDUser, SteamID steamIDSource) bool Friends::IsUserInSource(SteamID steamIDUser, SteamID steamIDSource)

View File

@ -20,21 +20,21 @@ namespace Steam
class Friends class Friends
{ {
public: public:
virtual const char *GetPersonaName(); virtual const char* GetPersonaName();
virtual void SetPersonaName(const char *pchPersonaName); virtual void SetPersonaName(const char *pchPersonaName);
virtual int GetPersonaState(); virtual int GetPersonaState();
virtual int GetFriendCount(int eFriendFlags); virtual int GetFriendCount(int eFriendFlags);
virtual SteamID GetFriendByIndex(int iFriend, int iFriendFlags); virtual SteamID GetFriendByIndex(int iFriend, int iFriendFlags);
virtual int GetFriendRelationship(SteamID steamIDFriend); virtual int GetFriendRelationship(SteamID steamIDFriend);
virtual int GetFriendPersonaState(SteamID steamIDFriend); virtual int GetFriendPersonaState(SteamID steamIDFriend);
virtual const char *GetFriendPersonaName(SteamID steamIDFriend); virtual const char* GetFriendPersonaName(SteamID steamIDFriend);
virtual int GetFriendAvatar(SteamID steamIDFriend, int eAvatarSize); virtual int GetFriendAvatar(SteamID steamIDFriend, int eAvatarSize);
virtual bool GetFriendGamePlayed(SteamID steamIDFriend, FriendGameInfo *pFriendGameInfo); virtual bool GetFriendGamePlayed(SteamID steamIDFriend, FriendGameInfo *pFriendGameInfo);
virtual const char *GetFriendPersonaNameHistory(SteamID steamIDFriend, int iPersonaName); virtual const char* GetFriendPersonaNameHistory(SteamID steamIDFriend, int iPersonaName);
virtual bool HasFriend(SteamID steamIDFriend, int eFriendFlags); virtual bool HasFriend(SteamID steamIDFriend, int eFriendFlags);
virtual int GetClanCount(); virtual int GetClanCount();
virtual SteamID GetClanByIndex(int iClan); virtual SteamID GetClanByIndex(int iClan);
virtual const char *GetClanName(SteamID steamIDClan); virtual const char* GetClanName(SteamID steamIDClan);
virtual int GetFriendCountFromSource(SteamID steamIDSource); virtual int GetFriendCountFromSource(SteamID steamIDSource);
virtual SteamID GetFriendFromSourceByIndex(SteamID steamIDSource, int iFriend); virtual SteamID GetFriendFromSourceByIndex(SteamID steamIDSource, int iFriend);
virtual bool IsUserInSource(SteamID steamIDUser, SteamID steamIDSource); virtual bool IsUserInSource(SteamID steamIDUser, SteamID steamIDSource);
@ -49,28 +49,28 @@ namespace Steam
class Friends15 class Friends15
{ {
public: public:
virtual const char *GetPersonaName() = 0; virtual const char* GetPersonaName() = 0;
virtual uint64_t SetPersonaName(const char *pchPersonaName) = 0; virtual uint64_t SetPersonaName(const char *pchPersonaName) = 0;
virtual int GetPersonaState() = 0; virtual int GetPersonaState() = 0;
virtual int GetFriendCount(int iFriendFlags) = 0; virtual int GetFriendCount(int iFriendFlags) = 0;
virtual SteamID GetFriendByIndex(int iFriend, int iFriendFlags) = 0; virtual SteamID GetFriendByIndex(int iFriend, int iFriendFlags) = 0;
virtual int GetFriendRelationship(SteamID steamIDFriend) = 0; virtual int GetFriendRelationship(SteamID steamIDFriend) = 0;
virtual int GetFriendPersonaState(SteamID steamIDFriend) = 0; virtual int GetFriendPersonaState(SteamID steamIDFriend) = 0;
virtual const char *GetFriendPersonaName(SteamID steamIDFriend) = 0; virtual const char* GetFriendPersonaName(SteamID steamIDFriend) = 0;
virtual bool GetFriendGamePlayed(SteamID steamID, void *pGamePlayInfo) = 0; virtual bool GetFriendGamePlayed(SteamID steamID, void *pGamePlayInfo) = 0;
virtual const char *GetFriendPersonaNameHistory(SteamID steamIDFriend, FriendGameInfo iPersonaName) = 0; virtual const char* GetFriendPersonaNameHistory(SteamID steamIDFriend, FriendGameInfo iPersonaName) = 0;
virtual int GetFriendSteamLevel(SteamID steamIDFriend) = 0; virtual int GetFriendSteamLevel(SteamID steamIDFriend) = 0;
virtual const char *GetPlayerNickname(SteamID steamIDPlayer) = 0; virtual const char* GetPlayerNickname(SteamID steamIDPlayer) = 0;
virtual int16_t GetFriendsGroupCount() = 0; virtual int16_t GetFriendsGroupCount() = 0;
virtual int16_t GetFriendsGroupIDByIndex(int32_t) = 0; virtual int16_t GetFriendsGroupIDByIndex(int32_t) = 0;
virtual const char * GetFriendsGroupName(int16_t) = 0; virtual const char* GetFriendsGroupName(int16_t) = 0;
virtual int GetFriendsGroupMembersCount(int16_t) = 0; virtual int GetFriendsGroupMembersCount(int16_t) = 0;
virtual int GetFriendsGroupMembersList(int16_t, SteamID *, int32_t) = 0; virtual int GetFriendsGroupMembersList(int16_t, SteamID *, int32_t) = 0;
virtual bool HasFriend(SteamID steamIDFriend, int iFriendFlags) = 0; virtual bool HasFriend(SteamID steamIDFriend, int iFriendFlags) = 0;
virtual int GetClanCount() = 0; virtual int GetClanCount() = 0;
virtual SteamID GetClanByIndex(int iClan) = 0; virtual SteamID GetClanByIndex(int iClan) = 0;
virtual const char *GetClanName(SteamID steamIDClan) = 0; virtual const char* GetClanName(SteamID steamIDClan) = 0;
virtual const char *GetClanTag(SteamID steamIDClan) = 0; virtual const char* GetClanTag(SteamID steamIDClan) = 0;
virtual bool GetClanActivityCounts(SteamID steamID, int *pnOnline, int *pnInGame, int *pnChatting) = 0; virtual bool GetClanActivityCounts(SteamID steamID, int *pnOnline, int *pnInGame, int *pnChatting) = 0;
virtual uint64_t DownloadClanActivityCounts(SteamID groupIDs[], int nIds) = 0; virtual uint64_t DownloadClanActivityCounts(SteamID groupIDs[], int nIds) = 0;
virtual int GetFriendCountFromSource(SteamID steamIDSource) = 0; virtual int GetFriendCountFromSource(SteamID steamIDSource) = 0;
@ -94,9 +94,9 @@ namespace Steam
virtual int GetUserRestrictions() = 0; virtual int GetUserRestrictions() = 0;
virtual bool SetRichPresence(const char *pchKey, const char *pchValue) = 0; virtual bool SetRichPresence(const char *pchKey, const char *pchValue) = 0;
virtual void ClearRichPresence() = 0; virtual void ClearRichPresence() = 0;
virtual const char *GetFriendRichPresence(SteamID steamIDFriend, const char *pchKey) = 0; virtual const char* GetFriendRichPresence(SteamID steamIDFriend, const char *pchKey) = 0;
virtual int GetFriendRichPresenceKeyCount(SteamID steamIDFriend) = 0; virtual int GetFriendRichPresenceKeyCount(SteamID steamIDFriend) = 0;
virtual const char *GetFriendRichPresenceKeyByIndex(SteamID steamIDFriend, int iKey) = 0; virtual const char* GetFriendRichPresenceKeyByIndex(SteamID steamIDFriend, int iKey) = 0;
virtual void RequestFriendRichPresence(SteamID steamIDFriend) = 0; virtual void RequestFriendRichPresence(SteamID steamIDFriend) = 0;
virtual bool InviteUserToGame(SteamID steamIDFriend, const char *pchConnectString) = 0; virtual bool InviteUserToGame(SteamID steamIDFriend, const char *pchConnectString) = 0;
virtual int GetCoplayFriendCount() = 0; virtual int GetCoplayFriendCount() = 0;