diff options
-rw-r--r-- | protocols/SkypeWeb/src/skype_files.cpp | 10 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 16 |
2 files changed, 23 insertions, 3 deletions
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);
}
|