Anope IRC Services  Version 2.0
Public Member Functions | Static Public Member Functions | Data Fields | Private Member Functions | Private Attributes
Server Class Reference

#include <servers.h>

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

Public Member Functions

 Server (Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid="", bool jupe=false)
 
void Delete (const Anope::string &reason)
 
const Anope::stringGetName () const
 
unsigned GetHops () const
 
void SetDescription (const Anope::string &desc)
 
const Anope::stringGetDescription () const
 
void SetSID (const Anope::string &sid)
 
const Anope::stringGetSID () const
 
const Anope::stringGetQuitReason () const
 
const std::vector< Server * > & GetLinks () const
 
ServerGetUplink ()
 
void AddLink (Server *s)
 
void DelLink (Server *s)
 
void Sync (bool sync_links)
 
bool IsSynced () const
 
void Unsync ()
 
bool IsULined () const
 
bool IsJuped () const
 
bool IsQuitting () const
 
void Notice (BotInfo *source, const Anope::string &message)
 
- Public Member Functions inherited from Extensible
virtual ~Extensible ()
 
template<typename T >
T * GetExt (const Anope::string &name) const
 
bool HasExt (const Anope::string &name) const
 
template<typename T >
T * Extend (const Anope::string &name, const T &what)
 
template<typename T >
T * Extend (const Anope::string &name)
 
template<typename T >
T * Require (const Anope::string &name)
 
template<typename T >
void Shrink (const Anope::string &name)
 
template<>
bool * Extend (const Anope::string &name, const bool &what)
 

Static Public Member Functions

static ServerFind (const Anope::string &name, bool name_only=false)
 
- Static Public Member Functions inherited from Extensible
static void ExtensibleSerialize (const Extensible *, const Serializable *, Serialize::Data &data)
 
static void ExtensibleUnserialize (Extensible *, Serializable *, Serialize::Data &data)
 

Data Fields

unsigned users
 
- Data Fields inherited from Extensible
std::set< ExtensibleBase * > extension_items
 

Private Member Functions

 ~Server ()
 

Private Attributes

Anope::string name
 
unsigned int hops
 
Anope::string description
 
Anope::string sid
 
std::vector< Server * > links
 
Serveruplink
 
bool syncing
 
bool juped
 
bool quitting
 
Anope::string quit_reason
 

Detailed Description

Class representing a server

Definition at line 42 of file servers.h.

Constructor & Destructor Documentation

Server::Server ( Server uplink,
const Anope::string name,
unsigned  hops,
const Anope::string description,
const Anope::string sid = "",
bool  jupe = false 
)
Server::~Server ( )
private

Member Function Documentation

void Server::AddLink ( Server s)

Adds a link to this server

Parameters
sThe linking server

Definition at line 226 of file servers.cpp.

References GetName(), and links.

Referenced by Server().

void Server::Delete ( const Anope::string reason)

Delete this server with a reason

Parameters
reasonThe reason

Definition at line 167 of file servers.cpp.

References FOREACH_MOD, quit_reason, and quitting.

Referenced by CommandOSJupe::Execute(), Message::SQuit::Run(), IRCDMessageRSQuit::Run(), and ~Server().

void Server::DelLink ( Server s)

Delinks a server from this server

Parameters
sThe server

Definition at line 233 of file servers.cpp.

References GetName(), and links.

Referenced by ~Server().

Server * Server::Find ( const Anope::string name,
bool  name_only = false 
)
static
const Anope::string & Server::GetDescription ( ) const

Get the server description

Returns
The server description

Definition at line 190 of file servers.cpp.

References description.

Referenced by Log::BuildPrefix(), and IRC2SQL::OnNewServer().

unsigned Server::GetHops ( ) const

Get the number of hops this server is from services

Returns
Number of hops

Definition at line 180 of file servers.cpp.

References hops.

Referenced by IRC2SQL::OnNewServer().

const std::vector< Server * > & Server::GetLinks ( ) const

Get the list of links this server has, or NULL if it has none

Returns
A list of servers

Definition at line 216 of file servers.cpp.

References links.

Referenced by MyXMLRPCEvent::DoStats(), CommandOSStats::DoStatsUplink(), Servers::GetUplink(), IRCDMessageBurst::Run(), GlobalCore::SendGlobal(), Server(), GlobalCore::ServerGlobal(), stats_count_servers(), and UplinkSocket::~UplinkSocket().

const Anope::string & Server::GetName ( ) const
const Anope::string & Server::GetQuitReason ( ) const

