diff options
author | George Hazan <george.hazan@gmail.com> | 2024-09-17 20:07:20 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-09-17 20:07:20 +0300 |
commit | 490d85373fcdeb405d486a9d0dd36bd7be6615ad (patch) | |
tree | 3f6d61bba6b6be10b194c051ea512aaed434f3d8 /protocols | |
parent | 1132005a31f35d7cde131f53b5de85ca754a84fc (diff) |
fixes #4680 (Skypeweb: не принимает PDF-файлы. Как минимум)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 126700afda..4fc18a5c97 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -229,7 +229,7 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: if (xmlRoot == nullptr)
return;
- const char *pszFileType = 0;
+ CMStringA szFileType;
CSkypeTransfer *ft = new CSkypeTransfer;
if (auto *str = xmlRoot->Attribute("doc_id"))
ft->docId = str;
@@ -238,7 +238,7 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: int iWidth = xmlRoot->IntAttribute("width", -1);
int iHeight = xmlRoot->IntAttribute("heighr", -1);
if (auto *str = xmlRoot->Attribute("type"))
- pszFileType = str;
+ szFileType = str;
if (auto *xml = xmlRoot->FirstChildElement("FileSize"))
if (auto *str = xml->Attribute("v"))
ft->iFileSize = atoi(str);
@@ -252,8 +252,12 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: return;
}
+ int idx = szFileType.Find('/');
+ if (idx != -1)
+ szFileType = szFileType.Left(idx);
+
// ordinary file
- if (!mir_strcmp(pszFileType, "File.1") || !mir_strcmp(pszFileType, "Picture.1") || !mir_strcmp(pszFileType, "Video.1")) {
+ if (szFileType == "File.1" || szFileType == "Picture.1" || szFileType == "Video.1") {
MEVENT hEvent;
dbei.flags |= DBEF_TEMPORARY | DBEF_JSON;
if (dbei) {
@@ -267,7 +271,7 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: else hEvent = ProtoChainRecvFile(hContact, DB::FILE_BLOB(ft, ft->fileName), dbei);
DBVARIANT dbv = { DBVT_UTF8 };
- dbv.pszVal = (char*)pszFileType;
+ dbv.pszVal = szFileType.GetBuffer();
db_event_setJson(hEvent, "skft", &dbv);
dbv.type = DBVT_DWORD;
@@ -280,7 +284,7 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: db_event_setJson(hEvent, "h", &dbv);
}
}
- else debugLogA("Invalid or unsupported file type <%s> ignored", pszFileType);
+ else debugLogA("Invalid or unsupported file type <%s> ignored", szFileType.c_str());
}
void CSkypeProto::ProcessContactRecv(MCONTACT hContact, const char *szContent, DB::EventInfo &dbei)
|