summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src/CSendDropbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SendScreenshotPlus/src/CSendDropbox.cpp')
-rw-r--r--plugins/SendScreenshotPlus/src/CSendDropbox.cpp29
1 files changed, 21 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();