Initial commit: webmail client (M0/M1)
Three-pane webmail client. - Backend: FastAPI + async SQLAlchemy + arq worker (Postgres/Redis), IMAP/SMTP sync, threading, search, drafts/outbox with undo, attachments, 2FA. - Frontend: React 18 + Vite + TypeScript + TanStack Query + Tailwind; three-pane UI with rich-text composer, light/dark themes, resizable panels. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
"""Special-use inference from folder names (SPEC §6.3 fallback heuristics).
|
||||
|
||||
Used only when the server does not advertise SPECIAL-USE. Includes Polish names
|
||||
(Wysłane, Kosz, ...) alongside English/German, per the spec's i18n intent.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
_NAME_MAP: dict[str, str] = {
|
||||
# sent
|
||||
"sent": "sent",
|
||||
"sent items": "sent",
|
||||
"sent mail": "sent",
|
||||
"wysłane": "sent",
|
||||
"wyslane": "sent",
|
||||
"elementy wysłane": "sent",
|
||||
"gesendet": "sent",
|
||||
# drafts
|
||||
"drafts": "drafts",
|
||||
"draft": "drafts",
|
||||
"robocze": "drafts",
|
||||
"kopie robocze": "drafts",
|
||||
"entwürfe": "drafts",
|
||||
# trash
|
||||
"trash": "trash",
|
||||
"deleted": "trash",
|
||||
"deleted items": "trash",
|
||||
"kosz": "trash",
|
||||
"papierkorb": "trash",
|
||||
# junk
|
||||
"junk": "junk",
|
||||
"spam": "junk",
|
||||
"bulk mail": "junk",
|
||||
"wiadomości-śmieci": "junk",
|
||||
# archive
|
||||
"archive": "archive",
|
||||
"archiwum": "archive",
|
||||
"all mail": "archive",
|
||||
"archiv": "archive",
|
||||
}
|
||||
|
||||
|
||||
def infer_special_use(path: str) -> str | None:
|
||||
"""Infer a special_use value from a mailbox path/name (case-insensitive)."""
|
||||
if path.upper() == "INBOX":
|
||||
return "inbox"
|
||||
leaf = path.replace("\\", "/").split("/")[-1].strip().lower()
|
||||
return _NAME_MAP.get(leaf) or _NAME_MAP.get(path.strip().lower())
|
||||
Reference in New Issue
Block a user