From cf2713fd362cfeeeda946ead18e6b88abdff9c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Sch=C3=BCmann?= Date: Thu, 3 Apr 2014 02:35:29 +0000 Subject: SendSS !*+ re-factored CSend a bit, fixes some bugs and improved re-usability + CSend got a new dialog to display URL created if there's no target contact (used by ImageShack when called from main menu * m_bDeleteAfterSend is now m_bAsync * CSend::Send now returns 1 if sent (sync, caller deletes) and 0 if sending is in progress (class self deletes, async) * ImageShack got new method SendSilent() (we used m_SendSync before, now renamed to m_bSilent for internal use) ! fixed memory leaks and using "delete" on already deleted CSend which caused a crash ! fixed graphical issue with wrongly initialized state buttons (delete after send, add description etc) git-svn-id: http://svn.miranda-ng.org/main/trunk@8835 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp') diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp index df8c3953bb..cb6893cd86 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp @@ -34,10 +34,10 @@ INT_PTR (*g_MirCallService)(const char *, WPARAM, LPARAM)=NULL; //--------------------------------------------------------------------------- -CSendHTTPServer::CSendHTTPServer(HWND Owner, MCONTACT hContact, bool bFreeOnExit) -: CSend(Owner, hContact, bFreeOnExit){ +CSendHTTPServer::CSendHTTPServer(HWND Owner, MCONTACT hContact, bool /*bAsync*/) +: CSend(Owner, hContact, true){ m_EnableItem = SS_DLG_DESCRIPTION ; //| SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; - m_pszSendTyp = _T("HTTPServer transfer"); + m_pszSendTyp = LPGENT("HTTPServer transfer"); m_pszFileName = NULL; m_URL = NULL; m_fsi_pszSrvPath = NULL; @@ -52,11 +52,12 @@ CSendHTTPServer::~CSendHTTPServer(){ } //--------------------------------------------------------------------------- -void CSendHTTPServer::Send() { - +int CSendHTTPServer::Send() +{ + if(!m_hContact) return 1; if (CallService(MS_HTTP_ACCEPT_CONNECTIONS, (WPARAM)true, 0) != 0) { Error(NULL, TranslateT("Could not start the HTTP Server plugin.")); - return; + return 1; } if (!m_pszFileName) { @@ -77,8 +78,8 @@ void CSendHTTPServer::Send() { //m_fsi.dwOptions = NULL; //OPT_SEND_LINK only work on single chat; //start Send thread - m_bFreeOnExit = TRUE; mir_forkthread(&CSendHTTPServer::SendThreadWrapper, this); + return 0; } void CSendHTTPServer::SendThread() { @@ -99,18 +100,17 @@ void CSendHTTPServer::SendThread() { //send DATA and wait for reply ret = CallService(MS_HTTP_ADD_CHANGE_REMOVE, (WPARAM)m_hContact, (LPARAM)&m_fsi); } - + if (ret != 0) { Error(TranslateT("%s (%i):\nCould not add a share to the HTTP Server plugin."),TranslateTS(m_pszSendTyp),ret); - Exit(ret); + Exit(ret); return; } //Share the file by HTTP Server plugin, SendSS does not own the file anymore = auto-delete won't work m_bDeleteAfterSend = false; if (m_URL && m_URL[0]!= NULL) { - m_ChatRoom ? svcSendChat(m_URL) : svcSendMsg(m_URL); - return; + svcSendMsgExit(m_URL); return; } Exit(ACKRESULT_FAILED); } -- cgit v1.2.3