feat: add conference URL support for virtual meetings

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

View File

@@ -182,6 +182,12 @@ let collect_description rem ev : (Remind.rem, error) result =
| Some desc -> Ok { rem with Remind.description = Some desc } | Some desc -> Ok { rem with Remind.description = Some desc }
| None -> Ok rem | None -> Ok rem
let collect_conference_url rem ev : (Remind.rem, error) result =
let conference_url_opt = Utils.get_conference_url ev in
match conference_url_opt with
| Some url -> Ok { rem with Remind.conference_url = Some url }
| None -> Ok rem
let collect_start_end_duration rem ev : (Remind.rem, error) result = let collect_start_end_duration rem ev : (Remind.rem, error) result =
let _, dtstart = ev.dtstart in let _, dtstart = ev.dtstart in
match dtstart with match dtstart with
@@ -431,6 +437,7 @@ let all_collectors : collector list =
collect_summary; collect_summary;
collect_location; collect_location;
collect_description; collect_description;
collect_conference_url;
collect_start_end_duration; collect_start_end_duration;
collect_exdates; collect_exdates;
collect_overrides; collect_overrides;

View File

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

View File

@@ -215,6 +215,15 @@ let get_description ev =
| _ -> None) | _ -> None)
ev.props ev.props
let get_conference_url ev =
List.find_map
(fun prop ->
match prop with
| `Xprop (("", "GOOGLE-CONFERENCE"), _, url) -> Some url
| `Xprop (("", "MICROSOFT-SKYPETEAMSMEETINGURL"), _, url) -> Some url
| _ -> None)
ev.props
let separate_master_and_recurrence (events : Icalendar.event list) : Icalendar.event * Icalendar.event list = let separate_master_and_recurrence (events : Icalendar.event list) : Icalendar.event * Icalendar.event list =
(* List.iteri (fun i e -> Printf.eprintf "%02d: %s\n" (i + 1) (Icalendar.show_component (`Event e))) events; *) (* List.iteri (fun i e -> Printf.eprintf "%02d: %s\n" (i + 1) (Icalendar.show_component (`Event e))) events; *)
let recur_ids = List.map (fun ev -> (ev, get_recurrence_id ev)) events in let recur_ids = List.map (fun ev -> (ev, get_recurrence_id ev)) events in