import irc.client

class Client(irc.client.SimpleIRCClient):
    """\
    An IRC client to handle the most basic functionality.
    """

    def __init__(self, target):
        super(Client, self).__init__()
        self.target = target

    def on_welcome(self, conn, event):
        """\
        What should I do when I'm connected to a server.
        """
        if irc.client.is_channel(self.target): # Join it if `target` is a channel
            conn.join(self.target)
        else: # TODO: What should I do when `target` is not a channel?
            # conn.privmsg(self.target, "hey sexy")
            # conn.quit("leaving the party")
            pass

    def on_join(self, conn, event):
        """\
        What should I do when I join a channel.
        """
        pass # TODO: Implement

    def on_disconnect(self, conn, event):
        """\
        What should I do on disconnect.
        """
        pass # TODO: Implement


@@ -1,8 +1,19 @@
+import ssl%0A
 import i
@@ -40,33 +40,13 @@
 ent(
-irc.client.SimpleIRCClien
+objec
 t):%0A
@@ -146,86 +146,1043 @@
 self
-, target):%0A        super(Client, self).__init__()%0A        self.target = target
+):%0A        self.ircobj = irc.client.IRC()%0A        self.ircobj.add_global_handler('all_events', self._dispatcher, -10)%0A%0A    def connect(self, *args, **kwargs):%0A        %22%22%22%5C%0A        Connect to an IRC server.%0A%0A        :param server: Server name.%0A        :param port: Port number.%0A        :param nickname: The nickname.%0A        :param password: Password (optional).%0A        :param username: The username (optional).%0A        :param ircname: The realname (optional).%0A        %22%22%22%0A        self._connect(*args, **kwargs)%0A%0A    def ssl_connect(self, *args, **kwargs):%0A        %22%22%22%5C%0A        Connect to an IRC server over SSL.%0A%0A        :param server: Server name.%0A        :param port: Port number.%0A        :param nickname: The nickname.%0A        :param password: Password (optional).%0A        :param username: The username (optional).%0A        :param ircname: The realname (optional).%0A        %22%22%22%0A        ssl_factory = irc.connection.Factory(wrapper=ssl.wrap_socket)%0A        kwargs%5B'connect_factory'%5D = ssl_factory%0A        self.connect(*args, **kwargs)
 %0A%0A  
@@ -1863,28 +1863,625 @@
     pass # TODO: Implement%0A%0A
+    def on_kick(self, conn, event):%0A        %22%22%22%5C%0A        What should I do when kicked out of a channel.%0A        %22%22%22%0A        pass # TODO: Implement%0A%0A    def _dispatcher(self, conn, event):%0A        %22%22%22%5C%0A        Dispatch events to an event handler if one is available.%0A        %22%22%22%0A        do_nothing = lambda c, e: None%0A        method = getattr(self, %22on_%7B%7D%22.format(event.type), do_nothing)%0A        method(connection, event)%0A%0A    def _connect(self, *args, **kwargs):%0A        %22%22%22%5C%0A        Create a new connection.%0A        %22%22%22%0A        conn = self.ircobj.server()%0A        conn.connect(*args, **kwargs)%0A%0A

Add basic IRC client