bouncer module¶
Sputnik Bouncer Implementation
This module provides the Sputnik Bouncer implementation. As the primary entry point, the Bouncer is responsible for bootstrapping the entire program.
-
class
bouncer.
Bouncer
[source]¶ Bases:
object
A singleton that manages connected devices.
The Bouncer provides the base functionality needed to instantiate a new Client or Network. It also acts as a bridge between connected Clients and Networks by maintaining an authoritative record of each connected device.
-
clients
¶ set of sputnik.Client
A set of connected Clients.
-
datastore
¶ sputnik.Datastore
A Redis interface.
-
networks
¶ dict of sputnik.Network
A dictionary of connected Networks.
-
add_network
(network, hostname, port, nickname, username, realname, password=None, usermode=0)[source]¶ Connects the Bouncer to an IRC network.
This forms the credentials into a dictionary. It then registers the network in the datastore, and connects to the indicated IRC network.
Parameters: - network (str) – The name of the IRC network to connect to.
- hostname (str) – The hostname of the IRC network to connect to.
- port (int) – The port to connect using.
- nickname (str) – The IRC nickname to use when connecting.
- username (str) – The IRC ident to use when connecting.
- realname (str) – The real name of the user.
- password (str, optional) – Bouncer password. Defaults to
None
. - usermode (int, optional) – The IRC usermode. Defaults to
0
.
-
remove_network
(network)[source]¶ Removes a network from the Bouncer.
This disconnects the Bouncer from the indicated network and unregisters the network from the datastore.
Parameters: network (str) – the name of a network.
-
start
(hostname='', port=6667)[source]¶ Starts the IRC and HTTP listen servers.
This creates the IRC server-portion of the Bouncer, allowing it to accept connections from IRC clients. It also starts the HTTP server, enabling browsers to connect to the web interface.
Note
This is a blocking call.
Parameters: - hostname (str, optional) – Hostname to use. Defaults to
""
. - port (int, optional) – The port to listen on. Defaults to 6667.
- hostname (str, optional) – Hostname to use. Defaults to
-