summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-06 13:46:05 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-06 13:46:05 +0300
commit065b40aaa42324348d3f898120c6e344a1abd12f (patch)
treed522525c4cc5bc85983b7121bcc1e3198440401a /protocols
parentf72638c4700b2f790d3d71d19360763a330a907a (diff)
ICQ-WIM: fixes two first points of #2201
- когда из Миранды отправляешь, то в журнале Миранды остаётся невалиднвя ссылка - входящий файл принимается автоматически, а в журнале остаётся запись
Diffstat (limited to 'protocols')
-rw-r--r--protocols/ICQ-WIM/src/proto.h2
-rw-r--r--protocols/ICQ-WIM/src/server.cpp23
2 files changed, 13 insertions, 12 deletions
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index 28b54f202a..88388e9bd6 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -138,7 +138,7 @@ struct IcqFileTransfer : public MZeroedObject
ptrW pwszFileName(mir_utf8decodeW(pszUrl));
const wchar_t *p = wcsrchr(pwszFileName, '/');
m_wszFileName = (p == nullptr) ? pwszFileName : p + 1;
- m_wszShortName = m_wszShortName;
+ m_wszShortName = m_wszFileName;
}
// create an object for sending
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index 2f67f4b0d9..43b0112907 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -734,12 +734,6 @@ void CIcqProto::OnFileContinue(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pOld
<< CHAR_PARAM("offlineIM", "true") << WCHAR_PARAM("parts", wszParts) << WCHAR_PARAM("t", GetUserId(pTransfer->pfts.hContact)) << INT_PARAM("ts", TS());
Push(pReq);
- T2Utf msgText(wszUrl);
- PROTORECVEVENT recv = {};
- recv.flags = PREF_CREATEREAD | PREF_SENT;
- recv.szMessage = msgText;
- recv.timestamp = time(0);
- ProtoChainRecvMsg(pTransfer->pfts.hContact, &recv);
}
else ProtoBroadcastAck(pTransfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, pTransfer);
delete pTransfer;
@@ -799,14 +793,21 @@ void CIcqProto::OnFileInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
if (root.error() != 200)
return;
- auto &data = root.result();
- std::string szUrl(data["info"]["dlink"].as_string());
+ auto &data = root.result()["info"];
+ std::string szUrl(data["dlink"].as_string());
if (szUrl.empty())
return;
mir_urlDecode(&*szUrl.begin());
+ for (size_t i = 0; i < szUrl.length(); ++i)
+ if (szUrl[i] == '_' && isxdigit(szUrl[i+1]) && isxdigit(szUrl[i+2])) {
+ int c;
+ if (1 == sscanf(szUrl.c_str() + i + 1, "%02x", &c))
+ szUrl.replace(i, 3, 1, c);
+ }
+
auto *ft = new IcqFileTransfer(pReq->hContact, szUrl.c_str());
- ft->pfts.totalBytes = ft->pfts.currentFileSize = 100;
+ ft->pfts.totalBytes = ft->pfts.currentFileSize = data["file_size"].as_int();
ft->pfts.szCurrentFile.w = ft->m_wszFileName.GetBuffer();
PROTORECVFILE pre = { 0 };
@@ -828,8 +829,8 @@ LBL_Error:
return;
}
- ft->pfts.totalProgress += 100;
- ft->pfts.currentFileProgress += 100;
+ ft->pfts.totalProgress += pReply->dataLength;
+ ft->pfts.currentFileProgress += pReply->dataLength;
ProtoBroadcastAck(ft->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->pfts);
debugLogW(L"Saving to [%s]", ft->pfts.szCurrentFile.w);