Repository navigation
IMAP 서버 CAPABILITY 저장과 계정 화면 수신 방식 표시 #69
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
Merged
+153
−1
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3445ca4
IMAP 로그인 후 서버 CAPABILITY를 계정에 저장하고 계정 화면에 수신 방식 표시
littlebit0 c97102e
실제로 IDLE을 쓰는 경우에만 idle 수신 방식으로 기록
littlebit0 2a00fc6
Merge remote-tracking branch 'origin/main' into feat/issue-32-imap-ca…
littlebit0 fa36c61
Merge remote-tracking branch 'origin/main' into feat/issue-32-imap-ca…
littlebit0 307f4d5
IDLE 기록 판정을 계정 설정 기준(supportsImapIdle)으로 맞춤
littlebit0 948b728
Merge remote-tracking branch 'origin/main' into feat/issue-32-imap-ca…
littlebit0 c5c3ad0
Merge remote-tracking branch 'origin/main' into feat/issue-32-imap-ca…
littlebit0 8b3f3f1
Merge remote-tracking branch 'origin/main' into feat/issue-32-imap-ca…
littlebit0 ca9d88b
Merge remote-tracking branch 'origin/main' into feat/issue-32-imap-ca…
littlebit0 b675db1
Merge remote-tracking branch 'origin/main' into feat/issue-32-imap-ca…
littlebit0 ae3a249
Merge remote-tracking branch 'origin/main' into feat/issue-32-imap-ca…
littlebit0 ffed202
Merge remote-tracking branch 'origin/main' into feat/issue-32-imap-ca…
littlebit0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import type { IncomingCapabilities } from "../domain/types.js"; | ||
|
|
||
| /** Reads the post-login CAPABILITY set exposed by imapflow (`client.capabilities`). */ | ||
| export function detectImapCapabilities( | ||
| capabilities: ReadonlyMap<string, unknown>, | ||
| now = new Date() | ||
| ): IncomingCapabilities { | ||
| const has = (name: string) => capabilities.has(name); | ||
| return { | ||
| idle: has("IDLE"), | ||
| move: has("MOVE"), | ||
| specialUse: has("SPECIAL-USE"), | ||
| condstore: has("CONDSTORE"), | ||
| checkedAt: now.toISOString() | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import assert from "node:assert/strict"; | ||
| import test from "node:test"; | ||
| import { detectImapCapabilities } from "../src/mail/imapCapabilities.js"; | ||
|
|
||
| test("detects IMAP capabilities from the CAPABILITY set", () => { | ||
| const now = new Date("2026-11-22T00:00:00.000Z"); | ||
| const result = detectImapCapabilities( | ||
| new Map<string, unknown>([["IMAP4REV1", true], ["IDLE", true], ["MOVE", true]]), | ||
| now | ||
| ); | ||
| assert.deepEqual(result, { | ||
| idle: true, | ||
| move: true, | ||
| specialUse: false, | ||
| condstore: false, | ||
| checkedAt: now.toISOString() | ||
| }); | ||
| }); | ||
|
|
||
| test("reports no IDLE when the server does not advertise it", () => { | ||
| const result = detectImapCapabilities(new Map([["IMAP4REV1", true]])); | ||
| assert.equal(result.idle, false); | ||
| }); | ||
|
|
||
| test("ImapReceiver records idle=false for providers that never run IDLE", async () => { | ||
| const { ImapReceiver } = await import("../src/mail/ImapReceiver.js"); | ||
| const receiver = new ImapReceiver({} as never, {} as never) as unknown as { | ||
| recordCapabilities(account: unknown, client: unknown): void; | ||
| }; | ||
| const client = { capabilities: new Map([["IDLE", true]]) }; | ||
| const custom: { providerId: string; incomingProtocol: string; incomingCapabilities?: { idle: boolean } } = { | ||
| providerId: "custom", | ||
| incomingProtocol: "imap" | ||
| }; | ||
| const gmail: typeof custom = { providerId: "gmail", incomingProtocol: "imap" }; | ||
| receiver.recordCapabilities(custom, client); | ||
| receiver.recordCapabilities(gmail, client); | ||
| assert.equal(custom.incomingCapabilities?.idle, false); | ||
| assert.equal(gmail.incomingCapabilities?.idle, true); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.