Beispiel #1
0
    def __init__(self, address, socket=None, factory=None):
        """
        Base class for IRC connections.

        address: A tuple containing the remote host/IP and port
                 of the connection
        socket: An existing socket for the connection, or None
                if a new connection is to be established.
        factory: The factory that was used to create this object.
        """

        self.socket_address = address
        self.socket = socket
        self.factory = factory

        evt = Event()
        evt.bind(self.__class__.connection_closed_event, filter=match_source(self))
        self.connection_closed_event = evt
        
        evt = Event()
        evt.bind(self.__class__.registration_event, filter=match_source(self))
        self.registration_event = evt
        
        evt = Event()
        evt.bind(self.__class__.command_received_event, filter=match_source(self))
        self.command_received_event = evt

        self.me = Nick(self)
        self.server = Nick(self)

        self.registered = False
        self.away = False
        self.realname = None
        self.usermodes = ''

        self.nicks = WeakValueDictionary()
        self.channels = {}

        self.isupport = {
            'CHANMODES': 'bIe,k,l',
            'CHANTYPES': '#&+',
            'PREFIX': '(ov)@+',
            'NAMESX': ''
        }

        self.motd = []

        self.owner = None

        self._registration_timeout = None
Beispiel #2
0
    def __init__(self, address, socket, factory=None):
        _BaseConnection.__init__(self, address=address, socket=socket, factory=factory)

        self.me.host = self.socket_address[0]
        self.server.nick = ClientConnection.DEFAULT_SERVERNAME
        
        evt = Event()
        evt.bind(ClientConnection.authentication_event, filter=match_source(self))
        self.authentication_event = evt
        
        self._password = None
Beispiel #3
0
    def __init__(self, cls):
        evt = Event()
        evt.bind(ConnectionFactory.new_connection_event, filter=match_source(self))
        self.new_connection_event = evt

        self._cls = cls