client module

Sputnik Client Implementation

This module provides the Sputnik Client implementation. This is a subclass of a Connection, and defines an interface to IRC client applications implementing _RFC 2812: https://tools.ietf.org/html/rfc2812 .

class client.Client(bouncer)[source]

Bases: connection.Connection

An instance of a connection from an IRC client.

A Client is the product of an asyncio protocol factory, and represents an instance of a connection from an IRC client to the listen server. It does not implement an actual IRC client, as defined in _RFC 2812: https://tools.ietf.org/html/rfc2812 .

bouncer

sputnik.Bouncer

A reference to the Bouncer singleton.

broker

sputnik.Network

The connected Network instance.

network

str

The name of the IRC network to connect to.

ready

bool

Indicates if the Client has connected to a Network.

connection_lost(exc)[source]

Unregister the connected Client from the Bouncer.

Removes the Client from the set of connected Clients in the Bouncer before the connection is terminated. After this point, there should be no remaining references to this instance of the Client.

connection_made(transport)[source]

Registers the connected Client with the Bouncer.

Adds the Client to the set of connected Clients in the Bouncer and saves the transport for later use.

data_received(data)[source]

Handles incoming messages from connected IRC clients.

Messages coming from IRC clients are potentially batched, and need to be parsed into individual lines before any other operation may occur. Afterwards, we split lines according to the IRC message format and then perform actions as appropriate.

forward(*args)[source]

Writes a message to the Network.

Because the Client represents an instance of a connection from an IRC client, we instead need to write to the transport associated with the connected network.

Parameters:args (list of str) – A list of strings to concatenate.