From 490d85373fcdeb405d486a9d0dd36bd7be6615ad Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 17 Sep 2024 20:07:20 +0300 Subject: =?UTF-8?q?fixes=20#4680=20(Skypeweb:=20=D0=BD=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B8=D0=BC=D0=B0=D0=B5=D1=82=20PDF-=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB=D1=8B.=20=D0=9A=D0=B0=D0=BA=20=D0=BC=D0=B8?= =?UTF-8?q?=D0=BD=D0=B8=D0=BC=D1=83=D0=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/SkypeWeb/src/skype_messages.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'protocols/SkypeWeb/src') 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) -- cgit v1.2.3