Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added source code, headers and unit tests for the CLIENTPIDMAP vCard Property for...
[xestiaab/.git] / source / contacteditor / ContactDataObject.cpp
index 66f4259..ffca460 100644 (file)
@@ -110,6 +110,7 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
        int VendorCount = 0;
        int XTokenCount = 0;
        int XMLCount = 0;
+       int ClientPIDCount = 0;
        wxString ContactLine;
        wxString PropertyLine;
        wxString PropertySeg1;
@@ -247,6 +248,11 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
                        ProcessN(PropertySeg1, PropertySeg2);
                        NameProcessed = TRUE;
                
+               } else if (Property == wxT("CLIENTPIDMAP")){
+               
+                       ProcessClientPIDMap(PropertySeg1, PropertySeg2, &ClientPIDCount);
+                       ClientPIDCount++;
+               
                } else if (Property == wxT("NICKNAME")){
                                                
                        ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
@@ -1092,6 +1098,90 @@ void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
 
 }
 
+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;
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