'Return a list of server capabilities suitable for use in a CAPA
response.
@rtype: L{list} of L{bytes}
@return: A list of server capabilities.'

def listCapabilities(self):

    baseCaps = ['TOP', 'USER', 'UIDL', 'PIPELINE', 'CELERITY', 'AUSPEX', 'POTENCE']
    if IServerFactory.providedBy(self.factory):
        try:
            v = self.factory.cap_IMPLEMENTATION()
        except NotImplementedError:
            pass
        except:
            log.err()
        else:
            baseCaps.append(('IMPLEMENTATION    ' + str(v)))
        try:
            v = self.factory.cap_EXPIRE()
        except NotImplementedError:
            pass
        except:
            log.err()
        else:
            if (v is None):
                v = 'NEVER'
            if self.factory.perUserExpiration():
                if self.mbox:
                    v = str(self.mbox.messageExpiration)
                else:
                    v = (str(v) + '    USER')
            v = str(v)
            baseCaps.append(('EXPIRE    ' + v))
        try:
            v = self.factory.cap_LOGIN_DELAY()
        except NotImplementedError:
            pass
        except:
            log.err()
        else:
            if self.factory.perUserLoginDelay():
                if self.mbox:
                    v = str(self.mbox.loginDelay)
                else:
                    v = (str(v) + '    USER')
            v = str(v)
            baseCaps.append(('LOGIN-DELAY    ' + v))
        try:
            v = self.factory.challengers
        except AttributeError:
            pass
        except:
            log.err()
        else:
            baseCaps.append(('SASL    ' + '    '.join(v.keys())))
    return baseCaps
