From: Steve Brokenshire Date: Sat, 4 Jun 2016 22:20:20 +0000 (+0100) Subject: Added VALARM:ATTENDEE property for saving data from a CalendarEventObject. X-Git-Tag: release-0.02~219 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=35ea987164571833f7a5d2a465e531920fa64be2;p=xestiacalendar%2F.git Added VALARM:ATTENDEE property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:ATTENDEE property. --- diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 9e143ce..b511dc0 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1360,6 +1360,120 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the ATTENDEE VALARM values. + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeList.size() > 0){ + + for (int AttendeeListSeek = 0; AttendeeListSeek < CalendarAlarmData[CalendarAlarmDataSeek].AttendeeList.size(); + AttendeeListSeek++){ + + DataLine += "ATTENDEE"; + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListMember[AttendeeListSeek].size() > 0){ + + DataLine += ";MEMBER=\""; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListMember[AttendeeListSeek]; + DataLine += "\""; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListDelegatedFrom[AttendeeListSeek].size() > 0){ + + DataLine += ";DELEGATED-FROM=\""; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListDelegatedFrom[AttendeeListSeek]; + DataLine += "\""; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListDelegatedTo[AttendeeListSeek].size() > 0){ + + DataLine += ";DELEGATED-TO=\""; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListDelegatedTo[AttendeeListSeek]; + DataLine += "\""; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListRole[AttendeeListSeek].size() > 0){ + + DataLine += ";ROLE="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListRole[AttendeeListSeek]; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListRSVP[AttendeeListSeek].size() > 0){ + + DataLine += ";RSVP="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListRSVP[AttendeeListSeek]; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListDirectoryEntry[AttendeeListSeek].size() > 0){ + + DataLine += ";DIR=\""; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListDirectoryEntry[AttendeeListSeek]; + DataLine += "\""; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListSentBy[AttendeeListSeek].size() > 0){ + + DataLine += ";SENT-BY=\""; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListSentBy[AttendeeListSeek]; + DataLine += "\""; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListCommonName[AttendeeListSeek].size() > 0){ + + DataLine += ";CN=\""; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListCommonName[AttendeeListSeek]; + DataLine += "\""; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListCalendarUserType[AttendeeListSeek].size() > 0){ + + DataLine += ";CUTYPE="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListCalendarUserType[AttendeeListSeek]; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListParticipationStatus[AttendeeListSeek].size() > 0){ + + DataLine += ";PARTSTAT="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListParticipationStatus[AttendeeListSeek]; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListLanguage[AttendeeListSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListLanguage[AttendeeListSeek]; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListTokens[AttendeeListSeek].size() > 0){ + + DataLine += ";"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeListTokens[AttendeeListSeek]; + + } + + DataLine += ":"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttendeeList[AttendeeListSeek]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + } + *SaveData += "END:VALARM\n"; } diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/xestiacalendar_icaleventsave.h index b98907f..86710f5 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -155,6 +155,12 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "SUMMARY;ALTREP=\"null:nodata\";LANGUAGE=en;MEEP=MOOP:This is the summary of the\n" " third alarm.\n" "REPEAT;SLEEP=ALWAYS:PT3M\n" + "ATTENDEE:Attendee One\n" + "ATTENDEE;DELEGATED-FROM=\"mailto:delegated.from@example.com\";DELEGATED-TO=\"mai\n" + " lto:delegated.to@example.com\";ROLE=CHAIR;RSVP=TRUE:Attendee Two\n" + "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" "END:VALARM\n" "END:VEVENT\n" "END:VCARD";