From 99b43a519c595bd9c75c10ad204880c5b924db8c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 17 Jan 2018 14:01:50 +0300 Subject: ICQCorp: fix for broken file transfers --- protocols/ICQCorp/src/services.cpp | 10 +++++----- protocols/ICQCorp/src/transfer.cpp | 19 +++++++++++-------- protocols/ICQCorp/src/version.h | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) (limited to 'protocols') diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index 90f4354331..e50c3679e0 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -197,15 +197,15 @@ static INT_PTR icqRecvMessage(WPARAM, LPARAM lParam) db_unset(ccs->hContact, "CList", "Hidden"); + ptrA szMsg(Utf8CheckString(pre->szMessage) ? mir_strdup(pre->szMessage) : mir_utf8encode(pre->szMessage)); + DBEVENTINFO dbei = {}; dbei.szModule = protoName; dbei.timestamp = pre->timestamp; - dbei.flags = (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0; - if (Utf8CheckString(pre->szMessage)) - dbei.flags |= DBEF_UTF; + dbei.flags = DBEF_UTF | (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0; dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1; - dbei.pBlob = (PBYTE)pre->szMessage; + dbei.cbBlob = (DWORD)mir_strlen(szMsg) + 1; + dbei.pBlob = (PBYTE)szMsg.get(); db_event_add(ccs->hContact, &dbei); return 0; } diff --git a/protocols/ICQCorp/src/transfer.cpp b/protocols/ICQCorp/src/transfer.cpp index 13a8eb6499..1bbfd9c14e 100644 --- a/protocols/ICQCorp/src/transfer.cpp +++ b/protocols/ICQCorp/src/transfer.cpp @@ -91,8 +91,7 @@ void ICQTransfer::processTcpPacket(Packet &packet) case 0x01: T("[tcp] ack initialising\n"); - packet >> speed - >> name; + packet >> speed >> name; ack(ACKRESULT_INITIALISING); sendPacket0x02(); @@ -109,16 +108,20 @@ void ICQTransfer::processTcpPacket(Packet &packet) ++current; if (directoryName[0]) - files[current] = CMStringW(FORMAT, L"%s\\%s", ptrW(Utf8DecodeW(directoryName)), ptrW(Utf8DecodeW(fileName))).Detach(); + files[current] = CMStringW(FORMAT, L"%S\\%S", directoryName, fileName).Detach(); else - files[current] = Utf8DecodeW(fileName); + files[current] = mir_a2u(fileName); - if (directory) createDirectory(); - else openFile(); + if (directory) + createDirectory(); + else + openFile(); ack(ACKRESULT_NEXTFILE); - if (fileProgress) ack(ACKRESULT_FILERESUME); - else sendPacket0x03(); + if (fileProgress) + ack(ACKRESULT_FILERESUME); + else + sendPacket0x03(); break; case 0x03: diff --git a/protocols/ICQCorp/src/version.h b/protocols/ICQCorp/src/version.h index dea0e7a201..56f4f29843 100644 --- a/protocols/ICQCorp/src/version.h +++ b/protocols/ICQCorp/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 0 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include -- cgit v1.2.3