summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-09-19 08:54:00 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-09-19 08:54:00 +0000
commit9d19759010b01dad3f78123aff35a91891af64a4 (patch)
tree87443bd1b9bc666f1092c344e31a8c281d576de2 /plugins/SendScreenshotPlus/src/CSendDropbox.cpp
parent768e066ae359cb58a4b3359da1fe46074b201fe9 (diff)
SendSS: Dropbox sending rework
git-svn-id: http://svn.miranda-ng.org/main/trunk@15393 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus/src/CSendDropbox.cpp')
-rw-r--r--plugins/SendScreenshotPlus/src/CSendDropbox.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
index 507d61497a..400deea5fb 100644
--- a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
@@ -35,21 +35,19 @@ CSendDropbox::CSendDropbox(HWND Owner, MCONTACT hContact, bool bAsync)
{
/// @todo : re-enable SS_DLG_DELETEAFTERSSEND with full implemention of Dropbox upload with progress, msg and sounds
m_EnableItem = SS_DLG_DESCRIPTION | SS_DLG_AUTOSEND/* | SS_DLG_DELETEAFTERSSEND*/;
- m_pszSendTyp = LPGENT("Dropbox transfer");
+ m_pszSendTyp = TranslateT("Dropbox transfer");
+ m_hEvent = CreateEvent(NULL, 0, 0, NULL);
}
CSendDropbox::~CSendDropbox()
{
+ CloseHandle(m_hEvent);
}
//---------------------------------------------------------------------------
int CSendDropbox::Send()
{
- if (!m_bAsync) {
- SendThread();
- return 1;
- }
mir_forkthread(&CSendDropbox::SendThreadWrapper, this);
return 0;
}
@@ -59,17 +57,29 @@ int CSendDropbox::Send()
void CSendDropbox::SendThread()
{
/// @todo : SS_DLG_DESCRIPTION and SS_DLG_DELETEAFTERSSEND are of no use as of now since we don't track upload progress
- INT_PTR ret = 0;
- if (!m_hContact)
- SetContact(db_find_first("Dropbox"));
- if (m_hContact)
- ret = CallService(MS_DROPBOX_SEND_FILE, (WPARAM)m_hContact, (LPARAM)m_pszFile);
+ INT_PTR ret = CallService(MS_DROPBOX_SEND_FILE, (WPARAM)m_hContact, (LPARAM)m_pszFile);
if (!ret) {
Error(LPGENT("%s (%i):\nCould not add a share to the Dropbox plugin."), TranslateTS(m_pszSendTyp), ret);
Exit(ACKRESULT_FAILED); return;
}
- m_bSilent = true;
- Exit(ACKRESULT_SUCCESS);
+ m_hDropSend = (HANDLE)ret;
+ //m_bSilent = true;
+ m_hDropHook = HookEventObj(ME_DROPBOX_SENT, OnDropSend, this);
+ WaitForSingleObject(m_hEvent, INFINITE);
+}
+
+int CSendDropbox::OnDropSend(void *obj, WPARAM, LPARAM lParam)
+{
+ CSendDropbox *self = (CSendDropbox*)obj;
+ TRANSFERINFO *info = (TRANSFERINFO*)lParam;
+ if (info->hProcess == self->m_hDropSend && !info->status)
+ {
+ UnhookEvent(self->m_hDropHook);
+ self->m_URL = mir_strdup(info->data[0]);
+ self->svcSendMsgExit(self->m_URL);
+ SetEvent(self->m_hEvent);
+ }
+ return 0;
}
void CSendDropbox::SendThreadWrapper(void * Obj)