irccd  3.0.3
Public Member Functions | List of all members
irccd::daemon::server_service Class Reference

Manage IRC servers. More...

#include <server_service.hpp>

Public Member Functions

 server_service (bot &bot)
 
auto list () const noexcept -> const std::vector< std::shared_ptr< server >> &
 
auto has (std::string_view id) const noexcept -> bool
 
void add (std::shared_ptr< server > sv)
 
auto get (std::string_view id) const noexcept -> std::shared_ptr< server >
 
auto require (std::string_view id) const -> std::shared_ptr< server >
 
void disconnect (std::string_view id)
 
void disconnect ()
 
void reconnect (std::string_view id)
 
void reconnect ()
 
void remove (std::string_view id)
 
void clear () noexcept
 
void load (const config &cfg) noexcept
 

Detailed Description

Manage IRC servers.

This class holds servers and wait for IRC events to come and then are dispatched through the plugins.

Constructor & Destructor Documentation

◆ server_service()

irccd::daemon::server_service::server_service ( bot bot)

Create the server service.

Parameters
botthe irccd instance

Member Function Documentation

◆ add()

void irccd::daemon::server_service::add ( std::shared_ptr< server sv)

Add a new server to the application.

Parameters
svthe server
Exceptions
server_erroron errors

◆ clear()

void irccd::daemon::server_service::clear ( )
noexcept

Remove all servers.

All servers will be disconnected.

◆ disconnect() [1/2]

void irccd::daemon::server_service::disconnect ( )

Disconnect all servers.

◆ disconnect() [2/2]

void irccd::daemon::server_service::disconnect ( std::string_view  id)

Force disconnection, this also call plugin::handle_disconnect handler.

Parameters
idthe server identifier
Exceptions
server_erroron errors

◆ get()

auto irccd::daemon::server_service::get ( std::string_view  id) const -> std::shared_ptr< server >
noexcept

Get a server or empty one if not found

Parameters
idthe server identifier
Returns
the server or empty one if not found

◆ has()

auto irccd::daemon::server_service::has ( std::string_view  id) const -> bool
noexcept

Check if a server exists.

Parameters
idthe server identifier
Returns
true if exists

◆ list()

auto irccd::daemon::server_service::list ( ) const -> const std::vector< std::shared_ptr< server >> &
noexcept

Get the list of servers

Returns
the servers

◆ load()

void irccd::daemon::server_service::load ( const config cfg)
noexcept

Load servers from the configuration.

Parameters
cfgthe config

◆ reconnect() [1/2]

void irccd::daemon::server_service::reconnect ( )

Force reconnection of all servers.

◆ reconnect() [2/2]

void irccd::daemon::server_service::reconnect ( std::string_view  id)

Force reconnection, this also call plugin::handle_disconnect handler.

Parameters
idthe server identifier
Returns
the server
Exceptions
server_erroron errors

◆ remove()

void irccd::daemon::server_service::remove ( std::string_view  id)

Remove a server from the irccd instance.

The server if any, will be disconnected.

Parameters
idthe server identifier

◆ require()

auto irccd::daemon::server_service::require ( std::string_view  id) const -> std::shared_ptr< server >

Find a server from a JSON object.

Parameters
idthe server identifier
Returns
the server
Exceptions
server_erroron errors

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