2017-03-06 05:45:50 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
handler(command, callback) {
|
|
|
|
|
|
|
|
let capabilities = [];
|
|
|
|
|
|
|
|
if (!this.secure) {
|
|
|
|
capabilities.push('STARTTLS');
|
|
|
|
if (!this._server.options.ignoreSTARTTLS) {
|
|
|
|
capabilities.push('LOGINDISABLED');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.state === 'Not Authenticated') {
|
|
|
|
capabilities.push('AUTH=PLAIN');
|
|
|
|
capabilities.push('ID');
|
|
|
|
capabilities.push('SASL-IR');
|
2017-03-11 21:20:47 +08:00
|
|
|
capabilities.push('ENABLE');
|
2017-03-06 05:45:50 +08:00
|
|
|
} else {
|
|
|
|
capabilities.push('CHILDREN');
|
|
|
|
capabilities.push('ID');
|
|
|
|
capabilities.push('IDLE');
|
|
|
|
capabilities.push('NAMESPACE');
|
|
|
|
capabilities.push('SPECIAL-USE');
|
|
|
|
capabilities.push('UIDPLUS');
|
|
|
|
capabilities.push('UNSELECT');
|
2017-03-11 21:20:47 +08:00
|
|
|
capabilities.push('ENABLE');
|
|
|
|
capabilities.push('CONDSTORE');
|
2017-03-21 06:07:23 +08:00
|
|
|
capabilities.push('UTF8=ACCEPT');
|
2017-03-27 15:36:45 +08:00
|
|
|
capabilities.push('QUOTA');
|
|
|
|
|
2017-03-30 02:22:26 +08:00
|
|
|
capabilities.push('MOVE');
|
2017-03-30 01:06:09 +08:00
|
|
|
|
2017-03-27 15:36:45 +08:00
|
|
|
if (this._server.options.maxMessage) {
|
|
|
|
capabilities.push('APPENDLIMIT=' + this._server.options.maxMessage);
|
|
|
|
}
|
2017-03-06 05:45:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
capabilities.sort((a, b) => a.localeCompare(b));
|
|
|
|
|
|
|
|
this.send('* CAPABILITY ' + ['IMAP4rev1'].concat(capabilities).join(' '));
|
|
|
|
|
|
|
|
callback(null, {
|
|
|
|
response: 'OK'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|