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 | |
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')
-rw-r--r-- | plugins/Dropbox/src/dropbox.cpp | 4 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_events.cpp | 1 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_menus.cpp | 2 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_services.cpp | 29 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_transfers.cpp | 50 |
5 files changed, 65 insertions, 21 deletions
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index 64fc3bfae3..2cd459759f 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -54,7 +54,7 @@ void CDropbox::RequestAcceessToken() mir_snprintf(
data,
SIZEOF(data),
- Translate("grant_type=authorization_code&code=%s"),
+ "grant_type=authorization_code&code=%s",
request_token);
HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_POST, DROPBOX_API_URL "/oauth2/token");
@@ -124,7 +124,7 @@ void CDropbox::RequestApiAuthorizationAsync(void *arg) if (HasAccessToken() && MessageBox(
NULL,
TranslateT("Are you sure you want to request athorization?"),
- TranslateT("Request athorization"),
+ TranslateT("Request authorization"),
MB_YESNO | MB_ICONQUESTION) == IDYES)
{
INSTANCE->DestroyAcceessToken();
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp index fd2d67d26a..4fc7e3613c 100644 --- a/plugins/Dropbox/src/dropbox_events.cpp +++ b/plugins/Dropbox/src/dropbox_events.cpp @@ -19,6 +19,7 @@ int CDropbox::OnModulesLoaded(WPARAM wParam, LPARAM lParam) hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
if (!CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)MODULE))
{
+ db_set_s(NULL, MODULE, "Nick", MODULE);
db_set_s(hContact, MODULE, "Nick", MODULE);
db_set_ws(hContact, "CList", "MyHandle", L"Dropbox");
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp index ea885779ef..d7a1c235ee 100644 --- a/plugins/Dropbox/src/dropbox_menus.cpp +++ b/plugins/Dropbox/src/dropbox_menus.cpp @@ -16,7 +16,7 @@ void CDropbox::InitMenus() CreateServiceFunction(mi.pszService, SendFilesToDropbox);
mi.pszService = MODULE"/RequestAuthorization";
- mi.ptszName = LPGENT("Request Authorization");
+ mi.ptszName = LPGENT("Request authorization");
mi.position = -2000001000 + CMI_API_REQUEST_AUTH;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST);
ContactMenuItems[CMI_API_REQUEST_AUTH] = Menu_AddContactMenuItem(&mi);
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index 1368db4b5c..e18a6e9953 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -89,18 +89,23 @@ INT_PTR CDropbox::ProtoSendFile(WPARAM wParam, LPARAM lParam) INT_PTR CDropbox::ProtoSendMessage(WPARAM wParam, LPARAM lParam)
{
- CCSDATA *pccsd = (CCSDATA*)lParam;
-
- char *message = (char*)pccsd->lParam;
-
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.szModule = MODULE;
- dbei.timestamp = time(NULL);
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = (int)strlen(message);
- dbei.pBlob = (PBYTE)message;
- dbei.flags = DBEF_SENT | DBEF_UTF;
- db_event_add(pccsd->hContact, &dbei);
+ //CCSDATA *pccsd = (CCSDATA*)lParam;
+
+ //char *message = (char*)pccsd->lParam;
+
+ //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(pccsd->hContact, &dbei);
+
+ //if (message[0] && message[0] == '/')
+ //{
+ // // parse commands
+ //}
return 0;
}
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;
}
|