Skip to content

Commit

Permalink
- Remove unused header
Browse files Browse the repository at this point in the history
- Update smtps::ssl_options
  • Loading branch information
ParticleG committed Aug 5, 2024
1 parent 1268051 commit 214b4f3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
52 changes: 26 additions & 26 deletions plugins/EmailManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ using namespace studio26f::plugins;
using namespace studio26f::structures;
using namespace studio26f::types;

void EmailManager::initAndStart(const Json::Value &config) {
void EmailManager::initAndStart(const Json::Value& config) {
if (!(
config["server"].isString() &&
config["port"].isUInt() &&
config["account"].isString() &&
config["password"].isString() &&
config["senderEmail"].isString() &&
config["senderName"].isString()
config["server"].isString() &&
config["port"].isUInt() &&
config["account"].isString() &&
config["password"].isString() &&
config["senderEmail"].isString() &&
config["senderName"].isString()
)) {
LOG_ERROR << R"(Invalid config)";
abort();
Expand All @@ -44,9 +44,9 @@ void EmailManager::shutdown() {
}

void EmailManager::smtp(
const string &receiverEmail,
const string &subject,
const string &content
const string& receiverEmail,
const string& subject,
const string& content
) {
try {
message msg;
Expand All @@ -58,32 +58,32 @@ void EmailManager::smtp(
msg.content_type(message::media_type_t::TEXT, "html", "utf-8");
msg.content(content);
smtps conn(_server, _port);
conn.ssl_options({{}, 0});
conn.authenticate(_account, _password, smtps::auth_method_t::START_TLS);
conn.submit(msg);
} catch (smtp_error &e) {
} catch (smtp_error& e) {
LOG_WARN << "SMTP Error: " << e.what();
throw ResponseException(
i18n("emailError"),
e,
ResultCode::EmailError,
k503ServiceUnavailable
i18n("emailError"),
e,
ResultCode::EmailError,
k503ServiceUnavailable
);
} catch (dialog_error &e) {
} catch (dialog_error& e) {
LOG_WARN << "Dialog Error: " << e.what();
throw ResponseException(
i18n("emailError"),
e,
ResultCode::EmailError,
k503ServiceUnavailable
i18n("emailError"),
e,
ResultCode::EmailError,
k503ServiceUnavailable
);
} catch (message_error &e) {
} catch (message_error& e) {
LOG_WARN << "Message Error: " << e.what();
throw ResponseException(
i18n("emailError"),
e,
ResultCode::EmailError,
k503ServiceUnavailable
i18n("emailError"),
e,
ResultCode::EmailError,
k503ServiceUnavailable
);
}
}

2 changes: 0 additions & 2 deletions types/Permission.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#pragma once

#include <drogon/drogon.h>

namespace studio26f::types {
enum class Permission {
Banned,
Expand Down

0 comments on commit 214b4f3

Please sign in to comment.