The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
wesnothd::ban_manager Class Reference

#include <ban.hpp>

Public Member Functions

 ban_manager ()
 
 ~ban_manager ()
 
void read ()
 
void write ()
 
bool parse_time (const std::string &duration, time_t *time) const
 Parses the given duration and adds it to *time except if the duration is '0' or 'permanent' in which case *time will be set to '0'. More...
 
std::string ban (const std::string &, const time_t &, const std::string &, const std::string &, const std::string &, const std::string &="")
 
void unban (std::ostringstream &os, const std::string &ip)
 
void unban_group (std::ostringstream &os, const std::string &group)
 
void check_ban_times (time_t time_now)
 
void list_deleted_bans (std::ostringstream &out, const std::string &mask="*") const
 
void list_bans (std::ostringstream &out, const std::string &mask="*") const
 
std::string is_ip_banned (const std::string &ip) const
 
const std::string & get_ban_help () const
 
void load_config (const config &)
 

Private Member Functions

bool is_digit (const char &c) const
 
size_t to_digit (const char &c) const
 
void init_ban_help ()
 

Private Attributes

ban_set bans_
 
deleted_ban_list deleted_bans_
 
ban_time_queue time_queue_
 
default_ban_times ban_times_
 
std::string ban_help_
 
std::string filename_
 
bool dirty_
 

Detailed Description

Definition at line 121 of file ban.hpp.

Constructor & Destructor Documentation

wesnothd::ban_manager::ban_manager ( )

Definition at line 720 of file ban.cpp.

References init_ban_help().

wesnothd::ban_manager::~ban_manager ( )

Definition at line 713 of file ban.cpp.

References write().

Member Function Documentation

std::string wesnothd::ban_manager::ban ( const std::string &  ip,
const time_t &  end_time,
const std::string &  reason,
const std::string &  who_banned,
const std::string &  group,
const std::string &  nick = "" 
)
void wesnothd::ban_manager::check_ban_times ( time_t  time_now)

Definition at line 560 of file ban.cpp.

References ban(), DBG_SERVER, LOG_SERVER, time_queue_, unban(), and write().

const std::string& wesnothd::ban_manager::get_ban_help ( ) const
inline
void wesnothd::ban_manager::init_ban_help ( )
private

Definition at line 669 of file ban.cpp.

References ban_help_, and ban_times_.

Referenced by ban_manager(), and load_config().

bool wesnothd::ban_manager::is_digit ( const char &  c) const
inlineprivate

Definition at line 132 of file ban.hpp.

Referenced by parse_time().

std::string wesnothd::ban_manager::is_ip_banned ( const std::string &  ip) const

Definition at line 655 of file ban.cpp.

References ban(), bans_, p, and wesnothd::parse_ip().

Referenced by wesnothd::server::is_ip_banned().

void wesnothd::ban_manager::list_bans ( std::ostringstream &  out,
const std::string &  mask = "*" 
) const

Definition at line 612 of file ban.cpp.

References bans_, e, i, game::error::message, and wesnothd::parse_ip().

Referenced by wesnothd::server::bans_handler().

void wesnothd::ban_manager::list_deleted_bans ( std::ostringstream &  out,
const std::string &  mask = "*" 
) const

Definition at line 584 of file ban.cpp.

References deleted_bans_, e, i, game::error::message, and wesnothd::parse_ip().

Referenced by wesnothd::server::bans_handler().

void wesnothd::ban_manager::load_config ( const config cfg)
bool wesnothd::ban_manager::parse_time ( const std::string &  duration,
time_t *  time 
) const

Parses the given duration and adds it to *time except if the duration is '0' or 'permanent' in which case *time will be set to '0'.

Returns
false if an invalid time modifier is encountered. *time is undefined in that case.

Definition at line 326 of file ban.cpp.

References ban_times_, e, ERR_SERVER, i, is_digit(), LOG_SERVER, utf8::lowercase(), and to_digit().

Referenced by wesnothd::server::ban_handler(), wesnothd::server::gban_handler(), wesnothd::server::kickban_handler(), and load_config().

void wesnothd::ban_manager::read ( )
size_t wesnothd::ban_manager::to_digit ( const char &  c) const
inlineprivate

Definition at line 134 of file ban.hpp.

Referenced by parse_time().

void wesnothd::ban_manager::unban ( std::ostringstream &  os,
const std::string &  ip 
)
void wesnothd::ban_manager::unban_group ( std::ostringstream &  os,
const std::string &  group 
)

Definition at line 549 of file ban.cpp.

References bans_, dirty_, and p.

Referenced by wesnothd::server::ungban_handler().

void wesnothd::ban_manager::write ( )

Member Data Documentation

std::string wesnothd::ban_manager::ban_help_
private

Definition at line 128 of file ban.hpp.

Referenced by get_ban_help(), and init_ban_help().

default_ban_times wesnothd::ban_manager::ban_times_
private

Definition at line 127 of file ban.hpp.

Referenced by init_ban_help(), load_config(), and parse_time().

ban_set wesnothd::ban_manager::bans_
private

Definition at line 124 of file ban.hpp.

Referenced by ban(), is_ip_banned(), list_bans(), read(), unban(), unban_group(), and write().

deleted_ban_list wesnothd::ban_manager::deleted_bans_
private

Definition at line 125 of file ban.hpp.

Referenced by list_deleted_bans(), read(), unban(), and write().

bool wesnothd::ban_manager::dirty_
private

Definition at line 130 of file ban.hpp.

Referenced by ban(), load_config(), unban(), unban_group(), and write().

std::string wesnothd::ban_manager::filename_
private

Definition at line 129 of file ban.hpp.

Referenced by load_config(), read(), and write().

ban_time_queue wesnothd::ban_manager::time_queue_
private

Definition at line 126 of file ban.hpp.

Referenced by ban(), check_ban_times(), and read().


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