summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skypekit/search.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Skype/src/skypekit/search.cpp')
-rw-r--r--protocols/Skype/src/skypekit/search.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/protocols/Skype/src/skypekit/search.cpp b/protocols/Skype/src/skypekit/search.cpp
new file mode 100644
index 0000000000..362e412c86
--- /dev/null
+++ b/protocols/Skype/src/skypekit/search.cpp
@@ -0,0 +1,53 @@
+#include "search.h"
+
+CContactSearch::CContactSearch(unsigned int oid, SERootObject* root) : ContactSearch(oid, root)
+{
+ this->proto = NULL;
+ this->SearchCompletedCallback == NULL;
+ this->ContactFindedCallback == NULL;
+}
+
+void CContactSearch::OnChange(int prop)
+{
+ if (prop == P_CONTACT_SEARCH_STATUS)
+ {
+ CContactSearch::STATUS status;
+ this->GetPropContactSearchStatus(status);
+ if (status == FINISHED || status == FAILED)
+ {
+ this->isSeachFinished = true;
+ if (this->proto)
+ (proto->*SearchCompletedCallback)(this->hSearch);
+ }
+ }
+}
+
+void CContactSearch::OnNewResult(const ContactRef &contact, const uint &rankValue)
+{
+ if (this->proto)
+ (proto->*ContactFindedCallback)(contact, this->hSearch);
+}
+
+void CContactSearch::BlockWhileSearch()
+{
+ this->isSeachFinished = false;
+ this->isSeachFailed = false;
+ while (!this->isSeachFinished && !this->isSeachFailed)
+ Sleep(1);
+}
+
+void CContactSearch::SetProtoInfo(CSkypeProto* proto, HANDLE hSearch)
+{
+ this->proto = proto;
+ this->hSearch = hSearch;
+}
+
+void CContactSearch::SetOnSearchCompleatedCallback(OnSearchCompleted callback)
+{
+ this->SearchCompletedCallback = callback;
+}
+
+void CContactSearch::SetOnContactFindedCallback(OnContactFinded callback)
+{
+ this->ContactFindedCallback = callback;
+} \ No newline at end of file