From ecab7756b5a630a7ec0b1ded2bd0cdf2ff7816a3 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 20:46:16 +0100 Subject: [PATCH] Added EXDATE property for saving data from a CalendarEventObject. Added the code and unit tests for the EXDATE property. --- .../calendarevent/CalendarEvent-Save.cpp | 45 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 3 ++ 2 files changed, 48 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 5290574..7d303ca 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -943,6 +943,51 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the EXDATE value. + + if (ExcludeDateData.size() > 0){ + + for (int ExcludeDateDataSeek = 0; ExcludeDateDataSeek < ExcludeDateData.size(); + ExcludeDateDataSeek++){ + + DataLine += "EXDATE"; + + if (ExcludeDateDataTimeZoneParam[ExcludeDateDataSeek].size() > 0){ + + DataLine += ";TZID="; + DataLine += ExcludeDateDataTimeZoneParam[ExcludeDateDataSeek]; + + } + + if (ExcludeDateDataValue[ExcludeDateDataSeek].size() > 0){ + + DataLine += ";VALUE="; + DataLine += ExcludeDateDataValue[ExcludeDateDataSeek]; + + } + + if (ExcludeDateDataTokens[ExcludeDateDataSeek].size() > 0){ + + DataLine += ";"; + DataLine += ExcludeDateDataTokens[ExcludeDateDataSeek]; + + } + + DataLine += ":"; + DataLine += ExcludeDateData[ExcludeDateDataSeek]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + } + *SaveData += "END:VEVENT\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/xestiacalendar_icaleventsave.h index 2824a5f..f33662c 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -116,6 +116,9 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "CONTACT:First Contact\n" "CONTACT;ALTREP=\"null:nodata\";LANGUAGE=en-GB:Second Contact\n" "CONTACT;ZEBRAS=NO:Third Contact\n" + "EXDATE:20160125T120000Z\n" + "EXDATE;TZID=Europe/Truro;VALUE=DATE-TIME:20160125T130000Z\n" + "EXDATE;ZOOP=ZIPPO:20160125T133000Z\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5