iw4x-client/src/Components/Modules/Friends.hpp

91 lines
2.2 KiB
C++
Raw Normal View History

#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();
static void UpdateServer(Network::Address server, std::string hostname, std::string mapname);
2017-01-31 11:04:54 -05:00
static void UpdateName();
2017-01-29 15:49:48 -05:00
static void SetPresence(std::string key, std::string value);
static void ClearPresence(std::string key);
2017-02-16 21:27:38 -05:00
static void RequestPresence(SteamID user);
static std::string GetPresence(SteamID user, std::string key);
2017-02-16 13:44:21 -05:00
static void AddFriend(SteamID user);
private:
#pragma pack(push, 4)
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)
};
#pragma pack(pop)
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;
std::string name;
std::string playerName;
2017-01-31 12:16:30 -05:00
std::string cleanName;
Network::Address server;
std::string serverName;
std::string mapname;
bool online;
unsigned int lastTime;
2017-01-26 06:42:42 -05:00
int experience;
int prestige;
};
2017-02-19 05:38:18 -05:00
static bool LoggedOn;
2017-01-31 12:16:30 -05:00
static bool TriggerSort;
2017-01-31 11:04:54 -05:00
static bool TriggerUpdate;
2017-01-30 15:54:34 -05:00
static int InitialState;
static unsigned int CurrentFriend;
static std::recursive_mutex Mutex;
static std::vector<Friend> FriendsList;
static void DisconnectStub();
static void ClearServer();
static void SetServer();
2017-01-29 15:49:48 -05:00
static bool IsClientInParty(int controller, int clientNum);
static void UpdateUserInfo(SteamID user);
2017-01-31 11:04:54 -05:00
static void UpdateState(bool force = false);
2017-01-31 12:16:30 -05:00
static void SortList(bool force = false);
static void SortIndividualList(std::vector<Friend>* list);
static unsigned int GetFriendCount();
static const char* GetFriendText(unsigned int index, int column);
static void SelectFriend(unsigned int index);
static void UpdateTimeStamp();
static bool IsOnline(unsigned __int64 timeStamp);
static void StoreFriendsList();
};
}