From 2c9cd569e9892403582cda6ecb55bf95ad4e0f12 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 19:50:07 +0100 Subject: [PATCH] Added REQUEST-STATUS property for saving data from a CalendarFreeBusyObject. Added the code and unit tests for the REQUEST-STATUS property. --- .../CalendarFreeBusy-Save.cpp | 38 +++++++++++++++++++ .../tests/xestiacalendar_icalfreebusysave.h | 4 ++ 2 files changed, 42 insertions(+) diff --git a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp index d14ea57..482b99d 100644 --- a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp +++ b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp @@ -470,6 +470,44 @@ void CalendarFreeBusyObject::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:VFREEBUSY\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icalfreebusysave.h b/source/tests/xestiacalendar_icalfreebusysave.h index 75f73bb..5964b1c 100644 --- a/source/tests/xestiacalendar_icalfreebusysave.h +++ b/source/tests/xestiacalendar_icalfreebusysave.h @@ -78,6 +78,10 @@ TEST(iCalendarSaveFreeBusy, SaveFreeBusyTests){ "FREEBUSY:20160202T210000Z/PT1H\n" "FREEBUSY;FBTYPE=FREE:20160202T220000Z/PT1H\n" "FREEBUSY;FBTYPE=BUSY-UNAVAILABLE;RESULT=ARGH;TEST=YES:20160202T230000Z/PT9H\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:VFREEBUSY\n" "END:VCALENDAR"; -- 2.39.5