summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_pooling.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-06-03 18:39:15 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-06-03 18:39:15 +0000
commit9abbc99874c8558fab7995ef30a05fc40beddd81 (patch)
tree6f014ab837b0c9853b572427833ec27851f09b69 /protocols/Steam/src/steam_pooling.cpp
parent4c533c2fd10ff3d0e40ec384f5828c71e8b0e0f8 (diff)
Steam:
- add notifications - add user info updating - minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@9407 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_pooling.cpp')
-rw-r--r--protocols/Steam/src/steam_pooling.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/protocols/Steam/src/steam_pooling.cpp b/protocols/Steam/src/steam_pooling.cpp
index c6f7c3c747..957a3dff68 100644
--- a/protocols/Steam/src/steam_pooling.cpp
+++ b/protocols/Steam/src/steam_pooling.cpp
@@ -132,6 +132,7 @@ void CSteamProto::ParsePollData(JSONNODE *data)
{
JSONNODE *node, *item = NULL;
+ std::string steamIds;
for (size_t i = 0; i < json_size(data); i++)
{
item = json_at(data, i);
@@ -171,12 +172,6 @@ void CSteamProto::ParsePollData(JSONNODE *data)
if (hContact)
AddDBEvent(hContact, EVENTTYPE_MESSAGE, timestamp, DBEF_UTF | DBEF_SENT, lstrlen(text), (BYTE*)mir_utf8encodeW(text));
}
-
- /*node = json_get(item, "text");
- if (node != NULL) message->text = json_as_string(node);
-
- node = json_get(item, "utc_timestamp");
- message->timestamp = atol(ptrA(mir_u2a(json_as_string(node))));*/
}
/*else if (!lstrcmpi(type, L"typing"))
{
@@ -212,6 +207,7 @@ void CSteamProto::ParsePollData(JSONNODE *data)
setWString(hContact, "Nick", json_as_string(node));
// todo: find difference between state changing and info changing
+ steamIds.append(steamId).append(",");
}
else if (!lstrcmpi(type, L"personarelationship"))
{
@@ -221,11 +217,26 @@ void CSteamProto::ParsePollData(JSONNODE *data)
switch (state)
{
case 0:
- // removed
+ {// removed
+ MCONTACT hContact = FindContact(steamId);
+ if (hContact)
+ {
+ setByte(hContact, "Auth", 1);
+
+ wchar_t message[MAX_PATH];
+ mir_sntprintf(
+ message, MAX_PATH,
+ TranslateT("%s has been removed from your contact list"),
+ ptrW(mir_a2u(steamId)));
+
+ ShowNotification(L"Steam", message);
+ }
+ }
break;
case 1:
// ignored
+ // todo
break;
case 2:
@@ -247,6 +258,7 @@ void CSteamProto::ParsePollData(JSONNODE *data)
case 3:
// add to list
+ // todo
break;
default: continue;
@@ -260,6 +272,16 @@ void CSteamProto::ParsePollData(JSONNODE *data)
continue;
}
}
+
+ if (!steamIds.empty())
+ {
+ steamIds.pop_back();
+ ptrA token(getStringA("TokenSecret"));
+
+ PushRequest(
+ new SteamWebApi::GetUserSummariesRequest(token, steamIds.c_str()),
+ &CSteamProto::OnGotUserSummaries);
+ }
}
void CSteamProto::PollingThread(void*)