calendar-invite: add VALARM reminder, fix terminology, remove dead code
- Add 1-day reminder (VALARM) to all sent invites - Fix datetime.utcnow() deprecation → datetime.now(timezone.utc) - Rename "message ID" → "envelope ID" in SKILL.md for consistency - Remove unused _himalaya() and _himalaya_with_account() helpers
This commit is contained in:
@@ -14,14 +14,14 @@ import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from pathlib import Path
|
||||
|
||||
from email.mime.base import MIMEBase
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
|
||||
from icalendar import Calendar, Event, vCalAddress, vText
|
||||
from icalendar import Alarm, Calendar, Event, vCalAddress, vText
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Config
|
||||
@@ -38,24 +38,6 @@ PRODID = "-//OpenClaw//CalendarInvite//EN"
|
||||
# Helpers
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _himalaya(*args):
|
||||
"""Run a himalaya command and return stdout."""
|
||||
result = subprocess.run(
|
||||
["himalaya", *args],
|
||||
capture_output=True, text=True, check=True,
|
||||
)
|
||||
return result.stdout
|
||||
|
||||
|
||||
def _himalaya_with_account(account, *args):
|
||||
"""Run a himalaya command with optional account flag."""
|
||||
cmd = ["himalaya"]
|
||||
if account:
|
||||
cmd += ["--account", account]
|
||||
cmd += list(args)
|
||||
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
|
||||
return result.stdout
|
||||
|
||||
|
||||
def _sync_calendar():
|
||||
"""Sync local calendar to CalDAV server via vdirsyncer."""
|
||||
@@ -123,7 +105,7 @@ def cmd_send(args):
|
||||
|
||||
event = Event()
|
||||
event.add("uid", uid)
|
||||
event.add("dtstamp", datetime.utcnow())
|
||||
event.add("dtstamp", datetime.now(timezone.utc))
|
||||
event.add("dtstart", start, parameters={"TZID": args.timezone})
|
||||
event.add("dtend", end, parameters={"TZID": args.timezone})
|
||||
event.add("summary", args.summary)
|
||||
@@ -151,6 +133,13 @@ def cmd_send(args):
|
||||
"RSVP": "TRUE",
|
||||
})
|
||||
|
||||
# 1-day reminder
|
||||
alarm = Alarm()
|
||||
alarm.add("action", "DISPLAY")
|
||||
alarm.add("description", f"Reminder: {args.summary}")
|
||||
alarm.add("trigger", timedelta(days=-1))
|
||||
event.add_component(alarm)
|
||||
|
||||
cal.add_component(event)
|
||||
ics_bytes = cal.to_ical()
|
||||
|
||||
@@ -286,7 +275,7 @@ def cmd_reply(args):
|
||||
|
||||
reply_event = Event()
|
||||
reply_event.add("uid", uid)
|
||||
reply_event.add("dtstamp", datetime.utcnow())
|
||||
reply_event.add("dtstamp", datetime.now(timezone.utc))
|
||||
|
||||
# Copy timing from original
|
||||
if original_event.get("dtstart"):
|
||||
|
||||
Reference in New Issue
Block a user