Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

imapflow

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imapflow - npm Package Compare versions

Comparing version 1.0.38 to 1.0.39

106

lib/commands/list.js

@@ -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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc