'Login: send the username, send the password.
If the password is L{None}, the PASS command won\'t be sent.  Also, if
the response to the USER command has a response code of 230 (User logged
in), then PASS won\'t be sent either.'

def queueLogin(self, username, password):

    deferreds = []
    userDeferred = self.queueStringCommand(('USER    ' + username), public=0)
    deferreds.append(userDeferred)
    if (password is not None):
        passwordCmd = FTPCommand(('PASS    ' + password), public=0)
        self.queueCommand(passwordCmd)
        deferreds.append(passwordCmd.deferred)
        def cancelPasswordIfNotNeeded(response):
            if response[0].startswith('230'):
                self.actionQueue.remove(passwordCmd)
            return response
        userDeferred.addCallback(cancelPasswordIfNotNeeded)
    for deferred in deferreds:
        deferred.addErrback(self.fail)
        deferred.addErrback((lambda x: None))
