diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-12-08 23:53:52 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-12-08 23:53:52 +0000 |
commit | e295e68b9d9783ad1caebdc99d1fca1fd028f00b (patch) | |
tree | ab782d52b716c517452c10fba1ce272fe5d01565 /protocols/Steam | |
parent | a882547f12158c9b9e01f493d19c1d8fd5eda52b (diff) |
Steam: Load more info about user - client (website/mobile/classic), server ip, primary clan id,...
git-svn-id: http://svn.miranda-ng.org/main/trunk@11293 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam')
-rw-r--r-- | protocols/Steam/src/steam_contacts.cpp | 67 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.cpp | 4 |
2 files changed, 64 insertions, 7 deletions
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 6ae9a913bf..5724d2a411 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -61,10 +61,13 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNODE *data) // set common data node = json_get(data, "personaname"); - setWString(hContact, "Nick", json_as_string(node)); + setTString(hContact, "Nick", json_as_string(node)); node = json_get(data, "profileurl"); - setString(hContact, "Homepage", ptrA(mir_u2a(json_as_string(node)))); + setString(hContact, "Homepage", _T2A(json_as_string(node))); + + node = json_get(data, "primaryclanid"); + setString(hContact, "PrimaryClanID", _T2A(json_as_string(node))); // set name node = json_get(data, "realname"); @@ -109,9 +112,25 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNODE *data) else delSetting(hContact, "Country"); + // state code + node = json_get(data, "locstatecode"); + if (node) + setDword(hContact, "StateCode", json_as_int(node)); + else + delSetting(hContact, "StateCode"); + + // city id + node = json_get(data, "loccityid"); + if (node) + setDword(hContact, "CityID", json_as_int(node)); + else + delSetting(hContact, "CityID"); + + // account created node = json_get(data, "timecreated"); setDword(hContact, "MemberTS", json_as_int(node)); + // last logout time node = json_get(data, "lastlogoff"); setDword(hContact, "LogoffTS", json_as_int(node)); @@ -122,26 +141,60 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNODE *data) if (hContact != NULL) setWord(hContact, "Status", status); + // client + node = json_get(data, "personastateflags"); + int stateflags = node ? json_as_int(node) : -1; + switch (stateflags) + { + case 0: + // nothing special, either standard client or in different status (only online, I want to play, I want to trade statuses support this flags) + if (steamStatus == 1 || steamStatus == 5 || steamStatus == 6) + setTString(hContact, "MirVer", _T("Steam")); + break; + case 256: + // on website + setTString(hContact, "MirVer", _T("Steam (website)")); + break; + case 512: + // on mobile + setTString(hContact, "MirVer", _T("Steam (mobile)")); + break; + default: + // none/unknown (e.g. when contact is offline) + delSetting(hContact, "MirVer"); + break; + } + + // playing game node = json_get(data, "gameid"); DWORD gameId = node ? atol(_T2A(json_as_string(node))) : 0; if (gameId > 0) { + setDword(hContact, "GameID", gameId); + node = json_get(data, "gameextrainfo"); - const wchar_t *gameInfo = json_as_string(node); + const TCHAR *gameInfo = json_as_string(node); if (hContact != NULL) - db_set_ws(hContact, "CList", "StatusMsg", gameInfo); + db_set_ts(hContact, "CList", "StatusMsg", gameInfo); + setTString(hContact, "GameInfo", gameInfo); - setWString(hContact, "GameInfo", gameInfo); - setDword(hContact, "GameID", gameId); + node = json_get(data, "gameserverip"); + setString(hContact, "GameServerIP", _T2A(json_as_string(node))); + + node = json_get(data, "gameserversteamid"); + setString(hContact, "GameServerID", _T2A(json_as_string(node))); } else { if (hContact != NULL) db_unset(hContact, "CList", "StatusMsg"); - delSetting(hContact, "GameInfo"); delSetting(hContact, "GameID"); + delSetting(hContact, "GameInfo"); + delSetting(hContact, "GameServerIP"); + delSetting(hContact, "GameServerID"); + delSetting(hContact, "GameInfo"); } } diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 778c9f95ee..bd54e140f7 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -37,6 +37,10 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) : // temporary DB settings db_set_resident(m_szModuleName, "Status"); // NOTE: XStatus cannot be temporary db_set_resident(m_szModuleName, "IdleTS"); + db_set_resident(m_szModuleName, "GameID"); + db_set_resident(m_szModuleName, "GameInfo"); + db_set_resident(m_szModuleName, "GameServerIP"); + db_set_resident(m_szModuleName, "GameServerID"); SetAllContactsStatus(ID_STATUS_OFFLINE); |