diff options
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/skype_files.cpp | 25 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.h | 10 |
2 files changed, 21 insertions, 14 deletions
diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index 58400bb74e..90654bb155 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -1,5 +1,7 @@ #include "stdafx.h"
+#define FILETRANSFER_FAILED(fup) { ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)fup); delete fup; fup = nullptr;}
+
HANDLE CSkypeProto::SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles)
{
if (IsOnline())
@@ -15,13 +17,13 @@ void CSkypeProto::SendFileThread(void *p) {
CFileUploadParam *fup = (CFileUploadParam *)p;
if (!IsOnline()) {
- //SendFileFiled(fup, VKERR_OFFLINE);
+ FILETRANSFER_FAILED(fup);
+ return;
+ }
+ if (!fup->IsAccess()) {
+ FILETRANSFER_FAILED(fup);
return;
}
-// if (!fup->IsAccess()) {
-// //SendFileFiled(fup, VKERR_FILE_NOT_EXIST);
-// return;
-// }
ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)fup);
@@ -55,6 +57,7 @@ void CSkypeProto::OnASMObjectCreated(const NETLIBHTTPREQUEST *response, void *ar if (lBytes != lFileLen) {
fclose(pFile);
mir_free(pData);
+ FILETRANSFER_FAILED(fup);
return;
}
fup->size = lBytes;
@@ -66,14 +69,17 @@ void CSkypeProto::OnASMObjectCreated(const NETLIBHTTPREQUEST *response, void *ar void CSkypeProto::OnASMObjectUploaded(const NETLIBHTTPREQUEST *response, void *arg)
{
CFileUploadParam *fup = (CFileUploadParam*)arg;
- if (response == nullptr) return;
- CMStringA url(response->szUrl);
+ if (response == nullptr)
+ {
+ FILETRANSFER_FAILED(fup);
+ return;
+ }
TCHAR *tszFile = fup->tszFileName;
HXML xml = xmlCreateNode(L"URIObject", nullptr, 0);
- HXML xmlTitle = xmlAddChild(xml, L"Title", tszFile);
- HXML xmlDescr = xmlAddChild(xml, L"Description", fup->tszDesc);
+ xmlAddChild(xml, L"Title", tszFile);
+ xmlAddChild(xml, L"Description", fup->tszDesc);
HXML xmlA = xmlAddChild(xml, L"a", CMStringW(FORMAT, L"https://login.skype.com/login/sso?go=webclient.xmm&docid=%s", _A2T(fup->uid)));
xmlAddAttr(xmlA, L"href", CMStringW(FORMAT, L"https://login.skype.com/login/sso?go=webclient.xmm&docid=%s", _A2T(fup->uid)));
HXML xmlOrigName = xmlAddChild(xml, L"OriginalName", nullptr);
@@ -88,4 +94,5 @@ void CSkypeProto::OnASMObjectUploaded(const NETLIBHTTPREQUEST *response, void *a SendRequest(new SendMessageRequest(ptrA(getStringA(fup->hContact, SKYPE_SETTINGS_ID)), time(NULL), T2Utf(xmlToString(xml, nullptr)), li, "RichText/Media_GenericFile"));
xmlDestroyNode(xml);
ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)fup);
+ delete fup;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_utils.h b/protocols/SkypeWeb/src/skype_utils.h index 3fa43e5c4d..afb15d7d91 100644 --- a/protocols/SkypeWeb/src/skype_utils.h +++ b/protocols/SkypeWeb/src/skype_utils.h @@ -36,11 +36,11 @@ class DB_AUTH_BLOB *((PDWORD)pCurBlob) = (DWORD)hContact;
pCurBlob += sizeof(DWORD);
- if (szNick) { mir_strcpy((char*)pCurBlob, szNick ); pCurBlob += mir_strlen(szNick ); } pCurBlob += 1;
- if (szFirstName){ mir_strcpy((char*)pCurBlob, szFirstName); pCurBlob += mir_strlen(szFirstName); } pCurBlob += 1;
- if (szLastName) { mir_strcpy((char*)pCurBlob, szLastName ); pCurBlob += mir_strlen(szLastName ); } pCurBlob += 1;
- if (szId) { mir_strcpy((char*)pCurBlob, szId ); pCurBlob += mir_strlen(szId ); } pCurBlob += 1;
- if (szReason) { mir_strcpy((char*)pCurBlob, szReason ); pCurBlob += mir_strlen(szReason ); } pCurBlob += 1;
+ if (szNick) { mir_strcpy((char*)pCurBlob, szNick ); pCurBlob += mir_strlen(szNick ); } pCurBlob++;
+ if (szFirstName){ mir_strcpy((char*)pCurBlob, szFirstName); pCurBlob += mir_strlen(szFirstName); } pCurBlob++;
+ if (szLastName) { mir_strcpy((char*)pCurBlob, szLastName ); pCurBlob += mir_strlen(szLastName ); } pCurBlob++;
+ if (szId) { mir_strcpy((char*)pCurBlob, szId ); pCurBlob += mir_strlen(szId ); } pCurBlob++;
+ if (szReason) { mir_strcpy((char*)pCurBlob, szReason ); pCurBlob += mir_strlen(szReason ); } pCurBlob++;
return pBlob;
}
|