From: Steve Brokenshire Date: Sun, 5 Jun 2016 18:40:42 +0000 (+0100) Subject: Added COMMENT property for saving data from a CalendarFreeBusyObject. X-Git-Tag: release-0.02~203 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=147cac658c6094d91621c4a9fc8d8697045b2aad;p=xestiacalendar%2F.git Added COMMENT property for saving data from a CalendarFreeBusyObject. Added the code and unit tests for the COMMENT property. --- diff --git a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp index 71dfd35..9132b94 100644 --- a/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp +++ b/source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp @@ -386,6 +386,52 @@ void CalendarFreeBusyObject::SaveObjectData(string *SaveData){ } + // Process the COMMENT value. + + if (CommentList.size() > 0){ + + for (int CommentListSeek = 0; CommentListSeek < CommentList.size(); + CommentListSeek++){ + + DataLine += "COMMENT"; + + if (CommentListAltRep[CommentListSeek].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += CommentListAltRep[CommentListSeek]; + DataLine += "\""; + + } + + if (CommentListLanguage[CommentListSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += CommentListLanguage[CommentListSeek]; + + } + + if (CommentListTokens[CommentListSeek].size() > 0){ + + DataLine += ";"; + DataLine += CommentListTokens[CommentListSeek]; + + } + + DataLine += ":"; + DataLine += CommentList[CommentListSeek]; + 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 f953dc9..9d36a57 100644 --- a/source/tests/xestiacalendar_icalfreebusysave.h +++ b/source/tests/xestiacalendar_icalfreebusysave.h @@ -72,6 +72,9 @@ TEST(iCalendarSaveFreeBusy, SaveFreeBusyTests){ "ATTENDEE;DIR=\"null:nodata\";SENT-BY=\"mailto:sent.by@example.com\";CN=\"Attendee \n" " The Third\";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;LANGUAGE=kw;EXAMPLE=DATA:Atte\n" " ndee Three\n" + "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" "END:VFREEBUSY\n" "END:VCALENDAR";