This commit is contained in:
Andris Reinman 2019-05-07 10:27:30 +03:00
parent ad24d15d8d
commit 5297a6edbf
5 changed files with 44 additions and 13 deletions

View file

@ -1,5 +1,7 @@
'use strict';
process.env.NODE_ENV = 'test';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
@ -43,4 +45,5 @@ module.exports = function(grunt) {
// Tasks
grunt.registerTask('default', ['eslint', 'shell:server', 'wait:server', 'mochaTest', 'shell:server:kill']);
grunt.registerTask('testonly', ['shell:server', 'wait:server', 'mochaTest', 'shell:server:kill']);
};

View file

@ -50,6 +50,9 @@ module.exports = {
let flagsExist = false;
let uidExist = false;
let modseqExist = false;
let bodystructureExist = true;
let rfc822sizeExist = true;
let envelopeExist = true;
let markAsSeen = false;
let metadataOnly = true;
let changedSince = 0;
@ -115,6 +118,18 @@ module.exports = {
modseqExist = true;
}
if (param.value.toUpperCase() === 'BODYSTRUCTURE') {
bodystructureExist = true;
}
if (param.value.toUpperCase() === 'RFC822.SIZE') {
rfc822sizeExist = true;
}
if (param.value.toUpperCase() === 'ENVELOPE') {
envelopeExist = true;
}
if (!this.selected.readOnly) {
if (param.value.toUpperCase() === 'BODY' && param.section) {
// BODY[...]
@ -129,7 +144,7 @@ module.exports = {
param.value = 'BODY';
}
if (['BODY', 'RFC822', 'RFC822.SIZE', 'RFC822.HEADER', 'RFC822.TEXT', 'BODYSTRUCTURE'].indexOf(param.value.toUpperCase()) >= 0) {
if (['BODY', 'RFC822', 'RFC822.HEADER', 'RFC822.TEXT'].indexOf(param.value.toUpperCase()) >= 0) {
metadataOnly = false;
}
}
@ -257,6 +272,9 @@ module.exports = {
this._server.onFetch(
this.selected.mailbox,
{
bodystructureExist,
rfc822sizeExist,
envelopeExist,
metadataOnly: !!metadataOnly,
markAsSeen: !!markAsSeen,
messages,

View file

@ -1211,7 +1211,7 @@ describe('IMAP Protocol integration tests', function() {
describe('Multiple values', function() {
it('should list mixed data', function(done) {
let cmds = ['T1 LOGIN testuser pass', 'T2 SELECT INBOX', 'T3 FETCH 1:* (UID BODYSTRUCTURE ENVELOPE)', 'T4 LOGOUT'];
console.log(cmds);
testClient(
{
commands: cmds,
@ -1220,6 +1220,7 @@ describe('IMAP Protocol integration tests', function() {
},
function(resp) {
resp = resp.toString();
console.log(resp);
expect(
resp
.slice(/\n/)

View file

@ -55,12 +55,21 @@ module.exports = (server, messageHandler, userCache) => (mailbox, options, sessi
uid: true,
modseq: true,
idate: true,
flags: true,
envelope: true,
bodystructure: true,
size: true
flags: true
};
if (options.bodystructureExist) {
projection.bodystructure = true;
}
if (options.rfc822sizeExist) {
projection.size = true;
}
if (options.envelopeExist) {
projection.envelope = true;
}
if (!options.metadataOnly) {
projection.mimeTree = true;
}

View file

@ -1,6 +1,6 @@
{
"name": "wildduck",
"version": "1.18.1",
"version": "1.19.0",
"description": "IMAP/POP3 server built with Node.js and MongoDB",
"main": "server.js",
"scripts": {
@ -29,8 +29,8 @@
"grunt-shell-spawn": "0.4.0",
"grunt-wait": "0.3.0",
"icedfrisby": "1.5.0",
"mailparser": "2.6.0",
"mocha": "5.2.0",
"mailparser": "2.7.1",
"mocha": "6.1.4",
"request": "2.88.0"
},
"dependencies": {
@ -51,9 +51,9 @@
"js-yaml": "3.13.1",
"key-fingerprint": "1.1.0",
"libbase64": "1.0.3",
"libmime": "4.0.1",
"libmime": "4.1.1",
"libqp": "1.1.0",
"mailsplit": "4.3.1",
"mailsplit": "4.4.1",
"mobileconfig": "2.2.0",
"mongo-cursor-pagination": "7.1.0",
"mongodb": "3.2.3",
@ -61,11 +61,11 @@
"node-forge": "0.8.2",
"nodemailer": "6.1.1",
"npmlog": "4.1.2",
"openpgp": "4.4.10",
"openpgp": "4.5.1",
"pem": "1.14.2",
"pwnedpasswords": "1.0.4",
"qrcode": "1.3.3",
"restify": "8.3.1",
"restify": "8.3.2",
"restify-logger": "2.0.1",
"seq-index": "1.1.0",
"smtp-server": "3.5.0",