Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Replace tokens processing with the remaining elements that need it with ProcessTokens.
[xestiaab/.git] / source / contacteditor / ContactDataObject.cpp
index a4339f6..cba012d 100644 (file)
@@ -511,17 +511,8 @@ void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString Property
                }                       
                
                CaptureString(&PropertyValue, FALSE);
-                                                               
-               if (FirstToken == TRUE){
-                               
-                       PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                       FirstToken = FALSE;
-                               
-               } else {
-                               
-                       PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                               
-               }
+               
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }       
        
@@ -612,20 +603,7 @@ void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySe
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-                       
-                       if (FirstToken == TRUE){
-                               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }       
        
@@ -760,20 +738,7 @@ void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySe
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
-                       
-                       if (FirstToken == TRUE){
-                               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                               
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                               
-                       }
-                       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
                
        }
 
@@ -850,20 +815,7 @@ void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2,
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
-                       
-                       if (FirstToken == TRUE){
-                               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                               
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                               
-                       }
-                       
-               } 
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
 
@@ -929,16 +881,7 @@ void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
                
                } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
                        
-                       if (FirstToken == TRUE){
-                               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                               
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                               
-                       }
+                       ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
                        
                }
        
@@ -1070,20 +1013,7 @@ void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString Prop
                                
                CaptureString(&PropertyValue, FALSE);
                                        
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
-                                                       
-                       if (FirstToken == TRUE){
-                               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                               
-                       } else {
-                               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                               
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }       
        
@@ -1192,20 +1122,7 @@ void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString Property
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-       
-                       if (FirstToken == TRUE){
-               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-               
-                       } else {
-               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-               
-                       }
-       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
                
        }
        
@@ -1267,20 +1184,7 @@ void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySe
                        
                }                               
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
-
-                       if (FirstToken == TRUE){
-       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-       
-                       } else {
-       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-       
-                       }
-
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }       
 
@@ -1400,20 +1304,7 @@ void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString Property
                        // Something else we don't know about so append
                        // to the tokens variable.
                
-                       if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
-               
-                               if (FirstToken == TRUE){
-       
-                                       PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                                       FirstToken = FALSE;
-       
-                               } else {
-       
-                                       PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-       
-                               }
-                               
-                       }
+                       ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
                        
                }
 
@@ -1526,20 +1417,7 @@ void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString Prope
                        // Something else we don't know about so append
                        // to the tokens variable.
                
-                       if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
-               
-                               if (FirstToken == TRUE){
-       
-                                       PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                                       FirstToken = FALSE;
-       
-                               } else {
-       
-                                       PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-       
-                               }
-                               
-                       }
+                       ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
                        
                }
 
@@ -1656,16 +1534,7 @@ void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString Property
 
                if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
        
-                       if (FirstToken == TRUE){
-               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-               
-                       } else {
-               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-               
-                       }
+                       ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
                }
                
@@ -1837,20 +1706,7 @@ void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertyS
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-                       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }                       
        
@@ -2086,20 +1942,7 @@ void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-                       
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-                       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
        
@@ -2211,20 +2054,7 @@ void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2,
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
                
@@ -2500,20 +2330,7 @@ void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString Propert
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
                
@@ -2620,20 +2437,7 @@ void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString Property
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
                
@@ -2744,20 +2548,7 @@ void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString Proper
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
                
@@ -2956,20 +2747,7 @@ void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertyS
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-       
-                       if (FirstToken == TRUE){
-               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-               
-                       } else {
-               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-               
-                       }
-       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }                                       
        
@@ -3100,20 +2878,7 @@ void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2,
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-       
-                       if (FirstToken == TRUE){
-               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-               
-                       } else {
-               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-               
-                       }
-       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
        
@@ -3245,20 +3010,7 @@ void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-       
-                       if (FirstToken == TRUE){
-               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-               
-                       } else {
-               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-               
-                       }
-       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
        
@@ -3390,20 +3142,7 @@ void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-       
-                       if (FirstToken == TRUE){
-               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-               
-                       } else {
-               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-               
-                       }
-       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
                
        }
        
@@ -3540,20 +3279,7 @@ void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString Prop
                
                }
                
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-       
-                       if (FirstToken == TRUE){
-               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-               
-                       } else {
-               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-               
-                       }
-       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
 
        }
        
@@ -3685,20 +3411,7 @@ void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-       
-                       if (FirstToken == TRUE){
-               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-               
-                       } else {
-               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-               
-                       }
-       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
        
@@ -3801,20 +3514,7 @@ void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString Property
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-       
-                       if (FirstToken == TRUE){
-               
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-               
-                       } else {
-               
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-               
-                       }
-       
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }
        
@@ -4061,20 +3761,7 @@ void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
                        
        }       
        
@@ -4249,20 +3936,7 @@ void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }       
        
@@ -4438,20 +4112,7 @@ void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }       
        
