feat: add conference URL support for virtual meetings

This commit is contained in:
2026-05-19 23:19:00 +02:00
parent 95e67c795b
commit b87a63f77b
3 changed files with 38 additions and 25 deletions

View File

@@ -34,6 +34,7 @@ type rem = {
summary : string; (** Summary or title of the reminder *)
location : string option; (** Optional location of the event *)
description : string option; (** Optional description of the event *)
conference_url : string option; (** Optional conference URL for virtual meetings *)
date : Timedesc.Date.t; (** Date specification (day, month, year) *)
end_date : Timedesc.Date.t option; (** Optional end date for a date range *)
time : Timedesc.Time.t option; (** Optional time specification (hour, minute) *)
@@ -58,6 +59,7 @@ let empty =
summary = "";
location = None;
description = None;
conference_url = None;
date = Timedesc.Date.Ymd.make_exn ~year:1970 ~month:1 ~day:1;
end_date = None;
time = None;
@@ -194,6 +196,21 @@ let add_description b desc =
Buffer.add_string b (spf "\\\n INFO \"Description: %s\" " (escape_msg desc))
| None -> ()
let add_url b url =
match url with
| Some url ->
let url = String.trim url in
Buffer.add_string b (spf "\\\n INFO \"Url: %s\" " (escape_msg url))
| None -> ()
let add_common_part b rem =
add_rem b;
add_uid b rem.original_uuid;
add_source b rem.source;
add_location b rem.location;
add_description b rem.description;
add_url b rem.conference_url
let date_of_date_or_datetime (d : Icalendar.date_or_datetime) : Timedesc.Date.t =
match d with
| `Date (year, month, day) -> Timedesc.Date.Ymd.make_exn ~year ~month ~day
@@ -220,11 +237,7 @@ let add_skip b exdates = if exdates <> [] then Buffer.add_string b "SKIP "
let render_daily rem (d : simple_daily) =
let b = Buffer.create 256 in
add_omit_context b rem.exdate;
add_rem b;
add_uid b rem.original_uuid;
add_source b rem.source;
add_location b rem.location;
add_description b rem.description;
add_common_part b rem;
add_date b rem.date;
Buffer.add_char b ' ';
add_interval_daily b d;
@@ -241,11 +254,7 @@ let render_weekly rem (w : simple_weekly) =
add_omit_context b rem.exdate;
List.iter
(fun wd ->
add_rem b;
add_uid b rem.original_uuid;
add_source b rem.source;
add_location b rem.location;
add_description b rem.description;
add_common_part b rem;
add_weekday b wd;
add_date b rem.date;
Buffer.add_char b ' ';
@@ -262,11 +271,7 @@ let render_weekly rem (w : simple_weekly) =
let render_monthly rem (m : simple_monthly) =
let b = Buffer.create 256 in
add_omit_context b rem.exdate;
add_rem b;
add_uid b rem.original_uuid;
add_source b rem.source;
add_location b rem.location;
add_description b rem.description;
add_common_part b rem;
(match m.pattern with
| By_month_day day -> Buffer.add_string b (spf "%d " day)
| By_nth_weekday (n, wd) when n > 0 ->
@@ -288,11 +293,7 @@ let render_monthly rem (m : simple_monthly) =
let render_single rem =
let b = Buffer.create 256 in
add_rem b;
add_uid b rem.original_uuid;
add_source b rem.source;
add_location b rem.location;
add_description b rem.description;
add_common_part b rem;
add_date b rem.date;
add_at b rem.time;
add_duration b rem.duration;
@@ -302,11 +303,7 @@ let render_single rem =
let render_yearly rem month day =
let b = Buffer.create 64 in
add_rem b;
add_uid b rem.original_uuid;
add_source b rem.source;
add_location b rem.location;
add_description b rem.description;
add_common_part b rem;
Buffer.add_string b (spf "%s %d" (month_of_int month |> string_of_month) day);
add_msg b rem.summary;
Buffer.contents b