From 23088b0c249cb5b00f08947338734e03be36f961 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 9 Mar 2014 21:08:15 +0000 Subject: Dropbox: added MS_DROPBOX_SEND_FILEW service git-svn-id: http://svn.miranda-ng.org/main/trunk@8529 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dropbox/res/resource.rc | 3 ++- plugins/Dropbox/src/dropbox.cpp | 1 + plugins/Dropbox/src/dropbox.h | 1 + plugins/Dropbox/src/dropbox_dialogs.cpp | 4 ++-- plugins/Dropbox/src/dropbox_services.cpp | 12 ++++++++++++ plugins/Dropbox/src/dropbox_transfers.cpp | 6 ++++-- plugins/Dropbox/src/m_dropbox.h | 7 +++++++ plugins/Dropbox/src/resource.h | 1 + 8 files changed, 30 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/Dropbox/res/resource.rc b/plugins/Dropbox/res/resource.rc index 7937bcaf18..3691202f4c 100644 --- a/plugins/Dropbox/res/resource.rc +++ b/plugins/Dropbox/res/resource.rc @@ -26,6 +26,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_OPTIONS_MAIN DIALOGEX 0, 0, 323, 256 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS +EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN GROUPBOX "Authorization",IDC_STATIC,5,5,313,103 @@ -46,7 +47,7 @@ BEGIN CTEXT "",IDC_AUTH_STATUS,145,89,169,8 CONTROL "Autosend download link to contact",IDC_URL_AUTOSEND, "Button",BS_AUTORADIOBUTTON,15,138,298,10 - CONTROL "Paste download link to message log",IDC_URL_COPYTOML, + CONTROL "Paste download link into message input area",IDC_URL_COPYTOMIA, "Button",BS_AUTORADIOBUTTON,15,151,298,10 CONTROL "Copy download link to clibboard",IDC_URL_COPYTOCB, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,164,298,10 diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index 89e3a427fd..74c3eb8653 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -14,6 +14,7 @@ CDropbox::CDropbox() HookEventObj(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu, this); CreateServiceFunctionObj(MS_DROPBOX_SEND_FILE, SendFileToDropbox, this); + CreateServiceFunctionObj(MS_DROPBOX_SEND_FILEW, SendFileWToDropbox, this); CreateProtoServiceFunction(MODULE, PS_GETCAPS, ProtoGetCaps); CreateProtoServiceFunctionObj(PSS_FILE, ProtoSendFile, this); diff --git a/plugins/Dropbox/src/dropbox.h b/plugins/Dropbox/src/dropbox.h index 2e63719160..afe501c0f0 100644 --- a/plugins/Dropbox/src/dropbox.h +++ b/plugins/Dropbox/src/dropbox.h @@ -70,6 +70,7 @@ private: static INT_PTR ProtoReceiveMessage(void *obj, WPARAM wParam, LPARAM lParam); static INT_PTR SendFileToDropbox(void *obj, WPARAM wParam, LPARAM lParam); + static INT_PTR SendFileWToDropbox(void *obj, WPARAM wParam, LPARAM lParam); static INT_PTR SendFilesToDropbox(void *obj, WPARAM wParam, LPARAM lParam); diff --git a/plugins/Dropbox/src/dropbox_dialogs.cpp b/plugins/Dropbox/src/dropbox_dialogs.cpp index 1f8e30aeca..0a2f9c1187 100644 --- a/plugins/Dropbox/src/dropbox_dialogs.cpp +++ b/plugins/Dropbox/src/dropbox_dialogs.cpp @@ -28,7 +28,7 @@ INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam CheckDlgButton(hwndDlg, IDC_USE_SHORT_LINKS, db_get_b(NULL, MODULE, "UseSortLinks", 1)); CheckDlgButton(hwndDlg, IDC_URL_AUTOSEND, db_get_b(NULL, MODULE, "UrlAutoSend", 1)); - CheckDlgButton(hwndDlg, IDC_URL_COPYTOML, db_get_b(NULL, MODULE, "UrlPasteToMessageLog", 0)); + CheckDlgButton(hwndDlg, IDC_URL_COPYTOMIA, db_get_b(NULL, MODULE, "UrlPasteToMessageInputArea", 0)); CheckDlgButton(hwndDlg, IDC_URL_COPYTOCB, db_get_b(NULL, MODULE, "UrlCopyToClipboard", 0)); } return TRUE; @@ -70,7 +70,7 @@ INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam { db_set_b(NULL, MODULE, "UseSortLinks", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_SHORT_LINKS)); db_set_b(NULL, MODULE, "UrlAutoSend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_URL_AUTOSEND)); - db_set_b(NULL, MODULE, "UrlPasteToMessageLog", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_URL_COPYTOML)); + db_set_b(NULL, MODULE, "UrlPasteToMessageInputArea", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_URL_COPYTOMIA)); db_set_b(NULL, MODULE, "UrlCopyToClipboard", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_URL_COPYTOCB)); } break; diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index 3755299199..2ab715089b 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -238,6 +238,18 @@ INT_PTR CDropbox::SendFileToDropbox(void *obj, WPARAM hContact, LPARAM lParam) return 0; } +INT_PTR CDropbox::SendFileWToDropbox(void *obj, WPARAM hContact, LPARAM lParam) +{ + const wchar_t *filePathW = (wchar_t*)lParam; + char *filePath = Utf8EncodeW(filePathW); + + SendFileToDropbox(obj, hContact, (LPARAM)filePath); + + mir_free(filePath); + + return 0; +} + INT_PTR CDropbox::SendFilesToDropbox(void *obj, WPARAM hContact, LPARAM) { CDropbox *instance = (CDropbox*)obj; diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp index 53433bacd1..82233f6b74 100644 --- a/plugins/Dropbox/src/dropbox_transfers.cpp +++ b/plugins/Dropbox/src/dropbox_transfers.cpp @@ -493,12 +493,14 @@ void _cdecl CDropbox::SendFileAsync(void *arg) if (ftp->hContact != ftp->instance->GetDefaultContact()) { CallContactService(ftp->hContact, PSS_MESSAGE, 0, (LPARAM)urls.GetBuffer()); - dbei.flags |= DBEF_SENT | DBEF_READ; + dbei.flags |= DBEF_SENT; + dbei.flags |= DBEF_READ; } db_event_add(ftp->hContact, &dbei); } - else if (db_get_b(NULL, MODULE, "UrlPasteToMessageLog", 1)) + + if (db_get_b(NULL, MODULE, "UrlPasteToMessageInputArea", 1)) CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)ftp->hContact, (LPARAM)urls.GetBuffer()); if (db_get_b(NULL, MODULE, "UrlCopyToClipboard", 1)) diff --git a/plugins/Dropbox/src/m_dropbox.h b/plugins/Dropbox/src/m_dropbox.h index d0266942a7..5077f488af 100644 --- a/plugins/Dropbox/src/m_dropbox.h +++ b/plugins/Dropbox/src/m_dropbox.h @@ -8,4 +8,11 @@ //returns immediately, before the file or folder is uploaded #define MS_DROPBOX_SEND_FILE "Dropbox/Send/File" +//upload file on Dropbox +//wParam = (MCONTACT)hContact +//lParam = (LPARAM)(const wchar_t*)wszPath +//returns 0 on success or nonzero on failure +//returns immediately, before the file or folder is uploaded +#define MS_DROPBOX_SEND_FILEW "Dropbox/Send/FileW" + #endif //M_DROPBOX_H_ \ No newline at end of file diff --git a/plugins/Dropbox/src/resource.h b/plugins/Dropbox/src/resource.h index a8423821f2..f52fb0a3a7 100644 --- a/plugins/Dropbox/src/resource.h +++ b/plugins/Dropbox/src/resource.h @@ -14,6 +14,7 @@ #define IDC_URL_COPYTOCB 1009 #define IDC_CHECK1 1010 #define IDC_URL_COPYTOML 1029 +#define IDC_URL_COPYTOMIA 1029 #define IDC_URL_AUTOSEND 1030 #define IDC_GETAUTH 1200 -- cgit v1.2.3