From a30b2689d14a4026af2f3ebd01764bf896aaeb59 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 17 Sep 2012 14:45:41 +0000 Subject: fix for the file transfer events git-svn-id: http://svn.miranda-ng.org/main/trunk@1590 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/oscar_filetransfer.cpp | 33 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'protocols/IcqOscarJ/oscar_filetransfer.cpp') diff --git a/protocols/IcqOscarJ/oscar_filetransfer.cpp b/protocols/IcqOscarJ/oscar_filetransfer.cpp index 8a0db9a6f3..a1f516d363 100644 --- a/protocols/IcqOscarJ/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/oscar_filetransfer.cpp @@ -515,19 +515,15 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz else // or empty directory name pszFileName = ""; - { // apply Filename / Directory Name encoding - oscar_tlv* charset = chain->getTLV(0x2712, 1); - - if (charset) - { - char* szEnc = (char*)_alloca(charset->wLen + 1); - - null_strcpy(szEnc, (char*)charset->pData, charset->wLen); - pszFileName = ApplyEncoding(pszFileName, szEnc); - } - else - pszFileName = ansi_to_utf8(pszFileName); + // apply Filename / Directory Name encoding + oscar_tlv* charset = chain->getTLV(0x2712, 1); + if (charset) { + char* szEnc = (char*)_alloca(charset->wLen + 1); + null_strcpy(szEnc, (char*)charset->pData, charset->wLen); + pszFileName = ApplyEncoding(pszFileName, szEnc); } + else pszFileName = ansi_to_utf8(pszFileName); + if (ft->wFilesCount == 1) { // Filename - use for DB event char *szFileName = (char*)_alloca(strlennull(pszFileName) + 1); @@ -570,10 +566,14 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz strcpy(szBlob + sizeof(DWORD), pszFileName); strcpy(szBlob + sizeof(DWORD) + strlennull(pszFileName) + 1, pszDescription); - PROTORECVEVENT pre; - pre.flags = PREF_UTF; + TCHAR* ptszFileName = mir_a2t(pszFileName); + + PROTORECVFILET pre = {0}; + pre.flags = PREF_TCHAR; + pre.fileCount = 1; pre.timestamp = time(NULL); - pre.szMessage = szBlob; + pre.tszDescription = mir_a2t(pszDescription); + pre.ptszFiles = &ptszFileName; pre.lParam = (LPARAM)ft; CCSDATA ccs; @@ -582,6 +582,9 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz ccs.wParam = 0; ccs.lParam = (LPARAM)⪯ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + + mir_free(pre.tszDescription); + mir_free(ptszFileName); } else if (wAckType == 2) { // First attempt failed, reverse requested -- cgit v1.2.3