Skip to content

Commit

Permalink
Remove unused email-related functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pentarctagon authored and soliton- committed Aug 22, 2019
1 parent 4a93de4 commit 0870d1b
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 53 deletions.
9 changes: 0 additions & 9 deletions src/server/forum_user_handler.cpp
Expand Up @@ -322,15 +322,6 @@ std::string fuh::get_hash(const std::string& user) {
}
}

std::string fuh::get_mail(const std::string& user) {
try {
return get_detail_for_user<std::string>(user, "user_email");
} catch (const sql_error& e) {
ERR_UH << "Could not retrieve email for user '" << user << "' :" << e.message << std::endl;
return "";
}
}

std::time_t fuh::get_lastlogin(const std::string& user) {
try {
int time_int = get_writable_detail_for_user<int>(user, "user_lastvisit");
Expand Down
3 changes: 0 additions & 3 deletions src/server/forum_user_handler.hpp
Expand Up @@ -91,9 +91,6 @@ class fuh : public user_handler {

private:
std::string get_hash(const std::string& user);
std::string get_mail(const std::string& user);
/*std::vector<std::string> get_friends(const std::string& user);
std::vector<std::string> get_ignores(const std::string& user);*/
std::time_t get_lastlogin(const std::string& user);
std::time_t get_registrationdate(const std::string& user);
bool is_inactive(const std::string& user);
Expand Down
3 changes: 0 additions & 3 deletions src/server/server.cpp
Expand Up @@ -525,10 +525,7 @@ void server::load_config()
#ifdef HAVE_MYSQLPP
user_handler_.reset(new fuh(user_handler));
#endif
// Initiate the mailer class with the [mail] tag
// from the config file
if(user_handler_) {
user_handler_->init_mailer(cfg_.child("mail"));
uuid_ = user_handler_->get_uuid();
}
}
Expand Down
19 changes: 0 additions & 19 deletions src/server/user_handler.cpp
Expand Up @@ -27,25 +27,6 @@
#include <ctime>
#include <sstream>

bool user_handler::send_mail(const std::string& to_user,
const std::string& /*subject*/, const std::string& /*message*/) {

//If this user is registered at all
if(!user_exists(to_user)) {
throw error("Could not send email. No user with the name '" + to_user + "' exists.");
}

// If this user did not provide an email
if(get_mail(to_user).empty()) {
throw error("Could not send email. The email address of the user '" + to_user + "' is empty.");
}

throw user_handler::error("This server is configured not to send email.");
}

void user_handler::init_mailer(const config &) {
}

std::string user_handler::create_unsecure_nonce(int length) {
srand(static_cast<unsigned>(std::time(nullptr)));

Expand Down
19 changes: 0 additions & 19 deletions src/server/user_handler.hpp
Expand Up @@ -150,9 +150,6 @@ class user_handler {
error(const std::string& message) : game::error(message) {}
};

/** Initiate the mailer object. */
void init_mailer(const config &c);

/** Create a random string of digits for password encryption. */
std::string create_unsecure_nonce(int length = 8);
std::string create_secure_nonce();
Expand All @@ -178,20 +175,4 @@ class user_handler {
virtual void db_insert_game_player_info(const std::string& uuid, int game_id, const std::string& username, int side_number, const std::string& is_host, const std::string& faction) =0;
virtual void db_insert_modification_info(const std::string& uuid, int game_id, const std::string& modification_name) =0;
virtual void db_set_oos_flag(const std::string& uuid, int game_id) =0;

protected:

/**
* Sends an email to the specified address. Requires access to an SMTP server.
*
* Throws an error if the mail could not be sent.
*/
bool send_mail(const std::string& to_user, const std::string& subject, const std::string& message);

/**
* Used in send_mail().
*
* Should return an empty string when not used.
*/
virtual std::string get_mail(const std::string& user) =0;
};

0 comments on commit 0870d1b

Please sign in to comment.