Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added CONTACT property for saving data from a CalendarFreeBusyObject.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 5 Jun 2016 13:57:36 +0000 (14:57 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 5 Jun 2016 13:57:36 +0000 (14:57 +0100)
Added the code and unit tests for the CONTACT property.

source/objects/calendarfreebusy/CalendarFreeBusy-Save.cpp
source/tests/xestiacalendar_icalfreebusysave.h

index aed39d8..f59de19 100644 (file)
@@ -65,6 +65,51 @@ void CalendarFreeBusyObject::SaveObjectData(string *SaveData){
                
        }
        
+       // Process the CONTACT value.
+       
+       if (ContactList.size() > 0){
+               
+               if (ContactList[0].size() > 0){
+               
+                       DataLine += "CONTACT";
+               
+                       if (ContactListAltRep[0].size() > 0){
+               
+                               DataLine += ";ALTREP=\"";
+                               DataLine += ContactListAltRep[0];
+                               DataLine += "\"";
+                       
+                       }
+               
+                       if (ContactListLanguage[0].size() > 0){
+               
+                               DataLine += ";LANGUAGE=";
+                               DataLine += ContactListLanguage[0];
+                       
+                       }
+               
+                       if (ContactListTokens[0].size() > 0){
+               
+                               DataLine += ";";
+                               DataLine += ContactListTokens[0];
+                       
+                       }
+               
+                       DataLine += ":";
+                       DataLine += ContactList[0];
+                       DataLine += "\n";
+               
+                       DataLineProcessed = OutputText(&DataLine);
+               
+                       *SaveData += DataLineProcessed;
+
+                       DataLine.clear();
+                       DataLineProcessed.clear();
+               
+               }
+               
+       }
+       
        *SaveData += "END:VFREEBUSY\n";
        
 }
\ No newline at end of file
index 6b30f1a..849b8d0 100644 (file)
@@ -21,6 +21,7 @@
 TEST(iCalendarSaveFreeBusy, SaveFreeBusyTests){
        
        CalendarFreeBusyObject TestFreeBusy;
+       CalendarFreeBusyObject TestFreeBusy2;
        
        // Load the test free/busy information.
        
@@ -46,4 +47,23 @@ TEST(iCalendarSaveFreeBusy, SaveFreeBusyTests){
        
        ASSERT_EQ(SaveDataComparison, SaveData);
        
+       SaveData.clear();
+       
+       ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestFreeBusy2.LoadFile("iCalendarFreeBusy-Load2.vcf"));
+       ASSERT_EQ(CALENDAROBJECTVALID_OK, TestFreeBusy2.ValidBaseObject());
+       
+       SaveDataComparison = "BEGIN:VCALENDAR\n"
+       "VERSION:2.0\n"
+       "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
+       "BEGIN:VFREEBUSY\n"
+       "UID;UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT:b3a16392-ad86-4061-be53-c215af2306ff\n"
+       "DTSTAMP;OTHER=PARAM:20160131T173000Z\n"
+       "CONTACT;ALTREP=\"null:nodata\";LANGUAGE=en-GB;EXAMPLE=TOKEN:Contact Person\n"
+       "END:VFREEBUSY\n"
+       "END:VCALENDAR";        
+
+       TestFreeBusy2.SaveString(&SaveData);
+
+       ASSERT_EQ(SaveDataComparison, SaveData);
+
 }
\ No newline at end of file
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