19#ifndef HEADER_ONLINE_PROFILE_HPP
20#define HEADER_ONLINE_PROFILE_HPP
23#include "utils/ptr_vector.hpp"
57 irr::core::stringw m_date;
60 RelationInfo(
const irr::core::stringw & date,
bool is_online,
61 bool is_pending,
bool is_asker =
false);
62 void setOnline(
bool online);
65 bool isPending()
const {
return m_is_pending; }
68 bool isAsker()
const {
return m_is_asker; }
71 const irr::core::stringw & getDate()
const {
return m_date; }
74 bool isOnline()
const {
return m_is_online; }
78 typedef std::vector<uint32_t> IDList;
84 S_FETCHING_ACHIEVEMENTS = 0x01,
85 S_FETCHING_FRIENDS = 0x02,
89 bool m_is_current_user;
91 irr::core::stringw m_username;
97 std::atomic_bool m_has_fetched_friends;
104 bool m_has_fetched_achievements;
105 std::vector<uint32_t> m_achievements;
106 std::map<uint32_t, irr::core::stringw> m_friend_server_map;
114 const irr::core::stringw & username,
115 bool is_current_user =
false );
127 std::map<uint32_t, irr::core::stringw>& getFriendServerMap()
128 {
return m_friend_server_map; }
145 return (m_state & S_FETCHING_FRIENDS) == 0;
152 return (m_state & S_FETCHING_ACHIEVEMENTS) == 0;
169 void setRelationInfo(RelationInfo * r)
186 uint32_t
getID()
const {
return m_id; }
190 const irr::core::stringw&
getUserName()
const {
return m_username; }
Definition: online_profile.hpp:52
Class that represents an online profile.
Definition: online_profile.hpp:42
void removeFriend(const uint32_t id)
Removed a friend with a given id.
Definition: online_profile.cpp:251
State
The profile can either be fetching data, or be ready.
Definition: online_profile.hpp:83
const IDList & getAchievements()
Returns the list of all achievement ids.
Definition: online_profile.cpp:309
bool finishedFetchingFriends() const
True if the profile has fetched friends.
Definition: online_profile.hpp:143
void fetchFriends()
Triggers an asynchronous request to download the friends for this user.
Definition: online_profile.cpp:186
const IDList & getFriends()
Returns the list of all friend ids.
Definition: online_profile.cpp:299
RelationInfo * m_relation_info
information about the relation with the current user
Definition: online_profile.hpp:93
bool finishedFetchingAchievements() const
True if the profile has fetched friends.
Definition: online_profile.hpp:150
void storeAchievements(const XMLNode *input)
Stores the achievement ids from an XML node into this profile.
Definition: online_profile.cpp:169
void fetchAchievements()
Triggers an asynchronous request to get the achievements for this user from the server.
Definition: online_profile.cpp:131
bool isCurrentUser() const
Returns true if this item is the current user.
Definition: online_profile.hpp:157
void merge(OnlineProfile *profile)
Merges the information from a given profile with this profile.
Definition: online_profile.cpp:322
void deleteRelationalInfo()
Deletes the relational info for this profile.
Definition: online_profile.cpp:290
void setCacheBit(bool cache_bit)
Sets the cache bit of this profile.
Definition: online_profile.hpp:177
bool hasFetchedFriends() const
Returns true if the friend list for this profile has been fetched.
Definition: online_profile.hpp:139
bool m_is_friend
Whether or not the user of this profile, is a friend of the current user.
Definition: online_profile.hpp:95
uint32_t getID() const
Returns the online id of this profile.
Definition: online_profile.hpp:186
const irr::core::stringw & getUserName() const
Returns the user name of this profile.
Definition: online_profile.hpp:190
void addFriend(const uint32_t id)
Adds a friend to the friend list.
Definition: online_profile.cpp:273
bool hasFetchedAchievements() const
Returns true if the achievements for this profile have been fetched.
Definition: online_profile.hpp:131
void unsetHasFetchedFriends()
Unsets the flag that all friends of this profile are in cache.
Definition: online_profile.hpp:136
bool getCacheBit() const
Returns the cache bit for this profile.
Definition: online_profile.hpp:182
std::vector< uint32_t > m_friends
List of user id's that are friends with the user of this profile.
Definition: online_profile.hpp:102
void storeFriends(const XMLNode *input)
Stores the friends from an XML node into this profile.
Definition: online_profile.cpp:222
utility class used to parse XML files
Definition: xml_node.hpp:48
Declares the general types that are used by the network.