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

imap-client

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imap-client - npm Package Compare versions

Comparing version 0.3.8 to 0.4.0

2

package.json
{
"name": "imap-client",
"version": "0.3.8",
"version": "0.4.0",
"scripts": {

@@ -5,0 +5,0 @@ "pretest": "cd node_modules/node-forge/ && npm install && npm run minify && cd ../..",

@@ -443,2 +443,5 @@ (function(factory) {

* Provides the well known folders: Drafts, Sent, Inbox, Trash, Flagged, etc. No-op if not logged in.
* Since there may actually be multiple sent folders (e.g. one is default, others were created by Thunderbird,
* Outlook, another accidentally matched the naming), we return the well known folders as an array to avoid false positives.
*
* @param {Function} callback(error, folders) will be invoked as soon as traversal is done;

@@ -457,3 +460,11 @@ */

var wellKnownFolders = {
other: []
Inbox: [],
Drafts: [],
All: [],
Flagged: [],
Sent: [],
Trash: [],
Junk: [],
Archive: [],
Other: []
};

@@ -475,37 +486,38 @@

function walkMailbox(mailbox) {
if (mailbox.name && mailbox.path) {
if (mailbox.path && (mailbox.flags || []).indexOf("\\Noselect") === -1) {
// only list mailboxes here that have a path and are selectable
axe.debug(DEBUG_TAG, 'name: ' + mailbox.name + ', path: ' + mailbox.path + (mailbox.flags ? (', flags: ' + mailbox.flags) : '') + (mailbox.specialUse ? (', special use: ' + mailbox.specialUse) : ''));
var folder = {
name: mailbox.name,
name: mailbox.name || mailbox.path,
path: mailbox.path
};
if (mailbox.name.toUpperCase() === 'INBOX' && !wellKnownFolders.inbox) {
if (folder.name.toUpperCase() === 'INBOX') {
folder.type = 'Inbox';
wellKnownFolders.inbox = folder;
} else if (mailbox.specialUse === '\\Drafts' && !wellKnownFolders.drafts) {
wellKnownFolders.Inbox.push(folder);
} else if (mailbox.specialUse === '\\Drafts') {
folder.type = 'Drafts';
wellKnownFolders.drafts = folder;
} else if (mailbox.specialUse === '\\All' && !wellKnownFolders.all) {
wellKnownFolders.Drafts.push(folder);
} else if (mailbox.specialUse === '\\All') {
folder.type = 'All';
wellKnownFolders.all = folder;
} else if (mailbox.specialUse === '\\Flagged' && !wellKnownFolders.flagged) {
wellKnownFolders.All.push(folder);
} else if (mailbox.specialUse === '\\Flagged') {
folder.type = 'Flagged';
wellKnownFolders.flagged = folder;
} else if (mailbox.specialUse === '\\Sent' && !wellKnownFolders.sent) {
wellKnownFolders.Flagged.push(folder);
} else if (mailbox.specialUse === '\\Sent') {
folder.type = 'Sent';
wellKnownFolders.sent = folder;
} else if (mailbox.specialUse === '\\Trash' && !wellKnownFolders.trash) {
wellKnownFolders.Sent.push(folder);
} else if (mailbox.specialUse === '\\Trash') {
folder.type = 'Trash';
wellKnownFolders.trash = folder;
} else if (mailbox.specialUse === '\\Junk' && !wellKnownFolders.junk) {
wellKnownFolders.Trash.push(folder);
} else if (mailbox.specialUse === '\\Junk') {
folder.type = 'Junk';
wellKnownFolders.junk = folder;
} else if (mailbox.specialUse === '\\Archive' && !wellKnownFolders.archive) {
wellKnownFolders.Junk.push(folder);
} else if (mailbox.specialUse === '\\Archive') {
folder.type = 'Archive';
wellKnownFolders.archive = folder;
wellKnownFolders.Archive.push(folder);
} else {
folder.type = 'Other';
wellKnownFolders.other.push(folder);
wellKnownFolders.Other.push(folder);
}

@@ -515,2 +527,3 @@ }

if (mailbox.children) {
// walk the child mailboxes recursively
mailbox.children.forEach(walkMailbox);

@@ -673,7 +686,6 @@ }

answered: (message.flags || []).indexOf('\\Answered') > -1,
bodystructure: message.bodystructure || {},
bodyParts: []
};
walkMimeTree(cleansed.bodystructure, cleansed);
walkMimeTree((message.bodystructure || {}), cleansed);
cleansed.encrypted = cleansed.bodyParts.filter(function(bodyPart) {

@@ -680,0 +692,0 @@ return bodyPart.type === 'encrypted';

@@ -52,13 +52,19 @@ (function(factory) {

expect(folders.inbox).to.exist;
expect(folders.inbox.name).to.exist;
expect(folders.inbox.type).to.exist;
expect(folders.inbox.path).to.exist;
expect(folders.Inbox).to.be.instanceof(Array);
expect(folders.Inbox[0]).to.exist;
expect(folders.Inbox[0].name).to.exist;
expect(folders.Inbox[0].type).to.exist;
expect(folders.Inbox[0].path).to.exist;
expect(folders.drafts).to.exist;
expect(folders.sent).to.exist;
expect(folders.trash).to.exist;
expect(folders.Drafts).to.be.instanceof(Array);
expect(folders.Drafts).to.not.be.empty;
expect(folders.other).to.be.instanceof(Array);
expect(folders.Sent).to.be.instanceof(Array);
expect(folders.Sent).to.not.be.empty;
expect(folders.Trash).to.be.instanceof(Array);
expect(folders.Trash).to.not.be.empty;
expect(folders.Other).to.be.instanceof(Array);
done();

@@ -65,0 +71,0 @@ });

@@ -117,16 +117,20 @@ 'use strict';

expect(folders.inbox).to.exist;
expect(folders.inbox.name).to.exist;
expect(folders.inbox.type).to.exist;
expect(folders.inbox.path).to.exist;
expect(folders.Inbox).to.be.instanceof(Array);
expect(folders.Inbox[0]).to.exist;
expect(folders.Inbox[0].name).to.exist;
expect(folders.Inbox[0].type).to.exist;
expect(folders.Inbox[0].path).to.exist;
expect(folders.drafts).to.exist;
expect(folders.sent).to.exist;
expect(folders.trash).to.exist;
expect(folders.junk).to.exist;
expect(folders.flagged).to.exist;
expect(folders.Drafts).to.be.instanceof(Array);
expect(folders.Drafts).to.not.be.empty;
expect(folders.other).to.be.instanceof(Array);
expect(folders.other).to.not.be.empty;
expect(folders.Sent).to.be.instanceof(Array);
expect(folders.Sent).to.not.be.empty;
expect(folders.Trash).to.be.instanceof(Array);
expect(folders.Trash).to.not.be.empty;
expect(folders.Other).to.be.instanceof(Array);
expect(folders.Other).to.not.be.empty;
done();

@@ -159,3 +163,2 @@ });

expect(messages[0].id).to.not.be.empty;
expect(messages[0].bodystructure).to.exist;
expect(messages[0].bodyParts.length).to.equal(1);

@@ -162,0 +165,0 @@ done();

@@ -113,3 +113,2 @@ (function(factory) {

children: [{
name: 'INBOX',
path: 'INBOX'

@@ -131,9 +130,20 @@ }, {

expect(folders).to.exist;
expect(folders.inbox).to.exist;
expect(folders.inbox.name).to.exist;
expect(folders.inbox.type).to.exist;
expect(folders.inbox.path).to.exist;
expect(folders.drafts).to.exist;
expect(folders.sent).to.exist;
expect(folders.Inbox).to.be.instanceof(Array);
expect(folders.Inbox[0]).to.exist;
expect(folders.Inbox[0].name).to.exist;
expect(folders.Inbox[0].type).to.exist;
expect(folders.Inbox[0].path).to.exist;
expect(folders.Drafts).to.be.instanceof(Array);
expect(folders.Drafts).to.not.be.empty;
expect(folders.Sent).to.be.instanceof(Array);
expect(folders.Sent).to.not.be.empty;
expect(folders.Trash).to.be.instanceof(Array);
expect(folders.Trash).to.be.empty;
expect(folders.Other).to.be.instanceof(Array);
expect(bboxMock.listMailboxes.calledOnce).to.be.true;

@@ -140,0 +150,0 @@

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