2017-01-25 16:39:00 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Friends : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Friends();
|
|
|
|
~Friends();
|
|
|
|
|
|
|
|
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
|
|
|
const char* getName() override { return "Friends"; };
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static void UpdateFriends();
|
2017-01-29 09:10:54 -05:00
|
|
|
static void UpdateRank();
|
2017-01-29 11:16:09 -05:00
|
|
|
static void UpdateHostname(Network::Address server, std::string hostname);
|
2017-01-25 16:39:00 -05:00
|
|
|
|
2017-01-29 15:49:48 -05:00
|
|
|
static void SetPresence(std::string key, std::string value);
|
|
|
|
static void ClearPresence(std::string key);
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
private:
|
2017-01-28 18:31:11 -05:00
|
|
|
#pragma pack(push, 4)
|
2017-01-25 16:39:00 -05:00
|
|
|
struct FriendRichPresenceUpdate
|
|
|
|
{
|
|
|
|
SteamID m_steamIDFriend; // friend who's rich presence has changed
|
|
|
|
int32_t m_nAppID; // the appID of the game (should always be the current game)
|
|
|
|
};
|
2017-01-28 18:31:11 -05:00
|
|
|
#pragma pack(pop)
|
2017-01-25 16:39:00 -05:00
|
|
|
|
|
|
|
struct PersonaStateChange
|
|
|
|
{
|
|
|
|
SteamID m_ulSteamID; // steamID of the friend who changed
|
|
|
|
int m_nChangeFlags; // what's changed
|
|
|
|
};
|
|
|
|
|
|
|
|
class Friend
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SteamID userId;
|
2017-01-29 15:49:48 -05:00
|
|
|
SteamID guid;
|
2017-01-25 16:39:00 -05:00
|
|
|
std::string name;
|
2017-01-29 11:16:09 -05:00
|
|
|
std::string playerName;
|
2017-01-25 16:39:00 -05:00
|
|
|
Network::Address server;
|
2017-01-29 11:16:09 -05:00
|
|
|
std::string serverName;
|
2017-01-25 16:39:00 -05:00
|
|
|
bool online;
|
2017-01-31 04:20:28 -05:00
|
|
|
unsigned int lastTime;
|
2017-01-26 06:42:42 -05:00
|
|
|
int experience;
|
|
|
|
int prestige;
|
2017-01-25 16:39:00 -05:00
|
|
|
};
|
|
|
|
|
2017-01-30 15:54:34 -05:00
|
|
|
static int InitialState;
|
2017-01-25 16:39:00 -05:00
|
|
|
static unsigned int CurrentFriend;
|
|
|
|
static std::recursive_mutex Mutex;
|
|
|
|
static std::vector<Friend> FriendsList;
|
|
|
|
|
2017-01-29 11:16:09 -05:00
|
|
|
static void DisconnectStub();
|
|
|
|
static void ClearServer();
|
|
|
|
static void SetServer();
|
|
|
|
|
2017-01-29 15:49:48 -05:00
|
|
|
static bool IsClientInParty(int controller, int clientNum);
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
static void UpdateUserInfo(SteamID user);
|
2017-01-29 09:10:54 -05:00
|
|
|
static void UpdateState();
|
2017-01-25 16:39:00 -05:00
|
|
|
|
2017-01-29 11:16:09 -05:00
|
|
|
static void SortList();
|
|
|
|
static void SortIndividualList(std::vector<Friend>* list);
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
static unsigned int GetFriendCount();
|
|
|
|
static const char* GetFriendText(unsigned int index, int column);
|
|
|
|
static void SelectFriend(unsigned int index);
|
2017-01-31 04:20:28 -05:00
|
|
|
|
|
|
|
static void UpdateTimeStamp();
|
|
|
|
|
2017-01-31 09:35:34 -05:00
|
|
|
static bool IsOnline(unsigned __int64 timeStamp);
|
2017-01-25 16:39:00 -05:00
|
|
|
};
|
|
|
|
}
|