summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/SendScreenshotPlus/src/CSendDropbox.cpp29
-rw-r--r--plugins/SendScreenshotPlus/src/CSendDropbox.h2
2 files changed, 23 insertions, 8 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
index e1d59255f3..635a7f3673 100644
--- a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
@@ -58,21 +58,17 @@ 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
- if (!ServiceExists(MS_DROPBOX_SEND_FILE))
- {
- Error(LPGENT("Dropbox plugin is not installed"));
- Exit(ACKRESULT_FAILED); return;
- }
-
m_hDropHook = HookEventObj(ME_DROPBOX_SENT, OnDropSend, this);
+ m_hOnAck = HookEventObj(ME_PROTO_ACK, OnDropAck, this);
- if (!(m_hDropSend = (HANDLE)CallService(MS_DROPBOX_SEND_FILE, (WPARAM)m_hContact, (LPARAM)m_pszFile)))
+ if ((m_hDropSend = (HANDLE)CallService(MS_DROPBOX_SEND_FILE, (WPARAM)m_hContact, (LPARAM)m_pszFile)) == NULL)
{
Error(LPGENT("%s (%i):\nCould not add a share to the Dropbox plugin."), TranslateTS(m_pszSendTyp), (INT_PTR)m_hDropSend);
Exit(ACKRESULT_FAILED); return;
}
- WaitForSingleObject(m_hEvent, 1000 * 60 * 5);
+ WaitForSingleObject(m_hEvent, INFINITE);
+ UnhookEvent(m_hOnAck);
UnhookEvent(m_hDropHook);
if (m_URL)
@@ -96,6 +92,23 @@ int CSendDropbox::OnDropSend(void *obj, WPARAM, LPARAM lParam)
return 0;
}
+int CSendDropbox::OnDropAck(void *obj, WPARAM, LPARAM lParam)
+{
+ CSendDropbox* self = (CSendDropbox*)obj;
+ ACKDATA *ack = (ACKDATA*)lParam;
+ if (ack->hProcess == self->m_hDropSend)
+ {
+ switch (ack->result)
+ {
+ case ACKRESULT_DENIED:
+ case ACKRESULT_FAILED:
+ SetEvent(self->m_hEvent);
+ break;
+ }
+ }
+ return 0;
+}
+
void CSendDropbox::SendThreadWrapper(void * Obj)
{
reinterpret_cast<CSendDropbox*>(Obj)->SendThread();
diff --git a/plugins/SendScreenshotPlus/src/CSendDropbox.h b/plugins/SendScreenshotPlus/src/CSendDropbox.h
index cade8e9d8e..83b2db142e 100644
--- a/plugins/SendScreenshotPlus/src/CSendDropbox.h
+++ b/plugins/SendScreenshotPlus/src/CSendDropbox.h
@@ -41,10 +41,12 @@ class CSendDropbox : public CSend {
HANDLE m_hEvent;
HANDLE m_hDropHook;
HANDLE m_hDropSend;
+ HANDLE m_hOnAck;
void SendThread();
static void SendThreadWrapper(void *Obj);
static int OnDropSend(void*, WPARAM, LPARAM);
+ static int OnDropAck(void*, WPARAM, LPARAM);
};
//---------------------------------------------------------------------------