summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_contacts.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-04-08 14:23:04 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-04-08 14:23:04 +0000
commit0a41e7f5bd2d3cd705e5806b3190ff7afadde131 (patch)
treebd3c660ba3d7462a2d0fe03fb538b97075215436 /protocols/Steam/src/steam_contacts.cpp
parentade564ea848b34e64e50acec80b649ac380a5e7c (diff)
Steam:
- added searching by steamid - attempt to replace OpenSSL on CryptoAPI git-svn-id: http://svn.miranda-ng.org/main/trunk@8890 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_contacts.cpp')
-rw-r--r--protocols/Steam/src/steam_contacts.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 9e01da2e33..8e9aa87f9f 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -59,4 +59,46 @@ MCONTACT CSteamProto::AddContact(const SteamWebApi::FriendApi::Friend &contact)
}
return hContact;
+}
+
+void CSteamProto::SearchByIdThread(void* arg)
+{
+ ptrW steamIdW((wchar_t*)arg);
+ ptrA steamId(mir_u2a(steamIdW));
+
+ ptrA token(getStringA("TokenSecret"));
+
+ SteamWebApi::FriendApi::Friend rFriend;
+ SteamWebApi::FriendApi::LoadSummaries(m_hNetlibUser, token, steamId, &rFriend);
+
+ if (!rFriend.IsSuccess())
+ {
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)STEAM_SEARCH_BYID, 0);
+ return;
+ }
+
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+
+ psr.id = mir_wstrdup(steamIdW);
+ psr.nick = mir_wstrdup(rFriend.GetNickname());
+
+ const wchar_t *realname = rFriend.GetRealname();
+ const wchar_t *p = wcschr(realname, ' ');
+ if (p == NULL)
+ psr.firstName = mir_wstrdup(realname);
+ else
+ {
+ int length = p - realname;
+ psr.firstName = (wchar_t*)mir_alloc(sizeof(wchar_t) * (length + 1));
+ wmemcpy(psr.firstName, realname, length);
+ psr.firstName[length] = '\0';
+ psr.lastName = mir_wstrdup(p + 1);
+ }
+
+ //psr.reserved[0] = &psr;
+
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)STEAM_SEARCH_BYID, (LPARAM)&psr);
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)STEAM_SEARCH_BYID, 0);
} \ No newline at end of file