@bobfrankston/iflow 1.0.40 → 1.0.41
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/imaplib/imap-native.d.ts +1 -0
- package/imaplib/imap-native.js +16 -12
- package/package.json +1 -1
package/imaplib/imap-native.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export declare class NativeImapClient {
|
|
|
57
57
|
private verbose;
|
|
58
58
|
private selectedMailbox;
|
|
59
59
|
private mailboxInfo;
|
|
60
|
+
private greetingResolve;
|
|
60
61
|
constructor(config: ImapClientConfig, transportFactory: TransportFactory);
|
|
61
62
|
get connected(): boolean;
|
|
62
63
|
connect(): Promise<void>;
|
package/imaplib/imap-native.js
CHANGED
|
@@ -20,6 +20,7 @@ export class NativeImapClient {
|
|
|
20
20
|
verbose;
|
|
21
21
|
selectedMailbox = null;
|
|
22
22
|
mailboxInfo = { exists: 0, recent: 0, uidNext: 0, uidValidity: 0, flags: [], permanentFlags: [] };
|
|
23
|
+
greetingResolve = null;
|
|
23
24
|
constructor(config, transportFactory) {
|
|
24
25
|
this.config = config;
|
|
25
26
|
this.transportFactory = transportFactory;
|
|
@@ -71,19 +72,15 @@ export class NativeImapClient {
|
|
|
71
72
|
await this.authenticate();
|
|
72
73
|
}
|
|
73
74
|
async readGreeting() {
|
|
74
|
-
return new Promise((resolve) => {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
else {
|
|
83
|
-
setTimeout(check, 10);
|
|
84
|
-
}
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
|
+
const timeout = setTimeout(() => {
|
|
77
|
+
this.greetingResolve = null;
|
|
78
|
+
reject(new Error("Greeting timeout (10s)"));
|
|
79
|
+
}, 10000);
|
|
80
|
+
this.greetingResolve = (resp) => {
|
|
81
|
+
clearTimeout(timeout);
|
|
82
|
+
resolve(resp);
|
|
85
83
|
};
|
|
86
|
-
check();
|
|
87
84
|
});
|
|
88
85
|
}
|
|
89
86
|
async authenticate() {
|
|
@@ -511,6 +508,13 @@ export class NativeImapClient {
|
|
|
511
508
|
if (this.verbose && resp.raw.length < 200) {
|
|
512
509
|
console.log(` [imap] < ${resp.raw}`);
|
|
513
510
|
}
|
|
511
|
+
// Server greeting — resolve readGreeting() promise
|
|
512
|
+
if (this.greetingResolve && resp.tag === "*" && (resp.type === "OK" || resp.type === "PREAUTH")) {
|
|
513
|
+
const resolve = this.greetingResolve;
|
|
514
|
+
this.greetingResolve = null;
|
|
515
|
+
resolve(resp);
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
514
518
|
// During IDLE, handle EXISTS notifications
|
|
515
519
|
if (this.idleTag && resp.tag === "*" && resp.type === "EXISTS") {
|
|
516
520
|
const count = parseInt(resp.text);
|