Add readOnly attribute to mailbox object when opening

fork
Brian White 12 years ago
parent d00edf7f2c
commit f4641e9523

@ -194,6 +194,7 @@ node-imap exposes one object: **ImapConnection**.
* _Box_ is an object representing the currently open mailbox, and has the following properties: * _Box_ is an object representing the currently open mailbox, and has the following properties:
* **name** - <_string_> - The name of this mailbox. * **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. * **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. * **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: * **messages** - <_object_> Contains various message counts for this mailbox:

@ -536,6 +536,7 @@ ImapConnection.prototype.connect = function(loginCb) {
if (state.status === STATES.BOXSELECTING) { if (state.status === STATES.BOXSELECTING) {
if (/^A\d+ OK/i.test(line)) { if (/^A\d+ OK/i.test(line)) {
sendBox = true; sendBox = true;
state.box.readOnly = (requests[0].cmd === 'EXAMINE');
state.status = STATES.BOXSELECTED; state.status = STATES.BOXSELECTED;
} else { } else {
state.status = STATES.AUTH; state.status = STATES.AUTH;

Loading…
Cancel
Save