From: Steve Brokenshire Date: Sat, 2 Jul 2016 20:10:06 +0000 (+0100) Subject: Added FBURL to the SaveString function of ContactDataObject X-Git-Tag: release-0.14~28 X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=commitdiff_plain;h=331acea9b4442591a0d8458c5ca4b311f9733fcb Added FBURL to the SaveString function of ContactDataObject --- diff --git a/source/contacteditor/cdo/ContactDataObject-Save.cpp b/source/contacteditor/cdo/ContactDataObject-Save.cpp index bf755f1..39f4a2a 100644 --- a/source/contacteditor/cdo/ContactDataObject-Save.cpp +++ b/source/contacteditor/cdo/ContactDataObject-Save.cpp @@ -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 *CalendarReque } +} + +void ContactDataObject::SaveFreeBusyURI(std::map *FreeBusyList, std::map *FreeBusyListAltID, + std::map *FreeBusyListPID, std::map *FreeBusyListType, + std::map *FreeBusyListMediatype, std::map *FreeBusyListPref, + std::map *FreeBusyListTokens, wxString *SaveData){ + + wxString ProcessData = ""; + + for (std::map::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 diff --git a/source/contacteditor/cdo/ContactDataObject.h b/source/contacteditor/cdo/ContactDataObject.h index db79545..0cc1f23 100644 --- a/source/contacteditor/cdo/ContactDataObject.h +++ b/source/contacteditor/cdo/ContactDataObject.h @@ -180,6 +180,10 @@ class ContactDataObject{ std::map *CalendarRequestListPID, std::map *CalendarRequestListType, std::map *CalendarRequestListMediatype, std::map *CalendarRequestListPref, std::map *CalendarRequestListTokens, wxString *SaveData); + void SaveFreeBusyURI(std::map *FreeBusyList, std::map *FreeBusyListAltID, + std::map *FreeBusyListPID, std::map *FreeBusyListType, + std::map *FreeBusyListMediatype, std::map *FreeBusyListPref, + std::map *FreeBusyListTokens, wxString *SaveData); public: diff --git a/source/tests/xestiaab_contactsave.h b/source/tests/xestiaab_contactsave.h index 524b835..a680d5a 100644 --- a/source/tests/xestiaab_contactsave.h +++ b/source/tests/xestiaab_contactsave.h @@ -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"));