aboutsummaryrefslogtreecommitdiff
path: root/src/ics.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/ics.ml')
-rw-r--r--src/ics.ml14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ics.ml b/src/ics.ml
index 4de1897..0f8c7d6 100644
--- a/src/ics.ml
+++ b/src/ics.ml
@@ -42,7 +42,7 @@ module Event = struct
start: Calendar.t;
stop: Calendar.t;
summary: string;
- location: string;
+ location: string option;
groups: string list;
}
@@ -50,14 +50,20 @@ module Event = struct
{start; stop; summary; location; groups}
let to_string date event id =
+ let summary, location = match event.location with
+ | None -> "[PAS DE SALLE] " ^ event.summary, ""
+ | Some location -> event.summary, location in
+ let attendees =
+ List.map (fun group -> "ATTENDEE:" ^ group) event.groups
+ |> String.concat "\r\n" in
["BEGIN:VEVENT";
"UID:" ^ date ^ "." ^ (string_of_int id) ^ "@ucs.pa1ch.fr";
"DTSTART:" ^ to_date event.start;
"DTEND:" ^ to_date event.stop;
"DTSTAMP:" ^ date;
- "SUMMARY:" ^ event.summary;
- "COMMENT:" ^ String.concat ", " event.groups;
- "LOCATION:" ^ event.location;
+ "SUMMARY:" ^ summary;
+ attendees;
+ "LOCATION:" ^ location;
"END:VEVENT\r\n"]
|> List.map ics_split_line
|> String.concat "\r\n"