X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fobjects%2Fcalendarevent%2FCalendarEvent.cpp;h=7cc99a4d563af689da6ebfdda11fdd027f24fcbf;hb=cebb37aa7d20bc00003fc9c66b8a75a75a071dd7;hp=720c7bd3fa353cc8289a1fe0c8e56dbbf6dd410c;hpb=9f0d4d57d29e29d63fc3623c567a5d22c4eb86d9;p=xestiacalendar%2F.git diff --git a/source/objects/calendarevent/CalendarEvent.cpp b/source/objects/calendarevent/CalendarEvent.cpp index 720c7bd..7cc99a4 100644 --- a/source/objects/calendarevent/CalendarEvent.cpp +++ b/source/objects/calendarevent/CalendarEvent.cpp @@ -100,31 +100,37 @@ CalendarObjectValidResult CalendarEventObject::ValidObject(){ SeekCount = 0; - // Look for DTSTART. + // Look for DTSTART if nothing is set for METHOD.. - for (vector::iterator iter = ObjectName.begin(); - iter != ObjectName.end(); iter++){ + if (MethodData.size() == 0){ + + for (vector::iterator iter = ObjectName.begin(); + iter != ObjectName.end(); iter++){ - try{ - PropertyName = ObjectName[SeekCount].substr(0,7); - } + try{ + PropertyName = ObjectName[SeekCount].substr(0,7); + } - catch(const out_of_range& oor){ - continue; - } + catch(const out_of_range& oor){ + continue; + } - if (PropertyName == "DTSTART"){ + if (PropertyName == "DTSTART"){ - if (ValidDateTimeStart == false){ - ValidDateTimeStart = true; - } else { - return CALENDAROBJECTVALID_INVALIDFORMAT; - } + if (ValidDateTimeStart == false){ + ValidDateTimeStart = true; + } else { + return CALENDAROBJECTVALID_INVALIDFORMAT; + } - } + } - SeekCount++; + SeekCount++; + } + + } else { + ValidDateTimeStart = true; } SeekCount = 0; @@ -172,6 +178,8 @@ void CalendarEventObject::ProcessData(){ // Process the data. multimap DataReceived; + map PropertyData; + string *PropertyNameData = nullptr; // Get the Date Time Stamp (DTSTAMP). @@ -197,7 +205,7 @@ void CalendarEventObject::ProcessData(){ DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "UID"); - // Process the data from DTSTAMP. + // Process the data from UID. if (DataReceived.begin() != DataReceived.end()){ @@ -213,4 +221,72 @@ void CalendarEventObject::ProcessData(){ } + // Get the Date Time Start value. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DTSTART"); + + // Process the data from DTSTART. + + if (DataReceived.begin() != DataReceived.end()){ + + 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 == "VALUE"){ + + DateTimeStartDataValue = iter->second; + + } else if (iter->first == "TZID"){ + + DateTimeStartDataTimeZoneID = iter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += iter->first; + PropertyTokens += "="; + PropertyTokens += iter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + DateTimeStartDataTokens = PropertyTokens; + } + + DateTimeStartData = DataReceived.begin()->second; + + } + + // Get the Class value. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "CLASS"); + + if (DataReceived.begin() != DataReceived.end()){ + + try { + ClassDataTokens = DataReceived.begin()->first.substr(6); + } + + catch(const out_of_range &oor){ + // Do nothing as there is no data. + } + + ClassData = DataReceived.begin()->second; + + } + }