The Battle for Wesnoth  1.17.0-dev
Classes | Public Types | Public Member Functions | List of all members
user_handler Class Referenceabstract

An interface class to handle nick registration To activate it put a [user_handler] section into the server configuration file. More...

#include <user_handler.hpp>

Inheritance diagram for user_handler:

Classes

struct  ban_info
 Ban status description. More...
 
struct  error
 

Public Types

enum  BAN_TYPE { BAN_NONE = 0, BAN_IP = 1, BAN_USER = 2, BAN_EMAIL = 3 }
 Ban type values. More...
 

Public Member Functions

 user_handler ()
 
virtual ~user_handler ()
 
virtual bool login (const std::string &name, const std::string &password)=0
 Return true if the given password matches the password for the given user. More...
 
virtual void user_logged_in (const std::string &name)=0
 Executed when the user with the given name logged in. More...
 
virtual std::string user_info (const std::string &name)=0
 Returns a string containing info like the last login of this user. More...
 
virtual bool user_exists (const std::string &name)=0
 Returns true if a user with the given name exists. More...
 
virtual long get_forum_id (const std::string &name)=0
 Returns the forum user id for the given username. More...
 
virtual bool user_is_active (const std::string &name)=0
 Returns true if the specified user account is usable for logins. More...
 
virtual bool user_is_moderator (const std::string &name)=0
 Returns true if this user is a moderator on this server. More...
 
virtual void set_is_moderator (const std::string &name, const bool &is_moderator)=0
 Mark this user as a moderator. More...
 
virtual ban_info user_is_banned (const std::string &name, const std::string &addr="")=0
 Returns true if this user account or IP address is banned. More...
 
virtual std::string extract_salt (const std::string &username)=0
 Create custom salt. More...
 
virtual std::string get_uuid ()=0
 
virtual std::string get_tournaments ()=0
 
virtual void async_get_and_send_game_history (boost::asio::io_service &io_service, wesnothd::server &s, wesnothd::player_iterator player, int player_id, int offset)=0
 
virtual void db_insert_game_info (const std::string &uuid, int game_id, const std::string &version, const std::string &name, int reload, int observers, int is_public, int has_password)=0
 
virtual void db_update_game_end (const std::string &uuid, int game_id, const std::string &replay_location)=0
 
virtual void db_insert_game_player_info (const std::string &uuid, int game_id, const std::string &username, int side_number, int is_host, const std::string &faction, const std::string &version, const std::string &source, const std::string &current_user)=0
 
virtual void db_insert_game_content_info (const std::string &uuid, int game_id, const std::string &type, const std::string &name, const std::string &id, const std::string &source, const std::string &version)=0
 
virtual void db_set_oos_flag (const std::string &uuid, int game_id)=0
 
virtual void async_test_query (boost::asio::io_service &io_service, int limit)=0
 
virtual bool db_topic_id_exists (int topic_id)=0
 
virtual void db_insert_addon_info (const std::string &instance_version, const std::string &id, const std::string &name, const std::string &type, const std::string &version, bool forum_auth, int topic_id)=0
 
virtual unsigned long long db_insert_login (const std::string &username, const std::string &ip, const std::string &version)=0
 
virtual void db_update_logout (unsigned long long login_id)=0
 
virtual void get_users_for_ip (const std::string &ip, std::ostringstream *out)=0
 
virtual void get_ips_for_user (const std::string &username, std::ostringstream *out)=0
 

Detailed Description

An interface class to handle nick registration To activate it put a [user_handler] section into the server configuration file.

Definition at line 38 of file user_handler.hpp.

Member Enumeration Documentation

◆ BAN_TYPE

Ban type values.

Enumerator
BAN_NONE 

Not a ban.

BAN_IP 

IP address ban.

BAN_USER 

User account/name ban.

BAN_EMAIL 

Account email address ban.

Definition at line 91 of file user_handler.hpp.

Constructor & Destructor Documentation

◆ user_handler()

user_handler::user_handler ( )
inline

Definition at line 47 of file user_handler.hpp.

◆ ~user_handler()

virtual user_handler::~user_handler ( )
inlinevirtual

Definition at line 51 of file user_handler.hpp.

References preferences::login(), and preferences::password().

Member Function Documentation

◆ async_get_and_send_game_history()

virtual void user_handler::async_get_and_send_game_history ( boost::asio::io_service &  io_service,
wesnothd::server s,
wesnothd::player_iterator  player,
int  player_id,
int  offset 
)
pure virtual

Implemented in fuh.

◆ async_test_query()

virtual void user_handler::async_test_query ( boost::asio::io_service &  io_service,
int  limit 
)
pure virtual

Implemented in fuh.

◆ db_insert_addon_info()

