From 2f6035a86d42b71950b2090559d0eb29c593137c Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 4 Jul 2013 05:00:03 +0000 Subject: Skype: some fix in file transfer and blocked list dialog git-svn-id: http://svn.miranda-ng.org/main/trunk@5226 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_transfers.cpp | 60 ++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 27 deletions(-) (limited to 'protocols/Skype/src/skype_transfers.cpp') diff --git a/protocols/Skype/src/skype_transfers.cpp b/protocols/Skype/src/skype_transfers.cpp index b3edeeba1a..f99d439ffa 100644 --- a/protocols/Skype/src/skype_transfers.cpp +++ b/protocols/Skype/src/skype_transfers.cpp @@ -21,11 +21,11 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) { case Transfer::P_STATUS: { - SEBinary guid; - transfer->GetPropChatmsgGuid(guid); - Transfer::FAILUREREASON reason; + SEBinary guid; + transfer->GetPropChatmsgGuid(guid); + MessageRef msgRef; this->GetMessageByGuid(guid, msgRef); @@ -39,10 +39,6 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) transfer->GetPropStatus(status); switch(status) { - /*case CTransfer::NEW: - break;*/ - /*case CTransfer::WAITING_FOR_ACCEPT: - break;*/ case Transfer::CONNECTING: this->SendBroadcast(hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)oid, 0); break; @@ -110,15 +106,21 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const MessageRef &message) { + SEString data; + bool isRecvFiles = false; Transfer::TYPE transferType; Transfer::STATUS transferStatus; TransferRefs transfers; message->GetTransfers(transfers); + wchar_t **files = new wchar_t*[transfers.size()]; for (size_t i = 0; i < transfers.size(); i++) { auto transfer = transfers[i]; + transfer->GetPropFilename(data); + files[i] = ::mir_utf8decodeW(data); + // For incomings, we need to check for transfer status, just to be sure. // In some cases, a transfer can appear with STATUS == PLACEHOLDER // As such transfers cannot be accepted, we will need to just store @@ -130,28 +132,10 @@ void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const Message transfer->GetPropType(transferType); if (transferType == Transfer::INCOMING) { + isRecvFiles = true; + this->transferList.append(transfer); transfer.fetch(); - - uint timestamp; - message->GetPropTimestamp(timestamp); - - SEString data; - transfer->GetPropPartnerHandle(data); - HANDLE hContact = this->GetContactBySid(ptrW(::mir_utf8decodeW(data))); - - transfer->GetPropFilename(data); - wchar_t *fileName = ::mir_utf8decodeW(data); - - PROTORECVFILET pre = {0}; - pre.flags = PREF_TCHAR; - pre.fileCount = 1; - pre.timestamp = timestamp; - pre.tszDescription = L""; - pre.ptszFiles = &fileName; - pre.lParam = (LPARAM)transfer->getOID(); - ::ProtoChainRecvFile(hContact, &pre); - ::mir_free(fileName); } else if (transferType == Transfer::PLACEHOLDER) { @@ -160,4 +144,26 @@ void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const Message } } } + files[transfers.size()] = NULL; + + if (isRecvFiles) + { + uint timestamp; + message->GetPropTimestamp(timestamp); + + ContactRef author; + message->GetPropAuthor(data); + this->GetContact(data, author); + + HANDLE hContact = this->AddContact(author, true); + + PROTORECVFILET pre = {0}; + pre.flags = PREF_TCHAR; + pre.fileCount = transfers.size(); + pre.timestamp = timestamp; + pre.tszDescription = L""; + pre.ptszFiles = files; + pre.lParam = (LPARAM)message->getOID(); + ::ProtoChainRecvFile(hContact, &pre); + } } \ No newline at end of file -- cgit v1.2.3