Remove unused email-related functions.

This commit is contained in:
Pentarctagon 2019-08-20 19:00:14 -05:00 committed by Gunter Labes
parent 4a93de4b00
commit 0870d1bc89
5 changed files with 0 additions and 53 deletions

View file

@ -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");

View file

@ -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);

View file

@ -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();
}
}

View file

@ -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)));

View file

@ -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();
@ -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;
};