Fixed LIST

This commit is contained in:
Andris Reinman 2017-05-16 15:23:08 +03:00
parent fe5d3f123c
commit 8e42c4eb5b
2 changed files with 35 additions and 5 deletions

View file

@ -133,12 +133,22 @@ module.exports = {
};
if (!mailbox) {
if (!mailbox && !filterSpecialUseFlags) {
// return delimiter only
return listResponse(null, [{
path: '/',
flags: '\\Noselect'
}]);
let response = {
tag: '*',
command: 'LIST',
attributes: [
[{
type: 'atom',
value: '\\Noselect'
}], '/', '/'
]
};
this.send(imapHandler.compiler(response));
return callback(null, {
response: 'OK'
});
}
// Do folder listing

View file

@ -241,6 +241,26 @@ describe('IMAP Protocol integration tests', function () {
});
describe('LIST', function () {
it('should list delimiter', function (done) {
let cmds = [
'T1 LOGIN testuser pass',
'T2 LIST "" ""',
'T3 LOGOUT'
];
testClient({
commands: cmds,
secure: true,
port
}, function (resp) {
resp = resp.toString();
expect(resp.match(/^\* LIST /mg).length).to.equal(1);
expect(resp.indexOf('\r\n* LIST (\\Noselect) "/" "/"\r\n') >= 0).to.be.true;
expect(/^T2 OK/m.test(resp)).to.be.true;
done();
});
});
it('should list all mailboxes', function (done) {
let cmds = [
'T1 LOGIN testuser pass',