Class ServerConnection

Table of contents Index

# class ServerConnection - This class represents an IRC server connection.

Declared in module irclib

## Inheritance hierarchy:

irclib.ServerConnection
irclib.Connection

## Synopsis

    class ServerConnection(Connection):
        def __init__(self, irclibobj)
        def _get_socket(self) # [Internal]
        def _handle_event(self, event) # [Internal]
        def action(self, target, action) # Send a CTCP ACTION command.
        def add_global_handler(self, *args) # Add global handler.
        def admin(self, server='') # Send an ADMIN command.
        def close(self) # Close the connection.
        def connect(self, server, port, nickname, password=None, username=None, ircname=None) # Connect/reconnect to a server.
        def ctcp(self, ctcptype, target, parameter='') # Send a CTCP command.
        def ctcp_reply(self, target, parameter) # Send a CTCP REPLY command.
        def disconnect(self, message='') # Hang up the connection.
        def get_nickname(self) # Get the (real) nick name.
        def get_server_name(self) # Get the (real) server name.
        def globops(self, text) # Send a GLOBOPS command.
        def info(self, server='') # Send an INFO command.
        def invite(self, nick, channel) # Send an INVITE command.
        def is_connected(self) # Return connection status.
        def ison(self, nicks) # Send an ISON command.
        def join(self, channel, key='') # Send a JOIN command.
        def kick(self, channel, nick, comment='') # Send a KICK command.
        def links(self, remote_server='', server_mask='') # Send a LINKS command.
        def list(self, channels=None, server='') # Send a LIST command.
        def lusers(self, server='') # Send a LUSERS command.
        def mode(self, target, command) # Send a MODE command.
        def motd(self, server='') # Send an MOTD command.
        def names(self, channels=None) # Send a NAMES command.
        def nick(self, newnick) # Send a NICK command.
        def notice(self, target, text) # Send a NOTICE command.
        def oper(self, nick, password) # Send an OPER command.
        def part(self, channels) # Send a PART command.
        def pass_(self, password) # Send a PASS command.
        def ping(self, target, target2='') # Send a PING command.
        def pong(self, target, target2='') # Send a PONG command.
        def privmsg(self, target, text) # Send a PRIVMSG command.
        def privmsg_many(self, targets, text) # Send a PRIVMSG command to multiple targets.
        def process_data(self) # [Internal]
        def quit(self, message='') # Send a QUIT command.
        def sconnect(self, target, port='', server='') # Send an SCONNECT command.
        def send_raw(self, string) # Send raw string to the server.
        def squit(self, server, comment='') # Send an SQUIT command.
        def stats(self, statstype, server='') # Send a STATS command.
        def time(self, server='') # Send a TIME command.
        def topic(self, channel, new_topic=None) # Send a TOPIC command.
        def trace(self, target='') # Send a TRACE command.
        def user(self, username, localhost, server, ircname) # Send a USER command.
        def userhost(self, nicks) # Send a USERHOST command.
        def users(self, server='') # Send a USERS command.
        def version(self, server='') # Send a VERSION command.
        def wallops(self, text) # Send a WALLOPS command.
        def who(self, target='', op='') # Send a WHO command.
        def whois(self, targets) # Send a WHOIS command.
        def whowas(self, nick, max=None, server='') # Send a WHOWAS command.

        # Inherited from irclib.Connection
        def __init__(self, irclibobj)
        def _get_socket()
        def execute_at(self, at, function, arguments=())
        def execute_delayed(self, delay, function, arguments=())

## Description

ServerConnection objects are instantiated by calling the server method on an IRC object.

## add_global_handler(self, *args)

Add global handler.

See documentation for IRC.add_global_handler.

## close(self)

Close the connection.

This method closes the connection permanently; after it has been called, the object is unusable.

## 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.

Returns the ServerConnection object.

## get_nickname(self)

Get the (real) nick name.

This method returns the (real) nickname. The library keeps track of nick changes, so it might not be the nick name that was passed to the connect() method.

## get_server_name(self)

Get the (real) server name.

This method returns the (real) server name, or, more specifically, what the server calls itself.

## is_connected(self)

Return connection status.

Returns true if connected, otherwise false.

## send_raw(self, string)

Send raw string to the server.

The string will be padded with appropriate CR LF.