@@ -4626,20 +4287,7 @@ void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString Prope
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }       
        
@@ -4749,20 +4397,7 @@ void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxStrin
                
                }
 
-               if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-               
-                       if (FirstToken == TRUE){
-                       
-                               PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                               FirstToken = FALSE;
-                       
-                       } else {
-                       
-                               PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                       
-                       }
-               
-               }
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }       
        
@@ -4826,6 +4461,7 @@ void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString
        CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
 
        intPrevValue = 6;
+       bool PropertyMatched = FALSE;
 
        for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
        intiter != SplitPoints.end(); ++intiter){
@@ -4859,46 +4495,19 @@ void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString
                
                CaptureString(&PropertyValue, FALSE);
                
-               if (PropertyName == wxT("ALTID")){
-
-                       FreeBusyListAltID.erase(*FreeBusyAddressCount);
-                       FreeBusyListAltID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
-               
-               } else if (PropertyName == wxT("PID")){
-
-                       FreeBusyListPID.erase(*FreeBusyAddressCount);
-                       FreeBusyListPID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
-               
-               } else if (PropertyName == wxT("PREF")){
-
-                       ProcessIntegerValue(&FreeBusyListPref, &PropertyValue, FreeBusyAddressCount);
+               ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
+               ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
                
-               } else if (PropertyName == wxT("MEDIATYPE")){
-               
-                       FreeBusyListMediatype.erase(*FreeBusyAddressCount);
-                       FreeBusyListMediatype.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
-
-               } else {
+               if (PropertyMatched == TRUE){
                
-                       // Something else we don't know about so append
-                       // to the tokens variable.
-                       
-                       if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-                       
-                               if (FirstToken == TRUE){
-                               
-                                       PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                                       FirstToken = FALSE;
-                               
-                               } else {
-                               
-                                       PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                               
-                               }
-                       
-                       }
+                       PropertyMatched = FALSE;
+                       continue;
                
                }
+
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }       
        
@@ -4963,6 +4572,7 @@ void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2,
        CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
 
        intPrevValue = 4;
+       bool PropertyMatched = FALSE;
 
        for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
        intiter != SplitPoints.end(); ++intiter){
@@ -4992,43 +4602,20 @@ void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2,
                        
                        PropertyValue.Remove(0, 1);
                        
-               }                               
-               
-               if (PropertyName == wxT("ALTID")){
-
-                       KeyListAltID.erase(*KeyCount);
-                       KeyListAltID.insert(std::make_pair(*KeyCount, PropertyValue));
-               
-               } else if (PropertyName == wxT("PID")){
-
-                       KeyListPID.erase(*KeyCount);
-                       KeyListPID.insert(std::make_pair(*KeyCount, PropertyValue));
+               }
                
-               } else if (PropertyName == wxT("PREF")){
-
-                       ProcessIntegerValue(&KeyListPref, &PropertyValue, KeyCount);
+               ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
+               ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
+               ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
                
-               } else {
+               if (PropertyMatched == TRUE){
                
-                       // Something else we don't know about so append
-                       // to the tokens variable.
-                       
-                       if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-                       
-                               if (FirstToken == TRUE){
-                               
-                                       PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
-                                       FirstToken = FALSE;
-                               
-                               } else {
-                               
-                                       PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-                               
-                               }
-                       
-                       }
+                       PropertyMatched = FALSE;
+                       continue;
                
                }
+
+               ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
        
        }                               
        
@@ -5180,6 +4767,28 @@ void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySe
 
 }
 
+void ProcessTokens(wxString *PropertyName,
+       wxString *PropertyValue,
+       wxString *PropertyTokens,
+       bool *FirstToken){
+       
+       if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
+               
+               if (*FirstToken == TRUE){
+                       
+                       PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
+                       *FirstToken = FALSE;
+                       
+               } else {
+                       
+                       PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
+                       
+               }
+               
+       }
+       
+}
+
 void ProcessStringValue(wxString *PropertyName,
        wxString PropertyNameMatch,
        std::map<int,wxString> *MapPtr,
@@ -5228,30 +4837,6 @@ void ProcessIntegerValue(wxString *PropertyName,
 
 }
 
-void ProcessIntegerValue(std::map<int,int> *PrefPtr, 
-       wxString *PropertyValue, 
-       int *ItemCount){
-
-       int PriorityNumber = 0; 
-       bool ValidNumber = TRUE;
-                       
-       try{
-               PriorityNumber = std::stoi(PropertyValue->ToStdString());
-       }
-                       
-       catch(std::invalid_argument &e){
-               ValidNumber = FALSE;
-       }
-
-       if (ValidNumber == TRUE){
-
-               PrefPtr->erase(*ItemCount);
-               PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
-
-       }
-
-}
-
 void SplitValues(wxString *PropertyLine, 
        std::map<int,int> *SplitPoints, 
        std::map<int,int> *SplitLength, 
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