From eeb65bde963cf3ccb07b1c73da87a4d2564c7ea7 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 6 Jun 2016 00:03:23 +0100 Subject: [PATCH] Added REQUEST-STATUS property for saving data from a CalendarJournalObject. Added the code and unit tests for the REQUEST-STATUS property. --- .../calendarjournal/CalendarJournal-Save.cpp | 39 +++++++++++++++++++ source/tests/xestiacalendar_icaljournalsave.h | 4 ++ 2 files changed, 43 insertions(+) diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index b347e0b..a46aa84 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -883,6 +883,45 @@ void CalendarJournalObject::SaveObjectData(string *SaveData){ } } + + // Process the REQUEST-STATUS value. + + if (RequestStatusData.size() > 0){ + + for (int RequestStatusDataSeek = 0; RequestStatusDataSeek < RequestStatusData.size(); + RequestStatusDataSeek++){ + + DataLine += "REQUEST-STATUS"; + + if (RequestStatusLanguage[RequestStatusDataSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += RequestStatusLanguage[RequestStatusDataSeek]; + + } + + if (RequestStatusTokens[RequestStatusDataSeek].size() > 0){ + + DataLine += ";"; + DataLine += RequestStatusTokens[RequestStatusDataSeek]; + + } + + DataLine += ":"; + DataLine += RequestStatusData[RequestStatusDataSeek]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + } + *SaveData += "END:VJOURNAL\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaljournalsave.h b/source/tests/xestiacalendar_icaljournalsave.h index 835d995..f9da37e 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -113,6 +113,10 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "RDATE:20160120\n" "RDATE;VALUE=DATE;TZID=Europe/Truro:20160121\n" "RDATE;ZILCH=DATA:20160520\n" + "REQUEST-STATUS:2.0;Success\n" + "REQUEST-STATUS;LANGUAGE=en:3.42;Really big irrecoverable error caused by the \n" + " user\n" + "REQUEST-STATUS;USER=MISSING:3.7;Invalid calendar user\n" "END:VJOURNAL\n" "END:VCALENDAR"; -- 2.39.5