From 294462b8ae2358991a304ae4dd3c757d26ed818d Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 00:48:32 +0100 Subject: [PATCH] Added VALARM:X-Token property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:X-Token property. --- .../calendarevent/CalendarEvent-Save.cpp | 23 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 9 ++++++++ 2 files changed, 32 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index f539944..89819dd 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1526,6 +1526,29 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the X-Token VALARM values. + + if (CalendarAlarmData[CalendarAlarmDataSeek].XTokensData.size() > 0){ + + for (int XTokenSeek = 0; XTokenSeek < CalendarAlarmData[CalendarAlarmDataSeek].XTokensData.size(); + XTokenSeek++){ + + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].XTokensDataTokens[XTokenSeek]; + DataLine += ":"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].XTokensData[XTokenSeek]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + } + *SaveData += "END:VALARM\n"; } diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/xestiacalendar_icaleventsave.h index f2e4847..8f188ef 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -142,6 +142,9 @@ TEST(iCalendarSaveEvent, SaveEventTests){ " l\n" "ATTACH;FMTTYPE=text/plain;VALUE=BINARY;ENCODING=BASE64;STUPID=EXAMPLE:VGhpcyB\n" " pcyBhbiBleGFtcGxlIGZpbGU=\n" + "X-EXAMPLE1;YAY=YES:Example Data 1\n" + "X-EXAMPLE2;NOPE=YEP:Example Data 2\n" + "X-EXAMPLE3;WORLD=NO:Example Data 3\n" "END:VALARM\n" "BEGIN:VALARM\n" "ACTION;FLASHING=LIGHTS:DISPLAY\n" @@ -150,6 +153,9 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=kw;TERRIBLE=TOKEN:This is the secon\n" " d alarm.\n" "REPEAT;SLEEP=ALWAYS:PT3M\n" + "X-EXAMPLE1;YAY=YES:Example Data 1\n" + "X-EXAMPLE2;NOPE=YEP:Example Data 2\n" + "X-EXAMPLE3;WORLD=NO:Example Data 3\n" "END:VALARM\n" "BEGIN:VALARM\n" "ACTION;FLASHING=LIGHTS:EMAIL\n" @@ -171,6 +177,9 @@ TEST(iCalendarSaveEvent, SaveEventTests){ " l\n" "ATTACH;FMTTYPE=text/plain;VALUE=BINARY;ENCODING=BASE64;STUPID=EXAMPLE:VGhpcyB\n" " pcyBhbiBleGFtcGxlIGZpbGU=\n" + "X-EXAMPLE1;YAY=YES:Example Data 1\n" + "X-EXAMPLE2;NOPE=YEP:Example Data 2\n" + "X-EXAMPLE3;WORLD=NO:Example Data 3\n" "END:VALARM\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5