aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2021-09-20 10:08:15 +0200
committerAlban Gruin2021-09-20 10:08:15 +0200
commit9522c817654c435f1929f4a37961780346406cf7 (patch)
tree66c4c37d26eb61c2bb26e38e3cff7ce1e07b5083
parent04e2797550154f1567bbe2ede09d6961cd7da71b (diff)
ics: fix issues with EOLs
End of lines in iCalendar files should be CRLF, but some (most?) lines generated by µCS were LF. This changes that. Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
-rw-r--r--src/ics.ml22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ics.ml b/src/ics.ml
index d6d165a..732cbd5 100644
--- a/src/ics.ml
+++ b/src/ics.ml
@@ -56,9 +56,9 @@ module Event = struct
"SUMMARY:" ^ event.summary;
"COMMENT:" ^ String.concat ", " event.groups;
"LOCATION:" ^ event.location;
- "END:VEVENT\n"]
+ "END:VEVENT\r\n"]
|> List.map ics_split_line
- |> String.concat "\n"
+ |> String.concat "\r\n"
let has_groups groups event =
List.fold_left (fun found group ->
@@ -76,11 +76,11 @@ let filter_groups groups =
let gen_vtimezone tz =
if tz <> "" then
- ["BEGIN:VTIMEZONE";
- "TZID:" ^ tz;
- "END:VTIMEZONE\n"]
- |> List.map ics_split_line
- |> String.concat "\n"
+ ["BEGIN:VTIMEZONE";
+ "TZID:" ^ tz;
+ "END:VTIMEZONE\r\n"]
+ |> List.map ics_split_line
+ |> String.concat "\r\n"
else
""
@@ -97,9 +97,9 @@ let to_string tz events =
| [] -> str
| event :: l ->
gen_events (id + 1) (str ^ Event.to_string date event id) l in
- "BEGIN:VCALENDAR\n\
- VERSION:2.0\n\
- PRODID:-//ucs//\n"
+ "BEGIN:VCALENDAR\r\n\
+ VERSION:2.0\r\n\
+ PRODID:-//ucs//\r\n"
^ vtimezone
^ gen_events 0 "" events
- ^ "END:VCALENDAR\n"
+ ^ "END:VCALENDAR\r\n"