From bebe444a9884ec7ee83fc1d18853ade85dcc709e Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 16:23:15 +0100 Subject: [PATCH] Added ATTACH property for saving data from a CalendarEventObject. Added the code and unit tests for the ATTACH property. --- .../calendarevent/CalendarEvent-Save.cpp | 52 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 5 ++ 2 files changed, 57 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index aee9093..2a4c83b 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -647,6 +647,58 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the ATTACH values. + + if (AttachList.size() > 0){ + + for (int AttachListSeek = 0; AttachListSeek < AttachList.size(); + AttachListSeek++){ + + DataLine += "ATTACH"; + + if (AttachListFormatType[AttachListSeek].size() > 0){ + + DataLine += ";FMTTYPE="; + DataLine += AttachListFormatType[AttachListSeek]; + + } + + if (AttachListValue[AttachListSeek].size() > 0){ + + DataLine += ";VALUE="; + DataLine += AttachListValue[AttachListSeek]; + + } + + if (AttachListEncoding[AttachListSeek].size() > 0){ + + DataLine += ";ENCODING="; + DataLine += AttachListEncoding[AttachListSeek]; + + } + + if (AttachListTokens[AttachListSeek].size() > 0){ + + DataLine += ";"; + DataLine += AttachListTokens[AttachListSeek]; + + } + + DataLine += ":"; + DataLine += AttachList[AttachListSeek]; + 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 ccbb1ea..655a980 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -95,6 +95,11 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "RECURRENCE-ID;TZID=Europe/Truro;RANGE=THISANDFUTURE;VALUE=DATE;EXAMPLE=DATA:2\n" " 0160124\n" "RRULE;TEST=DATA:FREQ=DAILY;COUNT=10\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:VEVENT\n" "END:VCARD"; -- 2.39.5