small refactoring

This commit is contained in:
SimplestStudio
2025-03-07 15:22:36 +02:00
parent 44c08379b4
commit 00da3d036c
2 changed files with 9 additions and 6 deletions

View File

@ -34,7 +34,7 @@
#include <fstream>
#include <ctime>
#include <stack>
#if defined(_WIN32) && !defined(FORCE_USING_EML)
#ifdef WIN32_USING_MAPI
# include <Windows.h>
# include <shlwapi.h>
# include <commctrl.h>
@ -52,7 +52,7 @@
# endif
#endif
#if defined(_WIN32) && !defined(FORCE_USING_EML)
#ifdef WIN32_USING_MAPI
static void regValue(HKEY rootKey, std::wstring &value)
{
HKEY hKey;
@ -221,7 +221,7 @@ public:
tmp_files.pop();
}
}
#if defined(_WIN32) && !defined(FORCE_USING_EML)
#ifdef WIN32_USING_MAPI
bool sendMailMAPI(std::string to, std::string subject, std::string msg)
{
to.insert(0, "SMTP:");
@ -315,7 +315,7 @@ CMailMessage &CMailMessage::instance()
return inst;
}
#if defined(_WIN32) && !defined(FORCE_USING_EML)
#ifdef WIN32_USING_MAPI
int CMailMessage::checkMAPIClient()
{
if (!isMAPIClientAssigned()) {
@ -338,7 +338,7 @@ int CMailMessage::checkMAPIClient()
bool CMailMessage::sendMail(const std::string &to, const std::string &subject, const std::string &msg)
{
#if defined(_WIN32) && !defined(FORCE_USING_EML)
#ifdef WIN32_USING_MAPI
return pimpl->sendMailMAPI(to, subject, msg);
#else
return pimpl->openEML(to, subject, msg);

View File

@ -35,6 +35,9 @@
#include <string>
// #define FORCE_USING_EML
#if defined(_WIN32) && !defined(FORCE_USING_EML)
# define WIN32_USING_MAPI
#endif
class CMailMessage
{
@ -43,7 +46,7 @@ public:
CMailMessage& operator=(const CMailMessage&) = delete;
static CMailMessage& instance();
#if defined(_WIN32) && !defined(FORCE_USING_EML)
#ifdef WIN32_USING_MAPI
enum MAPIResult {MAPIClientOK, MapiClientCancel, MAPIClientEmpty, MAPIClientError};
int checkMAPIClient();
#endif