X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fobjects%2Fcalendarjournal%2FCalendarJournal.cpp;h=beb9755430aa013f6d4ae70c4257ec7ae1f23997;hb=cba151c4b833a26c63984769f921bab5e755decd;hp=61beba061fe1b1c49efadcb6cad38489114d8980;hpb=f2fb4a3be092201439d6e76bc517dbe931e4e332;p=xestiacalendar%2F.git diff --git a/source/objects/calendarjournal/CalendarJournal.cpp b/source/objects/calendarjournal/CalendarJournal.cpp index 61beba0..beb9755 100644 --- a/source/objects/calendarjournal/CalendarJournal.cpp +++ b/source/objects/calendarjournal/CalendarJournal.cpp @@ -1,3 +1,21 @@ +// CalendarJournal.cpp - CalendarJournal class functions +// +// (c) 2016-2017 Xestia Software Development. +// +// This file is part of Xestia Calendar. +// +// Xestia Calendar is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Calendar is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Calendar. If not, see + #include "CalendarJournal.h" using namespace std; @@ -407,4 +425,781 @@ void CalendarJournalObject::ProcessData(){ } + // Process the data from STATUS. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "STATUS"); + + 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 == "LANGUAGE"){ + + StatusLanguage = iter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += iter->first; + PropertyTokens += "="; + PropertyTokens += iter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + + StatusTokens = PropertyTokens; + + } + + StatusData = DataReceived.begin()->second; + + } + + // Process the data from SUMMARY. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "SUMMARY"); + + 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 == "ALTREP"){ + + SummaryDataAltRep = iter->second; + + } else if (iter->first == "LANGUAGE"){ + + SummaryDataLanguage = iter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += iter->first; + PropertyTokens += "="; + PropertyTokens += iter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + + SummaryDataTokens = PropertyTokens; + + } + + SummaryData = DataReceived.begin()->second; + + } + + // Process the data from URL. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "URL"); + + if (DataReceived.begin() != DataReceived.end()){ + + try { + URLDataTokens = DataReceived.begin()->first.substr(4); + } + + catch(const out_of_range &oor){ + // Do nothing as there is no data. + } + + URLData = DataReceived.begin()->second; + + } + + // Process the data from RRULE. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "RRULE"); + + if (DataReceived.begin() != DataReceived.end()){ + + try { + RecurranceRuleDataTokens = DataReceived.begin()->first.substr(6); + } + + catch(const out_of_range &oor){ + // Do nothing as there is no data. + } + + RecurranceRuleData = DataReceived.begin()->second; + + } + + // Process the data from ATTACH. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "ATTACH"); + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + AttachListEncoding.push_back(""); + AttachListValue.push_back(""); + AttachListFormatType.push_back(""); + AttachListTokens.push_back(""); + AttachList.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "ENCODING"){ + + AttachListEncoding[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "VALUE"){ + + AttachListValue[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "FMTTYPE"){ + + AttachListFormatType[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + AttachListTokens[ObjectSeekCount] = PropertyTokens; + } + + AttachList[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + // Process the data from ATTENDEE. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "ATTENDEE"); + + ObjectSeekCount = 0; + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + AttendeeListMember.push_back(""); + AttendeeListDelegatedFrom.push_back(""); + AttendeeListDelegatedTo.push_back(""); + AttendeeListRole.push_back(""); + AttendeeListRSVP.push_back(""); + AttendeeListDirectoryEntry.push_back(""); + AttendeeListSentBy.push_back(""); + AttendeeListCommonName.push_back(""); + AttendeeListCalendarUserType.push_back(""); + AttendeeListParticipationStatus.push_back(""); + AttendeeListLanguage.push_back(""); + AttendeeListTokens.push_back(""); + AttendeeList.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "CUTYPE"){ + + AttendeeListCalendarUserType[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "MEMBER"){ + + AttendeeListMember[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "ROLE"){ + + AttendeeListRole[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "PARTSTAT"){ + + AttendeeListParticipationStatus[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "RSVP"){ + + AttendeeListRSVP[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "DELEGATED-TO"){ + + AttendeeListDelegatedTo[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "DELEGATED-FROM"){ + + AttendeeListDelegatedFrom[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "SENT-BY"){ + + AttendeeListSentBy[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "CN"){ + + AttendeeListCommonName[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "DIR"){ + + AttendeeListDirectoryEntry[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "LANGUAGE"){ + + AttendeeListLanguage[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + AttendeeListTokens[ObjectSeekCount] = PropertyTokens; + } + + AttendeeList[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + // Process the data from CATEGORIES. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "CATEGORIES"); + + ObjectSeekCount = 0; + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + CategoriesListTokens.push_back(""); + CategoriesListLanguage.push_back(""); + CategoriesList.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "LANGUAGE"){ + + CategoriesListLanguage[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + CategoriesListTokens[ObjectSeekCount] = PropertyTokens; + } + + CategoriesList[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + // Process the data from COMMENT. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "COMMENT"); + + ObjectSeekCount = 0; + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + CommentListTokens.push_back(""); + CommentListAltRep.push_back(""); + CommentListLanguage.push_back(""); + CommentList.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "ALTREP"){ + + CommentListAltRep[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "LANGUAGE"){ + + CommentListLanguage[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + CommentListTokens[ObjectSeekCount] = PropertyTokens; + } + + CommentList[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + // Process the data from CONTACT. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "CONTACT"); + + ObjectSeekCount = 0; + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + ContactListTokens.push_back(""); + ContactListAltRep.push_back(""); + ContactListLanguage.push_back(""); + ContactList.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "ALTREP"){ + + ContactListAltRep[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "LANGUAGE"){ + + ContactListLanguage[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + ContactListTokens[ObjectSeekCount] = PropertyTokens; + } + + ContactList[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + // Process the data from Description. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "DESCRIPTION"); + + ObjectSeekCount = 0; + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + DescriptionListTokens.push_back(""); + DescriptionListAltRep.push_back(""); + DescriptionListLanguage.push_back(""); + DescriptionList.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "ALTREP"){ + + DescriptionListAltRep[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "LANGUAGE"){ + + DescriptionListLanguage[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + DescriptionListTokens[ObjectSeekCount] = PropertyTokens; + } + + DescriptionList[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + // Process the data from EXDATE. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "EXDATE"); + + ObjectSeekCount = 0; + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + ExcludeDateDataTokens.push_back(""); + ExcludeDateDataValue.push_back(""); + ExcludeDateDataTimeZoneParam.push_back(""); + ExcludeDateData.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "VALUE"){ + + ExcludeDateDataValue[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "TZID"){ + + ExcludeDateDataTimeZoneParam[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + ExcludeDateDataTokens[ObjectSeekCount] = PropertyTokens; + } + + ExcludeDateData[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + // Process the data from RELATED-TO. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "RELATED-TO"); + + ObjectSeekCount = 0; + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + RelatedToDataTokens.push_back(""); + RelatedToDataRelationType.push_back(""); + RelatedToData.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "RELTYPE"){ + + RelatedToDataRelationType[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + RelatedToDataTokens[ObjectSeekCount] = PropertyTokens; + } + + RelatedToData[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + // Process the data from RDATE. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "RDATE"); + + ObjectSeekCount = 0; + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + RecurranceDateDataTokens.push_back(""); + RecurranceDateDataValue.push_back(""); + RecurranceDateDataTimeZoneParam.push_back(""); + RecurranceDateData.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "VALUE"){ + + RecurranceDateDataValue[ObjectSeekCount] = dataiter->second; + + } else if (dataiter->first == "TZID"){ + + RecurranceDateDataTimeZoneParam[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + RecurranceDateDataTokens[ObjectSeekCount] = PropertyTokens; + } + + RecurranceDateData[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + // Process the data from REQUEST-STATUS. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, true, "REQUEST-STATUS"); + + ObjectSeekCount = 0; + + for(multimap::iterator iter = DataReceived.begin(); + iter != DataReceived.end(); + ++iter){ + + RequestStatusTokens.push_back(""); + RequestStatusLanguage.push_back(""); + RequestStatusData.push_back(""); + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&iter->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator dataiter = PropertyData.begin(); + dataiter != PropertyData.end(); dataiter++){ + + if (dataiter->first == "LANGUAGE"){ + + RequestStatusLanguage[ObjectSeekCount] = dataiter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += dataiter->first; + PropertyTokens += "="; + PropertyTokens += dataiter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + RequestStatusTokens[ObjectSeekCount] = PropertyTokens; + } + + RequestStatusData[ObjectSeekCount] = iter->second; + + ObjectSeekCount++; + + } + + ObjectSeekCount = 0; + + // Process data from X-* + + for(vector::iterator iter = ObjectName.begin(); + iter != ObjectName.end(); ++iter){ + + bool TokenData = false; + string PropertyTokens; + + if (iter->substr(0,2) == "X-" && + iter->size() > 2){ + + XTokensData.push_back(ObjectData[ObjectSeekCount]); + XTokensDataTokens.push_back(ObjectName[ObjectSeekCount]); + + } + + ObjectSeekCount++; + + } + } \ No newline at end of file