summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src/CSend.cpp
diff options
context:
space:
mode:
authorRené Schümann <white06tiger@gmail.com>2014-04-11 00:56:58 +0000
committerRené Schümann <white06tiger@gmail.com>2014-04-11 00:56:58 +0000
commit6d08efb05a3ed58dadf7e280d4a683293961ff78 (patch)
tree6dfe2104a80d07b89d68b99691b905d2e6c57d6c /plugins/SendScreenshotPlus/src/CSend.cpp
parent577556ad930d4302e51cfeda256ce3a9898bea86 (diff)
SendSS:
! translation fixes (CSendFTPFile,CSendHTTPServer) ! fixed some error handling (CSendHTTPServer,CSendImageShack) * allow silent sending with all CSend's (CSend, CSendDropbox, CSendFTPFile, CSendImageShack) we also use this for Dropbox since we don't know the upload progress * CSend's addition to r8939 (mir_freeAndNil() removed with mir_free() in some places) git-svn-id: http://svn.miranda-ng.org/main/trunk@8942 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus/src/CSend.cpp')
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp75
1 files changed, 42 insertions, 33 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index 84cee53540..7de9574cf6 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -29,9 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "global.h"
//---------------------------------------------------------------------------
-CSend::CSend(HWND /*Owner*/, MCONTACT hContact, bool bAsync) :
+CSend::CSend(HWND /*Owner*/, MCONTACT hContact, bool bAsync, bool bSilent) :
m_bDeleteAfterSend(false),
m_bAsync(bAsync),
+ m_bSilent(bSilent),
m_pszFile(NULL),
m_pszFileDesc(NULL),
m_pszSendTyp(NULL),
@@ -125,6 +126,9 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LP
return FALSE;
}
void CSend::svcSendMsgExit(const char* szMessage) {
+ if(m_bSilent){
+ Exit(ACKRESULT_SUCCESS); return;
+ }
if(!m_hContact){
mir_free(m_ErrorTitle), m_ErrorTitle=mir_a2t(szMessage);
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UResultForm),0, ResultDialogProc,(LPARAM)this);
@@ -192,6 +196,9 @@ void CSend::svcSendFileExit() {
//szMessage should be encoded as the File followed by the description, the
//separator being a single nul (\0). If there is no description, do not forget
//to end the File with two nuls.
+ if(m_bSilent){
+ Exit(ACKRESULT_SUCCESS); return;
+ }
if(!m_hContact){
Error(LPGENT("%s requires a valid contact!"), m_pszSendTyp);
Exit(ACKRESULT_FAILED); return;
@@ -208,9 +215,9 @@ void CSend::svcSendFileExit() {
m_szEventMsg=(char*)mir_realloc(m_szEventMsg, sizeof(char)*m_cbEventMsg);
lstrcpyA(m_szEventMsg+lstrlenA(szFile)+1,temp);
m_szEventMsg[m_cbEventMsg-1] = 0;
- mir_freeAndNil(temp);
+ mir_free(temp);
}
- mir_freeAndNil(szFile);
+ mir_free(szFile);
//create a HookEventObj on ME_PROTO_ACK
if (!m_hOnSend) {
@@ -329,36 +336,38 @@ void CSend::Error(LPCTSTR pszFormat, ...) {
//---------------------------------------------------------------------------
void CSend::Exit(unsigned int Result) {
- bool err = true;
- switch(Result) {
- case ACKRESULT_SUCCESS:
- case GC_RESULT_SUCCESS:
- SkinPlaySound("FileDone");
- err = false;
- break;
- case ACKRESULT_DENIED:
- SkinPlaySound("FileDenied");
- Error(_T("%s (%i):\nFile transfer denied."),TranslateTS(m_pszSendTyp),Result);
- MsgBoxService(NULL, (LPARAM)&m_box);
- err = false;
- break;
- case GC_RESULT_WRONGVER: //.You appear to be using the wrong version of GC API.
- Error(_T("%s (%i):\nYou appear to be using the wrong version of GC API"),TranslateT("GCHAT error"),Result);
- break;
- case GC_RESULT_ERROR: // An internal GC error occurred.
- Error(_T("%s (%i):\nAn internal GC error occurred."),TranslateT("GCHAT error"),Result);
- break;
- case GC_RESULT_NOSESSION: // contact has no open GC session
- Error(_T("%s (%i):\nContact has no open GC session."),TranslateT("GCHAT error"),Result);
- break;
- case ACKRESULT_FAILED:
- default:
- break;
- }
- if(err){
- SkinPlaySound("FileFailed");
- if(m_ErrorMsg) MsgBoxService(NULL, (LPARAM)&m_box);
- else MsgErr(NULL, LPGENT("An unknown error has occurred."));
+ if(!m_bSilent){
+ bool err = true;
+ switch(Result) {
+ case ACKRESULT_SUCCESS:
+ case GC_RESULT_SUCCESS:
+ SkinPlaySound("FileDone");
+ err = false;
+ break;
+ case ACKRESULT_DENIED:
+ SkinPlaySound("FileDenied");
+ Error(_T("%s (%i):\nFile transfer denied."),TranslateTS(m_pszSendTyp),Result);
+ MsgBoxService(NULL, (LPARAM)&m_box);
+ err = false;
+ break;
+ case GC_RESULT_WRONGVER: //.You appear to be using the wrong version of GC API.
+ Error(_T("%s (%i):\nYou appear to be using the wrong version of GC API"),TranslateT("GCHAT error"),Result);
+ break;
+ case GC_RESULT_ERROR: // An internal GC error occurred.
+ Error(_T("%s (%i):\nAn internal GC error occurred."),TranslateT("GCHAT error"),Result);
+ break;
+ case GC_RESULT_NOSESSION: // contact has no open GC session
+ Error(_T("%s (%i):\nContact has no open GC session."),TranslateT("GCHAT error"),Result);
+ break;
+ case ACKRESULT_FAILED:
+ default:
+ break;
+ }
+ if(err){
+ SkinPlaySound("FileFailed");
+ if(m_ErrorMsg) MsgBoxService(NULL, (LPARAM)&m_box);
+ else MsgErr(NULL, LPGENT("An unknown error has occurred."));
+ }
}
if(m_pszFile && *m_pszFile && m_bDeleteAfterSend && m_EnableItem&SS_DLG_DELETEAFTERSSEND) {
DeleteFile(m_pszFile), m_pszFile=NULL;