feat(editor): F4.6e the e-mail program and e-mail server on a computer's desktop

The oracle MailWindowRun uses Java's e-mail windows as a person does and
answers their dialogs. The core sets and saves the program's account,
deletes a mail, checks a form as Java's window does, and gives the server
its domain, new and removed accounts and the window's own line; the room
sends both programs' views and takes their actions; the editor has both
windows. Better than Java: a name field for a new account, a user name the
server has is refused, deleting hits the folder shown, a new domain goes
into the accounts file at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 16:44:36 +00:00
co-authored by Claude Opus 5.5
parent aa54e5400e
commit 11f13bca84
33 changed files with 2841 additions and 52 deletions
+50
View File
@@ -0,0 +1,50 @@
// The e-mail programs' lines as Java's windows show them, in the person's
// language: the server's window appends each line its server tells it
// (EmailServer, SMTPMitarbeiter, POP3Mitarbeiter, SMTPClient — only those that
// are text: a failure the SMTP client throws does not show there); the
// program's window shows a failure's message in a dialog (Exception.getMessage).
import type { EmailServerLogEntry, MailFailure } from '@mdg-filius/core';
import type { Translate } from '../i18n/i18n.js';
/** EmailServer.LINE_SEPARATOR. */
const SEPARATOR = '----';
/** A line of the server's window; undefined for what Java's window does not show. */
export function emailServerLine(entry: EmailServerLogEntry, t: Translate): string | undefined {
switch (entry.kind) {
case 'connectionOpened':
case 'connectionStarting':
return SEPARATOR;
case 'received':
return `${entry.address}< ${entry.text}`;
case 'sent':
return `${entry.address}> ${entry.text}`;
case 'sendFailed':
return t('mail.sendFailed', { address: entry.address });
case 'stored':
return t('mail.stored', { name: entry.username });
case 'switched':
return t(entry.active ? 'emailServer.started' : 'emailServer.stopped');
case 'smtpConnected':
return t('mail.connected', { address: `${entry.address}:${entry.port}` });
case 'smtpDisconnected':
return t('mail.disconnected', { address: `${entry.address}:${entry.port}` });
case 'mailSent':
return t('mail.mailSent', { recipients: entry.recipients });
case 'failed':
return undefined;
}
}
/** The message of a failure, as the program's window shows it. */
export function mailFailureText(failure: MailFailure, t: Translate): string {
switch (failure.kind) {
case 'answer':
return failure.text;
case 'connect':
return t(`mail.failure.${failure.failure}`);
case 'receiveFailed':
return t('mail.failure.receiveFailed');
}
}