From 428c04b066eb433a9cad124bf7d659af8b699544 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 00:03:31 +0100 Subject: [PATCH] Added VALARM:ATTACH property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:ATTACH property. --- .../calendarevent/CalendarEvent-Save.cpp | 52 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 10 ++++ 2 files changed, 62 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index b511dc0..f539944 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1474,6 +1474,58 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the ATTACH VALARM values. + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttachList.size() > 0){ + + for (int AttachListSeek = 0; AttachListSeek < CalendarAlarmData[CalendarAlarmDataSeek].AttachList.size(); + AttachListSeek++){ + + DataLine += "ATTACH"; + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttachListFormatType[AttachListSeek].size() > 0){ + + DataLine += ";FMTTYPE="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttachListFormatType[AttachListSeek]; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttachListValue[AttachListSeek].size() > 0){ + + DataLine += ";VALUE="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttachListValue[AttachListSeek]; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttachListEncoding[AttachListSeek].size() > 0){ + + DataLine += ";ENCODING="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttachListEncoding[AttachListSeek]; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].AttachListTokens[AttachListSeek].size() > 0){ + + DataLine += ";"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttachListTokens[AttachListSeek]; + + } + + DataLine += ":"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AttachList[AttachListSeek]; + 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 86710f5..f2e4847 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -137,6 +137,11 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "TRIGGER;RELATED=END;VALUE=DATE-TIME;PUSH=BUTTON:20160220T160000Z\n" "DURATION;FLYING=NO:PT5H\n" "REPEAT;NEVER=SLEEP:PT5M\n" + "ATTACH;FMTTYPE=application/internet-shortcut:http://www.example.com/\n" + "ATTACH;FMTTYPE=application/internet-shortcut:http://www.example.com/page2.htm\n" + " l\n" + "ATTACH;FMTTYPE=text/plain;VALUE=BINARY;ENCODING=BASE64;STUPID=EXAMPLE:VGhpcyB\n" + " pcyBhbiBleGFtcGxlIGZpbGU=\n" "END:VALARM\n" "BEGIN:VALARM\n" "ACTION;FLASHING=LIGHTS:DISPLAY\n" @@ -161,6 +166,11 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "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" + "ATTACH;FMTTYPE=application/internet-shortcut:http://www.example.com/\n" + "ATTACH;FMTTYPE=application/internet-shortcut:http://www.example.com/page2.htm\n" + " l\n" + "ATTACH;FMTTYPE=text/plain;VALUE=BINARY;ENCODING=BASE64;STUPID=EXAMPLE:VGhpcyB\n" + " pcyBhbiBleGFtcGxlIGZpbGU=\n" "END:VALARM\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5