From 9f0d4d57d29e29d63fc3623c567a5d22c4eb86d9 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 23 Jan 2016 13:55:44 +0000 Subject: [PATCH] Added check for DTSTART in CalendarEventObject::ValidObject --- .../objects/calendarevent/CalendarEvent.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent.cpp b/source/objects/calendarevent/CalendarEvent.cpp index ee003f9..720c7bd 100644 --- a/source/objects/calendarevent/CalendarEvent.cpp +++ b/source/objects/calendarevent/CalendarEvent.cpp @@ -8,6 +8,7 @@ CalendarObjectValidResult CalendarEventObject::ValidObject(){ bool ValidEnd = false; bool ValidDateTimeStamp = false; bool ValidUniqueID = false; + bool ValidDateTimeStart = false; int SeekCount = 0; string PropertyName; @@ -99,6 +100,35 @@ CalendarObjectValidResult CalendarEventObject::ValidObject(){ SeekCount = 0; + // Look for DTSTART. + + for (vector::iterator iter = ObjectName.begin(); + iter != ObjectName.end(); iter++){ + + try{ + PropertyName = ObjectName[SeekCount].substr(0,7); + } + + catch(const out_of_range& oor){ + continue; + } + + if (PropertyName == "DTSTART"){ + + if (ValidDateTimeStart == false){ + ValidDateTimeStart = true; + } else { + return CALENDAROBJECTVALID_INVALIDFORMAT; + } + + } + + SeekCount++; + + } + + SeekCount = 0; + // Look for END:VEVENT. for (vector::iterator iter = ObjectName.begin(); @@ -124,6 +154,7 @@ CalendarObjectValidResult CalendarEventObject::ValidObject(){ if (ValidBegin == true && ValidEnd == true && ValidDateTimeStamp == true && + ValidDateTimeStart == true && ValidUniqueID == true){ return CALENDAROBJECTVALID_OK; -- 2.39.5