From 5c2da0fd5b2542d99750747fc746013b7755ddae Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 14 Jun 2013 19:41:18 +0000 Subject: callbacks removed git-svn-id: http://svn.miranda-ng.org/main/trunk@4947 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/Skype_10.vcxproj | 48 +++++++++------------------ protocols/Skype/Skype_11.vcxproj | 47 +++++++++----------------- protocols/Skype/src/skype_account.cpp | 1 - protocols/Skype/src/skype_contacts.cpp | 24 -------------- protocols/Skype/src/skype_dialogs.cpp | 1 - protocols/Skype/src/skype_proto.cpp | 1 - protocols/Skype/src/skype_proto.h | 6 ++++ protocols/Skype/src/skype_skype.cpp | 8 ++--- protocols/Skype/src/skype_transfers.cpp | 3 -- protocols/Skype/src/skypekit/account.cpp | 15 +++------ protocols/Skype/src/skypekit/account.h | 5 +-- protocols/Skype/src/skypekit/contact.cpp | 18 ++++------ protocols/Skype/src/skypekit/contact.h | 7 +--- protocols/Skype/src/skypekit/conversation.cpp | 12 ++----- protocols/Skype/src/skypekit/conversation.h | 7 ---- protocols/Skype/src/skypekit/group.cpp | 16 +++------ protocols/Skype/src/skypekit/group.h | 5 +-- protocols/Skype/src/skypekit/message.cpp | 1 + protocols/Skype/src/skypekit/participant.cpp | 1 + protocols/Skype/src/skypekit/search.cpp | 17 ++-------- protocols/Skype/src/skypekit/search.h | 8 +---- protocols/Skype/src/skypekit/transfer.cpp | 16 +++------ protocols/Skype/src/skypekit/transfer.h | 7 +--- 23 files changed, 75 insertions(+), 199 deletions(-) diff --git a/protocols/Skype/Skype_10.vcxproj b/protocols/Skype/Skype_10.vcxproj index 39b1927e8b..34ba2d3066 100644 --- a/protocols/Skype/Skype_10.vcxproj +++ b/protocols/Skype/Skype_10.vcxproj @@ -215,52 +215,36 @@ - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + diff --git a/protocols/Skype/Skype_11.vcxproj b/protocols/Skype/Skype_11.vcxproj index 2fc763ab79..6c5e5286c6 100644 --- a/protocols/Skype/Skype_11.vcxproj +++ b/protocols/Skype/Skype_11.vcxproj @@ -220,52 +220,35 @@ - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + - NotUsing - NotUsing - NotUsing - NotUsing + ..\skype.h + diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp index a4b49637df..39f4e52317 100644 --- a/protocols/Skype/src/skype_account.cpp +++ b/protocols/Skype/src/skype_account.cpp @@ -110,7 +110,6 @@ bool CSkypeProto::LogIn() return false; this->account.fetch(); - this->account->SetOnAccountChangedCallback(&CSkypeProto::OnAccountChanged, this); this->InitProxy(); diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 37c97d286e..9264ca50af 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -146,9 +146,6 @@ void CSkypeProto::OnContactListChanged(CContact::Ref contact) CContact::Ref newContact(contact); this->contactList.append(newContact); newContact.fetch(); - newContact->SetOnContactChangedCallback( - (CContact::OnContactChanged)&CSkypeProto::OnContactChanged, - this); } } @@ -268,18 +265,12 @@ void __cdecl CSkypeProto::LoadContactList(void* data) this->GetHardwiredContactGroup(CContactGroup::ALL_BUDDIES, this->commonList); this->commonList.fetch(); - this->commonList->SetOnContactListChangedCallback( - (CContactGroup::OnContactListChanged)&CSkypeProto::OnContactListChanged, - this); this->commonList->GetContacts(this->contactList); fetch(this->contactList); for (uint i = 0; i < this->contactList.size(); i++) { CContact::Ref contact = this->contactList[i]; - contact->SetOnContactChangedCallback( - (CContact::OnContactChanged)&CSkypeProto::OnContactChanged, - this); HANDLE hContact = this->AddContact(contact); @@ -306,9 +297,6 @@ void __cdecl CSkypeProto::LoadAuthWaitList(void*) CContact::Refs authContacts; this->GetHardwiredContactGroup(CContactGroup::CONTACTS_WAITING_MY_AUTHORIZATION, this->authWaitList); this->authWaitList.fetch(); - this->authWaitList->SetOnContactListChangedCallback( - (CContactGroup::OnContactListChanged)&CSkypeProto::OnContactListChanged, - this); this->authWaitList->GetContacts(authContacts); for (uint i = 0; i < authContacts.size(); i++) @@ -396,10 +384,6 @@ void __cdecl CSkypeProto::SearchBySidAsync(void* arg) this->CreateIdentitySearch(::mir_u2a(sid), search); search.fetch(); search->SetProtoInfo(this, (HANDLE)SKYPE_SEARCH_BYSID); - search->SetOnContactFindedCallback( - (CContactSearch::OnContactFinded)&CSkypeProto::OnContactFinded); - search->SetOnSearchCompleatedCallback( - (CContactSearch::OnSearchCompleted)&CSkypeProto::OnSearchCompleted); bool valid; if (!search->IsValid(valid) || !valid || !search->Submit()) @@ -417,10 +401,6 @@ void __cdecl CSkypeProto::SearchByEmailAsync(void* arg) this->CreateContactSearch(search); search.fetch(); search->SetProtoInfo(this, (HANDLE)SKYPE_SEARCH_BYEMAIL); - search->SetOnContactFindedCallback( - (CContactSearch::OnContactFinded)&CSkypeProto::OnContactFinded); - search->SetOnSearchCompleatedCallback( - (CContactSearch::OnSearchCompleted)&CSkypeProto::OnSearchCompleted); bool valid; if (!search->AddEmailTerm(::mir_u2a(email), valid) || !valid || !search->Submit()) @@ -443,10 +423,6 @@ void __cdecl CSkypeProto::SearchByNamesAsync(void* arg) this->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) diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index f4927c049a..3ce20c4e3e 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -118,7 +118,6 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR CAccount::Ref account; proto->GetAccount(sid, proto->account); proto->account->SetStrProperty(CAccount::P_FULLNAME, sid); - proto->account->SetOnAccountChangedCallback(&CSkypeProto::OnAccountChanged, proto); proto->account->Register(pwd, false, false); } else diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index b0ccba123b..b74811ddbc 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -398,7 +398,6 @@ HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription { auto transfer = transfers[i]; transfer.fetch(); - transfer->SetOnTransferCallback((CTransfer::OnTransfer)&CSkypeProto::OnTransferChanged, this); this->transferList.append(transfer); } } diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index b19944400b..3dae01f678 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -72,6 +72,12 @@ class ChatRoom; struct CSkypeProto : public PROTO_INTERFACE, private Skype { friend class ChatRoom; + friend class CAccount; + friend class CContact; + friend class CConversation; + friend class CContactGroup; + friend class CContactSearch; + friend class CTransfer; public: // PROTO_INTERFACE diff --git a/protocols/Skype/src/skype_skype.cpp b/protocols/Skype/src/skype_skype.cpp index 65df7f98f7..4c683a0fa3 100644 --- a/protocols/Skype/src/skype_skype.cpp +++ b/protocols/Skype/src/skype_skype.cpp @@ -2,17 +2,17 @@ CAccount* CSkypeProto::newAccount(int oid) { - return new CAccount(oid, this); + return new CAccount(this, oid, this); } CContactGroup* CSkypeProto::newContactGroup(int oid) { - return new CContactGroup(oid, this); + return new CContactGroup(this, oid, this); } CContact* CSkypeProto::newContact(int oid) { - return new CContact(oid, this); + return new CContact(this, oid, this); } CConversation* CSkypeProto::newConversation(int oid) @@ -32,7 +32,7 @@ CMessage* CSkypeProto::newMessage(int oid) CTransfer* CSkypeProto::newTransfer(int oid) { - return new CTransfer(oid, this); + return new CTransfer(this, oid, this); } CContactSearch* CSkypeProto::newContactSearch(int oid) diff --git a/protocols/Skype/src/skype_transfers.cpp b/protocols/Skype/src/skype_transfers.cpp index 6cd70b09d8..4bb18e432a 100644 --- a/protocols/Skype/src/skype_transfers.cpp +++ b/protocols/Skype/src/skype_transfers.cpp @@ -114,9 +114,6 @@ void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const Message if (transferType == Transfer::INCOMING) { transfer.fetch(); - transfer->SetOnTransferCallback( - (CTransfer::OnTransfer)&CSkypeProto::OnTransferChanged, - this); this->transferList.append(transfer); uint timestamp; diff --git a/protocols/Skype/src/skypekit/account.cpp b/protocols/Skype/src/skypekit/account.cpp index 088d747a77..995b070b72 100644 --- a/protocols/Skype/src/skypekit/account.cpp +++ b/protocols/Skype/src/skypekit/account.cpp @@ -1,14 +1,10 @@ +#include "..\skype.h" #include "account.h" -CAccount::CAccount(unsigned int oid, SERootObject* root) : Account(oid, root) +CAccount::CAccount(CSkypeProto *_ppro, unsigned int oid, SERootObject* root) : + Account(oid, root), + ppro(_ppro) { - this->ppro = NULL; -} - -void CAccount::SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProto *ppro) -{ - this->ppro = ppro; - this->callback = callback; } bool CAccount::IsOnline() @@ -32,6 +28,5 @@ bool CAccount::SetAvatar(SEBinary avatar, Skype::VALIDATERESULT &result) void CAccount::OnChange(int prop) { - if (this->ppro != NULL) - (ppro->*callback)(prop); + ppro->OnAccountChanged(prop); } \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/account.h b/protocols/Skype/src/skypekit/account.h index ce6151da63..3b2b7063a5 100644 --- a/protocols/Skype/src/skypekit/account.h +++ b/protocols/Skype/src/skypekit/account.h @@ -10,16 +10,13 @@ public: typedef DRef Ref; typedef DRefs Refs; - CAccount(unsigned int oid, SERootObject* root); + CAccount(CSkypeProto*, unsigned int oid, SERootObject* root); bool IsOnline(); bool SetAvatar(SEBinary avatar, Skype::VALIDATERESULT &result); - - void SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProto *ppro); private: CSkypeProto* ppro; - OnAccountChanged callback; void OnChange(int prop); }; \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/contact.cpp b/protocols/Skype/src/skypekit/contact.cpp index 6031837afe..30be4b478c 100644 --- a/protocols/Skype/src/skypekit/contact.cpp +++ b/protocols/Skype/src/skypekit/contact.cpp @@ -1,9 +1,10 @@ +#include "..\skype.h" #include "contact.h" -CContact::CContact(unsigned int oid, SERootObject* root) : Contact(oid, root) +CContact::CContact(CSkypeProto* _ppro, unsigned int oid, SERootObject* root) : + Contact(oid, root), + proto(_ppro) { - this->proto = NULL; - this->callback == NULL; } SEString CContact::GetSid() @@ -38,21 +39,14 @@ bool CContact::GetFullname(SEString &firstName, SEString &lastName) if (pos != -1) { firstName = fullname.substr(0, pos - 1); - lastName = fullname.right(fullname.size() - pos - 1); + lastName = fullname.right((int)fullname.size() - pos - 1); } else firstName = fullname; return true; } -void CContact::SetOnContactChangedCallback(OnContactChanged callback, CSkypeProto* proto) -{ - this->proto = proto; - this->callback = callback; -} - void CContact::OnChange(int prop) { - if (this->proto) - (proto->*callback)(this->ref(), prop); + proto->OnContactChanged(this->ref(), prop); } \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/contact.h b/protocols/Skype/src/skypekit/contact.h index ee36764c50..d15c684815 100644 --- a/protocols/Skype/src/skypekit/contact.h +++ b/protocols/Skype/src/skypekit/contact.h @@ -5,22 +5,17 @@ class CContact : public Contact { public: - typedef void (CSkypeProto::* OnContactChanged)(CContact::Ref contact, int); - typedef DRef Ref; typedef DRefs Refs; - CContact(unsigned int oid, SERootObject* root); + CContact(CSkypeProto*, unsigned int oid, SERootObject* root); SEString GetSid(); SEString GetNick(); bool GetFullname(SEString &firstName, SEString &lastName); - void SetOnContactChangedCallback(OnContactChanged callback, CSkypeProto* proto); - private: CSkypeProto* proto; - OnContactChanged callback; void OnChange(int prop); }; \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/conversation.cpp b/protocols/Skype/src/skypekit/conversation.cpp index 25ffbffbfe..3aa6fe39f2 100644 --- a/protocols/Skype/src/skypekit/conversation.cpp +++ b/protocols/Skype/src/skypekit/conversation.cpp @@ -1,13 +1,7 @@ +#include "..\skype.h" #include "conversation.h" -CConversation::CConversation(unsigned int oid, SERootObject* root) : Conversation(oid, root) { } - -void CConversation::SetOnConvoChangedCallback(OnConvoChanged callback) +CConversation::CConversation(unsigned int oid, SERootObject* root) : + Conversation(oid, root) { - this->callback = callback; } - -void CConversation::OnChange(int prop) -{ - //(((CSkypeProto*)this->root)->*callback)(this->ref(), prop); -} \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/conversation.h b/protocols/Skype/src/skypekit/conversation.h index b9b1a51da1..e8631dcac8 100644 --- a/protocols/Skype/src/skypekit/conversation.h +++ b/protocols/Skype/src/skypekit/conversation.h @@ -11,11 +11,4 @@ public: typedef DRefs Refs; CConversation(unsigned int oid, SERootObject* root); - - void SetOnConvoChangedCallback(OnConvoChanged callback); - -private: - OnConvoChanged callback; - - void OnChange(int prop); }; \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/group.cpp b/protocols/Skype/src/skypekit/group.cpp index f547563bcf..3e708280ca 100644 --- a/protocols/Skype/src/skypekit/group.cpp +++ b/protocols/Skype/src/skypekit/group.cpp @@ -1,19 +1,13 @@ +#include "..\skype.h" #include "group.h" -CContactGroup::CContactGroup(unsigned int oid, SERootObject* root) : ContactGroup(oid, root) +CContactGroup::CContactGroup(CSkypeProto* _ppro, unsigned int oid, SERootObject* root) : + ContactGroup(oid, root), + proto(_ppro) { - this->proto = NULL; - this->callback == NULL; -} - -void CContactGroup::SetOnContactListChangedCallback(OnContactListChanged callback, CSkypeProto* proto) -{ - this->proto = proto; - this->callback = callback; } void CContactGroup::OnChange(const ContactRef &contact) { - if (this->proto) - (proto->*callback)(contact); + proto->OnContactListChanged(contact); } \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/group.h b/protocols/Skype/src/skypekit/group.h index ff395594a5..92412fb59b 100644 --- a/protocols/Skype/src/skypekit/group.h +++ b/protocols/Skype/src/skypekit/group.h @@ -10,13 +10,10 @@ public: typedef DRef Ref; typedef DRefs Refs; - CContactGroup(unsigned int oid, SERootObject* root); - - void SetOnContactListChangedCallback(OnContactListChanged callback, CSkypeProto* proto); + CContactGroup(CSkypeProto*, unsigned int oid, SERootObject* root); private: CSkypeProto* proto; - OnContactListChanged callback; void OnChange(const ContactRef &contact); }; \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/message.cpp b/protocols/Skype/src/skypekit/message.cpp index ce96de0c01..82011d8c0d 100644 --- a/protocols/Skype/src/skypekit/message.cpp +++ b/protocols/Skype/src/skypekit/message.cpp @@ -1,3 +1,4 @@ +#include "..\skype.h" #include "message.h" CMessage::CMessage(unsigned int oid, SERootObject* root) : Message(oid, root) { } diff --git a/protocols/Skype/src/skypekit/participant.cpp b/protocols/Skype/src/skypekit/participant.cpp index 9b35cfabb2..34832d084d 100644 --- a/protocols/Skype/src/skypekit/participant.cpp +++ b/protocols/Skype/src/skypekit/participant.cpp @@ -1,3 +1,4 @@ +#include "..\skype.h" #include "participant.h" CParticipant::CParticipant(unsigned int oid, SERootObject* root) : Participant(oid, root) diff --git a/protocols/Skype/src/skypekit/search.cpp b/protocols/Skype/src/skypekit/search.cpp index 362e412c86..f6f035a3a1 100644 --- a/protocols/Skype/src/skypekit/search.cpp +++ b/protocols/Skype/src/skypekit/search.cpp @@ -1,10 +1,9 @@ +#include "..\skype.h" #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) @@ -17,7 +16,7 @@ void CContactSearch::OnChange(int prop) { this->isSeachFinished = true; if (this->proto) - (proto->*SearchCompletedCallback)(this->hSearch); + proto->OnSearchCompleted(this->hSearch); } } } @@ -25,7 +24,7 @@ void CContactSearch::OnChange(int prop) void CContactSearch::OnNewResult(const ContactRef &contact, const uint &rankValue) { if (this->proto) - (proto->*ContactFindedCallback)(contact, this->hSearch); + proto->OnContactFinded(contact, this->hSearch); } void CContactSearch::BlockWhileSearch() @@ -41,13 +40,3 @@ 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 diff --git a/protocols/Skype/src/skypekit/search.h b/protocols/Skype/src/skypekit/search.h index 60b920130d..fa5819ccee 100644 --- a/protocols/Skype/src/skypekit/search.h +++ b/protocols/Skype/src/skypekit/search.h @@ -6,9 +6,6 @@ class CContactSearch : public ContactSearch { public: - typedef void (CSkypeProto::* OnSearchCompleted)(HANDLE hSearch); - typedef void (CSkypeProto::* OnContactFinded)(CContact::Ref contact, HANDLE hSearch); - typedef DRef Ref; typedef DRefs Refs; @@ -21,13 +18,10 @@ public: void OnNewResult(const ContactRef &contact, const uint &rankValue); void SetProtoInfo(CSkypeProto* proto, HANDLE hSearch); - void SetOnSearchCompleatedCallback(OnSearchCompleted callback); - void SetOnContactFindedCallback(OnContactFinded callback); void BlockWhileSearch(); + private: HANDLE hSearch; CSkypeProto* proto; - OnSearchCompleted SearchCompletedCallback; - OnContactFinded ContactFindedCallback; }; \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/transfer.cpp b/protocols/Skype/src/skypekit/transfer.cpp index 986a5bcbab..68eb985fd0 100644 --- a/protocols/Skype/src/skypekit/transfer.cpp +++ b/protocols/Skype/src/skypekit/transfer.cpp @@ -1,19 +1,13 @@ +#include "..\skype.h" #include "transfer.h" -CTransfer::CTransfer(unsigned int oid, SERootObject* root) : Transfer(oid, root) +CTransfer::CTransfer(CSkypeProto* _ppro, unsigned int oid, SERootObject* root) : + Transfer(oid, root), + proto(_ppro) { - this->proto = NULL; - this->transferCallback = NULL; -} - -void CTransfer::SetOnTransferCallback(OnTransfer callback, CSkypeProto* proto) -{ - this->proto = proto; - this->transferCallback = callback; } void CTransfer::OnChange(int prop) { - if (this->proto) - (proto->*transferCallback)(this->ref(), prop); + proto->OnTransferChanged(this->ref(), prop); } \ No newline at end of file diff --git a/protocols/Skype/src/skypekit/transfer.h b/protocols/Skype/src/skypekit/transfer.h index d327c496b0..a9dbf709b6 100644 --- a/protocols/Skype/src/skypekit/transfer.h +++ b/protocols/Skype/src/skypekit/transfer.h @@ -5,18 +5,13 @@ class CTransfer : public Transfer { public: - typedef void (CSkypeProto::* OnTransfer)(CTransfer::Ref transfer, int); - typedef DRef Ref; typedef DRefs Refs; - CTransfer(unsigned int oid, SERootObject* p_root); - - void SetOnTransferCallback(OnTransfer callback, CSkypeProto* proto); + CTransfer(CSkypeProto*, unsigned int oid, SERootObject* p_root); private: CSkypeProto* proto; - OnTransfer transferCallback; void OnChange(int prop); }; \ No newline at end of file -- cgit v1.2.3