From 1440e9da7b83bb649aff90af3cdfe9433416c988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 20 Dec 2015 05:38:13 +0000 Subject: 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 --- protocols/Steam/src/steam_proto.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'protocols/Steam/src/steam_proto.cpp') 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()) -- cgit v1.2.3