summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_contacts.cpp
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-02-02 23:32:00 +0300
committeraunsane <aunsane@gmail.com>2018-02-02 23:34:06 +0300
commit5c145450b7aa7d4a59a7565d196fe67cec4f8880 (patch)
tree4ebc54062545f6ae00d13a8dfd17e0751a39def5 /protocols/Steam/src/steam_contacts.cpp
parenta7c14294ccfc26f48b5e4c511b7dc65b7e3020a9 (diff)
Steam:
- switched on c++17 language support - forsed update user summaries when got "personastate" message - added detection of VR (?) clent into MirVer
Diffstat (limited to 'protocols/Steam/src/steam_contacts.cpp')
-rw-r--r--protocols/Steam/src/steam_contacts.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 1375815dda..75f17f80e4 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -33,6 +33,7 @@ void CSteamProto::SetContactStatus(MCONTACT hContact, WORD status)
SetContactExtraIcon(hContact, NULL);
}
// no break intentionally
+ [[fallthrough]];
default:
db_unset(hContact, "CList", "StatusMsg");
@@ -161,29 +162,36 @@ void CSteamProto::UpdateContactDetails(MCONTACT hContact, const JSONNode &data)
// client
node = data["personastateflags"];
- long stateflags = !node.isnull() ? node.as_int() : -1;
- if (stateflags == 0) {
+ PersonaStateFlag stateflags = !node.isnull()
+ ? (PersonaStateFlag)node.as_int()
+ : (PersonaStateFlag)(-1);
+
+ if (stateflags == PersonaStateFlag::None) {
// nothing special, either standard client or in different status (only online, I want to play, I want to trade statuses support this flags)
WORD status = getWord(hContact, "Status", ID_STATUS_OFFLINE);
if (status == ID_STATUS_ONLINE || status == ID_STATUS_OUTTOLUNCH || status == ID_STATUS_FREECHAT)
setWString(hContact, "MirVer", L"Steam");
}
- else if (stateflags & PersonaStateFlag::InJoinableGame) {
+ else if (contains_flag(stateflags, PersonaStateFlag::InJoinableGame)) {
// game
setWString(hContact, "MirVer", L"Steam (in game)");
}
- else if (stateflags & PersonaStateFlag::OnlineUsingWeb) {
+ else if (contains_flag(stateflags, PersonaStateFlag::ClientTypeWeb)) {
// on website
setWString(hContact, "MirVer", L"Steam (website)");
}
- else if (stateflags & PersonaStateFlag::OnlineUsingMobile) {
+ else if (contains_flag(stateflags, PersonaStateFlag::ClientTypeMobile)) {
// on mobile
setWString(hContact, "MirVer", L"Steam (mobile)");
}
- else if (stateflags & PersonaStateFlag::OnlineUsingBigPicture) {
- // big picture mode
+ else if (contains_flag(stateflags, PersonaStateFlag::ClientTypeBigPicture)) {
+ // on big picture
setWString(hContact, "MirVer", L"Steam (Big Picture)");
}
+ else if (contains_flag(stateflags, PersonaStateFlag::ClientTypeVR)) {
+ // on VR
+ setWString(hContact, "MirVer", L"Steam (VR)");
+ }
else {
// none/unknown (e.g. when contact is offline)
delSetting(hContact, "MirVer");
@@ -533,7 +541,7 @@ void CSteamProto::OnGotAvatar(const HttpResponse &response, void *arg)
FILE *file = _wfopen(ai.filename, L"wb");
if (file) {
- fwrite(response.Content, sizeof(char), response.Content.GetSize(), file);
+ fwrite((const char*)response.Content, sizeof(char), response.Content.size(), file);
fclose(file);
if (ai.hContact)