ObjectSeekCount++;
}
+
+ // Process VALARM section.
+
+ int SeekCount = 0;
+ int AlarmObjectCount = 0;
+
+ bool AlarmActionFound = false;
+
+ for (vector<vector<string>>::iterator iter = EventAlarmName.begin();
+ iter != EventAlarmName.end(); iter++){
+
+ CalendarAlarmDataStruct NewAlarmData;
+
+ // Process the data from ACTION.
+
+ bool AlarmActionFound = false;
+ bool AlarmTriggerFound = false;
+ bool AlarmDurationFound = false;
+ bool AlarmDescriptionFound = false;
+ bool AlarmSummaryFound = false;
+
+ DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount],
+ &EventAlarmData[SeekCount], false, "ACTION");
+
+ if (DataReceived.begin() != DataReceived.end()){
+
+ try {
+ NewAlarmData.AlarmActionTokens = DataReceived.begin()->first.substr(7);
+ }
+
+ catch(const out_of_range &oor){
+ // Do nothing as there is no data.
+ }
+
+ NewAlarmData.AlarmAction = DataReceived.begin()->second;
+ AlarmActionFound = true;
+
+ }
+
+ // Check if a value was set for AlarmAction, otherwise
+ // process the next VALARM section.
+
+ if (NewAlarmData.AlarmAction.size() < 1){
+
+ SeekCount++;
+ continue;
+
+ }
+
+ // Check if AlarmAction is DISPLAY, AUDIO or EMAIL.
+ // Process the next VALARM section if not.
+
+ if (NewAlarmData.AlarmAction == "AUDIO"){
+
+ NewAlarmData.AlarmType = CALENDARALARM_AUDIO;
+
+ } else if (NewAlarmData.AlarmAction == "DISPLAY"){
+
+ NewAlarmData.AlarmType = CALENDARALARM_DISPLAY;
+
+ } else if (NewAlarmData.AlarmAction == "EMAIL"){
+
+ NewAlarmData.AlarmType = CALENDARALARM_EMAIL;
+
+ } else {
+
+ SeekCount++;
+ continue;
+
+ }
+
+ // Process the data from TRIGGER.
+
+ DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "TRIGGER");
+
+ if (DataReceived.begin() != DataReceived.end()){
+
+ bool TokenData = false;
+ string PropertyTokens;
+
+ PropertyNameData = (string*)&DataReceived.begin()->first;
+
+ PropertyData = SplitValues(*PropertyNameData);
+
+ for(map<string,string>::iterator iter = PropertyData.begin();
+ iter != PropertyData.end(); iter++){
+
+ if (iter->first == "VALUE"){
+
+ NewAlarmData.TriggerValue = iter->second;
+
+ } else if (iter->first == "RELATED"){
+
+ NewAlarmData.TriggerRelated = iter->second;
+
+ } else {
+
+ if (TokenData == false){
+ TokenData = true;
+ } else {
+ PropertyTokens += ";";
+ }
+
+ PropertyTokens += iter->first;
+ PropertyTokens += "=";
+ PropertyTokens += iter->second;
+
+ }
+
+ }
+
+ if (PropertyTokens.size() > 0){
+ NewAlarmData.TriggerTokens = PropertyTokens;
+ }
+
+ NewAlarmData.TriggerData = DataReceived.begin()->second;
+ AlarmTriggerFound = true;
+
+ }
+
+ // 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<string,string>::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;
+
+ }
+
+ // Process data from SUMMARY.
+
+ DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "SUMMARY");
+
+ if (DataReceived.begin() != DataReceived.end() &&
+ NewAlarmData.AlarmType == CALENDARALARM_EMAIL){
+
+ bool TokenData = false;
+ string PropertyTokens;
+
+ PropertyNameData = (string*)&DataReceived.begin()->first;
+
+ PropertyData = SplitValues(*PropertyNameData);
+
+ for(map<string,string>::iterator iter = PropertyData.begin();
+ iter != PropertyData.end(); iter++){
+
+ if (iter->first == "ALTREP"){
+
+ NewAlarmData.SummaryAltRep = iter->second;
+
+ } else if (iter->first == "LANGUAGE"){
+
+ NewAlarmData.SummaryLanguage = iter->second;
+
+ } else {
+
+ if (TokenData == false){
+ TokenData = true;
+ } else {
+ PropertyTokens += ";";
+ }
+
+ PropertyTokens += iter->first;
+ PropertyTokens += "=";
+ PropertyTokens += iter->second;
+
+ }
+
+ }
+
+ if (PropertyTokens.size() > 0){
+ NewAlarmData.SummaryTokens = PropertyTokens;
+ }
+
+ NewAlarmData.SummaryData = DataReceived.begin()->second;
+ AlarmSummaryFound = true;
+
+ }
+
+ // Process data from DURATION.
+
+ DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "DURATION");
+
+ if (DataReceived.begin() != DataReceived.end()){
+
+ try {
+ NewAlarmData.DurationTokens = DataReceived.begin()->first.substr(9);
+ }
+
+ catch(const out_of_range &oor){
+ // Do nothing as there is no data.
+ }
+
+ NewAlarmData.DurationData = DataReceived.begin()->second;
+ AlarmDurationFound = true;
+
+ }
+
+ // Process data from REPEAT.
+
+ DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "REPEAT");
+
+ if (DataReceived.begin() != DataReceived.end() && AlarmDurationFound == true){
+
+ try {
+ NewAlarmData.RepeatTokens = DataReceived.begin()->first.substr(7);
+ }
+
+ catch(const out_of_range &oor){
+ // Do nothing as there is no data.
+ }
+
+ NewAlarmData.RepeatData = DataReceived.begin()->second;
+
+ } else {
+
+ NewAlarmData.DurationData.clear();
+ NewAlarmData.DurationTokens.clear();
+
+ }
+
+ // Process data from ATTENDEE.
+
+ DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], true, "ATTENDEE");
+
+ ObjectSeekCount = 0;
+
+ for(multimap<string,string>::iterator iter = DataReceived.begin();
+ iter != DataReceived.end();
+ ++iter){
+
+ NewAlarmData.AttendeeListMember.push_back("");
+ NewAlarmData.AttendeeListDelegatedFrom.push_back("");
+ NewAlarmData.AttendeeListDelegatedTo.push_back("");
+ NewAlarmData.AttendeeListRole.push_back("");
+ NewAlarmData.AttendeeListRSVP.push_back("");
+ NewAlarmData.AttendeeListDirectoryEntry.push_back("");
+ NewAlarmData.AttendeeListSentBy.push_back("");
+ NewAlarmData.AttendeeListCommonName.push_back("");
+ NewAlarmData.AttendeeListCalendarUserType.push_back("");
+ NewAlarmData.AttendeeListParticipationStatus.push_back("");
+ NewAlarmData.AttendeeListLanguage.push_back("");
+ NewAlarmData.AttendeeListTokens.push_back("");
+ NewAlarmData.AttendeeList.push_back("");
+
+ bool TokenData = false;
+ string PropertyTokens;
+
+ PropertyNameData = (string*)&iter->first;
+
+ PropertyData = SplitValues(*PropertyNameData);
+
+ for(map<string,string>::iterator dataiter = PropertyData.begin();
+ dataiter != PropertyData.end(); dataiter++){
+
+ if (dataiter->first == "CUTYPE"){
+
+ NewAlarmData.AttendeeListCalendarUserType[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "MEMBER"){
+
+ NewAlarmData.AttendeeListMember[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "ROLE"){
+
+ NewAlarmData.AttendeeListRole[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "PARTSTAT"){
+
+ NewAlarmData.AttendeeListParticipationStatus[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "RSVP"){
+
+ NewAlarmData.AttendeeListRSVP[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "DELEGATED-TO"){
+
+ NewAlarmData.AttendeeListDelegatedTo[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "DELEGATED-FROM"){
+
+ NewAlarmData.AttendeeListDelegatedFrom[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "SENT-BY"){
+
+ NewAlarmData.AttendeeListSentBy[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "CN"){
+
+ NewAlarmData.AttendeeListCommonName[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "DIR"){
+
+ NewAlarmData.AttendeeListDirectoryEntry[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "LANGUAGE"){
+
+ NewAlarmData.AttendeeListLanguage[ObjectSeekCount] = dataiter->second;
+
+ } else {
+
+ if (TokenData == false){
+ TokenData = true;
+ } else {
+ PropertyTokens += ";";
+ }
+
+ PropertyTokens += dataiter->first;
+ PropertyTokens += "=";
+ PropertyTokens += dataiter->second;
+
+ }
+
+ }
+
+ if (PropertyTokens.size() > 0){
+ NewAlarmData.AttendeeListTokens[ObjectSeekCount] = PropertyTokens;
+ }
+
+ NewAlarmData.AttendeeList[ObjectSeekCount] = iter->second;
+
+ ObjectSeekCount++;
+
+ }
+
+ // Process data from ATTACH.
+
+ DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], true, "ATTACH");
+
+ ObjectSeekCount = 0;
+
+ for(multimap<string,string>::iterator iter = DataReceived.begin();
+ iter != DataReceived.end();
+ ++iter){
+
+ NewAlarmData.AttachListEncoding.push_back("");
+ NewAlarmData.AttachListValue.push_back("");
+ NewAlarmData.AttachListFormatType.push_back("");
+ NewAlarmData.AttachListTokens.push_back("");
+ NewAlarmData.AttachList.push_back("");
+
+ bool TokenData = false;
+ string PropertyTokens;
+
+ PropertyNameData = (string*)&iter->first;
+
+ PropertyData = SplitValues(*PropertyNameData);
+
+ for(map<string,string>::iterator dataiter = PropertyData.begin();
+ dataiter != PropertyData.end(); dataiter++){
+
+ if (dataiter->first == "ENCODING"){
+
+ NewAlarmData.AttachListEncoding[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "VALUE"){
+
+ NewAlarmData.AttachListValue[ObjectSeekCount] = dataiter->second;
+
+ } else if (dataiter->first == "FMTTYPE"){
+
+ NewAlarmData.AttachListFormatType[ObjectSeekCount] = dataiter->second;
+
+ } else {
+
+ if (TokenData == false){
+ TokenData = true;
+ } else {
+ PropertyTokens += ";";
+ }
+
+ PropertyTokens += dataiter->first;
+ PropertyTokens += "=";
+ PropertyTokens += dataiter->second;
+
+ }
+
+ }
+
+ if (PropertyTokens.size() > 0){
+ NewAlarmData.AttachListTokens[ObjectSeekCount] = PropertyTokens;
+ }
+
+ NewAlarmData.AttachList[ObjectSeekCount] = iter->second;
+
+ ObjectSeekCount++;
+
+ }
+
+ // Process data from X-*
+
+ AlarmObjectCount = 0;
+
+ for(vector<string>::iterator xtokeniter = EventAlarmName[SeekCount].begin();
+ xtokeniter != EventAlarmName[SeekCount].end(); ++xtokeniter){
+
+ bool TokenData = false;
+ string PropertyTokens;
+
+ if (xtokeniter->substr(0,2) == "X-" &&
+ xtokeniter->size() > 2){
+
+ NewAlarmData.XTokensData.push_back(EventAlarmData[SeekCount][AlarmObjectCount]);
+ NewAlarmData.XTokensDataTokens.push_back(EventAlarmName[SeekCount][AlarmObjectCount]);
+
+ }
+
+ AlarmObjectCount++;
+
+ }
+
+ if (NewAlarmData.AlarmType == CALENDARALARM_AUDIO &&
+ AlarmActionFound == true &&
+ AlarmTriggerFound == true){
+
+ CalendarAlarmData.push_back(NewAlarmData);
+
+ } else if (NewAlarmData.AlarmType == CALENDARALARM_DISPLAY &&
+ AlarmActionFound == true &&
+ AlarmTriggerFound == true &&
+ AlarmDescriptionFound == true){
+
+ CalendarAlarmData.push_back(NewAlarmData);
+
+ } else if (NewAlarmData.AlarmType == CALENDARALARM_EMAIL &&
+ AlarmActionFound == true &&
+ AlarmTriggerFound == true &&
+ AlarmDescriptionFound == true &&
+ AlarmSummaryFound == true){
+
+ CalendarAlarmData.push_back(NewAlarmData);
+
+ }
+
+ SeekCount++;
+
+ }
ObjectSeekCount = 0;