From a2184eb00d2b02d48ec14e72615736281b9d5f81 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Tue, 23 Apr 2013 19:47:32 +0000 Subject: - changed project file structure - skype runtime initialization moved to plugin load func - fixed password encription - disabled message sync git-svn-id: http://svn.miranda-ng.org/main/trunk@4518 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_events.cpp | 39 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'protocols/Skype/src/skype_events.cpp') diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index 23a3599fcb..b35300a3b8 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -2,8 +2,6 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) { - this->InitSkype(); - this->InitChat(); this->InitNetLib(); this->InitCustomFolders(); @@ -11,6 +9,10 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) this->HookEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit); this->HookEvent(ME_USERINFO_INITIALISE, &CSkypeProto::OnUserInfoInit); + g_skype->SetOnMessageCallback( + (CSkype::OnMessaged)&CSkypeProto::OnMessage, + this); + return 0; } @@ -19,7 +21,6 @@ int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) this->SetStatus(ID_STATUS_OFFLINE); this->UninitNetLib(); - this->UninitSkype(); return 0; } @@ -35,7 +36,7 @@ int CSkypeProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) this->LeaveChat(chatID); CConversation::Ref conversation; - this->skype->GetConversationByIdentity(::mir_utf8encodeW(chatID), conversation); + g_skype->GetConversationByIdentity(::mir_utf8encodeW(chatID), conversation); conversation->RetireFrom(); conversation->Delete(); } @@ -55,15 +56,17 @@ int CSkypeProto::OnMessagePreCreate(WPARAM, LPARAM lParam) SEBinary guid; if (message->GetPropGuid(guid)) { - evt->dbei->pBlob = (PBYTE)::mir_realloc(evt->dbei->pBlob, (evt->dbei->cbBlob + 32)); + evt->dbei->pBlob = (PBYTE)::mir_realloc(evt->dbei->pBlob, (evt->dbei->cbBlob + 33)); ::memcpy(&evt->dbei->pBlob[evt->dbei->cbBlob], guid.data(), 32); - evt->dbei->cbBlob += 32; + evt->dbei->cbBlob += 33; } + //delete message; + return 1; } -void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref message) +void CSkypeProto::OnMessageSended(CConversation::Ref &conversation, CMessage::Ref &message) { SEString data; @@ -88,7 +91,7 @@ void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref participants[0]->GetPropIdentity(data); CContact::Ref receiver; - this->skype->GetContact(data, receiver); + g_skype->GetContact(data, receiver); HANDLE hContact = this->AddContact(receiver); @@ -130,7 +133,7 @@ void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref ::mir_free(text); } -void CSkypeProto::OnMessageReceived(CConversation::Ref conversation, CMessage::Ref message) +void CSkypeProto::OnMessageReceived(CConversation::Ref &conversation, CMessage::Ref &message) { SEString data; @@ -150,7 +153,7 @@ void CSkypeProto::OnMessageReceived(CConversation::Ref conversation, CMessage::R message->GetPropAuthor(data); CContact::Ref author; - this->skype->GetContact(data, author); + g_skype->GetContact(data, author); HANDLE hContact = this->AddContact(author); @@ -181,7 +184,7 @@ void CSkypeProto::OnMessageReceived(CConversation::Ref conversation, CMessage::R ::mir_free(text); } -void CSkypeProto::OnTransferChanged(int prop, CTransfer::Ref transfer) +void CSkypeProto::OnTransferChanged(CTransfer::Ref transfer, int prop) { switch (prop) { @@ -191,7 +194,7 @@ void CSkypeProto::OnTransferChanged(int prop, CTransfer::Ref transfer) transfer->GetPropChatmsgGuid(guid); CMessage::Ref message; - this->skype->GetMessageByGuid(guid, message); + g_skype->GetMessageByGuid(guid, message); uint oid = message->getOID(); @@ -239,7 +242,7 @@ void CSkypeProto::OnTransferChanged(int prop, CTransfer::Ref transfer) transfer->GetPropChatmsgGuid(guid); CMessage::Ref message; - this->skype->GetMessageByGuid(guid, message); + g_skype->GetMessageByGuid(guid, message); uint oid = message->getOID(); @@ -259,10 +262,10 @@ void CSkypeProto::OnTransferChanged(int prop, CTransfer::Ref transfer) pfts.pszFiles = &pfts.szCurrentFile; transfer->GetPropFilesize(data); - pfts.totalBytes = pfts.currentFileSize = data.toUInt(); + pfts.totalBytes = pfts.currentFileSize = data.toUInt64(); transfer->GetPropBytestransferred(data); - pfts.totalProgress = pfts.currentFileProgress = data.toUInt(); + pfts.totalProgress = pfts.currentFileProgress = data.toUInt64(); this->SendBroadcast(hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)oid, (LPARAM)&pfts); } @@ -270,7 +273,7 @@ void CSkypeProto::OnTransferChanged(int prop, CTransfer::Ref transfer) } } -void CSkypeProto::OnFile(CConversation::Ref conversation, CMessage::Ref message) +void CSkypeProto::OnFile(CConversation::Ref &conversation, CMessage::Ref &message) { CTransfer::Refs transfers; message->GetTransfers(transfers); @@ -375,7 +378,7 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa if ( !alreadyInChat.contains(sid)) { CContact::Ref contact; - this->skype->GetContact((char *)mir_ptr(::mir_utf8encodeW(sid)), contact); + g_skype->GetContact((char *)mir_ptr(::mir_utf8encodeW(sid)), contact); CContact::AVAILABILITY status; contact->GetPropAvailability(status); @@ -453,7 +456,7 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa message->GetPropAuthor(identity); CContact::Ref author; - this->skype->GetContact(identity, author); + g_skype->GetContact(identity, author); HANDLE hContact = this->AddContact(author); -- cgit v1.2.3