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

index bf755f1..39f4a2a 100644 (file)
@@ -606,6 +606,13 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &CalendarRequestListType, &CalendarRequestListPref,
                &CalendarRequestListTokens, SaveData);
 
+       // Process FBURL.
+       
+       SaveFreeBusyURI(&FreeBusyList, &FreeBusyListAltID, 
+               &FreeBusyListPID, &FreeBusyListType,
+               &FreeBusyListMediatype, &FreeBusyListPref, 
+               &FreeBusyListTokens, SaveData);
+
        // Write the end part of the vCard data file.
        
        SaveData->Append("END:VCARD");
@@ -2114,4 +2121,83 @@ void ContactDataObject::SaveCalendarRequestURI(map<int, wxString> *CalendarReque
                        
        }
                
+}
+
+void ContactDataObject::SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID, 
+       std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
+       std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref, 
+       std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData){
+
+       wxString ProcessData = "";
+               
+       for (std::map<int, wxString>::iterator FreeBusyIter = FreeBusyList->begin();
+               FreeBusyIter != FreeBusyList->end(); FreeBusyIter++){
+
+               ProcessData.Append("FBURL");
+                       
+               // Check if there is a value for TYPE.
+               
+               if ((*FreeBusyListType)[FreeBusyIter->first].size() > 0){
+               
+                       ProcessData.Append(";TYPE=");
+                       ProcessData.Append((*FreeBusyListType)[FreeBusyIter->first]);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*FreeBusyListAltID)[FreeBusyIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*FreeBusyListAltID)[FreeBusyIter->first]);
+                       
+               }
+
+               // Check if there is a value for MEDIATYPE.
+               
+               if ((*FreeBusyListMediatype)[FreeBusyIter->first].size() > 0){
+               
+                       ProcessData.Append(";MEDIATYPE=");
+                       ProcessData.Append((*FreeBusyListMediatype)[FreeBusyIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*FreeBusyListPID)[FreeBusyIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*FreeBusyListPID)[FreeBusyIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*FreeBusyListPref)[FreeBusyIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*FreeBusyListPref)[FreeBusyIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*FreeBusyListTokens)[FreeBusyIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*FreeBusyListTokens)[FreeBusyIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(FreeBusyIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+               
 }
\ No newline at end of file
index db79545..0cc1f23 100644 (file)
@@ -180,6 +180,10 @@ class ContactDataObject{
                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);
+       void SaveFreeBusyURI(std::map<int, wxString> *FreeBusyList, std::map<int, wxString> *FreeBusyListAltID, 
+               std::map<int, wxString> *FreeBusyListPID, std::map<int, wxString> *FreeBusyListType,
+               std::map<int, wxString> *FreeBusyListMediatype, std::map<int, int> *FreeBusyListPref, 
+               std::map<int, wxString> *FreeBusyListTokens, wxString *SaveData);
 
        public:
 
index 524b835..a680d5a 100644 (file)
@@ -556,6 +556,12 @@ TEST(ContactSave, ContactSaveTests){
        " 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"
+       "FBURL;ALTID=74;MEDIATYPE=text/plain;PID=71;PREF=72;STATUS=OUT:http://example.\n"
+       " com/freebusy\n"
+       "FBURL;TYPE=home;ALTID=84;MEDIATYPE=text/dryplain;PID=81;PREF=82;STATUS=FREE:h\n"
+       " ttp://example.com/home/freebusy\n"
+       "FBURL;TYPE=work;ALTID=94;MEDIATYPE=text/stillwetink;PID=91;PREF=92;STATUS=BUS\n"
+       " Y:http://example.com/business/freebusy\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