summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src/CSendEmail.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-07-29 21:18:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-07-29 21:18:27 +0000
commit1271802f514d41e8e06df7714d1f1e4a430b417b (patch)
tree5bd4ef52613333cba786f1246414e422a5e4c95a /plugins/SendScreenshotPlus/src/CSendEmail.cpp
parent14d0ed2003485ebf19d45672b065a7dd2bf5274a (diff)
- warning fixes;
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14757 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus/src/CSendEmail.cpp')
-rw-r--r--plugins/SendScreenshotPlus/src/CSendEmail.cpp137
1 files changed, 72 insertions, 65 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.cpp b/plugins/SendScreenshotPlus/src/CSendEmail.cpp
index ee5628e420..548fa055cf 100644
--- a/plugins/SendScreenshotPlus/src/CSendEmail.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendEmail.cpp
@@ -30,18 +30,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
//---------------------------------------------------------------------------
+
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;
- m_FriendlyName = NULL;
- m_Subject = NULL;
+ : 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;
+ m_FriendlyName = NULL;
+ m_Subject = NULL;
}
-CSendEmail::~CSendEmail(){
+CSendEmail::~CSendEmail()
+{
mir_free(m_pszFileA);
mir_free(m_pszFileName);
mir_free(m_Email);
@@ -50,9 +53,10 @@ CSendEmail::~CSendEmail(){
}
//---------------------------------------------------------------------------
+
int CSendEmail::Send()
{
- if(!m_hContact) return 1;
+ if (!m_hContact) return 1;
mir_free(m_pszFileName);
m_pszFileName = GetFileNameA(m_pszFile);
@@ -60,19 +64,19 @@ int CSendEmail::Send()
m_pszFileA = mir_t2a(m_pszFile);
-// AnsiString Email, Subject, FriendlyName;
- CONTACTINFO ci={0};
+ // AnsiString Email, Subject, FriendlyName;
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.hContact = m_hContact;
ci.szProto = m_pszProto;
//ci.dwFlag = CNF_TCHAR;
ci.dwFlag = CNF_EMAIL | CNF_TCHAR;
- CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci);
+ CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci);
m_Email = mir_t2a(ci.pszVal);
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci);
+ CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci);
m_FriendlyName = mir_t2a(ci.pszVal);
mir_free(ci.pszVal);
@@ -86,14 +90,15 @@ int CSendEmail::Send()
return 0;
}
-void CSendEmail::SendThread() {
+void CSendEmail::SendThread()
+{
//This code based on SentTo.exe application.
//The default mail client for Simple MAPI or MAPI calls is defined by the
//HKLM\Software\Clients\Mail::(default) registry value.
MapiFileDesc arrfileDesc[1];
- typedef ULONG (FAR PASCAL *MAPIFUNC)(LHANDLE,ULONG,lpMapiMessage,FLAGS,ULONG);
+ typedef ULONG(FAR PASCAL *MAPIFUNC)(LHANDLE, ULONG, lpMapiMessage, FLAGS, ULONG);
MapiMessage Msg;
MAPIFUNC lpMAPISendMail;
@@ -131,7 +136,7 @@ void CSendEmail::SendThread() {
recip.ulReserved = 0;
recip.ulRecipClass = MAPI_TO;
- if (m_FriendlyName && m_FriendlyName[0]!= NULL) {
+ if (m_FriendlyName && m_FriendlyName[0] != NULL) {
recip.lpszName = m_FriendlyName; //friendly name set to contact's name
}
else {
@@ -144,61 +149,62 @@ void CSendEmail::SendThread() {
Msg.lpRecips = &recip;
try {
- int res = lpMAPISendMail(NULL, NULL, &Msg, MAPI_LOGON_UI|MAPI_DIALOG, 0);
+ int res = lpMAPISendMail(NULL, NULL, &Msg, MAPI_LOGON_UI | MAPI_DIALOG, 0);
::FreeLibrary(hMAPILib);
TCHAR* err;
switch (res) {
- case SUCCESS_SUCCESS:
- //The call succeeded and the message was sent.
- Exit(ACKRESULT_SUCCESS); return;
+ case SUCCESS_SUCCESS:
+ //The call succeeded and the message was sent.
+ 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");
- break;
- case MAPI_E_ATTACHMENT_NOT_FOUND:
- err = LPGENT("The specified attachment was not found");
- break;
- case MAPI_E_ATTACHMENT_OPEN_FAILURE:
- err = LPGENT("The specified attachment could not be opened");
- break;
- case MAPI_E_BAD_RECIPTYPE:
- err = LPGENT("The type of a recipient was not MAPI_TO, MAPI_CC, or MAPI_BCC");
- break;
- case MAPI_E_FAILURE:
- err = LPGENT("One or more unspecified errors occurred");
- break;
- case MAPI_E_INSUFFICIENT_MEMORY:
- err = LPGENT("There was insufficient memory to proceed");
- break;
- case MAPI_E_INVALID_RECIPS:
- err = LPGENT("One or more recipients were invalid or did not resolve to any address");
- break;
- case MAPI_E_LOGIN_FAILURE:
- err = LPGENT("There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed");
- break;
- case MAPI_E_TEXT_TOO_LARGE:
- err = LPGENT("The text in the message was too large");
- break;
- case MAPI_E_TOO_MANY_FILES:
- err = LPGENT("There were too many file attachments");
- break;
- case MAPI_E_TOO_MANY_RECIPIENTS:
- err = LPGENT("There were too many recipients");
- break;
- case MAPI_E_UNKNOWN_RECIPIENT:
- err = LPGENT("A recipient did not appear in the address list");
- break;
- case MAPI_E_USER_ABORT:
- err = LPGENT("The user canceled one of the dialog boxes");
- break;
- default:
- err = LPGENT("Unknown Error");
- break;
+ case MAPI_E_AMBIGUOUS_RECIPIENT:
+ err = LPGENT("A recipient matched more than one of the recipient descriptor structures and MAPI_DIALOG was not set");
+ break;
+ case MAPI_E_ATTACHMENT_NOT_FOUND:
+ err = LPGENT("The specified attachment was not found");
+ break;
+ case MAPI_E_ATTACHMENT_OPEN_FAILURE:
+ err = LPGENT("The specified attachment could not be opened");
+ break;
+ case MAPI_E_BAD_RECIPTYPE:
+ err = LPGENT("The type of a recipient was not MAPI_TO, MAPI_CC, or MAPI_BCC");
+ break;
+ case MAPI_E_FAILURE:
+ err = LPGENT("One or more unspecified errors occurred");
+ break;
+ case MAPI_E_INSUFFICIENT_MEMORY:
+ err = LPGENT("There was insufficient memory to proceed");
+ break;
+ case MAPI_E_INVALID_RECIPS:
+ err = LPGENT("One or more recipients were invalid or did not resolve to any address");
+ break;
+ case MAPI_E_LOGIN_FAILURE:
+ err = LPGENT("There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed");
+ break;
+ case MAPI_E_TEXT_TOO_LARGE:
+ err = LPGENT("The text in the message was too large");
+ break;
+ case MAPI_E_TOO_MANY_FILES:
+ err = LPGENT("There were too many file attachments");
+ break;
+ case MAPI_E_TOO_MANY_RECIPIENTS:
+ err = LPGENT("There were too many recipients");
+ break;
+ case MAPI_E_UNKNOWN_RECIPIENT:
+ err = LPGENT("A recipient did not appear in the address list");
+ break;
+ case MAPI_E_USER_ABORT:
+ err = LPGENT("The user canceled one of the dialog boxes");
+ break;
+ default:
+ err = LPGENT("Unknown Error");
+ break;
}
Error(SS_ERR_MAPI, res, err);
Exit(ACKRESULT_FAILED);
- } catch (...) {
+ }
+ catch (...) {
::FreeLibrary(hMAPILib);
Error(SS_ERR_INIT, m_pszSendTyp);
Exit(ACKRESULT_FAILED);
@@ -206,7 +212,8 @@ void CSendEmail::SendThread() {
}
}
-void CSendEmail::SendThreadWrapper(void * Obj) {
+void CSendEmail::SendThreadWrapper(void * Obj)
+{
reinterpret_cast<CSendEmail*>(Obj)->SendThread();
}