From f82091b2af907fb1d120c305da75c57b09cb0e7b Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Fri, 5 Sep 2014 12:08:52 +0000 Subject: SkypeKit based Skype plugin is moved to deprecated and will be deleted from Plugins folder by PluginUpdater git-svn-id: http://svn.miranda-ng.org/main/trunk@10372 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/!Deprecated/Skype/src/skypekit/account.cpp | 32 +++++++++++ plugins/!Deprecated/Skype/src/skypekit/account.h | 20 +++++++ plugins/!Deprecated/Skype/src/skypekit/common.h | 8 +++ plugins/!Deprecated/Skype/src/skypekit/contact.cpp | 65 ++++++++++++++++++++++ plugins/!Deprecated/Skype/src/skypekit/contact.h | 21 +++++++ .../Skype/src/skypekit/conversation.cpp | 20 +++++++ .../!Deprecated/Skype/src/skypekit/conversation.h | 23 ++++++++ plugins/!Deprecated/Skype/src/skypekit/group.cpp | 13 +++++ plugins/!Deprecated/Skype/src/skypekit/group.h | 19 +++++++ plugins/!Deprecated/Skype/src/skypekit/message.cpp | 7 +++ plugins/!Deprecated/Skype/src/skypekit/message.h | 12 ++++ .../!Deprecated/Skype/src/skypekit/participant.cpp | 27 +++++++++ .../!Deprecated/Skype/src/skypekit/participant.h | 25 +++++++++ plugins/!Deprecated/Skype/src/skypekit/search.cpp | 36 ++++++++++++ plugins/!Deprecated/Skype/src/skypekit/search.h | 29 ++++++++++ .../!Deprecated/Skype/src/skypekit/transfer.cpp | 13 +++++ plugins/!Deprecated/Skype/src/skypekit/transfer.h | 17 ++++++ 17 files changed, 387 insertions(+) create mode 100644 plugins/!Deprecated/Skype/src/skypekit/account.cpp create mode 100644 plugins/!Deprecated/Skype/src/skypekit/account.h create mode 100644 plugins/!Deprecated/Skype/src/skypekit/common.h create mode 100644 plugins/!Deprecated/Skype/src/skypekit/contact.cpp create mode 100644 plugins/!Deprecated/Skype/src/skypekit/contact.h create mode 100644 plugins/!Deprecated/Skype/src/skypekit/conversation.cpp create mode 100644 plugins/!Deprecated/Skype/src/skypekit/conversation.h create mode 100644 plugins/!Deprecated/Skype/src/skypekit/group.cpp create mode 100644 plugins/!Deprecated/Skype/src/skypekit/group.h create mode 100644 plugins/!Deprecated/Skype/src/skypekit/message.cpp create mode 100644 plugins/!Deprecated/Skype/src/skypekit/message.h create mode 100644 plugins/!Deprecated/Skype/src/skypekit/participant.cpp create mode 100644 plugins/!Deprecated/Skype/src/skypekit/participant.h create mode 100644 plugins/!Deprecated/Skype/src/skypekit/search.cpp create mode 100644 plugins/!Deprecated/Skype/src/skypekit/search.h create mode 100644 plugins/!Deprecated/Skype/src/skypekit/transfer.cpp create mode 100644 plugins/!Deprecated/Skype/src/skypekit/transfer.h (limited to 'plugins/!Deprecated/Skype/src/skypekit') diff --git a/plugins/!Deprecated/Skype/src/skypekit/account.cpp b/plugins/!Deprecated/Skype/src/skypekit/account.cpp new file mode 100644 index 0000000000..8ec02e08e8 --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/account.cpp @@ -0,0 +1,32 @@ +#include "..\skype.h" +#include "account.h" + +CAccount::CAccount(unsigned int oid, CSkypeProto* _ppro) : + Account(oid, _ppro), + ppro(_ppro) +{ +} + +bool CAccount::IsOnline() +{ + CAccount::STATUS status; + this->GetPropStatus(status); + return status == CAccount::LOGGED_IN; +} + +bool CAccount::SetAvatar(SEBinary avatar, Skype::VALIDATERESULT &result) +{ + int fbl; + if (!((Skype*)this->root)->ValidateAvatar(avatar, result, fbl) || result != Skype::VALIDATED_OK) + return false; + + if (!this->SetBinProperty(Account::P_AVATAR_IMAGE, avatar)) + return false; + + return true; +} + +void CAccount::OnChange(int prop) +{ + ppro->OnAccountChanged(prop); +} \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/account.h b/plugins/!Deprecated/Skype/src/skypekit/account.h new file mode 100644 index 0000000000..a7128598ee --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/account.h @@ -0,0 +1,20 @@ +#pragma once + +#include "common.h" + +class CAccount : public Account +{ +public: + typedef DRef Ref; + typedef DRefs Refs; + + CAccount(unsigned int oid, CSkypeProto*); + + bool IsOnline(); + bool SetAvatar(SEBinary avatar, Skype::VALIDATERESULT &result); + +private: + CSkypeProto* ppro; + + void OnChange(int prop); +}; \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/common.h b/plugins/!Deprecated/Skype/src/skypekit/common.h new file mode 100644 index 0000000000..de00501ba3 --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/common.h @@ -0,0 +1,8 @@ +#pragma once + +#undef OCSP_REQUEST +#undef OCSP_RESPONSE + +#include + +struct CSkypeProto; \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/contact.cpp b/plugins/!Deprecated/Skype/src/skypekit/contact.cpp new file mode 100644 index 0000000000..c7a1a3247d --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/contact.cpp @@ -0,0 +1,65 @@ +#include "..\skype.h" +#include "contact.h" + +CContact::CContact(unsigned int oid, CSkypeProto* _ppro) : + Contact(oid, _ppro), + proto(_ppro) +{ +} + +SEString CContact::GetSid() +{ + SEString result; + CContact::AVAILABILITY availability; + this->GetPropAvailability(availability); + if (availability == Contact::SKYPEOUT || availability == Contact::BLOCKED_SKYPEOUT) + this->GetPropPstnnumber(result); + else + this->GetPropSkypename(result); + return result; +} + +SEString CContact::GetNick() +{ + SEString result; + CContact::AVAILABILITY availability; + this->GetPropAvailability(availability); + if (availability == CContact::SKYPEOUT) + this->GetPropPstnnumber(result); + else + { + SEString sid; + this->GetIdentity(sid); + + this->GetPropDisplayname(result); + if (this->proto && this->proto->login) + { + if (sid.equals(result)) + this->GetPropFullname(result); + } + + if (result.size() == 0) + result = sid; + } + return result; +} + +bool CContact::GetFullname(SEString &firstName, SEString &lastName) +{ + SEString fullname; + this->GetPropFullname(fullname); + int pos = fullname.find(" "); + if (pos != -1) + { + firstName = fullname.substr(0, pos - 1); + lastName = fullname.right((int)fullname.size() - pos - 1); + } else + firstName = fullname; + + return true; +} + +void CContact::OnChange(int prop) +{ + proto->OnContactChanged(this->ref(), prop); +} \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/contact.h b/plugins/!Deprecated/Skype/src/skypekit/contact.h new file mode 100644 index 0000000000..4a79ba723d --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/contact.h @@ -0,0 +1,21 @@ +#pragma once + +#include "common.h" + +class CContact : public Contact +{ +public: + typedef DRef Ref; + typedef DRefs Refs; + + CContact(unsigned int oid, CSkypeProto*); + + SEString GetSid(); + SEString GetNick(); + bool GetFullname(SEString &firstName, SEString &lastName); + +private: + CSkypeProto* proto; + + void OnChange(int prop); +}; \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/conversation.cpp b/plugins/!Deprecated/Skype/src/skypekit/conversation.cpp new file mode 100644 index 0000000000..ff393c8efb --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/conversation.cpp @@ -0,0 +1,20 @@ +#include "..\skype.h" +#include "conversation.h" +#include "..\skype_chat.h" + +CConversation::CConversation(unsigned int oid, SERootObject* root) : + Conversation(oid, root) +{ + this->room = NULL; +} + +void CConversation::SetChatRoom(ChatRoom *room) +{ + this->room = room; +} + +void CConversation::OnChange(int prop) +{ + if (this->room != NULL) + this->room->OnChange(this->ref(), prop); +} \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/conversation.h b/plugins/!Deprecated/Skype/src/skypekit/conversation.h new file mode 100644 index 0000000000..3441743328 --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/conversation.h @@ -0,0 +1,23 @@ +#pragma once + +#include "common.h" + +class ChatRoom; + +class CConversation : public Conversation +{ +public: + //typedef void (CSkypeProto::* OnConvoChanged)(const ConversationRef &conversation, int); + + typedef DRef Ref; + typedef DRefs Refs; + + CConversation(unsigned int oid, SERootObject* root); + + void SetChatRoom(ChatRoom *room); + +private: + ChatRoom *room; + + void OnChange(int prop); +}; \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/group.cpp b/plugins/!Deprecated/Skype/src/skypekit/group.cpp new file mode 100644 index 0000000000..a75c43d371 --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/group.cpp @@ -0,0 +1,13 @@ +#include "..\skype.h" +#include "group.h" + +CContactGroup::CContactGroup(unsigned int oid, CSkypeProto* _ppro) : + ContactGroup(oid, _ppro), + proto(_ppro) +{ +} + +void CContactGroup::OnChange(const ContactRef &contact) +{ + proto->OnContactListChanged(contact); +} \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/group.h b/plugins/!Deprecated/Skype/src/skypekit/group.h new file mode 100644 index 0000000000..0443d203ea --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/group.h @@ -0,0 +1,19 @@ +#pragma once + +#include "common.h" +#include "contact.h" + +class CContactGroup : public ContactGroup +{ +public: + typedef void (CSkypeProto::* OnContactListChanged)(CContact::Ref contact); + + typedef DRef Ref; + typedef DRefs Refs; + CContactGroup(unsigned int oid, CSkypeProto*); + +private: + CSkypeProto* proto; + + void OnChange(const ContactRef &contact); +}; \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/message.cpp b/plugins/!Deprecated/Skype/src/skypekit/message.cpp new file mode 100644 index 0000000000..48afa08662 --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/message.cpp @@ -0,0 +1,7 @@ +#include "..\skype.h" +#include "message.h" + +CMessage::CMessage(unsigned int oid, SERootObject* root) : + Message(oid, root) +{ +} diff --git a/plugins/!Deprecated/Skype/src/skypekit/message.h b/plugins/!Deprecated/Skype/src/skypekit/message.h new file mode 100644 index 0000000000..6bf1eda497 --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/message.h @@ -0,0 +1,12 @@ +#pragma once + +#include "common.h" + +class CMessage : public Message +{ +public: + typedef DRef Ref; + typedef DRefs Refs; + + CMessage(unsigned int oid, SERootObject* root); +}; \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/participant.cpp b/plugins/!Deprecated/Skype/src/skypekit/participant.cpp new file mode 100644 index 0000000000..41e183821b --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/participant.cpp @@ -0,0 +1,27 @@ +#include "..\skype.h" +#include "participant.h" +#include "..\skype_chat.h" + +CParticipant::CParticipant(unsigned int oid, SERootObject* root) : + Participant(oid, root) +{ + this->room = NULL; +} + +//void CParticipant::SetOnChangedCallback(OnChanged callback, ChatRoom *room) +//{ +// this->room = room; +// this->callback = callback; +//} + +void CParticipant::SetChatRoom(ChatRoom *room) +{ + this->room = room; +} + +void CParticipant::OnChange(int prop) +{ + if (this->room != NULL) + this->room->OnParticipantChanged(this->ref(), prop); + //(room->*callback)(this->ref(), prop); +} \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/participant.h b/plugins/!Deprecated/Skype/src/skypekit/participant.h new file mode 100644 index 0000000000..170c14f1b7 --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/participant.h @@ -0,0 +1,25 @@ +#pragma once + +#include "common.h" + +class ChatRoom; + +class CParticipant : public Participant +{ +public: + //typedef void (ChatRoom::* OnChanged)(const ParticipantRef &participant, int); + + typedef DRef Ref; + typedef DRefs Refs; + + CParticipant(unsigned int oid, SERootObject* root); + + //void SetOnChangedCallback(OnChanged callback, ChatRoom *room); + void SetChatRoom(ChatRoom *room); + +private: + ChatRoom *room; + //OnChanged callback; + + void OnChange(int prop); +}; \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/search.cpp b/plugins/!Deprecated/Skype/src/skypekit/search.cpp new file mode 100644 index 0000000000..f1b20563aa --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/search.cpp @@ -0,0 +1,36 @@ +#include "..\skype.h" +#include "search.h" + +CContactSearch::CContactSearch(unsigned int oid, CSkypeProto* _ppro) : + ContactSearch(oid, _ppro), + proto(_ppro) +{ +} + +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->OnSearchCompleted(this->hSearch); + } + } +} + +void CContactSearch::OnNewResult(const ContactRef &contact, const uint &rankValue) +{ + proto->OnContactFinded(contact, this->hSearch); +} + +void CContactSearch::BlockWhileSearch() +{ + this->isSeachFinished = false; + this->isSeachFailed = false; + while (!this->isSeachFinished && !this->isSeachFailed) + Sleep(1); +} diff --git a/plugins/!Deprecated/Skype/src/skypekit/search.h b/plugins/!Deprecated/Skype/src/skypekit/search.h new file mode 100644 index 0000000000..dde9a043e3 --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/search.h @@ -0,0 +1,29 @@ +#pragma once + +#include "common.h" +#include "contact.h" + +class CContactSearch : public ContactSearch +{ +public: + typedef DRef Ref; + typedef DRefs Refs; + + bool isSeachFinished; + bool isSeachFailed; + + CContactSearch(unsigned int oid, CSkypeProto* _ppro); + + void OnChange(int prop); + void OnNewResult(const ContactRef &contact, const uint &rankValue); + + __forceinline void SetProtoInfo(HANDLE _hSearch) { + hSearch = _hSearch; + } + + void BlockWhileSearch(); + +private: + HANDLE hSearch; + CSkypeProto* proto; +}; \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/transfer.cpp b/plugins/!Deprecated/Skype/src/skypekit/transfer.cpp new file mode 100644 index 0000000000..60a41bdcfe --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/transfer.cpp @@ -0,0 +1,13 @@ +#include "..\skype.h" +#include "transfer.h" + +CTransfer::CTransfer(unsigned int oid, CSkypeProto* _ppro) : + Transfer(oid, _ppro), + proto(_ppro) +{ +} + +void CTransfer::OnChange(int prop) +{ + proto->OnTransferChanged(this->ref(), prop); +} \ No newline at end of file diff --git a/plugins/!Deprecated/Skype/src/skypekit/transfer.h b/plugins/!Deprecated/Skype/src/skypekit/transfer.h new file mode 100644 index 0000000000..f01d48d328 --- /dev/null +++ b/plugins/!Deprecated/Skype/src/skypekit/transfer.h @@ -0,0 +1,17 @@ +#pragma once + +#include "common.h" + +class CTransfer : public Transfer +{ +public: + typedef DRef Ref; + typedef DRefs Refs; + + CTransfer(unsigned int oid, CSkypeProto*); + +private: + CSkypeProto* proto; + + void OnChange(int prop); +}; \ No newline at end of file -- cgit v1.2.3