X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fobjects%2Fcalendarevent%2FCalendarEvent.cpp;h=720c7bd3fa353cc8289a1fe0c8e56dbbf6dd410c;hb=23ed94d24ff92c7e8e1a253575c02935cb672d19;hp=b266d191768407ddf56ef532de07ccf392decec4;hpb=a635d33edace32e152c96b25e364e3481850cb9f;p=xestiacalendar%2F.git diff --git a/source/objects/calendarevent/CalendarEvent.cpp b/source/objects/calendarevent/CalendarEvent.cpp index b266d19..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; @@ -146,7 +177,7 @@ void CalendarEventObject::ProcessData(){ DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DTSTAMP"); - // Process the data. + // Process the data from DTSTAMP. if (DataReceived.begin() != DataReceived.end()){ @@ -161,5 +192,25 @@ void CalendarEventObject::ProcessData(){ DateTimeStampData = DataReceived.begin()->second; } + + // Get the Unique ID (UID). + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "UID"); + + // Process the data from DTSTAMP. + + if (DataReceived.begin() != DataReceived.end()){ + + try { + UniqueIDTokens = DataReceived.begin()->first.substr(4); + } + + catch(const out_of_range &oor){ + // Do nothing as there is no data. + } + + UniqueID = DataReceived.begin()->second; + + } }