int VendorCount = 0;
int XTokenCount = 0;
int XMLCount = 0;
+ int ClientPIDCount = 0;
wxString ContactLine;
wxString PropertyLine;
wxString PropertySeg1;
ProcessN(PropertySeg1, PropertySeg2);
NameProcessed = TRUE;
+ } else if (Property == wxT("CLIENTPIDMAP")){
+
+ ProcessClientPIDMap(PropertySeg1, PropertySeg2, &ClientPIDCount);
+ ClientPIDCount++;
+
} else if (Property == wxT("NICKNAME")){
ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
}
+void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
+
+ size_t intPropertyLen = PropertySeg1.Len();
+ std::map<int, int> SplitPoints;
+ std::map<int, int> SplitLength;
+ std::map<int, int>::iterator SLiter;
+ wxString PropertyData;
+ wxString PropertyName;
+ wxString PropertyValue;
+ wxString PropertyTokens;
+ bool FirstToken = TRUE;
+ int intSplitsFound = 0;
+ int intSplitSize = 0;
+ int intPrevValue = 14;
+ int intPref = 0;
+ int intType = 0;
+
+ SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
+
+ intPrevValue = 13;
+
+ for (std::map<int, int>::iterator intiter = SplitPoints.begin();
+ intiter != SplitPoints.end(); ++intiter){
+
+ SLiter = SplitLength.find(intiter->first);
+
+ PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
+
+ wxStringTokenizer PropertyElement (PropertyData, wxT("="));
+ PropertyName = PropertyElement.GetNextToken();
+ PropertyValue = PropertyElement.GetNextToken();
+
+ intPrevValue = intiter->second;
+
+ // Process properties.
+
+ size_t intPropertyValueLen = PropertyValue.Len();
+
+ if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
+
+ PropertyValue.Trim();
+ PropertyValue.RemoveLast();
+
+ }
+
+ if (PropertyValue.Mid(0, 1) == wxT("\"")){
+
+ PropertyValue.Remove(0, 1);
+
+ }
+
+ CaptureString(&PropertyValue, FALSE);
+
+ if (PropertyName.IsEmpty() || PropertyName.IsEmpty()){
+
+ continue;
+
+ }
+
+ if (FirstToken == TRUE){
+
+ PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
+ FirstToken = FALSE;
+
+ } else {
+
+ PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
+
+ }
+
+ }
+
+ CaptureString(&PropertySeg2, FALSE);
+
+ ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
+
+ if (!PropertyTokens.IsEmpty()){
+
+ ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
+
+ }
+
+}
+
void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
std::map<int, int> SplitPoints;
void ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount);
void ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount);
void ProcessN(wxString PropertySeg1, wxString PropertySeg2);
+ void ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount);
void ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount);
void ProcessGender(wxString PropertySeg1, wxString PropertySeg2);
void ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2);
std::map<int, wxString> XMLList;
std::map<int, wxString> XMLListAltID;
+ std::map<int, wxString> ClientPIDList;
+ std::map<int, wxString> ClientPIDListTokens;
+
/* We don't use these at the moment but we want to keep
them for compatability reasons */
UID:903588-9082374-989120310-AAFECDBCDF
KIND:individual
REV;TEST=YES;DATA=NO;MORE=MAYBE:20151227T033000Z
+CLIENTPIDMAP:1;urn;uuid:aaaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
+CLIENTPIDMAP:2;urn;uuid:ccccccccc-cccc-cccc-cccc-cccccccccccc
+CLIENTPIDMAP;MEEP=MOO;WOOP=WOO:3;urn;uuid:bbbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbb
+ bbb
XML:<a xmlns="http://www.w3.org/1999/xhtml"\n
href="http://example.com/">Example Page 1</a>
XML;ALTID=3:<a xmlns="http://www.w3.org/1999/xhtml"\n
}
+TEST(ContactLoad, ClientPIDMapTests){
+
+ ContactDataObject TestFile;
+
+ ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
+
+ std::map<int,wxString>::iterator TestFileIter;
+
+ // Test the first Client PID Map.
+
+ TestFileIter = TestFile.ClientPIDList.find(0);
+ ASSERT_NE(TestFile.ClientPIDList.end(), TestFileIter);
+ ASSERT_EQ("1;urn;uuid:aaaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", TestFileIter->second);
+
+ TestFileIter = TestFile.ClientPIDListTokens.find(0);
+ ASSERT_EQ(TestFile.ClientPIDListTokens.end(), TestFileIter);
+
+ // Test the second Client PID Map.
+
+ TestFileIter = TestFile.ClientPIDList.find(1);
+ ASSERT_NE(TestFile.ClientPIDList.end(), TestFileIter);
+ ASSERT_EQ("2;urn;uuid:ccccccccc-cccc-cccc-cccc-cccccccccccc", TestFileIter->second);
+
+ TestFileIter = TestFile.ClientPIDListTokens.find(1);
+ ASSERT_EQ(TestFile.ClientPIDListTokens.end(), TestFileIter);
+
+ // Test the third Client PID Map.
+
+ TestFileIter = TestFile.ClientPIDListTokens.find(2);
+ ASSERT_NE(TestFile.ClientPIDListTokens.end(), TestFileIter);
+ ASSERT_EQ("MEEP=MOO;WOOP=WOO", TestFileIter->second);
+
+ TestFileIter = TestFile.ClientPIDList.find(2);
+ ASSERT_NE(TestFile.ClientPIDList.end(), TestFileIter);
+ ASSERT_EQ("3;urn;uuid:bbbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb", TestFileIter->second);
+
+}
+
TEST(ContactLoad, RevisionTests){
ContactDataObject TestFile;