'Login to the server.
@type nickname: C{str}
@param nickname: The nickname to register.
@type hostname: C{str}
@param hostname: If specified, the hostname to logon as.
@type servername: C{str}
@param servername: If specified, the servername to logon as.'

def register(self, nickname, hostname='foo', servername='bar'):

    if (self.password is not None):
        self.sendLine(('PASS    %s' % self.password))
    self.setNick(nickname)
    if (self.username is None):
        self.username = nickname
    self.sendLine(('USER    %s    %s    %s    :%s' % (self.username, hostname, servername, self.realname)))
