diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2012-10-20 22:27:29 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2012-10-20 22:27:29 +0000 |
commit | 8942a206bef8abef8f6b9c7141d35c50d15049aa (patch) | |
tree | 8749955fc888e5b910e38c9b3721c9f1f5faba50 /protocols/Skype/src/skype_subclassing.cpp | |
parent | 01f5b9941dd8c9925fde3dfbb07fb28f41c01b51 (diff) |
- fixed contact search async loading
- added search by email
git-svn-id: http://svn.miranda-ng.org/main/trunk@2008 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_subclassing.cpp')
-rw-r--r-- | protocols/Skype/src/skype_subclassing.cpp | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/protocols/Skype/src/skype_subclassing.cpp b/protocols/Skype/src/skype_subclassing.cpp index 587a4ba6cf..4a2d9773dd 100644 --- a/protocols/Skype/src/skype_subclassing.cpp +++ b/protocols/Skype/src/skype_subclassing.cpp @@ -22,6 +22,11 @@ CConversation* CSkype::newConversation(int oid) return new CConversation(oid, this); } +CContactSearch* CSkype::newContactSearch(int oid) +{ + return new CContactSearch(oid, this); +} + // CAccount CAccount::CAccount(unsigned int oid, SERootObject* root) : Account(oid, root) @@ -96,10 +101,11 @@ void CContactGroup::OnChange(const ContactRef& contact) // CContactSearch -CContactSearch::CContactSearch(unsigned int oid, SERootObject* root) : ContactSearch(oid, root) -{ - this->isSeachFailed = false; - this->isSeachFinished = false; +CContactSearch::CContactSearch(unsigned int oid, SERootObject* root) : ContactSearch(oid, root) +{ + this->proto = NULL; + this->SearchCompletedCallback == NULL; + this->ContactFindedCallback == NULL; } void CContactSearch::OnChange(int prop) @@ -108,10 +114,12 @@ void CContactSearch::OnChange(int prop) { CContactSearch::STATUS status; this->GetPropContactSearchStatus(status); - if (status == FINISHED) + if (status == FINISHED || status == FAILED) + { this->isSeachFinished = true; - if (status == FAILED) - this->isSeachFailed = true; + if (this->proto) + (proto->*SearchCompletedCallback)(this->hSearch); + } } //SEString value = GetProp(prop); @@ -121,18 +129,34 @@ void CContactSearch::OnChange(int prop) void CContactSearch::OnNewResult(const ContactRef& contact, const uint& rankValue) { - Sid::String identity; - contact->GetIdentity(identity); + if (this->proto) + (proto->*ContactFindedCallback)(this->hSearch, contact->ref()); } -void CContactSearch::BlockWhileSearching() +void CContactSearch::BlockWhileSearch() { - this->isSeachFailed = false; this->isSeachFinished = false; - while ( !this->isSeachFailed && !this->isSeachFinished) + 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; +} + // CContact CContact::CContact(unsigned int oid, SERootObject* root) : Contact(oid, root) |