diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-02-27 11:49:07 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-02-27 11:49:07 +0000 |
commit | 11e87912bbd1082ad3939348ce891efaf547fd6c (patch) | |
tree | f2199f711a5f491bae5950a02c1c63034dbdd99f /plugins/Dropbox/src/dropbox_transfers.cpp | |
parent | 122e8eefe2aa6a93a2ee27c66b39ea52658bbfee (diff) |
Dropbox: shows sent link in history
git-svn-id: http://svn.miranda-ng.org/main/trunk@8286 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_transfers.cpp')
-rw-r--r-- | plugins/Dropbox/src/dropbox_transfers.cpp | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp index f146a71a55..2978955de7 100644 --- a/plugins/Dropbox/src/dropbox_transfers.cpp +++ b/plugins/Dropbox/src/dropbox_transfers.cpp @@ -85,14 +85,18 @@ int CDropbox::SendFileChunkedNext(const char *data, int length, const char *uplo int CDropbox::SendFileChunkedLast(const char *fileName, const char *uploadId, MCONTACT hContact)
{
+ char *utf8_fileName = mir_utf8encode(fileName);
+
CMStringA url;
url.AppendFormat(
"%s/commit_chunked_upload/%s/%s",
DROPBOX_APICONTENT_URL,
DROPBOX_API_ROOT,
- fileName);
+ utf8_fileName);
url.Replace('\\', '/');
+ mir_free(utf8_fileName);
+
CMStringA param = CMStringA("upload_id=") + uploadId;
HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_POST, url);
@@ -132,9 +136,24 @@ int CDropbox::SendFileChunkedLast(const char *fileName, const char *uploadId, MC SIZEOF(message),
Translate("Link to download file \"%s\": %s"),
fileName,
- mir_utf8encodeW(json_as_string(node)));
+ mir_u2a(json_as_string(node)));
+
+ int res = ACKRESULT_SUCCESS;
- CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)&message);
+ if (hContact != CDropbox::GetDefaultContact())
+ res = CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)&message);
+
+ if (res != ACKRESULT_FAILED)
+ {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.szModule = MODULE;
+ dbei.timestamp = time(NULL);
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.cbBlob = strlen(message);
+ dbei.pBlob = (PBYTE)message;
+ dbei.flags = DBEF_SENT | DBEF_UTF;
+ db_event_add(hContact, &dbei);
+ }
return 0;
}
@@ -151,9 +170,13 @@ int CDropbox::SendFileChunkedLast(const char *fileName, const char *uploadId, MC int CDropbox::CreateFolder(const char *folderName, MCONTACT hContact)
{
- CMStringA folder = folderName;
+ char *utf8_folderName = mir_utf8encode(folderName);
+
+ CMStringA folder = utf8_folderName;
folder.Replace('\\', '/');
+ mir_free(utf8_folderName);
+
CMStringA param;
param.AppendFormat("root=%s&path=%s",
DROPBOX_API_ROOT,
@@ -195,9 +218,24 @@ int CDropbox::CreateFolder(const char *folderName, MCONTACT hContact) SIZEOF(message),
Translate("Link to download folder \"%s\": %s"),
folderName,
- mir_utf8encodeW(json_as_string(node)));
+ mir_u2a(json_as_string(node)));
+
+ int res = ACKRESULT_SUCCESS;
- CallContactService(hContact, PSS_MESSAGE, DBEF_UTF, (LPARAM)&message);
+ if (hContact != CDropbox::GetDefaultContact())
+ res = CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)&message);
+
+ if (res != ACKRESULT_FAILED)
+ {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.szModule = MODULE;
+ dbei.timestamp = time(NULL);
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.cbBlob = strlen(message);
+ dbei.pBlob = (PBYTE)message;
+ dbei.flags = DBEF_SENT | DBEF_UTF;
+ db_event_add(hContact, &dbei);
+ }
return 0;
}
|