From b72e59934d6d3629e5d01572aff4516895439888 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 5 Jul 2013 09:22:35 +0000 Subject: Skype: - temporary disabled multiple file transfer (it send olny first file) - fixed duplication on history sync git-svn-id: http://svn.miranda-ng.org/main/trunk@5238 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_messages.cpp | 2 +- protocols/Skype/src/skype_proto.cpp | 67 ++++++++++++++++++++++----------- protocols/Skype/src/skype_transfers.cpp | 40 +++++++++++++------- 3 files changed, 74 insertions(+), 35 deletions(-) (limited to 'protocols/Skype') diff --git a/protocols/Skype/src/skype_messages.cpp b/protocols/Skype/src/skype_messages.cpp index 97a830b0b5..352aa5f291 100644 --- a/protocols/Skype/src/skype_messages.cpp +++ b/protocols/Skype/src/skype_messages.cpp @@ -60,7 +60,7 @@ void CSkypeProto::OnMessageReceived(const ConversationRef &conversation, const M message->GetPropGuid(guid); ReadMessageParam param = { guid, messageType }; - if (status != CMessage::UNCONSUMED_NORMAL) + //if (status != CMessage::UNCONSUMED_NORMAL) if (this->IsMessageInDB(hContact, timestamp, guid)) return; diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index b5b60e35f7..5bb995029d 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -155,16 +155,35 @@ HANDLE __cdecl CSkypeProto::FileAllow( HANDLE hContact, HANDLE hTransfer, const wchar_t fullPath[MAX_PATH] = {0}; SEString data; - MessageRef msgRef(oid); - TransferRefs transfers; - msgRef->GetTransfers(transfers); - for (uint i = 0; i < transfers.size(); i++) + TransferRef transfer(oid); + //TransferRefs transfers; + //msgRef->GetTransfers(transfers); + //for (uint i = 0; i < transfers.size(); i++) { - transfers[i]->GetPropFilename(data); + transfer->GetPropFilename(data); ptrW name(::mir_utf8decodeW(data)); ::mir_sntprintf(fullPath, MAX_PATH, L"%s%s", szPath, name); - if ( !transfers[i]->Accept((char *)ptrA(::mir_utf8encodeW(fullPath)), success) || !success) + //PROTOFILETRANSFERSTATUS pfts = {0}; + //ZeroMemory(&pfts, sizeof(PROTOFILETRANSFERSTATUS)); + //pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); + //pfts.hContact = hContact; + //pfts.flags = PFTS_TCHAR | PFTS_RECEIVING; /* Standard FT is Ansi only */ + //pfts.pszFiles = NULL; /* FIXME */ + //pfts.totalFiles = transfers.size(); + //pfts.currentFileNumber = i; + ////pfts.totalBytes = transfers[i]->GetUintProp(Transfer::P_FILESIZE); + ////pfts->totalProgress = ft->dwBytesDone; + ////pfts->szWorkingDir = ft->szSavePath; + //pfts.tszCurrentFile = fullPath; + //pfts.currentFileSize = transfers[i]->GetUintProp(Transfer::P_FILESIZE); + ////pfts->currentFileTime = ft->dwThisFileDate; + ////pfts->currentFileProgress = ft->dwFileBytesDone; + + /*if (ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)oid, (LPARAM)&pfts)) + return 0;*/ + + if ( !transfer->Accept((char *)ptrA(::mir_utf8encodeW(fullPath)), success) || !success) return 0; } @@ -175,13 +194,14 @@ int __cdecl CSkypeProto::FileCancel( HANDLE hContact, HANDLE hTransfer ) { uint oid = (uint)hTransfer; - SEString data; - MessageRef msgRef(oid); + //SEString data; + /*MessageRef msgRef(oid); TransferRefs transfers; msgRef->GetTransfers(transfers); - for (uint i = 0; i < transfers.size(); i++) - if ( !transfers[i]->Cancel()) - return 0; + for (uint i = 0; i < transfers.size(); i++)*/ + TransferRef transfer(oid); + if ( !transfer->Cancel()) + return 0; this->Log(L"Incoming file transfer is cancelled"); @@ -192,13 +212,16 @@ int __cdecl CSkypeProto::FileDeny( HANDLE hContact, HANDLE hTransfer, const T { uint oid = (uint)hTransfer; - SEString data; - MessageRef msgRef(oid); + //SEString data; + /*MessageRef msgRef(oid); TransferRefs transfers; msgRef->GetTransfers(transfers); for (uint i = 0; i < transfers.size(); i++) if ( !transfers[i]->Cancel()) - return 0; + return 0;*/ + TransferRef transfer(oid); + if ( !transfer->Cancel()) + return 0; this->Log(L"Incoming file transfer is denied"); @@ -253,7 +276,7 @@ DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HANDLE hContact) case PFLAGNUM_3: return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_INVISIBLE | PF2_ONTHEPHONE; case PFLAGNUM_4: - return PF4_FORCEAUTH | PF4_FORCEADDED | PF4_SUPPORTTYPING | PF4_AVATARS | + return PF4_FORCEAUTH | PF4_FORCEADDED | PF4_SUPPORTTYPING | PF4_AVATARS | /*PF4_OFFLINEFILES | */PF4_IMSENDUTF | PF4_IMSENDOFFLINE | PF4_NOAUTHDENYREASON; case PFLAGNUM_5: return PF2_ONTHEPHONE; @@ -426,8 +449,8 @@ HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription return 0; SEFilenameList fileList; - for (int i = 0; ppszFiles[i]; i++) - fileList.append((char *)ptrA(::mir_utf8encodeW(ppszFiles[i]))); + //for (int i = 0; ppszFiles[i]; i++) + fileList.append((char *)ptrA(::mir_utf8encodeW(ppszFiles[0]))); auto error = TRANSFER_OPEN_SUCCESS; SEFilename errFile; @@ -435,18 +458,20 @@ HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription if ( !conversation->PostFiles(fileList, " ", error, errFile, msgRef) || error) return 0; - CTransfer::Refs transfers; + TransferRefs transfers; if (msgRef->GetTransfers(transfers)) { - for (uint i = 0; i < transfers.size(); i++) + //for (uint i = 0; i < transfers.size(); i++) { - auto transfer = transfers[i]; + auto transfer = transfers[0]; transfer.fetch(); this->transferList.append(transfer); + + return (HANDLE)transfer->getOID(); } } - return (HANDLE)msgRef->getOID(); + //return (HANDLE)msgRef->getOID(); } return 0; diff --git a/protocols/Skype/src/skype_transfers.cpp b/protocols/Skype/src/skype_transfers.cpp index f99d439ffa..90d1440f4c 100644 --- a/protocols/Skype/src/skype_transfers.cpp +++ b/protocols/Skype/src/skype_transfers.cpp @@ -23,13 +23,15 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) { Transfer::FAILUREREASON reason; - SEBinary guid; + /*SEBinary guid; transfer->GetPropChatmsgGuid(guid); MessageRef msgRef; this->GetMessageByGuid(guid, msgRef); - uint oid = msgRef->getOID(); + uint oid = msgRef->getOID();*/ + + uint oid = transfer->getOID(); SEString data; transfer->GetPropPartnerHandle(data); @@ -69,13 +71,7 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) { SEString data; - SEBinary guid; - transfer->GetPropChatmsgGuid(guid); - - MessageRef msgRef; - this->GetMessageByGuid(guid, msgRef); - - uint oid = msgRef->getOID(); + uint oid = transfer->getOID(); PROTOFILETRANSFERSTATUS pfts = {0}; pfts.cbSize = sizeof(pfts); @@ -107,7 +103,7 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const MessageRef &message) { SEString data; - bool isRecvFiles = false; + //bool isRecvFiles = false; Transfer::TYPE transferType; Transfer::STATUS transferStatus; @@ -132,10 +128,28 @@ void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const Message transfer->GetPropType(transferType); if (transferType == Transfer::INCOMING) { - isRecvFiles = true; + //isRecvFiles = true; this->transferList.append(transfer); transfer.fetch(); + + 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)transfer->getOID(); + ::ProtoChainRecvFile(hContact, &pre); } else if (transferType == Transfer::PLACEHOLDER) { @@ -144,7 +158,7 @@ void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const Message } } } - files[transfers.size()] = NULL; + /*files[transfers.size()] = NULL; if (isRecvFiles) { @@ -165,5 +179,5 @@ void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const Message pre.ptszFiles = files; pre.lParam = (LPARAM)message->getOID(); ::ProtoChainRecvFile(hContact, &pre); - } + }*/ } \ No newline at end of file -- cgit v1.2.3