From f35b02119d8cc81fb5c3409b4a093b2854e5a12f Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 15:01:12 +0100 Subject: [PATCH] Added DTSTART property for saving data from a CalendarFreeBusyObject. Added the code and unit tests for the DTSTART property. --- .../CalendarFreeBusy-Save.cpp | 40 +++++++++++++++++++ .../tests/xestiacalendar_icalfreebusysave.h | 2 + 2 files changed, 42 insertions(+) diff --git a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp index f59de19..1fabb01 100644 --- a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp +++ b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp @@ -110,6 +110,46 @@ void CalendarFreeBusyObject::SaveObjectData(string *SaveData){ } + // Process the DTSTART. + + if (DateTimeStartData.size() > 0){ + + DataLine += "DTSTART"; + + if (DateTimeStartDataValue.size() > 0){ + + DataLine += ";VALUE="; + DataLine += DateTimeStartDataValue; + + } + + if (DateTimeStartDataTimeZoneID.size() > 0){ + + DataLine += ";TZID="; + DataLine += DateTimeStartDataTimeZoneID; + + } + + if (DateTimeStartDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += DateTimeStartDataTokens; + + } + + DataLine += ":"; + DataLine += DateTimeStartData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + *SaveData += "END:VFREEBUSY\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icalfreebusysave.h b/source/tests/xestiacalendar_icalfreebusysave.h index 849b8d0..bc09da4 100644 --- a/source/tests/xestiacalendar_icalfreebusysave.h +++ b/source/tests/xestiacalendar_icalfreebusysave.h @@ -59,6 +59,8 @@ TEST(iCalendarSaveFreeBusy, SaveFreeBusyTests){ "UID;UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT:b3a16392-ad86-4061-be53-c215af2306ff\n" "DTSTAMP;OTHER=PARAM:20160131T173000Z\n" "CONTACT;ALTREP=\"null:nodata\";LANGUAGE=en-GB;EXAMPLE=TOKEN:Contact Person\n" + "DTSTART;VALUE=DATE-TIME;TZID=Europe/Truro;PARAMONE=YES;PARAMTWO=NO:20160131T1\n" + " 03000Z\n" "END:VFREEBUSY\n" "END:VCALENDAR"; -- 2.39.5