From 0b391df2006b89b5ea9df1115dc695e5f44c26ce Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Aug 2024 21:08:13 +0300 Subject: =?UTF-8?q?fixes=20#4573=20(Skypeweb:=20=D0=B2=D0=B8=D0=B4=D0=B5?= =?UTF-8?q?=D0=BE=20=D0=BD=D0=B5=20=D0=BF=D1=80=D0=B8=D0=BD=D0=B8=D0=BC?= =?UTF-8?q?=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D0=BA=D0=B0=D0=BA=20=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/SkypeWeb/src/skype_files.cpp | 10 +++++++++- protocols/SkypeWeb/src/skype_messages.cpp | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index 2d6bd2c163..ee9ace0407 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -30,11 +30,19 @@ void CSkypeProto::ReceiveFileThread(void *param) { auto &json = dbei.getJson(); auto skft = json["skft"].as_string(); + + const char *preview; + if (skft == "Picture.1") + preview = "imgpsh_mobile_save_anim"; + else if (skft == "Video.1") + preview = "video"; + else + preview = "original"; MHttpRequest nlhr(REQUEST_GET); nlhr.flags = NLHRF_HTTP11 | NLHRF_NOUSERAGENT; nlhr.m_szUrl = blob.getUrl(); - nlhr.m_szUrl.AppendFormat("/views/%s/status", skft == "Picture.1" ? "imgpsh_mobile_save_anim" : "original"); + nlhr.m_szUrl.AppendFormat("/views/%s/status", preview); nlhr.AddHeader("Accept", "*/*"); nlhr.AddHeader("Accept-Encoding", "gzip, deflate"); nlhr.AddHeader("Cookie", szCookie); diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 22ad6918b9..14832353d4 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -93,7 +93,7 @@ bool CSkypeProto::ParseMessage(const JSONNode &node, DB::EventInfo &dbei) CMStringW wszContent = node["content"].as_mstring(); std::string strMessageType = node["messagetype"].as_string(); - if (strMessageType == "RichText/Media_GenericFile" || strMessageType == "RichText/UriObject") { + if (strMessageType == "RichText/Media_GenericFile" || strMessageType == "RichText/Media_Video" || strMessageType == "RichText/UriObject" ) { ProcessFileRecv(dbei.hContact, node["content"].as_string().c_str(), dbei); return false; } @@ -224,6 +224,8 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: ft->docId = str; if (auto *str = xmlRoot->Attribute("uri")) ft->url = str; + int iWidth = xmlRoot->IntAttribute("width", -1); + int iHeight = xmlRoot->IntAttribute("heighr", -1); if (auto *str = xmlRoot->Attribute("type")) pszFileType = str; if (auto *xml = xmlRoot->FirstChildElement("FileSize")) @@ -240,7 +242,7 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: } // ordinary file - if (!mir_strcmp(pszFileType, "File.1") || !mir_strcmp(pszFileType, "Picture.1")) { + if (!mir_strcmp(pszFileType, "File.1") || !mir_strcmp(pszFileType, "Picture.1") || !mir_strcmp(pszFileType, "Video.1")) { MEVENT hEvent; dbei.flags |= DBEF_TEMPORARY | DBEF_JSON; if (dbei) { @@ -256,6 +258,16 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: DBVARIANT dbv = { DBVT_UTF8 }; dbv.pszVal = (char*)pszFileType; db_event_setJson(hEvent, "skft", &dbv); + + dbv.type = DBVT_DWORD; + if (iWidth != -1) { + dbv.dVal = iWidth; + db_event_setJson(hEvent, "w", &dbv); + } + if (iHeight != -1) { + dbv.dVal = iHeight; + db_event_setJson(hEvent, "h", &dbv); + } } else debugLogA("Invalid or unsupported file type <%s> ignored", pszFileType); } -- cgit v1.2.3