The Battle for Wesnoth  1.19.0-dev
Classes | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
wesnothd::banned Class Reference

#include <ban.hpp>

Classes

struct  error
 

Public Member Functions

 banned (const std::string &ip, const std::time_t end_time, const std::string &reason, const std::string &who_banned=who_banned_default_, const std::string &group="", const std::string &nick="")
 
 banned (const config &)
 
 banned (const std::string &ip)
 
void read (const config &)
 
void write (config &) const
 
std::time_t get_end_time () const
 
std::string get_human_end_time () const
 
std::string get_human_start_time () const
 
std::string get_human_time_span () const
 
std::string get_reason () const
 
std::string get_ip () const
 
std::string get_group () const
 
std::string get_who_banned () const
 
std::string get_nick () const
 
bool match_group (const std::string &group) const
 
bool match_ip (const ip_mask &ip) const
 
bool match_ipmask (const ip_mask &ip) const
 
unsigned int get_mask_ip (unsigned int) const
 
unsigned int get_int_ip () const
 
unsigned int mask () const
 
bool operator> (const banned &b) const
 

Static Public Member Functions

static std::string get_human_time (const std::time_t &)
 

Private Attributes

unsigned int ip_
 
unsigned int mask_
 
std::string ip_text_
 
std::time_t end_time_
 
std::time_t start_time_
 
std::string reason_
 
std::string who_banned_
 
std::string group_
 
std::string nick_
 

Static Private Attributes

static const std::string who_banned_default_ = "system"
 

Detailed Description

Definition at line 60 of file ban.hpp.

Constructor & Destructor Documentation

◆ banned() [1/3]

wesnothd::banned::banned ( const std::string &  ip,
const std::time_t  end_time,
const std::string &  reason,
const std::string &  who_banned = who_banned_default_,
const std::string &  group = "",
const std::string &  nick = "" 
)

Definition at line 82 of file ban.cpp.

References ip_, ip_text_, mask_, and wesnothd::parse_ip().

◆ banned() [2/3]

wesnothd::banned::banned ( const config cfg)

Definition at line 103 of file ban.cpp.

References read().

◆ banned() [3/3]

wesnothd::banned::banned ( const std::string &  ip)

Definition at line 66 of file ban.cpp.

References ip_, mask_, and wesnothd::parse_ip().

Member Function Documentation

◆ get_end_time()

std::time_t wesnothd::banned::get_end_time ( ) const
inline

Definition at line 81 of file ban.hpp.

References end_time_.

◆ get_group()

std::string wesnothd::banned::get_group ( ) const
inline

Definition at line 94 of file ban.hpp.

References group_.

◆ get_human_end_time()

std::string wesnothd::banned::get_human_end_time ( ) const

Definition at line 231 of file ban.cpp.

References end_time_, and lg::get_timestamp().

◆ get_human_start_time()

std::string wesnothd::banned::get_human_start_time ( ) const

Definition at line 222 of file ban.cpp.

References lg::get_timestamp(), and start_time_.

◆ get_human_time()

static std::string wesnothd::banned::get_human_time ( const std::time_t &  )
static

◆ get_human_time_span()

std::string wesnothd::banned::get_human_time_span ( ) const

Definition at line 240 of file ban.cpp.

References end_time_, and lg::get_timespan().

◆ get_int_ip()

unsigned int wesnothd::banned::get_int_ip ( ) const
inline

Definition at line 110 of file ban.hpp.

References ip_.

◆ get_ip()

std::string wesnothd::banned::get_ip ( ) const
inline

Definition at line 92 of file ban.hpp.

References ip_text_.

Referenced by write().

◆ get_mask_ip()

unsigned int wesnothd::banned::get_mask_ip ( unsigned int  mask) const

Definition at line 254 of file ban.cpp.

References ip_, mask(), and mask_.

◆ get_nick()

std::string wesnothd::banned::get_nick ( ) const
inline

Definition at line 100 of file ban.hpp.

References nick_.

Referenced by write().

◆ get_reason()

std::string wesnothd::banned::get_reason ( ) const
inline

Definition at line 89 of file ban.hpp.

References reason_.

◆ get_who_banned()

std::string wesnothd::banned::get_who_banned ( ) const
inline

Definition at line 97 of file ban.hpp.

References who_banned_.

◆ mask()

unsigned int wesnothd::banned::mask ( ) const
inline

Definition at line 113 of file ban.hpp.

References mask_.

Referenced by get_mask_ip().

◆ match_group()

bool wesnothd::banned::match_group ( const std::string &  group) const
inline

Definition at line 103 of file ban.hpp.

References group_.

◆ match_ip()

bool wesnothd::banned::match_ip ( const ip_mask ip) const

Definition at line 259 of file ban.cpp.

References ip_, and mask_.

◆ match_ipmask()

bool wesnothd::banned::match_ipmask ( const ip_mask ip) const

Definition at line 265 of file ban.cpp.

References ip_, and mask_.

◆ operator>()

bool wesnothd::banned::operator> ( const banned b) const

Definition at line 249 of file ban.cpp.

References b, and end_time_.

◆ read()

void wesnothd::banned::read ( const config cfg)

Definition at line 162 of file ban.cpp.

References end_time_, group_, config::has_attribute(), ip_, ip_text_, mask_, nick_, wesnothd::parse_ip(), reason_, start_time_, and who_banned_.

Referenced by banned().

◆ write()

void wesnothd::banned::write ( config cfg) const

Definition at line 194 of file ban.cpp.

References end_time_, get_ip(), get_nick(), group_, reason_, start_time_, who_banned_, and who_banned_default_.

Member Data Documentation

◆ end_time_

std::time_t wesnothd::banned::end_time_
private

Definition at line 64 of file ban.hpp.

Referenced by get_end_time(), get_human_end_time(), get_human_time_span(), operator>(), read(), and write().

◆ group_

std::string wesnothd::banned::group_
private

Definition at line 68 of file ban.hpp.

Referenced by get_group(), match_group(), read(), and write().

◆ ip_

unsigned int wesnothd::banned::ip_
private

Definition at line 61 of file ban.hpp.

Referenced by banned(), get_int_ip(), get_mask_ip(), match_ip(), match_ipmask(), and read().

◆ ip_text_

std::string wesnothd::banned::ip_text_
private

Definition at line 63 of file ban.hpp.

Referenced by banned(), get_ip(), and read().

◆ mask_

unsigned int wesnothd::banned::mask_
private

Definition at line 62 of file ban.hpp.

Referenced by banned(), get_mask_ip(), mask(), match_ip(), match_ipmask(), and read().

◆ nick_

std::string wesnothd::banned::nick_
private

Definition at line 69 of file ban.hpp.

Referenced by get_nick(), and read().

◆ reason_

std::string wesnothd::banned::reason_
private

Definition at line 66 of file ban.hpp.

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

◆ start_time_

std::time_t wesnothd::banned::start_time_
private

Definition at line 65 of file ban.hpp.

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

◆ who_banned_

std::string wesnothd::banned::who_banned_
private

Definition at line 67 of file ban.hpp.

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

◆ who_banned_default_

const std::string wesnothd::banned::who_banned_default_ = "system"
staticprivate

Definition at line 70 of file ban.hpp.

Referenced by write().


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