mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-03 14:31:18 +00:00
Remove unused email-related functions.
This commit is contained in:
parent
4a93de4b00
commit
0870d1bc89
@ -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) {
|
std::time_t fuh::get_lastlogin(const std::string& user) {
|
||||||
try {
|
try {
|
||||||
int time_int = get_writable_detail_for_user<int>(user, "user_lastvisit");
|
int time_int = get_writable_detail_for_user<int>(user, "user_lastvisit");
|
||||||
|
@ -91,9 +91,6 @@ class fuh : public user_handler {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string get_hash(const std::string& user);
|
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_lastlogin(const std::string& user);
|
||||||
std::time_t get_registrationdate(const std::string& user);
|
std::time_t get_registrationdate(const std::string& user);
|
||||||
bool is_inactive(const std::string& user);
|
bool is_inactive(const std::string& user);
|
||||||
|
@ -525,10 +525,7 @@ void server::load_config()
|
|||||||
#ifdef HAVE_MYSQLPP
|
#ifdef HAVE_MYSQLPP
|
||||||
user_handler_.reset(new fuh(user_handler));
|
user_handler_.reset(new fuh(user_handler));
|
||||||
#endif
|
#endif
|
||||||
// Initiate the mailer class with the [mail] tag
|
|
||||||
// from the config file
|
|
||||||
if(user_handler_) {
|
if(user_handler_) {
|
||||||
user_handler_->init_mailer(cfg_.child("mail"));
|
|
||||||
uuid_ = user_handler_->get_uuid();
|
uuid_ = user_handler_->get_uuid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,25 +27,6 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <sstream>
|
#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) {
|
std::string user_handler::create_unsecure_nonce(int length) {
|
||||||
srand(static_cast<unsigned>(std::time(nullptr)));
|
srand(static_cast<unsigned>(std::time(nullptr)));
|
||||||
|
|
||||||
|
@ -150,9 +150,6 @@ class user_handler {
|
|||||||
error(const std::string& message) : game::error(message) {}
|
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. */
|
/** Create a random string of digits for password encryption. */
|
||||||
std::string create_unsecure_nonce(int length = 8);
|
std::string create_unsecure_nonce(int length = 8);
|
||||||
std::string create_secure_nonce();
|
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_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_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;
|
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;
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user