diff options
author | René Schümann <white06tiger@gmail.com> | 2014-04-03 02:35:29 +0000 |
---|---|---|
committer | René Schümann <white06tiger@gmail.com> | 2014-04-03 02:35:29 +0000 |
commit | cf2713fd362cfeeeda946ead18e6b88abdff9c93 (patch) | |
tree | 5c697c37b29aab31ea056d0ad94e0c05d816c506 /plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | |
parent | b87686ce677be209f6923fc8b2f11edcff7f98a0 (diff) |
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
Diffstat (limited to 'plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp')
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
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); } |