Table of contents Index

class SimpleIRCClient - A simple single-server IRC client class.

Declared in module irclib

Synopsis

class SimpleIRCClient:
    def __init__(self)
    def _dispatcher(self, c, e) # [Internal]
    def connect(self, server, port, nickname, password=None, username=None, ircname=None) # Connect/reconnect to a server.
    def start(self) # Start the IRC client.

Description

This is an example of an object-oriented wrapper of the IRC framework. A real IRC client can be made by subclassing this class and adding appropriate methods.

The method on_join will be called when a "join" event is created (which is done when the server sends a JOIN messsage/command), on_privmsg will be called for "privmsg" events, and so on. The handler methods get two arguments: the connection object (same as self.connection) and the event object.

Instance attributes that can be used by sub classes:

ircobj
The IRC instance.
connection
The ServerConnection instance.

connect(self, server, port, nickname, password=None, username=None, ircname=None)

Connect/reconnect to a server.

server
Server name.
port
Port number.
nickname
The nickname.
password=None
Password (if any).
username=None
The username.
ircname=None
The IRC name.
This function can be called to reconnect a closed connection.
Valid HTML 4.0! Made with CSS