[Friends] Add mapname to the status string

This commit is contained in:
momo5502 2017-02-12 22:55:45 +01:00
parent 512bec249d
commit 56f0897ac1
3 changed files with 8 additions and 4 deletions

View File

@ -138,7 +138,7 @@ namespace Components
}
}
void Friends::UpdateHostname(Network::Address server, std::string hostname)
void Friends::UpdateServer(Network::Address server, std::string hostname, std::string mapname)
{
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
@ -147,6 +147,7 @@ namespace Components
if(entry.server == server)
{
entry.serverName = hostname;
entry.mapname = mapname;
}
}
}
@ -226,6 +227,8 @@ namespace Components
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
if (!Steam::Proxy::SteamFriends) return;
Game::UI_UpdateArenas();
int count = Steam::Proxy::SteamFriends->GetFriendCount(4);
Proto::Friends::List list;
@ -350,7 +353,7 @@ namespace Components
if (!Friends::IsOnline(user.lastTime)) return "Online";
if (user.server.getType() == Game::NA_BAD) return "Playing IW4x";
if (user.serverName.empty()) return Utils::String::VA("Playing on %s", user.server.getCString());
return Utils::String::VA("Playing on %s", user.serverName.data());
return Utils::String::VA("Playing %s on %s", Game::UI_LocalizeMapName(user.mapname.data()), user.serverName.data());
}
default:

View File

@ -14,7 +14,7 @@ namespace Components
static void UpdateFriends();
static void UpdateRank();
static void UpdateHostname(Network::Address server, std::string hostname);
static void UpdateServer(Network::Address server, std::string hostname, std::string mapname);
static void UpdateName();
static void SetPresence(std::string key, std::string value);
@ -45,6 +45,7 @@ namespace Components
std::string cleanName;
Network::Address server;
std::string serverName;
std::string mapname;
bool online;
unsigned int lastTime;
int experience;

View File

@ -452,7 +452,7 @@ namespace Components
}
ServerList::Insert(address, info);
Friends::UpdateHostname(address, info.get("hostname"));
Friends::UpdateServer(address, info.get("hostname"), info.get("mapname"));
});
}