summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src/CSendEmail.cpp
diff options
context:
space:
mode:
authorRené Schümann <white06tiger@gmail.com>2014-04-03 02:35:29 +0000
committerRené Schümann <white06tiger@gmail.com>2014-04-03 02:35:29 +0000
commitcf2713fd362cfeeeda946ead18e6b88abdff9c93 (patch)
tree5c697c37b29aab31ea056d0ad94e0c05d816c506 /plugins/SendScreenshotPlus/src/CSendEmail.cpp
parentb87686ce677be209f6923fc8b2f11edcff7f98a0 (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/CSendEmail.cpp')
-rw-r--r--plugins/SendScreenshotPlus/src/CSendEmail.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.cpp b/plugins/SendScreenshotPlus/src/CSendEmail.cpp
index 1b1e681c31..77d21ad332 100644
--- a/plugins/SendScreenshotPlus/src/CSendEmail.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendEmail.cpp
@@ -30,10 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "global.h"
//---------------------------------------------------------------------------
-CSendEmail::CSendEmail(HWND Owner, MCONTACT hContact, bool bFreeOnExit)
-: CSend(Owner, hContact, bFreeOnExit){
- m_EnableItem = SS_DLG_DELETEAFTERSSEND | SS_DLG_DESCRIPTION; // SS_DLG_AUTOSEND | ;
- m_pszSendTyp = _T("Email transfer");
+CSendEmail::CSendEmail(HWND Owner, MCONTACT hContact, bool /*bAsync*/)
+: CSend(Owner, hContact, true){
+ m_EnableItem = SS_DLG_DESCRIPTION | SS_DLG_DELETEAFTERSSEND; // SS_DLG_AUTOSEND | ;
+ m_pszSendTyp = LPGENT("Email transfer");
m_pszFileA = NULL;
m_pszFileName = NULL;
m_Email = NULL;
@@ -50,8 +50,9 @@ CSendEmail::~CSendEmail(){
}
//---------------------------------------------------------------------------
-void CSendEmail::Send() {
-
+int CSendEmail::Send()
+{
+ if(!m_hContact) return 1;
mir_freeAndNil(m_pszFileName);
m_pszFileName = GetFileNameA(m_pszFile);
@@ -81,8 +82,8 @@ void CSendEmail::Send() {
//SendByEmail(m_pszFileA, "", m_FriendlyName, m_Email, m_Subject);
//start Send thread
- m_bFreeOnExit = TRUE;
mir_forkthread(&CSendEmail::SendThreadWrapper, this);
+ return 0;
}
void CSendEmail::SendThread() {
@@ -100,7 +101,7 @@ void CSendEmail::SendThread() {
if (hMAPILib == NULL) {
//return -1;
Error(SS_ERR_INIT, m_pszSendTyp);
- Exit(ACKRESULT_FAILED);
+ Exit(ACKRESULT_FAILED); return;
}
lpMAPISendMail = (MAPIFUNC)GetProcAddress(hMAPILib, "MAPISendMail");
@@ -108,7 +109,7 @@ void CSendEmail::SendThread() {
::FreeLibrary(hMAPILib);
//return -2;
Error(SS_ERR_INIT, m_pszSendTyp);
- Exit(ACKRESULT_FAILED);
+ Exit(ACKRESULT_FAILED); return;
}
memset(&Msg, 0, sizeof(Msg));
@@ -150,9 +151,7 @@ void CSendEmail::SendThread() {
switch (res) {
case SUCCESS_SUCCESS:
//The call succeeded and the message was sent.
- Exit(ACKRESULT_SUCCESS);
- return;
-
+ Exit(ACKRESULT_SUCCESS); return;
// No message was sent
case MAPI_E_AMBIGUOUS_RECIPIENT:
err = LPGENT("A recipient matched more than one of the recipient descriptor structures and MAPI_DIALOG was not set");
@@ -199,12 +198,10 @@ void CSendEmail::SendThread() {
}
Error(SS_ERR_MAPI, res, err);
Exit(ACKRESULT_FAILED);
-
} catch (...) {
::FreeLibrary(hMAPILib);
Error(SS_ERR_INIT, m_pszSendTyp);
Exit(ACKRESULT_FAILED);
- //return -3;
return;
}
}