diff options
author | Robert Pösel <robyer@seznam.cz> | 2015-12-20 05:38:13 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2015-12-20 05:38:13 +0000 |
commit | 1440e9da7b83bb649aff90af3cdfe9433416c988 (patch) | |
tree | 631b1ead3df9f2f793ef65b4ac199b42640c35be /protocols/Steam/src/steam_proto.cpp | |
parent | 3973fc0ef6292ab81d193a927f1e4cea4e447dfd (diff) |
Steam: Implement searching by keywords
Like by name or nickname, but it doesn't matter in which input user writes the text, it is searched as a whole combined string separated by spaces.
git-svn-id: http://svn.miranda-ng.org/main/trunk@15908 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_proto.cpp')
-rw-r--r-- | protocols/Steam/src/steam_proto.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 4d6da4e763..8644f9fa50 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -231,13 +231,32 @@ HANDLE CSteamProto::SearchBasic(const TCHAR* id) PushRequest( new GetUserSummariesRequest(token, steamId), - &CSteamProto::OnSearchByIdEnded, - mir_tstrdup(id), - MirFreeArg); + &CSteamProto::OnSearchResults, + (HANDLE)STEAM_SEARCH_BYID); return (HANDLE)STEAM_SEARCH_BYID; } +HANDLE CSteamProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName) +{ + if (!this->IsOnline()) + return 0; + + // Combine all fields to single text + TCHAR keywordsT[200]; + mir_sntprintf(keywordsT, _T("%s %s %s"), nick, firstName, lastName); + + ptrA token(getStringA("TokenSecret")); + ptrA keywords(mir_utf8encodeW(keywordsT)); + + PushRequest( + new SearchRequest(token, keywords), + &CSteamProto::OnSearchByNameStarted, + (HANDLE)STEAM_SEARCH_BYNAME); + + return (HANDLE)STEAM_SEARCH_BYNAME; +} + int CSteamProto::SendMsg(MCONTACT hContact, int, const char *message) { if (!IsOnline()) |