summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_files.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/SkypeWeb/src/skype_files.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_files.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp
index a9d6512498..2d6bd2c163 100644
--- a/protocols/SkypeWeb/src/skype_files.cpp
+++ b/protocols/SkypeWeb/src/skype_files.cpp
@@ -28,10 +28,13 @@ void CSkypeProto::ReceiveFileThread(void *param)
CMStringA szCookie, szUrl;
szCookie.AppendFormat("skypetoken_asm=%s", m_szApiToken.get());
{
+ auto &json = dbei.getJson();
+ auto skft = json["skft"].as_string();
+
MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_HTTP11 | NLHRF_NOUSERAGENT;
nlhr.m_szUrl = blob.getUrl();
- nlhr.m_szUrl += "/views/original/status";
+ nlhr.m_szUrl.AppendFormat("/views/%s/status", skft == "Picture.1" ? "imgpsh_mobile_save_anim" : "original");
nlhr.AddHeader("Accept", "*/*");
nlhr.AddHeader("Accept-Encoding", "gzip, deflate");
nlhr.AddHeader("Cookie", szCookie);
@@ -105,6 +108,13 @@ void CSkypeProto::SendFileThread(void *p)
return;
}
+ if (auto *pBitmap = FreeImage_LoadU(FreeImage_GetFIFFromFilenameU(fup->tszFileName), fup->tszFileName)) {
+ fup->isPicture = true;
+ fup->width = FreeImage_GetWidth(pBitmap);
+ fup->height = FreeImage_GetHeight(pBitmap);
+ FreeImage_Unload(pBitmap);
+ }
+
ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)fup);
PushRequest(new ASMObjectCreateRequest(this, fup));
}
@@ -174,22 +184,20 @@ void CSkypeProto::OnASMObjectUploaded(MHttpResponse *response, AsyncHttpRequest
// is that a picture?
CMStringA href;
- bool bIsPictture = false;
- if (auto *pBitmap = FreeImage_LoadU(FreeImage_GetFIFFromFilenameU(fup->tszFileName), fup->tszFileName)) {
- bIsPictture = true;
- pRoot->SetAttribute("type", "File.1" /*"Picture.1"*/);
+ if (fup->isPicture) {
+ pRoot->SetAttribute("type", "Picture.1");
pRoot->SetAttribute("url_thumbnail", CMStringA(FORMAT, "https://api.asm.skype.com/v1/objects/%s/views/imgt1_anim", fup->uid.get()));
- pRoot->SetAttribute("width", FreeImage_GetWidth(pBitmap));
- pRoot->SetAttribute("height", FreeImage_GetHeight(pBitmap));
- pRoot->SetText("To view this file, go to:");
- FreeImage_Unload(pBitmap);
+ pRoot->SetAttribute("width", fup->width);
+ pRoot->SetAttribute("height", fup->height);
+ pRoot->SetText("To view this shared photo, go to:");
href.Format("https://login.skype.com/login/sso?go=xmmfallback?pic=%s", fup->uid.get());
}
else {
pRoot->SetAttribute("type", "File.1");
pRoot->SetAttribute("url_thumbnail", CMStringA(FORMAT, "https://api.asm.skype.com/v1/objects/%s/views/original", fup->uid.get()));
- pRoot->SetText("To view this shared photo, go to:");
+ pRoot->SetText("To view this file, go to:");
+
href.Format("https://login.skype.com/login/sso?go=webclient.xmm&docid=%s", fup->uid.get());
}
@@ -200,7 +208,7 @@ void CSkypeProto::OnASMObjectUploaded(MHttpResponse *response, AsyncHttpRequest
auto *xmlOrigName = doc.NewElement("OriginalName"); xmlOrigName->SetAttribute("v", tszFile); pRoot->InsertEndChild(xmlOrigName);
auto *xmlSize = doc.NewElement("FileSize"); xmlSize->SetAttribute("v", (int)fup->size); pRoot->InsertEndChild(xmlSize);
- if (bIsPictture) {
+ if (fup->isPicture) {
auto xmlMeta = doc.NewElement("meta");
xmlMeta->SetAttribute("type", "photo"); xmlMeta->SetAttribute("originalName", tszFile);
pRoot->InsertEndChild(xmlMeta);
@@ -214,7 +222,7 @@ void CSkypeProto::OnASMObjectUploaded(MHttpResponse *response, AsyncHttpRequest
Utils_GetRandom(&param->hMessage, sizeof(param->hMessage));
param->hMessage &= ~0x80000000;
- auto *pReq = new SendFileRequest(getId(fup->hContact), time(NULL), printer.CStr(), "RichText/Media_GenericFile", fup->uid);
+ auto *pReq = new SendFileRequest(fup, getId(fup->hContact), printer.CStr());
pReq->pUserInfo = param;
PushRequest(pReq);