Retrieves the reason this server is quitting

Definition at line 211 of file servers.cpp.

References quit_reason.

Referenced by NickServCore::OnUserQuit().

const Anope::string & Server::GetSID ( ) const
Server * Server::GetUplink ( )

Get the uplink server for this server, if this is our uplink will be Me

Returns
The servers uplink

Definition at line 221 of file servers.cpp.

References uplink.

Referenced by Message::SQuit::Run(), IRCDMessageMetadata::Run(), IRCDMessageRSQuit::Run(), and Sync().

bool Server::IsJuped ( ) const

Check if this server is juped (a pseudoserver other than us)

Returns
true if this server is a juped server

Definition at line 319 of file servers.cpp.

References juped.

Referenced by CommandOSDNS::AddServer(), CommandOSJupe::Execute(), CommandOSNOOP::Execute(), ModuleDNS::OnNewServer(), IRCDMessageSQuit::Run(), GlobalCore::ServerGlobal(), and UplinkSocket::Message::~Message().

bool Server::IsQuitting ( ) const

Check if the server is quitting

Returns
true if this server is quitting.

Definition at line 324 of file servers.cpp.

References quitting.

Referenced by IRC2SQL::OnUserQuit().

bool Server::IsSynced ( ) const
bool Server::IsULined ( ) const

Check if this server is ULined

Returns
true or false

Definition at line 308 of file servers.cpp.

Referenced by User::IsProtected(), IRC2SQL::OnNewServer(), Channel::SetCorrectModes(), and User::User().

void Server::Notice ( BotInfo source,
const Anope::string message 
)

Send a message to alll users on this server

Parameters
sourceThe source of the message
messageThe message

Definition at line 329 of file servers.cpp.

References IRCD, IRCDProto::SendGlobalNotice(), and IRCDProto::SendGlobalPrivmsg().

Referenced by GlobalCore::ServerGlobal().

void Server::SetDescription ( const Anope::string desc)

Set the server description

Parameters
descThe new description

Definition at line 185 of file servers.cpp.

References desc, and description.

void Server::SetSID ( const Anope::string sid)

Change this servers SID

Parameters
sidThe new SID

Definition at line 195 of file servers.cpp.

References Anope::string::empty(), and sid.

Referenced by Anope::Init().

void Server::Sync ( bool  sync_links)

Finish syncing this server and optionally all links to it

Parameters
sync_linksTrue to sync the links for this server too (if any)

Definition at line 250 of file servers.cpp.

References Anope::AtTerm(), ChannelList, FOREACH_MOD, Anope::Fork(), GetUplink(), IRCD, IsSynced(), links, LOG_TERMINAL, me, Me, Anope::NoFork, IRCDProto::SendEOB(), Channel::Sync(), Sync(), Channel::syncing, and syncing.

Referenced by IRCDMessageBurst::Run(), IRCDMessageEndburst::Run(), and Sync().

void Server::Unsync ( )

Unsync the server. Only used for Me->Unsync()

Definition at line 303 of file servers.cpp.

References syncing.

Referenced by UplinkSocket::~UplinkSocket().

Field Documentation

Anope::string Server::description
private

Definition at line 50 of file servers.h.

Referenced by GetDescription(), and SetDescription().

unsigned int Server::hops
private

Definition at line 48 of file servers.h.

Referenced by GetHops().

bool Server::juped
private

Definition at line 60 of file servers.h.

Referenced by IsJuped(), and Server().

std::vector<Server *> Server::links
private

Definition at line 54 of file servers.h.

Referenced by AddLink(), DelLink(), GetLinks(), Sync(), and ~Server().

Anope::string Server::name
private

Definition at line 46 of file servers.h.

Referenced by GetName(), GetSID(), and ~Server().

Anope::string Server::quit_reason
private

Definition at line 64 of file servers.h.

Referenced by Delete(), GetQuitReason(), and ~Server().

bool Server::quitting
private

Definition at line 62 of file servers.h.

Referenced by Delete(), IsQuitting(), and Server().

Anope::string Server::sid
private

Definition at line 52 of file servers.h.

Referenced by GetSID(), SetSID(), and ~Server().

bool Server::syncing
private

Definition at line 58 of file servers.h.

Referenced by IsSynced(), Server(), Sync(), and Unsync().

Server* Server::uplink
private

Definition at line 56 of file servers.h.

Referenced by GetUplink(), Server(), and ~Server().

unsigned Server::users

Definition at line 84 of file servers.h.

Referenced by Anope::Init(), User::User(), and User::~User().


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