Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable idle #234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Where
* **ignoreTLS** – if set to true, *never uses STARTTLS before authentication* even if the host advertises support for it
* **requireTLS** – if set to true, *always uses STARTTLS before authentication* even if the host does not advertise it. If STARTTLS fails, do not try to authenticate the user
* **enableCompression** - if set to true then use IMAP COMPRESS extension (rfc4978) if the server supports it (Gmail does). All data sent and received in this case is compressed with *deflate*
* **idle** - (optional) if set to false, idle will not be entered. Defaults to true. Please note, that if idle is set to false `client.onupdate` will not be triggered automatically anymore.

Default STARTTLS support is opportunistic – if the server advertises STARTTLS capability, the client tries to use it. If STARTTLS is not advertised, the clients sends passwords in the plain. You can use `ignoreTLS` and `requireTLS` to change this behavior by explicitly enabling or disabling STARTTLS usage.

Expand Down
3 changes: 2 additions & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default class Client {
this._capability = [] // List of extensions the server supports
this._selectedMailbox = false // Selected mailbox
this._enteredIdle = false
this._useIdle = propOr(true, 'idle', options)
this._idleTimeout = false
this._enableCompression = !!options.enableCompression
this._auth = options.auth
Expand Down Expand Up @@ -715,7 +716,7 @@ export default class Client {
return
}
const supportsIdle = this._capability.indexOf('IDLE') >= 0
this._enteredIdle = supportsIdle && this._selectedMailbox ? 'IDLE' : 'NOOP'
this._enteredIdle = supportsIdle && this._selectedMailbox && this._useIdle ? 'IDLE' : 'NOOP'
this.logger.debug('Entering idle with ' + this._enteredIdle)

if (this._enteredIdle === 'NOOP') {
Expand Down