diff options
| author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-23 09:07:47 +0000 | 
|---|---|---|
| committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-23 09:07:47 +0000 | 
| commit | 9d1e90b503c64c9b8380b3ae741cfdb3e9b6bc9c (patch) | |
| tree | 146229b44061d721e0d3e7296ed3c88eb4066044 | |
| parent | bd65f90d8190432ffa17718d996096538f3393e8 (diff) | |
SendSS: Dropbox - fix infinite waiting 
git-svn-id: http://svn.miranda-ng.org/main/trunk@15427 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
| -rw-r--r-- | plugins/SendScreenshotPlus/src/CSendDropbox.cpp | 31 | 
1 files changed, 22 insertions, 9 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp index 0b381b8964..e1d59255f3 100644 --- a/plugins/SendScreenshotPlus/src/CSendDropbox.cpp +++ b/plugins/SendScreenshotPlus/src/CSendDropbox.cpp @@ -57,27 +57,40 @@ 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 = 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); + +	if (!ServiceExists(MS_DROPBOX_SEND_FILE)) +	{ +		Error(LPGENT("Dropbox plugin is not installed"));  		Exit(ACKRESULT_FAILED); return;  	} -	m_hDropSend = (HANDLE)ret; -	//m_bSilent = true; +  	m_hDropHook = HookEventObj(ME_DROPBOX_SENT, OnDropSend, this); -	WaitForSingleObject(m_hEvent, INFINITE); + +	if (!(m_hDropSend = (HANDLE)CallService(MS_DROPBOX_SEND_FILE, (WPARAM)m_hContact, (LPARAM)m_pszFile))) +	{ +		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); +	UnhookEvent(m_hDropHook); +  	if (m_URL)  		svcSendMsgExit(m_URL); +	else +		Exit(ACKRESULT_FAILED);  }  int CSendDropbox::OnDropSend(void *obj, WPARAM, LPARAM lParam)  {  	CSendDropbox *self = (CSendDropbox*)obj;  	TRANSFERINFO *info = (TRANSFERINFO*)lParam; -	if (info->hProcess == self->m_hDropSend && !info->status) +	if (info->hProcess == self->m_hDropSend)  	{ -		UnhookEvent(self->m_hDropHook); -		self->m_URL = mir_strdup(info->data[0]); +		if (!info->status) +		{ +			self->m_URL = mir_strdup(info->data[0]); +		}  		SetEvent(self->m_hEvent);  	}  	return 0;  | 
