From f7c1cf41f2b54e66dc8534a8b1e6c6a3ee7176d2 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 14 Feb 2016 12:03:30 +0000 Subject: [PATCH] Added code to process DISPLAY VALARMs in CalendarEventObject. --- .../objects/calendarevent/CalendarEvent.cpp | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent.cpp b/source/objects/calendarevent/CalendarEvent.cpp index b12d6c9..b88a265 100644 --- a/source/objects/calendarevent/CalendarEvent.cpp +++ b/source/objects/calendarevent/CalendarEvent.cpp @@ -1473,6 +1473,7 @@ void CalendarEventObject::ProcessData(){ bool AlarmActionFound = false; bool AlarmTriggerFound = false; bool AlarmDurationFound = false; + bool AlarmDescriptionFound = false; DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "ACTION"); @@ -1573,6 +1574,59 @@ void CalendarEventObject::ProcessData(){ } + // Process the data from DESCRIPTION. + + DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "DESCRIPTION"); + + if (DataReceived.begin() != DataReceived.end() && + (NewAlarmData.AlarmType == CALENDARALARM_DISPLAY || + NewAlarmData.AlarmType == CALENDARALARM_EMAIL)){ + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&DataReceived.begin()->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator iter = PropertyData.begin(); + iter != PropertyData.end(); iter++){ + + if (iter->first == "ALTREP"){ + + NewAlarmData.DescriptionAltRep = iter->second; + + } else if (iter->first == "LANGUAGE"){ + + NewAlarmData.DescriptionLanguage = iter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += iter->first; + PropertyTokens += "="; + PropertyTokens += iter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + NewAlarmData.DescriptionTokens = PropertyTokens; + } + + NewAlarmData.DescriptionData = DataReceived.begin()->second; + AlarmDescriptionFound = true; + + } + + // TODO: Implement SUMMARY. + // Process data from DURATION. DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "DURATION"); @@ -1643,6 +1697,13 @@ void CalendarEventObject::ProcessData(){ CalendarAlarmData.push_back(NewAlarmData); + } else if (NewAlarmData.AlarmType == CALENDARALARM_DISPLAY && + AlarmActionFound == true && + AlarmTriggerFound == true && + AlarmDescriptionFound == true){ + + CalendarAlarmData.push_back(NewAlarmData); + } SeekCount++; -- 2.39.5