From 31e8fea4021ed5f03b1266ff87d188c463619b90 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 20:37:29 +0100 Subject: [PATCH] Added CONTACT property for saving data from a CalendarEventObject. Added the code and unit tests for the CONTACT property. --- .../calendarevent/CalendarEvent-Save.cpp | 46 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 3 ++ 2 files changed, 49 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 940c557..5290574 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -897,6 +897,52 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the CONTACT value. + + if (ContactList.size() > 0){ + + for (int ContactListSeek = 0; ContactListSeek < ContactList.size(); + ContactListSeek++){ + + DataLine += "CONTACT"; + + if (ContactListAltRep[ContactListSeek].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += ContactListAltRep[ContactListSeek]; + DataLine += "\""; + + } + + if (ContactListLanguage[ContactListSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += ContactListLanguage[ContactListSeek]; + + } + + if (ContactListTokens[ContactListSeek].size() > 0){ + + DataLine += ";"; + DataLine += ContactListTokens[ContactListSeek]; + + } + + DataLine += ":"; + DataLine += ContactList[ContactListSeek]; + 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 06dd2a4..2824a5f 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -113,6 +113,9 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "COMMENT:This is the first comment.\n" "COMMENT;ALTREP=\"null:nodata\";LANGUAGE=en:This is the second comment.\n" "COMMENT;ZEBRAS=YES:This is the third comment.\n" + "CONTACT:First Contact\n" + "CONTACT;ALTREP=\"null:nodata\";LANGUAGE=en-GB:Second Contact\n" + "CONTACT;ZEBRAS=NO:Third Contact\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5