imapflow 1.0.111 → 1.0.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ - 1.0.112 - 2022-10-16
4
+
5
+ - Improved ID compatiblity with servers that allow ID only after login
6
+
3
7
  - 1.0.111 - 2022-10-13
4
8
 
5
9
  - Added new connection options
package/lib/imap-flow.js CHANGED
@@ -268,6 +268,8 @@ class ImapFlow extends EventEmitter {
268
268
  this.currentLock = false;
269
269
  this.locks = [];
270
270
 
271
+ this.idRequested = false;
272
+
271
273
  this.maxIdleTime = this.options.maxIdleTime || false;
272
274
 
273
275
  this.disableBinary = !!this.options.disableBinary;
@@ -613,7 +615,10 @@ class ImapFlow extends EventEmitter {
613
615
 
614
616
  async startSession() {
615
617
  await this.run('CAPABILITY');
616
- await this.run('ID', this.clientInfo);
618
+
619
+ if (this.capabilities.has('ID')) {
620
+ this.idRequested = await this.run('ID', this.clientInfo);
621
+ }
617
622
 
618
623
  // try to use STARTTLS is possible
619
624
  if (!this.secureConnection) {
@@ -626,6 +631,11 @@ class ImapFlow extends EventEmitter {
626
631
  return await this.logout();
627
632
  }
628
633
 
634
+ if (!this.idRequested && this.capabilities.has('ID')) {
635
+ // re-request ID after LOGIN
636
+ this.idRequested = await this.run('ID', this.clientInfo);
637
+ }
638
+
629
639
  // Make sure we have namespace set. This should also throw if Exchange actually failed authentication
630
640
  let nsResponse = await this.run('NAMESPACE');
631
641
  if (nsResponse && nsResponse.error && nsResponse.status === 'BAD' && /User is authenticated but not connected/i.test(nsResponse.text)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "1.0.111",
3
+ "version": "1.0.112",
4
4
  "description": "IMAP Client for Node",
5
5
  "main": "./lib/imap-flow.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  "@babel/eslint-plugin": "7.19.1",
32
32
  "@babel/plugin-syntax-class-properties": "7.12.13",
33
33
  "@babel/preset-env": "7.19.4",
34
- "@types/node": "18.8.5",
34
+ "@types/node": "18.11.0",
35
35
  "braintree-jsdoc-template": "3.3.0",
36
36
  "eslint": "8.25.0",
37
37
  "eslint-config-nodemailer": "1.2.0",