virtual void user_handler::db_insert_addon_info ( const std::string &  instance_version,
const std::string &  id,
const std::string &  name,
const std::string &  type,
const std::string &  version,
bool  forum_auth,
int  topic_id 
)
pure virtual

Implemented in fuh.

◆ db_insert_game_content_info()

virtual void user_handler::db_insert_game_content_info ( const std::string &  uuid,
int  game_id,
const std::string &  type,
const std::string &  name,
const std::string &  id,
const std::string &  source,
const std::string &  version 
)
pure virtual

Implemented in fuh.

◆ db_insert_game_info()

virtual void user_handler::db_insert_game_info ( const std::string &  uuid,
int  game_id,
const std::string &  version,
const std::string &  name,
int  reload,
int  observers,
int  is_public,
int  has_password 
)
pure virtual

Implemented in fuh.

◆ db_insert_game_player_info()

virtual void user_handler::db_insert_game_player_info ( const std::string &  uuid,
int  game_id,
const std::string &  username,
int  side_number,
int  is_host,
const std::string &  faction,
const std::string &  version,
const std::string &  source,
const std::string &  current_user 
)
pure virtual

Implemented in fuh.

◆ db_insert_login()

virtual unsigned long long user_handler::db_insert_login ( const std::string &  username,
const std::string &  ip,
const std::string &  version 
)
pure virtual

Implemented in fuh.

◆ db_set_oos_flag()

virtual void user_handler::db_set_oos_flag ( const std::string &  uuid,
int  game_id 
)
pure virtual

Implemented in fuh.

◆ db_topic_id_exists()

virtual bool user_handler::db_topic_id_exists ( int  topic_id)
pure virtual

Implemented in fuh.

◆ db_update_game_end()

virtual void user_handler::db_update_game_end ( const std::string &  uuid,
int  game_id,
const std::string &  replay_location 
)
pure virtual

Implemented in fuh.

◆ db_update_logout()

virtual void user_handler::db_update_logout ( unsigned long long  login_id)
pure virtual

Implemented in fuh.

◆ extract_salt()

virtual std::string user_handler::extract_salt ( const std::string &  username)
pure virtual

Create custom salt.

Implemented in fuh.

◆ get_forum_id()

virtual long user_handler::get_forum_id ( const std::string &  name)
pure virtual

Returns the forum user id for the given username.

Implemented in fuh.

◆ get_ips_for_user()

virtual void user_handler::get_ips_for_user ( const std::string &  username,
std::ostringstream *  out 
)
pure virtual

Implemented in fuh.

◆ get_tournaments()

virtual std::string user_handler::get_tournaments ( )
pure virtual

Implemented in fuh.

◆ get_users_for_ip()

virtual void user_handler::get_users_for_ip ( const std::string &  ip,
std::ostringstream *  out 
)
pure virtual

Implemented in fuh.

◆ get_uuid()

virtual std::string user_handler::get_uuid ( )
pure virtual

Implemented in fuh.

◆ login()

virtual bool user_handler::login ( const std::string &  name,
const std::string &  password 
)
pure virtual

Return true if the given password matches the password for the given user.

Password could also be a hash Seed is not needed for clear text log ins Currently the login procedure in the server and client code is hardcoded for the forum_user_handler implementation

Implemented in fuh.

◆ set_is_moderator()

virtual void user_handler::set_is_moderator ( const std::string &  name,
const bool &  is_moderator 
)
pure virtual

Mark this user as a moderator.

Implemented in fuh.

◆ user_exists()

virtual bool user_handler::user_exists ( const std::string &  name)
pure virtual

Returns true if a user with the given name exists.

Implemented in fuh.

◆ user_info()

virtual std::string user_handler::user_info ( const std::string &  name)
pure virtual

Returns a string containing info like the last login of this user.

Formatted for user readable output.

Implemented in fuh.

◆ user_is_active()

virtual bool user_handler::user_is_active ( const std::string &  name)
pure virtual

Returns true if the specified user account is usable for logins.

Implemented in fuh.

◆ user_is_banned()

virtual ban_info user_handler::user_is_banned ( const std::string &  name,
const std::string &  addr = "" 
)
pure virtual

Returns true if this user account or IP address is banned.

Note
The IP address is only used by the forum_user_handler subclass. Regular IP ban checks are done by server_base instead.

Implemented in fuh.

◆ user_is_moderator()

virtual bool user_handler::user_is_moderator ( const std::string &  name)
pure virtual

Returns true if this user is a moderator on this server.

Implemented in fuh.

◆ user_logged_in()

virtual void user_handler::user_logged_in ( const std::string &  name)
pure virtual

Executed when the user with the given name logged in.

Implemented in fuh.


The documentation for this class was generated from the following file: