summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_contacts.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2013-05-10 18:31:32 +0000
committerAlexander Lantsev <aunsane@gmail.com>2013-05-10 18:31:32 +0000
commitc16bfe00dc27525c03e36cca6930abe5a9fd43a7 (patch)
tree2af9b262bc48ef0a3bf004fab9fdbc1c969fe86a /protocols/Skype/src/skype_contacts.cpp
parent9403f94a71782e106d29f1ca2df5aa682ea3f746 (diff)
- added search by names
git-svn-id: http://svn.miranda-ng.org/main/trunk@4624 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_contacts.cpp')
-rw-r--r--protocols/Skype/src/skype_contacts.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp
index e64194bdd5..bf2582b71a 100644
--- a/protocols/Skype/src/skype_contacts.cpp
+++ b/protocols/Skype/src/skype_contacts.cpp
@@ -438,4 +438,54 @@ void __cdecl CSkypeProto::SearchByNamesAsync(void* arg)
{
//todo: write me
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT *)arg;
+
+ std::string nick = ::mir_utf8encodeW(psr->nick);
+ std::string fName = ::mir_utf8encodeW(psr->firstName);
+ std::string lName = " "; lName += ::mir_utf8encodeW(psr->lastName);
+
+ CContactSearch::Ref search;
+ g_skype->CreateContactSearch(search);
+ search.fetch();
+ search->SetProtoInfo(this, (HANDLE)SKYPE_SEARCH_BYNAMES);
+ search->SetOnContactFindedCallback(
+ (CContactSearch::OnContactFinded)&CSkypeProto::OnContactFinded);
+ search->SetOnSearchCompleatedCallback(
+ (CContactSearch::OnSearchCompleted)&CSkypeProto::OnSearchCompleted);
+
+ bool valid;
+ if (nick.length() != 0)
+ {
+ search->AddStrTerm(
+ Contact::P_FULLNAME,
+ CContactSearch::CONTAINS_WORD_PREFIXES,
+ nick.c_str(),
+ valid,
+ true);
+ }
+ if (fName.length() != 0)
+ {
+ search->AddOr();
+ search->AddStrTerm(
+ Contact::P_FULLNAME,
+ CContactSearch::CONTAINS_WORD_PREFIXES,
+ fName.c_str(),
+ valid,
+ true);
+ }
+ if (lName.length() != 0)
+ {
+ search->AddOr();
+ search->AddStrTerm(
+ Contact::P_FULLNAME,
+ CContactSearch::CONTAINS_WORD_PREFIXES,
+ lName.c_str(),
+ valid,
+ true);
+ }
+
+ if (!search->Submit())
+ return;
+
+ search->BlockWhileSearch();
+ search->Release();
} \ No newline at end of file