Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added CALADRURI to the SaveString function of ContactDataObject
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 2 Jul 2016 19:11:46 +0000 (20:11 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 2 Jul 2016 19:11:46 +0000 (20:11 +0100)
source/contacteditor/cdo/ContactDataObject-Save.cpp
source/contacteditor/cdo/ContactDataObject.h
source/tests/xestiaab_contactsave.h

index 642ea5c..bf755f1 100644 (file)
@@ -598,6 +598,13 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &CalendarListAltID, &CalendarListPID,
                &CalendarListType, &CalendarListPref,
                &CalendarListTokens, SaveData);
+       
+       // Process CALADRURI.
+       
+       SaveCalendarRequestURI(&CalendarRequestList, &CalendarRequestListMediatype,
+               &CalendarRequestListAltID, &CalendarRequestListPID,
+               &CalendarRequestListType, &CalendarRequestListPref,
+               &CalendarRequestListTokens, SaveData);
 
        // Write the end part of the vCard data file.
        
@@ -2028,4 +2035,83 @@ void ContactDataObject::SaveCalendarURI(map<int, wxString> *CalendarList, map<in
                        
        }
                
+}
+
+void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarRequestList, map<int, wxString> *CalendarRequestListMediatype,
+       map<int, wxString> *CalendarRequestListAltID, map<int, wxString> *CalendarRequestListPID,
+       map<int, wxString> *CalendarRequestListType, map<int, int> *CalendarRequestListPref,
+       map<int, wxString> *CalendarRequestListTokens, wxString *SaveData){
+
+       wxString ProcessData = "";
+               
+       for (std::map<int, wxString>::iterator CalendarRequestIter = CalendarRequestList->begin();
+               CalendarRequestIter != CalendarRequestList->end(); CalendarRequestIter++){
+
+               ProcessData.Append("CALADRURI");
+                       
+               // Check if there is a value for TYPE.
+               
+               if ((*CalendarRequestListType)[CalendarRequestIter->first].size() > 0){
+               
+                       ProcessData.Append(";TYPE=");
+                       ProcessData.Append((*CalendarRequestListType)[CalendarRequestIter->first]);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*CalendarRequestListAltID)[CalendarRequestIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*CalendarRequestListAltID)[CalendarRequestIter->first]);
+                       
+               }
+
+               // Check if there is a value for MEDIATYPE.
+               
+               if ((*CalendarRequestListMediatype)[CalendarRequestIter->first].size() > 0){
+               
+                       ProcessData.Append(";MEDIATYPE=");
+                       ProcessData.Append((*CalendarRequestListMediatype)[CalendarRequestIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*CalendarRequestListPID)[CalendarRequestIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*CalendarRequestListPID)[CalendarRequestIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*CalendarRequestListPref)[CalendarRequestIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*CalendarRequestListPref)[CalendarRequestIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*CalendarRequestListTokens)[CalendarRequestIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*CalendarRequestListTokens)[CalendarRequestIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(CalendarRequestIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+               
 }
\ No newline at end of file
index 1a47af9..db79545 100644 (file)
@@ -176,6 +176,10 @@ class ContactDataObject{
                std::map<int, wxString> *CalendarListPID, std::map<int, wxString> *CalendarListType,
                std::map<int, wxString> *CalendarListMediatype, std::map<int, int> *CalendarListPref, 
                std::map<int, wxString> *CalendarListTokens, wxString *SaveData);
+       void SaveCalendarRequestURI(std::map<int, wxString> *CalendarRequestList, std::map<int, wxString> *CalendarRequestListAltID, 
+               std::map<int, wxString> *CalendarRequestListPID, std::map<int, wxString> *CalendarRequestListType,
+               std::map<int, wxString> *CalendarRequestListMediatype, std::map<int, int> *CalendarRequestListPref, 
+               std::map<int, wxString> *CalendarRequestListTokens, wxString *SaveData);
 
        public:
 
index b2be408..524b835 100644 (file)
@@ -550,6 +550,12 @@ TEST(ContactSave, ContactSaveTests){
        " OUNDED:http://example.com/home\n"
        "CALURI;TYPE=work;ALTID=54;MEDIATYPE=text/stillwetink;PID=51;PREF=52;CALENDARS\n"
        " =CANCELLED:http://example.com/business\n"
+       "CALADRURI;ALTID=14;MEDIATYPE=text/plain;PID=11;PREF=12;REQUEST=YES:http://exa\n"
+       " mple.com/request\n"
+       "CALADRURI;TYPE=home;ALTID=24;MEDIATYPE=text/dryplain;PID=21;PREF=22;REQUEST=M\n"
+       " AYBE:http://example.com/home/request\n"
+       "CALADRURI;TYPE=work;ALTID=34;MEDIATYPE=text/stillwetink;PID=31;PREF=32;REQUES\n"
+       " T=NO:http://example.com/business/request\n"
        "END:VCARD";
 
        ASSERT_EQ(CONTACTLOAD_OK, TestFile3.LoadFile("LoadCheck-Load4.vcf"));
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy