Comparing version 1.0.38 to 1.0.39
@@ -15,59 +15,70 @@ 'use strict'; | ||
let entries = []; | ||
response = await connection.exec(listCommand, [normalizePath(connection, reference || ''), normalizePath(connection, mailbox || '', true)], { | ||
untagged: { | ||
[listCommand]: async untagged => { | ||
if (!untagged.attributes || !untagged.attributes.length) { | ||
return; | ||
} | ||
let entry = { | ||
path: (untagged.attributes[2] && untagged.attributes[2].value) || '', | ||
flags: new Set(untagged.attributes[0].map(entry => entry.value)), | ||
delimiter: (untagged.attributes[1] && untagged.attributes[1].value) || connection.namespace.prefix, | ||
listed: true | ||
}; | ||
let runList = async (reference, mailbox) => { | ||
response = await connection.exec(listCommand, [reference, mailbox], { | ||
untagged: { | ||
[listCommand]: async untagged => { | ||
if (!untagged.attributes || !untagged.attributes.length) { | ||
return; | ||
} | ||
if (listCommand === 'XLIST' && entry.flags.has('\\Inbox')) { | ||
// XLIST specific flag, ignore | ||
entry.flags.delete('\\Inbox'); | ||
if (entry.path !== 'INBOX') { | ||
// XLIST may use localised inbox name | ||
let entry = { | ||
path: (untagged.attributes[2] && untagged.attributes[2].value) || '', | ||
flags: new Set(untagged.attributes[0].map(entry => entry.value)), | ||
delimiter: (untagged.attributes[1] && untagged.attributes[1].value) || connection.namespace.prefix, | ||
listed: true | ||
}; | ||
if (listCommand === 'XLIST' && entry.flags.has('\\Inbox')) { | ||
// XLIST specific flag, ignore | ||
entry.flags.delete('\\Inbox'); | ||
if (entry.path !== 'INBOX') { | ||
// XLIST may use localised inbox name | ||
entry.specialUse = '\\Inbox'; | ||
} | ||
} | ||
if (entry.path.toUpperCase() === 'INBOX') { | ||
entry.specialUse = '\\Inbox'; | ||
} | ||
} | ||
if (entry.path.toUpperCase() === 'INBOX') { | ||
entry.specialUse = '\\Inbox'; | ||
} | ||
if (entry.path.charAt(0) === entry.delimiter) { | ||
entry.path = entry.path.slice(1); | ||
} | ||
if (entry.path.charAt(0) === entry.delimiter) { | ||
entry.path = entry.path.slice(1); | ||
} | ||
entry.parent = entry.path.split(entry.delimiter).map(folder => { | ||
if (!connection.enabled.has('UTF8=ACCEPT')) { | ||
try { | ||
return utf7.decode(folder); | ||
} catch (err) { | ||
entry.parent = entry.path.split(entry.delimiter).map(folder => { | ||
if (!connection.enabled.has('UTF8=ACCEPT')) { | ||
try { | ||
return utf7.decode(folder); | ||
} catch (err) { | ||
return folder; // keep as is | ||
} | ||
} else { | ||
return folder; // keep as is | ||
} | ||
} else { | ||
return folder; // keep as is | ||
}); | ||
entry.path = normalizePath(connection, entry.path); | ||
entry.name = entry.parent.pop(); | ||
let specialUseFlag = specialUse(connection.capabilities.has('XLIST') || connection.capabilities.has('SPECIAL-USE'), entry); | ||
if (specialUseFlag && !flagsSeen.has(specialUseFlag)) { | ||
entry.specialUse = specialUseFlag; | ||
} | ||
}); | ||
entry.path = normalizePath(connection, entry.path); | ||
entry.name = entry.parent.pop(); | ||
let specialUseFlag = specialUse(connection.capabilities.has('XLIST') || connection.capabilities.has('SPECIAL-USE'), entry); | ||
if (specialUseFlag && !flagsSeen.has(specialUseFlag)) { | ||
entry.specialUse = specialUseFlag; | ||
entries.push(entry); | ||
} | ||
entries.push(entry); | ||
} | ||
} | ||
}); | ||
response.next(); | ||
}); | ||
response.next(); | ||
}; | ||
let normalizedReference = normalizePath(connection, reference || ''); | ||
await runList(normalizedReference, normalizePath(connection, mailbox || '', true)); | ||
if (normalizedReference && !entries.find(entry => entry.specialUse === '\\Inbox')) { | ||
// INBOX was most probably not included in the listing if namespace was used | ||
await runList('', 'INBOX'); | ||
} | ||
response = await connection.exec('LSUB', [normalizePath(connection, reference || ''), normalizePath(connection, mailbox || '', true)], { | ||
@@ -124,2 +135,9 @@ untagged: { | ||
response.next(); | ||
let inboxEntry = entries.find(entry => entry.specialUse === '\\Inbox'); | ||
if (inboxEntry && !inboxEntry.subscribed) { | ||
// override server settings and make INBOX always as subscribed | ||
inboxEntry.subscribed = true; | ||
} | ||
return entries; | ||
@@ -126,0 +144,0 @@ } catch (err) { |
{ | ||
"name": "imapflow", | ||
"version": "1.0.38", | ||
"version": "1.0.39", | ||
"description": "IMAP Client for Node", | ||
@@ -41,3 +41,3 @@ "main": "./lib/imap-flow.js", | ||
"dependencies": { | ||
"@types/node": "13.9.2", | ||
"@types/node": "13.9.8", | ||
"encoding-japanese": "1.0.30", | ||
@@ -49,5 +49,5 @@ "iconv-lite": "0.5.1", | ||
"mailsplit": "4.6.4", | ||
"pino": "5.17.0", | ||
"pino": "6.0.0", | ||
"utf7": "1.0.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
520502
10940
+ Added@types/node@13.9.8(transitive)
+ Addedpino@6.0.0(transitive)
+ Addedquick-format-unescaped@4.0.4(transitive)
+ Addedsonic-boom@1.4.1(transitive)
- Removed@types/node@13.9.2(transitive)
- Removedpino@5.17.0(transitive)
- Removedquick-format-unescaped@3.0.3(transitive)
- Removedsonic-boom@0.7.7(transitive)
Updated@types/node@13.9.8
Updatedpino@6.0.0