From ba4a4202090322fe8f84a8fbcc785129575748af Mon Sep 17 00:00:00 2001 From: Aero Mail Dev Date: Thu, 16 Apr 2026 02:45:42 +0000 Subject: [PATCH] feat: calendar view with CalDAV support for self-hosted Exchange MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a full week-view calendar that reads events from Exchange via CalDAV (the same IMAP host/credentials are reused — no extra config needed). Backend (main process): - CalDavProvider: HTTP PROPFIND/REPORT against standard CalDAV and Exchange-specific /EWS/Calendar/ endpoints with Basic auth; inline iCal parser handles VEVENT fields, UTC/local/all-day dates, attendees - CalendarHandler: IPC channels calendar:list and calendar:events - AccountManager: calendarProviders map with lazy connect/cache Renderer: - CalendarStore (Pinia): week navigation, per-calendar toggling, event loading - CalendarView: full-screen layout matching liquid-glass design system - WeekView: 7-column time grid, overlap layout, current-time indicator, scrolls to business hours on mount, all-day event row - EventBlock: positioned absolute event card with status variants - EventDetailPopup: full event details (time, location, organizer, attendees) - Router: /calendar route added - AccountSwitcher: mail / calendar nav icons with active-state highlight - AppIcon: added 'calendar' SVG icon Co-Authored-By: Claude Sonnet 4.6 --- src/main/index.ts | 2 + src/main/ipc/calendar.handler.ts | 12 + src/main/providers/caldav.provider.ts | 530 ++++++++++++++++++ src/main/services/account-manager.ts | 46 ++ src/renderer/src/components/AppIcon.vue | 7 + .../src/components/calendar/EventBlock.vue | 92 +++ .../components/calendar/EventDetailPopup.vue | 200 +++++++ .../src/components/calendar/WeekView.vue | 520 +++++++++++++++++ .../components/sidebar/AccountSwitcher.vue | 36 +- src/renderer/src/main.ts | 5 + src/renderer/src/stores/calendar.store.ts | 135 +++++ src/renderer/src/views/CalendarView.vue | 496 ++++++++++++++++ src/shared/types/calendar.ts | 22 + src/shared/types/ipc.ts | 7 + 14 files changed, 2107 insertions(+), 3 deletions(-) create mode 100644 src/main/ipc/calendar.handler.ts create mode 100644 src/main/providers/caldav.provider.ts create mode 100644 src/renderer/src/components/calendar/EventBlock.vue create mode 100644 src/renderer/src/components/calendar/EventDetailPopup.vue create mode 100644 src/renderer/src/components/calendar/WeekView.vue create mode 100644 src/renderer/src/stores/calendar.store.ts create mode 100644 src/renderer/src/views/CalendarView.vue create mode 100644 src/shared/types/calendar.ts diff --git a/src/main/index.ts b/src/main/index.ts index efe5621..719ff95 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -5,6 +5,7 @@ import { AccountManager } from './services/account-manager' import { registerAccountHandlers } from './ipc/accounts.handler' import { registerFolderHandlers } from './ipc/folders.handler' import { registerMessageHandlers } from './ipc/messages.handler' +import { registerCalendarHandlers } from './ipc/calendar.handler' import type { ComposeSession } from '@shared/types/message' const accountManager = new AccountManager() @@ -142,6 +143,7 @@ app.whenReady().then(async () => { registerAccountHandlers(accountManager) registerFolderHandlers(accountManager) registerMessageHandlers(accountManager) + registerCalendarHandlers(accountManager) createWindow() diff --git a/src/main/ipc/calendar.handler.ts b/src/main/ipc/calendar.handler.ts new file mode 100644 index 0000000..aa6a2b2 --- /dev/null +++ b/src/main/ipc/calendar.handler.ts @@ -0,0 +1,12 @@ +import type { AccountManager } from '../services/account-manager' +import { registerHandler } from './registry' + +export function registerCalendarHandlers(manager: AccountManager): void { + registerHandler('calendar:list', ({ accountId }) => + manager.listCalendars(accountId) + ) + + registerHandler('calendar:events', ({ accountId, calendarId, start, end }) => + manager.listCalendarEvents(accountId, calendarId, new Date(start), new Date(end)) + ) +} diff --git a/src/main/providers/caldav.provider.ts b/src/main/providers/caldav.provider.ts new file mode 100644 index 0000000..3394c4d --- /dev/null +++ b/src/main/providers/caldav.provider.ts @@ -0,0 +1,530 @@ +/** + * CalDAV provider for Exchange (and any CalDAV-compliant server). + * + * Uses only Node.js built-in `https`/`http` — no extra npm deps. + * Exchange 2013+ exposes CalDAV at /EWS/Calendar/; standard servers + * advertise the principal via /.well-known/caldav (RFC 6764). + * + * Auth: HTTP Basic, same credentials as IMAP. + */ + +import https from 'node:https' +import http from 'node:http' +import type { IncomingMessage } from 'node:http' +import type { AccountConfig, ImapCredentials } from '@shared/types/account' +import type { CalendarInfo, CalendarEvent } from '@shared/types/calendar' + +// ── HTTP helper ──────────────────────────────────────────────────────────────── + +interface RequestOptions { + protocol: 'https' | 'http' + hostname: string + port: number + path: string + method: string + headers: Record + body?: string + allowSelfSigned?: boolean +} + +interface RequestResult { + status: number + headers: IncomingMessage['headers'] + body: string +} + +function request(opts: RequestOptions): Promise { + return new Promise((resolve, reject) => { + const module_ = opts.protocol === 'https' ? https : http + const req = module_.request( + { + hostname: opts.hostname, + port: opts.port, + path: opts.path, + method: opts.method, + headers: opts.headers, + rejectUnauthorized: !opts.allowSelfSigned, + timeout: 15_000 + }, + (res) => { + let data = '' + res.setEncoding('utf8') + res.on('data', (chunk) => { data += chunk }) + res.on('end', () => { + resolve({ status: res.statusCode ?? 0, headers: res.headers, body: data }) + }) + } + ) + req.on('timeout', () => { req.destroy(new Error('CalDAV request timed out')) }) + req.on('error', reject) + if (opts.body) req.write(opts.body) + req.end() + }) +} + +// ── Minimal iCal parser ──────────────────────────────────────────────────────── + +interface RawVEvent { + uid: string + summary: string + dtstart: string + dtStartParams: string + dtend: string + dtEndParams: string + location: string + description: string + organizer: string + attendees: string[] + status: string +} + +/** RFC 5545 line-unfolding: CRLF followed by a space or tab is a continuation. */ +function unfoldLines(raw: string): string[] { + return raw.replace(/\r\n[ \t]/g, '').replace(/\n[ \t]/g, '').split(/\r\n|\n/) +} + +function decodeICalText(value: string): string { + return value.replace(/\\n/g, '\n').replace(/\\,/g, ',').replace(/\\;/g, ';').replace(/\\\\/g, '\\') +} + +function extractEmail(value: string): string { + // ORGANIZER:mailto:user@example.com or ATTENDEE;CN=Name:mailto:user@example.com + const match = value.match(/mailto:([^\s;,>]+)/i) + return match ? match[1] : value +} + +function parseVEvents(icalText: string): RawVEvent[] { + const events: RawVEvent[] = [] + const lines = unfoldLines(icalText) + + let inEvent = false + let props: Record> = {} + + for (const line of lines) { + if (line === 'BEGIN:VEVENT') { + inEvent = true + props = {} + continue + } + if (line === 'END:VEVENT') { + inEvent = false + + const get = (key: string) => props[key]?.[0]?.value ?? '' + const getParams = (key: string) => props[key]?.[0]?.params ?? '' + const getAll = (key: string) => (props[key] ?? []).map((x) => x.value) + + events.push({ + uid: get('UID'), + summary: decodeICalText(get('SUMMARY')), + dtstart: get('DTSTART'), + dtStartParams: getParams('DTSTART'), + dtend: get('DTEND'), + dtEndParams: getParams('DTEND'), + location: decodeICalText(get('LOCATION')), + description: decodeICalText(get('DESCRIPTION')), + organizer: extractEmail(get('ORGANIZER')), + attendees: getAll('ATTENDEE').map(extractEmail).filter(Boolean), + status: get('STATUS').toLowerCase() + }) + continue + } + + if (!inEvent) continue + + const colonIdx = line.indexOf(':') + if (colonIdx === -1) continue + + const keyFull = line.substring(0, colonIdx) + const value = line.substring(colonIdx + 1) + const semicolonIdx = keyFull.indexOf(';') + const key = semicolonIdx === -1 ? keyFull : keyFull.substring(0, semicolonIdx) + const params = semicolonIdx === -1 ? '' : keyFull.substring(semicolonIdx + 1) + + if (!props[key]) props[key] = [] + props[key].push({ value, params }) + } + + return events +} + +/** + * Parse iCal date/time string to a JS Date. + * Handles: DATE (20240401), DATE-TIME UTC (20240401T090000Z), + * DATE-TIME local (20240401T090000), with TZID param ignored (treated as local). + */ +function parseICalDate(value: string, params: string): { date: Date; isAllDay: boolean } { + const isAllDay = params.includes('VALUE=DATE') || /^\d{8}$/.test(value) + + if (isAllDay) { + const y = parseInt(value.slice(0, 4), 10) + const m = parseInt(value.slice(4, 6), 10) - 1 + const d = parseInt(value.slice(6, 8), 10) + return { date: new Date(Date.UTC(y, m, d)), isAllDay: true } + } + + const isUTC = value.endsWith('Z') + const clean = isUTC ? value.slice(0, -1) : value + + const y = parseInt(clean.slice(0, 4), 10) + const mo = parseInt(clean.slice(4, 6), 10) - 1 + const d = parseInt(clean.slice(6, 8), 10) + const h = clean.length > 8 ? parseInt(clean.slice(9, 11), 10) : 0 + const mi = clean.length > 8 ? parseInt(clean.slice(11, 13), 10) : 0 + const s = clean.length > 8 ? parseInt(clean.slice(13, 15), 10) : 0 + + const date = isUTC + ? new Date(Date.UTC(y, mo, d, h, mi, s)) + : new Date(y, mo, d, h, mi, s) + + return { date, isAllDay: false } +} + +// ── XML helpers ──────────────────────────────────────────────────────────────── + +/** Extract all (or namespaced equivalent) block contents from a multistatus XML response. */ +function extractCalendarData(xml: string): string[] { + const results: string[] = [] + // Match both namespaced and un-namespaced calendar-data elements + const re = /<(?:[^:\s>]+:)?calendar-data[^>]*>([\s\S]*?)<\/(?:[^:\s>]+:)?calendar-data>/g + let match: RegExpExecArray | null + while ((match = re.exec(xml)) !== null) { + // CalDAV may XML-encode special chars inside calendar-data + const raw = match[1] + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/&/g, '&') + .replace(/ /g, '\r') + .trim() + if (raw.length > 0) results.push(raw) + } + return results +} + +/** Extract calendar collections from a PROPFIND multistatus response. */ +interface CalDavCalendar { + href: string + displayName: string +} + +function extractCalendars(xml: string, baseUrl: string): CalDavCalendar[] { + const calendars: CalDavCalendar[] = [] + + // Split by blocks + const responseRe = /<(?:[^:\s>]+:)?response[^>]*>([\s\S]*?)<\/(?:[^:\s>]+:)?response>/g + let match: RegExpExecArray | null + + while ((match = responseRe.exec(xml)) !== null) { + const block = match[1] + + // Must contain calendar resourcetype + if (!/<(?:[^:\s>]+:)?calendar[^>]*\/>/.test(block) && + !/<(?:[^:\s>]+:)?calendar[^>]*>/.test(block)) continue + + const hrefMatch = block.match(/<(?:[^:\s>]+:)?href[^>]*>([^<]+)<\/(?:[^:\s>]+:)?href>/) + const nameMatch = block.match(/<(?:[^:\s>]+:)?displayname[^>]*>([^<]*)<\/(?:[^:\s>]+:)?displayname>/) + + if (hrefMatch) { + calendars.push({ + href: hrefMatch[1].trim(), + displayName: nameMatch ? decodeICalText(nameMatch[1].trim()) : 'Calendar' + }) + } + } + + // If nothing found, treat the base path itself as the calendar + if (calendars.length === 0 && baseUrl.length > 0) { + calendars.push({ href: baseUrl, displayName: 'Calendar' }) + } + + return calendars +} + +// ── CalDAV Provider ──────────────────────────────────────────────────────────── + +export class CalDavProvider { + private readonly hostname: string + private readonly protocol: 'https' | 'http' + private readonly port: number + private readonly username: string + private readonly password: string + private readonly allowSelfSigned: boolean + private readonly authHeader: string + + /** Resolved CalDAV base path (e.g. "/EWS/Calendar/") */ + private basePath: string | null = null + + constructor(config: AccountConfig) { + const creds = config.credentials as ImapCredentials + + // Derive HTTPS endpoint from IMAP host; Exchange typically shares the hostname + this.hostname = creds.host + this.protocol = creds.secure ? 'https' : 'http' + this.port = creds.secure ? 443 : 80 + this.username = creds.username + this.password = creds.password + this.allowSelfSigned = creds.smtpAllowSelfSigned ?? false + + const encoded = Buffer.from(`${this.username}:${this.password}`).toString('base64') + this.authHeader = `Basic ${encoded}` + } + + // ── Discovery ────────────────────────────────────────────────────────────── + + /** + * Try to discover the CalDAV endpoint. + * Priority: /.well-known/caldav (RFC 6764) → /EWS/Calendar/ (Exchange) → /caldav/ (generic) + * Returns the resolved path or null if none found. + */ + async discoverBasePath(): Promise { + const candidates = [ + '/.well-known/caldav', + '/EWS/Calendar/', + `/EWS/Calendar/${this.username}/`, + '/caldav/', + `/caldav/${this.username}/`, + '/dav/', + ] + + for (const path of candidates) { + try { + const result = await this.req('PROPFIND', path, { + Depth: '0', + 'Content-Type': 'application/xml; charset=utf-8', + }) + + // 207 Multi-Status = CalDAV responded, 301/302 = redirect → follow + if (result.status === 207) return path + if (result.status === 301 || result.status === 302) { + const location = result.headers['location'] + if (location) { + const u = new URL(location, `${this.protocol}://${this.hostname}`) + return u.pathname + } + } + } catch { + // Try next candidate + } + } + + return null + } + + async connect(): Promise { + this.basePath = await this.discoverBasePath() + if (!this.basePath) { + throw new Error( + `CalDAV endpoint not found on ${this.hostname}. ` + + `Ensure Exchange CalDAV is enabled (Exchange 2013+).` + ) + } + } + + isConnected(): boolean { + return this.basePath !== null + } + + // ── List calendars ───────────────────────────────────────────────────────── + + async listCalendars(accountId: string): Promise { + if (!this.basePath) throw new Error('CalDAV not connected') + + const body = ` + + + + + +` + + const result = await this.req('PROPFIND', this.basePath, { + Depth: '1', + 'Content-Type': 'application/xml; charset=utf-8', + }, body) + + if (result.status !== 207) { + // Treat the base path as a single calendar on any other 2xx + return [{ + id: this.basePath, + name: 'Calendar', + accountId + }] + } + + const cals = extractCalendars(result.body, this.basePath) + return cals.map((c) => ({ + id: c.href, + name: c.displayName || 'Calendar', + accountId + })) + } + + // ── Fetch events ─────────────────────────────────────────────────────────── + + async listEvents( + accountId: string, + calendarId: string, + start: Date, + end: Date + ): Promise { + const startStr = toUtcString(start) + const endStr = toUtcString(end) + + const body = ` + + + + + + + + + + + + +` + + const result = await this.req('REPORT', calendarId, { + Depth: '1', + 'Content-Type': 'application/xml; charset=utf-8', + }, body) + + if (result.status !== 207) { + // Exchange may not support time-range; fall back to PROPFIND + client-side filtering + return this.fetchAllEventsAndFilter(accountId, calendarId, start, end) + } + + return this.parseMultistatusEvents(result.body, accountId, calendarId) + } + + /** Fallback: fetch all VEVENT objects and filter client-side by time range. */ + private async fetchAllEventsAndFilter( + accountId: string, + calendarId: string, + start: Date, + end: Date + ): Promise { + const body = ` + + + + + + + + + + +` + + const result = await this.req('REPORT', calendarId, { + Depth: '1', + 'Content-Type': 'application/xml; charset=utf-8', + }, body) + + if (result.status !== 207) return [] + + const all = this.parseMultistatusEvents(result.body, accountId, calendarId) + return all.filter((ev) => { + const evEnd = new Date(ev.end) + const evStart = new Date(ev.start) + return evStart < end && evEnd > start + }) + } + + // ── Parsing ──────────────────────────────────────────────────────────────── + + private parseMultistatusEvents( + xml: string, + accountId: string, + calendarId: string + ): CalendarEvent[] { + const events: CalendarEvent[] = [] + const icalBlocks = extractCalendarData(xml) + + for (const block of icalBlocks) { + const raw = parseVEvents(block) + for (const rv of raw) { + if (!rv.dtstart) continue + + const { date: startDate, isAllDay } = parseICalDate(rv.dtstart, rv.dtStartParams) + let endDate: Date + + if (rv.dtend) { + endDate = parseICalDate(rv.dtend, rv.dtEndParams).date + } else { + // No DTEND: for all-day events default to +1 day, for timed +1 hour + endDate = new Date(startDate) + if (isAllDay) endDate.setUTCDate(endDate.getUTCDate() + 1) + else endDate.setTime(endDate.getTime() + 60 * 60 * 1000) + } + + const id = `${calendarId}::${rv.uid || startDate.toISOString()}` + + events.push({ + id, + uid: rv.uid, + calendarId, + accountId, + title: rv.summary || '(no title)', + start: startDate.toISOString(), + end: endDate.toISOString(), + isAllDay, + location: rv.location || undefined, + description: rv.description || undefined, + organizer: rv.organizer || undefined, + attendees: rv.attendees, + status: (rv.status as CalendarEvent['status']) || 'confirmed' + }) + } + } + + return events + } + + // ── Internal HTTP helper ─────────────────────────────────────────────────── + + private async req( + method: string, + path: string, + extraHeaders: Record = {}, + body?: string + ): Promise { + const headers: Record = { + Authorization: this.authHeader, + 'User-Agent': 'AeroMail/1.0', + ...extraHeaders + } + if (body) { + headers['Content-Length'] = Buffer.byteLength(body, 'utf8').toString() + } + + return request({ + protocol: this.protocol, + hostname: this.hostname, + port: this.port, + path, + method, + headers, + body, + allowSelfSigned: this.allowSelfSigned + }) + } +} + +// ── Utility ──────────────────────────────────────────────────────────────────── + +/** Format a Date as an iCal UTC string: 20240401T000000Z */ +function toUtcString(d: Date): string { + const pad = (n: number) => String(n).padStart(2, '0') + return ( + d.getUTCFullYear().toString() + + pad(d.getUTCMonth() + 1) + + pad(d.getUTCDate()) + + 'T' + + pad(d.getUTCHours()) + + pad(d.getUTCMinutes()) + + pad(d.getUTCSeconds()) + + 'Z' + ) +} diff --git a/src/main/services/account-manager.ts b/src/main/services/account-manager.ts index 912466b..b86d602 100644 --- a/src/main/services/account-manager.ts +++ b/src/main/services/account-manager.ts @@ -3,7 +3,9 @@ import type { AccountConfig, ImapCredentials } from '@shared/types/account' import { AccountType } from '@shared/types/account' import type { IEmailProvider, FolderListResult, MessageListResult } from '@shared/types/provider' import type { MessageBody, MessageFlags, MessageEnvelope, ComposeData } from '@shared/types/message' +import type { CalendarInfo, CalendarEvent } from '@shared/types/calendar' import { ImapProvider } from '../providers/imap.provider' +import { CalDavProvider } from '../providers/caldav.provider' import { CredentialStore } from './credential-store' import Store from 'electron-store' @@ -16,6 +18,7 @@ const RECONNECT_CODES = new Set(['NoConnection', 'ECONNRESET', 'ECONNREFUSED', ' export class AccountManager { private providers = new Map() + private calendarProviders = new Map() private store: Store private credentialStore: CredentialStore private mainWindow: BrowserWindow | null = null @@ -72,6 +75,7 @@ export class AccountManager { await provider.disconnect() this.providers.delete(accountId) } + this.calendarProviders.delete(accountId) await this.credentialStore.remove(accountId) const accounts = this.store.get('accounts', []) @@ -205,6 +209,48 @@ export class AccountManager { ) } + // ── Calendar ──────────────────────────────────────────── + + async listCalendars(accountId: string): Promise { + const provider = await this.getOrCreateCalendarProvider(accountId) + return provider.listCalendars(accountId) + } + + async listCalendarEvents( + accountId: string, + calendarId: string, + start: Date, + end: Date + ): Promise { + const provider = await this.getOrCreateCalendarProvider(accountId) + return provider.listEvents(accountId, calendarId, start, end) + } + + private async getOrCreateCalendarProvider(accountId: string): Promise { + const existing = this.calendarProviders.get(accountId) + if (existing?.isConnected()) return existing + + const accounts = this.store.get('accounts', []) + const accMeta = accounts.find((a) => a.id === accountId) + if (!accMeta) throw new Error(`Account ${accountId} not found`) + + const credRaw = this.credentialStore.get(accountId) + if (!credRaw) throw new Error(`Credentials for ${accountId} not found`) + + let credentials: AccountConfig['credentials'] + try { + credentials = JSON.parse(credRaw) + } catch { + throw new Error('Corrupted credentials') + } + + const config: AccountConfig = { ...accMeta, credentials } + const provider = new CalDavProvider(config) + await provider.connect() + this.calendarProviders.set(accountId, provider) + return provider + } + // ── Auto-reconnect ────────────────────────────────────── private async withAutoReconnect(accountId: string, fn: () => Promise): Promise { diff --git a/src/renderer/src/components/AppIcon.vue b/src/renderer/src/components/AppIcon.vue index 0a8b5d2..72881f6 100644 --- a/src/renderer/src/components/AppIcon.vue +++ b/src/renderer/src/components/AppIcon.vue @@ -24,6 +24,7 @@ export type IconName = | 'pdf' | 'image' | 'bell-off' + | 'calendar' const props = defineProps<{ name: IconName @@ -141,6 +142,12 @@ const paths: Record = { `, + calendar: ` + + + + + `, } diff --git a/src/renderer/src/components/calendar/EventBlock.vue b/src/renderer/src/components/calendar/EventBlock.vue new file mode 100644 index 0000000..47c2d76 --- /dev/null +++ b/src/renderer/src/components/calendar/EventBlock.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/src/renderer/src/components/calendar/EventDetailPopup.vue b/src/renderer/src/components/calendar/EventDetailPopup.vue new file mode 100644 index 0000000..6476f72 --- /dev/null +++ b/src/renderer/src/components/calendar/EventDetailPopup.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/src/renderer/src/components/calendar/WeekView.vue b/src/renderer/src/components/calendar/WeekView.vue new file mode 100644 index 0000000..9c56cff --- /dev/null +++ b/src/renderer/src/components/calendar/WeekView.vue @@ -0,0 +1,520 @@ + + + + + diff --git a/src/renderer/src/components/sidebar/AccountSwitcher.vue b/src/renderer/src/components/sidebar/AccountSwitcher.vue index 2953f0b..bb89327 100644 --- a/src/renderer/src/components/sidebar/AccountSwitcher.vue +++ b/src/renderer/src/components/sidebar/AccountSwitcher.vue @@ -1,6 +1,6 @@ + + + + diff --git a/src/shared/types/calendar.ts b/src/shared/types/calendar.ts new file mode 100644 index 0000000..9aafb35 --- /dev/null +++ b/src/shared/types/calendar.ts @@ -0,0 +1,22 @@ +export interface CalendarInfo { + id: string + name: string + color?: string + accountId: string +} + +export interface CalendarEvent { + id: string + uid: string + calendarId: string + accountId: string + title: string + start: string // ISO 8601 + end: string // ISO 8601 + isAllDay: boolean + location?: string + description?: string + organizer?: string + attendees: string[] + status?: 'tentative' | 'confirmed' | 'cancelled' +} diff --git a/src/shared/types/ipc.ts b/src/shared/types/ipc.ts index 3d78f26..3043b85 100644 --- a/src/shared/types/ipc.ts +++ b/src/shared/types/ipc.ts @@ -1,6 +1,7 @@ import type { AccountConfig } from './account' import type { FolderListResult, MessageListResult } from './provider' import type { MessageBody, MessageFlags, MessageEnvelope, ComposeData, ComposeSession } from './message' +import type { CalendarInfo, CalendarEvent } from './calendar' export interface IpcChannelMap { 'accounts:list': [void, AccountConfig[]] @@ -47,6 +48,12 @@ export interface IpcChannelMap { 'app:setZoom': [{ factor: number }, void] 'app:isEncryptionAvailable': [void, boolean] + + 'calendar:list': [{ accountId: string }, CalendarInfo[]] + 'calendar:events': [ + { accountId: string; calendarId: string; start: string; end: string }, + CalendarEvent[] + ] } export interface IpcEventMap {