From f4641e95235ce06cded253d2a091c388f89331b5 Mon Sep 17 00:00:00 2001 From: Brian White Date: Wed, 10 Oct 2012 04:31:28 -0400 Subject: [PATCH] Add readOnly attribute to mailbox object when opening --- README.md | 1 + lib/imap.js | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 277c5c6..6463223 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,7 @@ node-imap exposes one object: **ImapConnection**. * _Box_ is an object representing the currently open mailbox, and has the following properties: * **name** - <_string_> - The name of this mailbox. + * **readOnly** - <_boolean_> - True if this mailbox was opened in read-only mode. * **validity** - <_string_> - A number that can be used to determine if UIDs in this mailbox have changed since the last time this mailbox was opened. * **permFlags** - <_array_> - A list of flags that can be permanently added/removed to/from messages in this mailbox. * **messages** - <_object_> Contains various message counts for this mailbox: diff --git a/lib/imap.js b/lib/imap.js index 64fe8e6..78e895f 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -536,6 +536,7 @@ ImapConnection.prototype.connect = function(loginCb) { if (state.status === STATES.BOXSELECTING) { if (/^A\d+ OK/i.test(line)) { sendBox = true; + state.box.readOnly = (requests[0].cmd === 'EXAMINE'); state.status = STATES.BOXSELECTED; } else { state.status = STATES.AUTH;