From: Steve Brokenshire Date: Sat, 4 Jun 2016 20:07:12 +0000 (+0100) Subject: Added RELATED-TO property for saving data from a CalendarEventObject. X-Git-Tag: release-0.02~228 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=3480b964183c98f4e7ff503e25b0bd253b4103b1;p=xestiacalendar%2F.git Added RELATED-TO property for saving data from a CalendarEventObject. Added the code and unit tests for the RELATED-TO property. --- diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 0181d0a..d7251aa 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1026,6 +1026,44 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the RELATED-TO value. + + if (RelatedToData.size() > 0){ + + for (int RequestToDataSeek = 0; RequestToDataSeek < RelatedToData.size(); + RequestToDataSeek++){ + + DataLine += "RELATED-TO"; + + if (RelatedToDataRelationType[RequestToDataSeek].size() > 0){ + + DataLine += ";RELTYPE="; + DataLine += RelatedToDataRelationType[RequestToDataSeek]; + + } + + if (RelatedToDataTokens[RequestToDataSeek].size() > 0){ + + DataLine += ";"; + DataLine += RelatedToDataTokens[RequestToDataSeek]; + + } + + DataLine += ":"; + DataLine += RelatedToData[RequestToDataSeek]; + 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 8b851fc..d7794da 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -123,6 +123,9 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "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" + "RELATED-TO:person.1@example.com\n" + "RELATED-TO;RELTYPE=PARENT:person.2@example.com\n" + "RELATED-TO;SCHOOL=MEETING:person.3@example.com\n" "END:VEVENT\n" "END:VCARD";