Public Member Functions | Private Member Functions | Private Attributes

fuh Class Reference

A user_handler implementation to link the server with a phpbb3 forum. More...

#include <forum_user_handler.hpp>

Inheritance diagram for fuh:
Inheritance graph
[legend]
Collaboration diagram for fuh:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 fuh (const config &c)
 ~fuh ()
void add_user (const std::string &name, const std::string &mail, const std::string &password)
 Adds a user.
void remove_user (const std::string &name)
 Removes a user.
void clean_up ()
 Called by the server once a day.
bool login (const std::string &name, const std::string &password, const std::string &seed)
 Return true if the given password matches the password for the given user.
std::string create_pepper (const std::string &name)
 Needed because the hashing algorithm used by phpbb requires some info from the original hash to recreate the same hash.
void user_logged_in (const std::string &name)
 Executed when the user with the given name logged in.
bool user_exists (const std::string &name)
 Returns true if a user with the given name exists.
bool user_is_active (const std::string &name)
 Returns true if the specified user account is usable for logins.
bool user_is_moderator (const std::string &name)
 Returns true if this user is a moderator on this server.
void set_is_moderator (const std::string &name, const bool &is_moderator)
 Mark this user as a moderator.
void password_reminder (const std::string &name)
 Send a password reminder email to the given user.
std::string user_info (const std::string &name)
 Returns a string containing info like the last login of this user.
void set_user_detail (const std::string &user, const std::string &detail, const std::string &value)
 Set data for a given user name.
std::string get_valid_details ()
 List of details that can be set for this user_handler.
bool use_phpbb_encryption () const
 Does this user_handler want passwords passed encrypted using phpbb's algorithm?

Private Member Functions

std::string get_hash (const std::string &user)
std::string get_mail (const std::string &user)
 Used in send_mail().
time_t get_lastlogin (const std::string &user)
time_t get_registrationdate (const std::string &user)
bool is_inactive (const std::string &user)
void set_lastlogin (const std::string &user, const time_t &lastlogin)
MYSQL_RES * db_query (const std::string &query)
std::string db_query_to_string (const std::string &query)
std::string get_detail_for_user (const std::string &name, const std::string &detail)
std::string get_writable_detail_for_user (const std::string &name, const std::string &detail)
void write_detail (const std::string &name, const std::string &detail, const std::string &value)
bool extra_row_exists (const std::string &name)

Private Attributes

std::string db_name_
std::string db_host_
std::string db_user_
std::string db_password_
std::string db_users_table_
std::string db_extra_table_
MYSQL * conn

Detailed Description

A user_handler implementation to link the server with a phpbb3 forum.

Definition at line 40 of file forum_user_handler.hpp.


Constructor & Destructor Documentation

fuh::fuh ( const config c  ) 
fuh::~fuh (  ) 

Member Function Documentation

void fuh::add_user ( const std::string &  name,
const std::string &  mail,
const std::string &  password 
) [virtual]

Adds a user.

Throws an error containing the error message if adding fails (e.g. because a user with the same name already exists).

Implements user_handler.

void fuh::clean_up (  )  [inline, virtual]

Called by the server once a day.

Could for example be used for removing users that have not logged in for a certain amount of time.

Implements user_handler.

Definition at line 31 of file forum_user_handler.hpp.

std::string fuh::create_pepper ( const std::string &  name  )  [virtual]

Needed because the hashing algorithm used by phpbb requires some info from the original hash to recreate the same hash.

Return an empty string if an error occurs

Implements user_handler.

MYSQL_RES* fuh::db_query ( const std::string &  query  )  [private]
std::string fuh::db_query_to_string ( const std::string &  query  )  [private]
bool fuh::extra_row_exists ( const std::string &  name  )  [private]
std::string fuh::get_detail_for_user ( const std::string &  name,
const std::string &  detail 
) [private]
std::string fuh::get_hash ( const std::string &  user  )  [private]
time_t fuh::get_lastlogin ( const std::string &  user  )  [private]
std::string fuh::get_mail ( const std::string &  user  )  [private, virtual]

Used in send_mail().

Should return an empty string when not used.

Implements user_handler.

time_t fuh::get_registrationdate ( const std::string &  user  )  [private]
std::string fuh::get_valid_details (  )  [virtual]

List of details that can be set for this user_handler.

Implements user_handler.

std::string fuh::get_writable_detail_for_user ( const std::string &  name,
const std::string &  detail 
) [private]
bool fuh::is_inactive ( const std::string &  user  )  [private]
bool fuh::login ( const std::string &  name,
const std::string &  password,
const std::string &  seed 
) [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

Implements user_handler.

void fuh::password_reminder ( const std::string &  name  )  [virtual]

Send a password reminder email to the given user.

Should throw user_handler::error if sending fails (e.g. because we cannot send email).

Implements user_handler.

void fuh::remove_user ( const std::string &  name  )  [virtual]

Removes a user.

Throws an error containing the error message if removing fails (e.g. no user with the given name exists).

Implements user_handler.

void fuh::set_is_moderator ( const std::string &  name,
const bool &  is_moderator 
) [virtual]

Mark this user as a moderator.

Implements user_handler.

void fuh::set_lastlogin ( const std::string &  user,
const time_t &  lastlogin 
) [private]
void fuh::set_user_detail ( const std::string &  user,
const std::string &  detail,
const std::string &  value 
) [virtual]

Set data for a given user name.

Should throw an error on invalid data.

Implements user_handler.

bool fuh::use_phpbb_encryption (  )  const [inline, virtual]

Does this user_handler want passwords passed encrypted using phpbb's algorithm?

Let it return true if it does and false if it does not.

Implements user_handler.

Definition at line 62 of file forum_user_handler.hpp.

bool fuh::user_exists ( const std::string &  name  )  [virtual]

Returns true if a user with the given name exists.

Implements user_handler.

std::string fuh::user_info ( const std::string &  name  )  [virtual]

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

Formatted for user readable output.

Implements user_handler.

bool fuh::user_is_active ( const std::string &  name  )  [virtual]

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

Implements user_handler.

bool fuh::user_is_moderator ( const std::string &  name  )  [virtual]

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

Implements user_handler.

void fuh::user_logged_in ( const std::string &  name  )  [virtual]

Executed when the user with the given name logged in.

Implements user_handler.

void fuh::write_detail ( const std::string &  name,
const std::string &  detail,
const std::string &  value 
) [private]

Member Data Documentation

MYSQL* fuh::conn [private]

Definition at line 82 of file forum_user_handler.hpp.

std::string fuh::db_extra_table_ [private]

Definition at line 75 of file forum_user_handler.hpp.

std::string fuh::db_host_ [private]

Definition at line 75 of file forum_user_handler.hpp.

std::string fuh::db_name_ [private]

Definition at line 75 of file forum_user_handler.hpp.

std::string fuh::db_password_ [private]

Definition at line 75 of file forum_user_handler.hpp.

std::string fuh::db_user_ [private]

Definition at line 75 of file forum_user_handler.hpp.

std::string fuh::db_users_table_ [private]

Definition at line 75 of file forum_user_handler.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:13:50 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs