From 72b79f26a1e1176401dbb089eb40ab5e30b70dc0 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Thu, 2 Jun 2016 22:28:19 +0100 Subject: [PATCH] Added ORGANIZER property for saving data from a CalendarEventObject. Added the code and unit tests for the ORGANIZER property. --- .../calendarevent/CalendarEvent-Save.cpp | 56 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 2 + 2 files changed, 58 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 8f28931..2219f1a 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -381,6 +381,62 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the ORGANIZER value. + + if (OrganiserData.size() > 0){ + + DataLine += "ORGANIZER"; + + if (OrganiserDataCommonName.size() > 0){ + + DataLine += ";CN="; + DataLine += OrganiserDataCommonName; + + } + + if (OrganiserDataDirectoryEntry.size() > 0){ + + DataLine += ";DIR=\""; + DataLine += OrganiserDataDirectoryEntry; + DataLine += "\""; + + } + + if (OrganiserDataSentByParam.size() > 0){ + + DataLine += ";SENT-BY=\""; + DataLine += OrganiserDataSentByParam; + DataLine += "\""; + + } + + if (OrganiserDataLanguage.size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += OrganiserDataLanguage; + + } + + if (OrganiserDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += OrganiserDataTokens; + + } + + DataLine += ":"; + DataLine += OrganiserData; + 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 b6c7576..247773f 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -85,6 +85,8 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "GEO;EXAMPLE=MEEP:5.0;5.0\n" "LAST-MODIFIED;FUTURE=ODD:20160124T093000Z\n" "LOCATION;ALTREP=\"null:nodata\";LANGUAGE=kw;EXACT=NO:The Basement, Truro\n" + "ORGANIZER;CN=ExampleOrganiser;DIR=\"null:nodata\";SENT-BY=\"mailto:organiser.nor\n" + " eply@example.com\";LANGUAGE=kw;HAPPY=DAYS:mailto:organiser@example.com\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5