#include #include #include #include #include #include "frmContactEditor.h" #include "../enums.h" #include "../version.h" #include "../vcard/vcard.h" #include "../common/textprocessing.h" #include "../common/dirs.h" bool frmContactEditor::LoadContact(wxString Filename){ // Load the contact into the contact editor. wxFFile ContactFile; wxString wxSContactString; wxString ContactLine; vCard ContactData; XABViewMode XVMData = MainPtr->GetViewMode(); wxSContactFilename = Filename; // Check if we are using wxWidgets version 2.8 or less and // execute the required command accordingly. #if wxABI_VERSION < 20900 ContactFile.Open(Filename.c_str(), wxT("r")); #else ContactFile.Open(Filename, wxT("r")); #endif if (ContactFile.IsOpened() == FALSE){ return FALSE; } ContactFile.ReadAll(&wxSContactString, wxConvAuto()); // Split the lines. std::map ContactFileLines; std::map::iterator striter; wxStringTokenizer wSTContactFileLines(wxSContactString, wxT("\r\n")); int ContactLineSeek = 0; while (wSTContactFileLines.HasMoreTokens() == TRUE){ ContactLine = wSTContactFileLines.GetNextToken(); ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine)); ContactLineSeek++; } // Get the line. bool QuoteMode = FALSE; bool PropertyFind = TRUE; bool HasExtraNicknames = FALSE; bool IgnoreGender = FALSE; bool ExtraLineSeek = TRUE; bool BirthdayProcessed = FALSE; bool AnniversaryProcessed = FALSE; bool FNProcessed = FALSE; bool GenderProcessed = FALSE; bool NameProcessed = FALSE; bool UIDProcessed = FALSE; bool KindProcessed = FALSE; bool ETagFound = FALSE; bool ETagOrigFound = FALSE; int intExtraNickname = 0; wxString wxSProperty; wxString wxSPropertySeg1; wxString wxSPropertySeg2; wxString wxSPropertyNextLine; size_t ContactLineLen = 0; int QuoteBreakPoint = 0; int FNCount = 0; int NameCount = 0; int NicknameCount = 0; int ADRCount = 0; int EmailCount = 0; int IMPPCount = 0; int TelCount = 0; int LangCount = 0; int TZCount = 0; int GeoCount = 0; int URLCount = 0; int RelatedCount = 0; int TitleCount = 0; int RoleCount = 0; int OrgCount = 0; int NoteCount = 0; int CategoryCount = 0; int GroupCount = 0; int PhotoCount = 0; int LogoCount = 0; int SoundCount = 0; int CalAdrCount = 0; int CalReqAdrCount = 0; int FreeBusyCount = 0; int KeyCount = 0; int VendorCount = 0; int XTokenCount = 0; //int intValueSeek = 1; for (std::map::iterator iter = ContactFileLines.begin(); iter != ContactFileLines.end(); ++iter){ // Find the colon which splits the start bit from the data part. ContactLine = iter->second; while (ExtraLineSeek == TRUE){ // Check if there is extra data on the next line // (indicated by space or tab at the start) and add data. iter++; if (iter == ContactFileLines.end()){ iter--; break; } wxSPropertyNextLine = iter->second; if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){ wxSPropertyNextLine.Remove(0, 1); //wxSPropertyNextLine.Trim(FALSE); //ContactLine.Trim(); ContactLine.Append(wxSPropertyNextLine); } else { iter--; ExtraLineSeek = FALSE; } } ContactLineLen = ContactLine.Len(); // Make sure we are not in quotation mode. // Make sure colon does not have \ or \\ before it. for (int i = 0; i <= ContactLineLen; i++){ if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){ PropertyFind = FALSE; } else if (PropertyFind == TRUE){ wxSProperty.Append(ContactLine.Mid(i, 1)); } if (ContactLine.Mid(i, 1) == wxT("\"")){ if (QuoteMode == TRUE){ QuoteMode = FALSE; } else { QuoteMode = TRUE; } } if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){ QuoteBreakPoint = i; break; } } // Split that line at the point into two variables (ignore the colon). wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint); wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1)); // Add the data into the contact editor depending on what it is. if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; if (wxSPropertySeg2 == wxT("individual")){ cmbType->SetSelection(1); } else if (wxSPropertySeg2 == wxT("group")){ cmbType->SetSelection(2); IsGroup = TRUE; } else if (wxSPropertySeg2 == wxT("org")){ cmbType->SetSelection(3); } else if (wxSPropertySeg2 == wxT("location")){ cmbType->SetSelection(4); } else { cmbType->SetSelection(0); } wxCommandEvent nullevent; UpdateMembersTab(nullevent); } else if (wxSProperty == wxT("MEMBER")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; // Go through the list of contacts for the account and find the matching UID. // If contact with UID doesn't match then say (unknown contact). wxString AccountDirFinal = GetAccountDir(wxSContactAccount, FALSE); //wxString vcardfilenamewxs; wxString vCardFilename; wxString vCardFilenameFull; wxString vCardDataString; //wxStringTokenizer vcardfileline; wxString lwxs; wxString setname, setvalue; //vCardNames = new std::map>; std::multimap> vCardNamesAsc; std::multimap> vCardNamesDsc; wxDir vcardaccdir(AccountDirFinal); bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES); while(ProcFiles){ if (vCardFilename.Right(4) == wxT(".vcf") || vCardFilename.Right(4) == wxT(".VCF") || vCardFilename.Right(5) == wxT(".vcard") || vCardFilename.Right(5) == wxT(".VCARD")){ vCard Person; vCardFilenameFull.Append(AccountDirFinal); vCardFilenameFull.Append(wxT("/")); vCardFilenameFull.Append(vCardFilename); Person.LoadFile(vCardFilenameFull); if (wxSPropertySeg2.Left(9) == wxT("urn:uuid:")){ wxString NewPropValue; NewPropValue = wxSPropertySeg2.Mid(9, wxString::npos); wxSPropertySeg2 = NewPropValue; } if (Person.MeetBaseSpecification()){ wxString KindStatus = Person.Get(wxT("KIND")); if (KindStatus == wxT("group")){ vCardFilename.Clear(); vCardFilenameFull.Clear(); vCardDataString.Clear(); ProcFiles = vcardaccdir.GetNext(&vCardFilename); continue; } wxString PersonName = Person.Get(wxT("N")); wxString PersonUID = Person.Get(wxT("UID")); wxString PersonFilename = vCardFilenameFull; if (PersonUID != wxSPropertySeg2){ vCardFilename.Clear(); vCardFilenameFull.Clear(); vCardDataString.Clear(); ProcFiles = vcardaccdir.GetNext(&vCardFilename); continue; } //ContactsNames.insert(std::make_pair(PersonName, ContactIndex)); //ContactsUIDs.insert(std::make_pair(ContactIndex, PersonUID)); if (XVMData.SortMode == 1){ // Split the name into sections. vCardDataString = Person.Get(wxT("N")); vCardName NameData = Person.GetName(); vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname; } else if (XVMData.SortMode == 2){ // Split the name into sections. vCardName NameData = Person.GetName(); vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename; } else if (XVMData.SortMode == 3){ // Check and make sure that the top most nickname is used. vCardDataString = Person.Get(wxT("NICKNAME")); if (vCardDataString.IsEmpty()){ vCardDataString = wxT("(no nickname)"); } } else if (XVMData.SortMode == 4){ vCardDataString = Person.Get(wxT("FN")); } if (XVMData.AscendingMode == TRUE){ vCardNamesAsc.insert(std::make_pair(vCardDataString, PersonUID)); } else { vCardNamesDsc.insert(std::make_pair(vCardDataString, PersonUID)); } } else { } } vCardFilename.Clear(); vCardFilenameFull.Clear(); vCardDataString.Clear(); ProcFiles = vcardaccdir.GetNext(&vCardFilename); } if (XVMData.AscendingMode == TRUE){ for (std::map::iterator iter = vCardNamesAsc.begin(); iter != vCardNamesAsc.end(); ++iter){ wxListItem ItemData; ItemData.SetId(0); ItemData.SetText(iter->first); lboGroups->InsertItem(ItemData); GroupsList.insert(std::make_pair(intValueSeek, iter->second)); } } else { for (std::map::iterator iter = vCardNamesDsc.begin(); iter != vCardNamesDsc.end(); ++iter){ wxListItem ItemData; ItemData.SetId(0); ItemData.SetText(iter->first); lboGroups->InsertItem(ItemData); GroupsList.insert(std::make_pair(intValueSeek, iter->second)); } } GroupCount++; intValueSeek++; } else if (wxSProperty == wxT("FN")){ /* NameDisplayAs = wxSPropertySeg2; cmbDisplayAs->SetValue(ContactData.Convert(wxSPropertySeg2, TRUE)); */ size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 4; int intPref = 0; int intType = 0; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 3; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. FullNamesList.insert(std::make_pair(intValueSeek, wxT(""))); FullNamesListAltID.insert(std::make_pair(intValueSeek, wxT(""))); FullNamesListPID.insert(std::make_pair(intValueSeek, wxT(""))); FullNamesListPref.insert(std::make_pair(intValueSeek, 0)); FullNamesListType.insert(std::make_pair(intValueSeek, wxT(""))); FullNamesListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); FullNamesListTokens.insert(std::make_pair(intValueSeek, wxT(""))); intPrevValue = 3; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName == wxT("ALTID")){ FullNamesListAltID.erase(intValueSeek); FullNamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PID")){ FullNamesListPID.erase(intValueSeek); FullNamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intPref > 0 && intPref < 101){ FullNamesListPref.erase(intValueSeek); FullNamesListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("LANG")){ FullNamesListLanguage.erase(intValueSeek); FullNamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else { // 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); } } } } // Split the address. //std::map::iterator SLiter; intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 1){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } intSplitSize = 0; } } // Add the data to the General/Home/Work address variables. /* wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(IMPPType); */ //ProcessCaptureStrings(wxsPropertySeg2); ProcessCaptureStrings(&wxSPropertySeg2); FullNamesList.erase(intValueSeek); FullNamesListType.erase(intValueSeek); FullNamesListTokens.erase(intValueSeek); FullNamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); FullNamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); if (intType == 0){ FullNamesListType.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ FullNamesListType.insert(std::make_pair(intValueSeek, wxT("home"))); } else if (intType == 2){ FullNamesListType.insert(std::make_pair(intValueSeek, wxT("work"))); } if (FNProcessed == FALSE){ NameDisplayAs = wxSPropertySeg2; cmbDisplayAs->SetValue(ContactData.Convert(wxSPropertySeg2, TRUE)); FNProcessed = TRUE; } /*if (intType == 0){ ListCtrlIndex = lboIM->InsertItem(coldata); lboIM->SetItem(ListCtrlIndex, 1, IMPPAddress); if (intPref > 0 && intPref < 101){ lboIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } GeneralIMList.erase(intValueSeek); GeneralIMListType.erase(intValueSeek); GeneralIMListTokens.erase(intValueSeek); GeneralIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralIMListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeIM->InsertItem(coldata); lboHomeIM->SetItem(ListCtrlIndex, 1, IMPPAddress); if (intPref > 0 && intPref < 101){ lboHomeIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } HomeIMList.erase(intValueSeek); HomeIMListType.erase(intValueSeek); HomeIMListTokens.erase(intValueSeek); HomeIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeIMListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessIM->InsertItem(coldata); lboBusinessIM->SetItem(ListCtrlIndex, 1, IMPPAddress); if (intPref > 0 && intPref < 101){ lboBusinessIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } BusinessIMList.erase(intValueSeek); BusinessIMListType.erase(intValueSeek); BusinessIMListTokens.erase(intValueSeek); BusinessIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessIMListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); }*/ FNCount++; intValueSeek++; } else if (wxSProperty == wxT("N") && NameProcessed == FALSE){ size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 3; int intSplitSeek = 0; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); // Look for type before continuing. intPrevValue = 2; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; } intPrevValue = 2; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName == wxT("ALTID")){ NameAltID = PropertyValue; } else if (PropertyName == wxT("LANG")){ NameLanguage = PropertyValue; } else if (PropertyName == wxT("SORT-AS")){ NameDisplayAs = PropertyValue; } else { // 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); } } } } intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitSeek = 0; intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 4){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } else { SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } intSplitSize = 0; } } // Split the data into several parts. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ if (intiter->first == 1){ // Deal with family name. SLiter = SplitLength.find(1); txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE)); intPrevValue = intiter->second; NameSurname = wxSPropertySeg2.Mid(0, SLiter->second); } else if (intiter->first == 2){ // Deal with given names. SLiter = SplitLength.find(2); txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE)); intPrevValue = intiter->second; NameForename = wxSPropertySeg2.Mid(intPrevValue, SLiter->second); } else if (intiter->first == 3){ // Deal with additional names. SLiter = SplitLength.find(3); txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE)); intPrevValue = intiter->second; NameOtherNames = wxSPropertySeg2.Mid(intPrevValue, SLiter->second); } else if (intiter->first == 4){ // Deal with honorifix prefixes and suffixes. SLiter = SplitLength.find(4); txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE)); intPrevValue = intiter->second; NameTitle = wxSPropertySeg2.Mid(intPrevValue, SLiter->second); txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE)); NameSuffix = wxSPropertySeg2.Mid(intPrevValue); } } NameTokens = PropertyTokens; NameProcessed = TRUE; } else if (wxSProperty == wxT("NICKNAME")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 10; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 9; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralNicknamesList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNicknamesListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNicknamesListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNicknamesListPref.insert(std::make_pair(intValueSeek, 0)); GeneralNicknamesListTokens.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNicknamesListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeNicknamesList.insert(std::make_pair(intValueSeek, wxT(""))); HomeNicknamesListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeNicknamesListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeNicknamesListPref.insert(std::make_pair(intValueSeek, 0)); HomeNicknamesListTokens.insert(std::make_pair(intValueSeek, wxT(""))); HomeNicknamesListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessNicknamesList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessNicknamesListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessNicknamesListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessNicknamesListPref.insert(std::make_pair(intValueSeek, 0)); BusinessNicknamesListTokens.insert(std::make_pair(intValueSeek, wxT(""))); BusinessNicknamesListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 9; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; ProcessCaptureStrings(&PropertyValue); // 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); } if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralNicknamesListAltID.erase(intValueSeek); GeneralNicknamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeNicknamesListAltID.erase(intValueSeek); HomeNicknamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessNicknamesListAltID.erase(intValueSeek); BusinessNicknamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralNicknamesListPID.erase(intValueSeek); GeneralNicknamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeNicknamesListPID.erase(intValueSeek); HomeNicknamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessNicknamesListPID.erase(intValueSeek); BusinessNicknamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ GeneralNicknamesListPref.erase(intValueSeek); GeneralNicknamesListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeNicknamesListPref.erase(intValueSeek); HomeNicknamesListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessNicknamesListPref.erase(intValueSeek); BusinessNicknamesListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("LANGUAGE")){ if (intType == 0){ GeneralNicknamesListLanguage.erase(intValueSeek); GeneralNicknamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeNicknamesListLanguage.erase(intValueSeek); HomeNicknamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessNicknamesListLanguage.erase(intValueSeek); BusinessNicknamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); if (intType == 0){ ListCtrlIndex = lboNicknames->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboNicknames->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } GeneralNicknamesList.erase(intValueSeek); GeneralNicknamesListType.erase(intValueSeek); GeneralNicknamesListTokens.erase(intValueSeek); GeneralNicknamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralNicknamesListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNicknamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeNicknames->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeNicknames->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } HomeNicknamesList.erase(intValueSeek); HomeNicknamesListType.erase(intValueSeek); HomeNicknamesListTokens.erase(intValueSeek); HomeNicknamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeNicknamesListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeNicknamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessNicknames->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessNicknames->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } BusinessNicknamesList.erase(intValueSeek); BusinessNicknamesListType.erase(intValueSeek); BusinessNicknamesListTokens.erase(intValueSeek); BusinessNicknamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessNicknamesListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessNicknamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } NicknameCount++; intValueSeek++; } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE;; int intPrevValue = 8; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 7; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){ if (FirstToken == TRUE){ PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue); FirstToken = FALSE; } else { PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); } } } wxStringTokenizer GenderDetails (wxSPropertySeg2, wxT(";")); wxString GenderComponent; wxString GenderIdentity; if (GenderDetails.CountTokens() >= 2){ GenderComponent = GenderDetails.GetNextToken(); GenderIdentity = GenderDetails.GetString(); ProcessCaptureStrings(&GenderIdentity); txtGenderDescription->SetValue(ContactData.Convert(GenderIdentity, TRUE)); } else { GenderComponent = GenderDetails.GetNextToken(); } if (GenderComponent == wxT("M")){ // Gender is Male. cmbGender->SetSelection(1); } else if (GenderComponent == wxT("F")){ // Gender is Female. cmbGender->SetSelection(2); } else if (GenderComponent == wxT("O")){ // Gender is Other. cmbGender->SetSelection(3); } else if (GenderComponent == wxT("N")){ // Gender is None/Not Applicable. cmbGender->SetSelection(4); } else if (GenderComponent == wxT("U")){ // Gender is Unknown. cmbGender->SetSelection(5); } GenderTokens = PropertyTokens; GenderProcessed = TRUE; } else if (wxSProperty == wxT("BDAY") && BirthdayProcessed == FALSE){ // Process date. Preserve the remainder in the string. std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool BirthdayText = FALSE; int intPrevValue = 6; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 5; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){ ProcessCaptureStrings(&wxSPropertySeg2); txtBirthday->SetValue(wxSPropertySeg2); Birthday = wxSPropertySeg2; BirthdayText = TRUE; } } // Setup blank lines for later on. intPrevValue = 5; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. ProcessCaptureStrings(&PropertyValue); 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); } if (PropertyName == wxT("ALTID")){ BirthdayAltID = PropertyValue; } else if (PropertyName == wxT("CALSCALE")){ BirthdayCalScale = PropertyValue; } else if (PropertyName != wxT("VALUE")) { // Something else we don't know about so append // to the tokens variable. if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){ PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); } } } // Add the data to the variables and form. if (BirthdayText == FALSE){ Birthday = wxSPropertySeg2; int DateYear = 0; wxDateTime::Month DateMonth; unsigned int DateDay; wxString wxSData; if (Birthday.Mid(0, 2) == wxT("--")){ // Skip year. } else { DateYear = wxAtoi(Birthday.Mid(0,4)); } DateMonth = (wxDateTime::Month)(wxAtoi(Birthday.Mid(4,2)) - 1); DateDay = wxAtoi(Birthday.Mid(6,2)); wxDateTime BDayDate(DateDay,DateMonth,DateYear); /*BDayDate.SetDay(DateDay); BDayDate.SetMonth(wxDateTime::Month::Jan); BDayDate.SetYear(DateYear);*/ dapBirthday->SetValue(BDayDate); } BirthdayTokens = PropertyTokens; BirthdayProcessed = TRUE; } else if (wxSProperty == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){ // Process date. Preserve the remainder in the string. std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool AnniversaryText = FALSE; int intPrevValue = 13; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 12; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){ ProcessCaptureStrings(&wxSPropertySeg2); txtAnniversary->SetValue(wxSPropertySeg2); Anniversary = wxSPropertySeg2; AnniversaryText = TRUE; } } // Setup blank lines for later on. intPrevValue = 12; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ AnniversaryAltID = PropertyValue; } else if (PropertyName == wxT("CALSCALE")){ AnniversaryCalScale = PropertyValue; } else if (PropertyName != wxT("VALUE")) { // Something else we don't know about so append // to the tokens variable. if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){ PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue); } } } // Add the data to the variables and form. if (AnniversaryText == FALSE){ Anniversary = wxSPropertySeg2; int DateYear = 0; wxDateTime::Month DateMonth; int DateDay; wxString wxSData; if (Anniversary.Mid(0, 2) == wxT("--")){ // Skip year. } else { DateYear = wxAtoi(Anniversary.Mid(0,4)); } DateMonth = (wxDateTime::Month)(wxAtoi(Anniversary.Mid(4,2)) - 1); DateDay = wxAtoi(Anniversary.Mid(6,2)); wxDateTime ADayDate(DateDay,DateMonth,DateYear); dapAnniversary->SetValue(ADayDate); } AnniversaryTokens = PropertyTokens; AnniversaryProcessed = TRUE; } else if (wxSProperty == wxT("TZ")){ size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 4; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 3; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralTZList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTZListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTZListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTZListPref.insert(std::make_pair(intValueSeek, 0)); GeneralTZListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTZListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeTZList.insert(std::make_pair(intValueSeek, wxT(""))); HomeTZListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeTZListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeTZListPref.insert(std::make_pair(intValueSeek, 0)); HomeTZListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); HomeTZListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessTZList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTZListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTZListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTZListPref.insert(std::make_pair(intValueSeek, 0)); BusinessTZListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTZListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 3; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; 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); } ProcessCaptureStrings(&PropertyValue); // Process properties. if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralTZListAltID.erase(intValueSeek); GeneralTZListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeTZListAltID.erase(intValueSeek); HomeTZListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessTZListAltID.erase(intValueSeek); BusinessTZListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralTZListPID.erase(intValueSeek); GeneralTZListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeTZListPID.erase(intValueSeek); HomeTZListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessTZListPID.erase(intValueSeek); BusinessTZListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("MEDIATYPE")){ if (intType == 0){ GeneralTZListMediatype.erase(intValueSeek); GeneralTZListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeTZListMediatype.erase(intValueSeek); HomeTZListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessTZListMediatype.erase(intValueSeek); BusinessTZListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intPref > 0 && intPref < 101){ if (intType == 0){ GeneralTZListPref.erase(intValueSeek); GeneralTZListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeTZListPref.erase(intValueSeek); HomeTZListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessTZListPref.erase(intValueSeek); BusinessTZListPref.insert(std::make_pair(intValueSeek, intPref)); } } } else { // 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); } } } } // Split the address. //std::map::iterator SLiter; intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 6){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } else { SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } intSplitSize = 0; } } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); if (intType == 0){ ListCtrlIndex = lboTimezones->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } GeneralTZList.erase(intValueSeek); GeneralTZListType.erase(intValueSeek); GeneralTZListTokens.erase(intValueSeek); GeneralTZList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralTZListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTZListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeTimezones->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } HomeTZList.erase(intValueSeek); HomeTZListType.erase(intValueSeek); HomeTZListTokens.erase(intValueSeek); HomeTZList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeTZListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeTZListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessTimezones->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } BusinessTZList.erase(intValueSeek); BusinessTZListType.erase(intValueSeek); BusinessTZListTokens.erase(intValueSeek); BusinessTZList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessTZListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessTZListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } TZCount++; intValueSeek++; } else if (wxSProperty == wxT("ADR")){ size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString AddressLabel; wxString AddressLang; wxString AddressAltID; wxString AddressPID; wxString AddressTokens; wxString AddressGeo; wxString AddressTimezone; wxString AddressType; wxString AddressMediatype; wxString AddressPOBox; wxString AddressExtended; wxString AddressStreet; wxString AddressLocality; wxString AddressCity; wxString AddressRegion; wxString AddressPostalCode; wxString AddressCountry; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 5; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 4; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralAddressList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListTown.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListCounty.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListPostCode.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListCountry.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListLabel.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListLang.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListGeo.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListTimezone.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListPref.insert(std::make_pair(intValueSeek, 0)); GeneralAddressListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeAddressList.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListTown.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListCounty.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListPostCode.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListCountry.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListLabel.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListLang.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListGeo.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListTimezone.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); HomeAddressListPref.insert(std::make_pair(intValueSeek, 0)); HomeAddressListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessAddressList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListTown.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListCounty.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListPostCode.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListCountry.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListLabel.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListLang.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListGeo.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListTimezone.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); BusinessAddressListPref.insert(std::make_pair(intValueSeek, 0)); BusinessAddressListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 4; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; ProcessCaptureStrings(&PropertyValue); // Process properties. if (PropertyName == wxT("LABEL")){ if (intType == 0){ GeneralAddressListLabel.erase(intValueSeek); GeneralAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeAddressListLabel.erase(intValueSeek); HomeAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessAddressListLabel.erase(intValueSeek); BusinessAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue));} } else if (PropertyName == wxT("LANGUAGE")){ if (intType == 0){ GeneralAddressListLang.erase(intValueSeek); GeneralAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeAddressListLang.erase(intValueSeek); HomeAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessAddressListLang.erase(intValueSeek); BusinessAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralAddressListAltID.erase(intValueSeek); GeneralAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeAddressListAltID.erase(intValueSeek); HomeAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessAddressListAltID.erase(intValueSeek); BusinessAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralAddressListPID.erase(intValueSeek); GeneralAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeAddressListPID.erase(intValueSeek); HomeAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessAddressListPID.erase(intValueSeek); BusinessAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("GEO")){ if (intType == 0){ GeneralAddressListGeo.erase(intValueSeek); GeneralAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeAddressListGeo.erase(intValueSeek); HomeAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessAddressListGeo.erase(intValueSeek); BusinessAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("TZ")){ if (intType == 0){ GeneralAddressListTimezone.erase(intValueSeek); GeneralAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeAddressListTimezone.erase(intValueSeek); HomeAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessAddressListTimezone.erase(intValueSeek); BusinessAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("MEDIATYPE")){ if (intType == 0){ GeneralAddressListMediatype.erase(intValueSeek); GeneralAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeAddressListMediatype.erase(intValueSeek); HomeAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessAddressListMediatype.erase(intValueSeek); BusinessAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intPref > 0 && intPref < 101){ if (intType == 0){ GeneralAddressListPref.erase(intValueSeek); GeneralAddressListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeAddressListPref.erase(intValueSeek); HomeAddressListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessAddressListPref.erase(intValueSeek); BusinessAddressListPref.insert(std::make_pair(intValueSeek, intPref)); } } } else { 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); } } } } // Split the address. //std::map::iterator SLiter; intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 6){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } else { SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } intSplitSize = 0; } } // Split the data into several parts. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ if (intiter->first == 1){ // Deal with PO Box. SLiter = SplitLength.find(1); //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE)); AddressPOBox = wxSPropertySeg2.Mid(0, SLiter->second); intPrevValue = intiter->second; } else if (intiter->first == 2){ // Deal with extended address. SLiter = SplitLength.find(2); AddressExtended = wxSPropertySeg2.Mid(intPrevValue, SLiter->second); //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE)); intPrevValue = intiter->second; } else if (intiter->first == 3){ // Deal with street address. SLiter = SplitLength.find(3); AddressStreet = wxSPropertySeg2.Mid(intPrevValue, SLiter->second); //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE)); intPrevValue = intiter->second; } else if (intiter->first == 4){ // Deal with locality SLiter = SplitLength.find(4); AddressLocality = wxSPropertySeg2.Mid(intPrevValue, SLiter->second); //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE)); intPrevValue = intiter->second; //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE)); } else if (intiter->first == 5){ // Deal with region. SLiter = SplitLength.find(5); AddressRegion = wxSPropertySeg2.Mid(intPrevValue, SLiter->second); //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE)); intPrevValue = intiter->second; //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE)); } else if (intiter->first == 6){ // Deal with post code. SLiter = SplitLength.find(6); AddressPostalCode = wxSPropertySeg2.Mid(intPrevValue, SLiter->second); //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE)); intPrevValue = intiter->second; // Deal with country. AddressCountry = wxSPropertySeg2.Mid(intPrevValue); //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE)); } } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&AddressStreet, &AddressLocality, &AddressRegion, &AddressPostalCode, &AddressCountry); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(AddressStreet); if (intType == 0){ ListCtrlIndex = lboAddresses->InsertItem(coldata); lboAddresses->SetItem(ListCtrlIndex, 1, AddressLocality); lboAddresses->SetItem(ListCtrlIndex, 2, AddressRegion); lboAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode); if (intPref > 0 && intPref < 101){ lboAddresses->SetItem(ListCtrlIndex, 4, wxString::Format(wxT("%i"), intPref)); } GeneralAddressList.erase(intValueSeek); GeneralAddressListTown.erase(intValueSeek); GeneralAddressListCounty.erase(intValueSeek); GeneralAddressListPostCode.erase(intValueSeek); GeneralAddressListCountry.erase(intValueSeek); GeneralAddressListType.erase(intValueSeek); GeneralAddressListTokens.erase(intValueSeek); GeneralAddressList.insert(std::make_pair(intValueSeek, AddressStreet)); GeneralAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality)); GeneralAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion)); GeneralAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode)); GeneralAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry)); GeneralAddressListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeAddresses->InsertItem(coldata); lboHomeAddresses->SetItem(ListCtrlIndex, 1, AddressLocality); lboHomeAddresses->SetItem(ListCtrlIndex, 2, AddressRegion); lboHomeAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode); if (intPref > 0 && intPref < 101){ lboHomeAddresses->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } HomeAddressList.erase(intValueSeek); HomeAddressListTown.erase(intValueSeek); HomeAddressListCounty.erase(intValueSeek); HomeAddressListPostCode.erase(intValueSeek); HomeAddressListCountry.erase(intValueSeek); HomeAddressListType.erase(intValueSeek); HomeAddressListTokens.erase(intValueSeek); HomeAddressList.insert(std::make_pair(intValueSeek, AddressStreet)); HomeAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality)); HomeAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion)); HomeAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode)); HomeAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry)); HomeAddressListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessAddresses->InsertItem(coldata); lboBusinessAddresses->SetItem(ListCtrlIndex, 1, AddressLocality); lboBusinessAddresses->SetItem(ListCtrlIndex, 2, AddressRegion); lboBusinessAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode); if (intPref > 0 && intPref < 101){ lboBusinessAddresses->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } BusinessAddressList.erase(intValueSeek); BusinessAddressListTown.erase(intValueSeek); BusinessAddressListCounty.erase(intValueSeek); BusinessAddressListPostCode.erase(intValueSeek); BusinessAddressListCountry.erase(intValueSeek); BusinessAddressListType.erase(intValueSeek); BusinessAddressListTokens.erase(intValueSeek); BusinessAddressList.insert(std::make_pair(intValueSeek, AddressStreet)); BusinessAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality)); BusinessAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion)); BusinessAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode)); BusinessAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry)); BusinessAddressListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } ADRCount++; intValueSeek++; } else if (wxSProperty == wxT("EMAIL")){ size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator SPoint; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString AddressLabel; wxString AddressLang; wxString AddressAltID; wxString AddressPID; wxString AddressTokens; wxString AddressGeo; wxString AddressTimezone; wxString AddressType; wxString AddressMediatype; wxString AddressPOBox; wxString AddressExtended; wxString AddressStreet; wxString AddressLocality; wxString AddressCity; wxString AddressRegion; wxString AddressPostalCode; wxString AddressCountry; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 7; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 6; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralEmailList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralEmailListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralEmailListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralEmailListPref.insert(std::make_pair(intValueSeek, 0)); GeneralEmailListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeEmailList.insert(std::make_pair(intValueSeek, wxT(""))); HomeEmailListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeEmailListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeEmailListPref.insert(std::make_pair(intValueSeek, 0)); HomeEmailListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessEmailList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessEmailListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessEmailListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessEmailListPref.insert(std::make_pair(intValueSeek, 0)); BusinessEmailListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 6; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; ProcessCaptureStrings(&PropertyValue); // Process properties. if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralEmailListAltID.erase(intValueSeek); GeneralEmailListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeEmailListAltID.erase(intValueSeek); HomeEmailListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessEmailListAltID.erase(intValueSeek); BusinessEmailListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralEmailListPID.erase(intValueSeek); GeneralEmailListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeEmailListPID.erase(intValueSeek); HomeEmailListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessEmailListPID.erase(intValueSeek); BusinessEmailListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intPref > 0 && intPref < 101){ if (intType == 0){ GeneralEmailListPref.erase(intValueSeek); GeneralEmailListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeEmailListPref.erase(intValueSeek); HomeEmailListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessEmailListPref.erase(intValueSeek); BusinessEmailListPref.insert(std::make_pair(intValueSeek, intPref)); } } } else { // 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); } } } } //std::map::iterator SLiter; intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; // Add the data to the General/Home/Work email variables. ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); if (intType == 0){ ListCtrlIndex = lboEmails->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboEmails->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } GeneralEmailList.erase(intValueSeek); GeneralEmailListType.erase(intValueSeek); GeneralEmailListTokens.erase(intValueSeek); GeneralEmailList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralEmailListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralEmailListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeEmails->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeEmails->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } HomeEmailList.erase(intValueSeek); HomeEmailListType.erase(intValueSeek); HomeEmailListTokens.erase(intValueSeek); HomeEmailList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeEmailListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeEmailListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessEmail->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessEmail->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } BusinessEmailList.erase(intValueSeek); BusinessEmailListType.erase(intValueSeek); BusinessEmailListTokens.erase(intValueSeek); BusinessEmailList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessEmailListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessEmailListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } EmailCount++; intValueSeek++; } else if (wxSProperty == wxT("IMPP")){ size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator SPoint; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString IMPPType; wxString IMPPAddress; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 6; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 5; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralIMList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralIMListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralIMListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralIMListPref.insert(std::make_pair(intValueSeek, 0)); GeneralIMListTokens.insert(std::make_pair(intValueSeek, wxT(""))); GeneralIMListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeIMList.insert(std::make_pair(intValueSeek, wxT(""))); HomeIMListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeIMListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeIMListPref.insert(std::make_pair(intValueSeek, 0)); HomeIMListTokens.insert(std::make_pair(intValueSeek, wxT(""))); HomeIMListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessIMList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessIMListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessIMListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessIMListPref.insert(std::make_pair(intValueSeek, 0)); BusinessIMListTokens.insert(std::make_pair(intValueSeek, wxT(""))); BusinessIMListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 5; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralIMListAltID.erase(intValueSeek); GeneralIMListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeIMListAltID.erase(intValueSeek); HomeIMListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessIMListAltID.erase(intValueSeek); BusinessIMListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralIMListPID.erase(intValueSeek); GeneralIMListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeIMListPID.erase(intValueSeek); HomeIMListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessIMListPID.erase(intValueSeek); BusinessIMListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intPref > 0 && intPref < 101){ if (intType == 0){ GeneralIMListPref.erase(intValueSeek); GeneralIMListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeIMListPref.erase(intValueSeek); HomeIMListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessIMListPref.erase(intValueSeek); BusinessIMListPref.insert(std::make_pair(intValueSeek, intPref)); } } } else if (PropertyName == wxT("MEDIATYPE")){ if (intType == 0){ GeneralIMListMediatype.erase(intValueSeek); GeneralIMListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeIMListMediatype.erase(intValueSeek); HomeIMListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessIMListMediatype.erase(intValueSeek); BusinessIMListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } // Split the address. //std::map::iterator SLiter; intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 1){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } intSplitSize = 0; } } // Split the data into several parts. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ if (intiter->first == 1){ // Deal with PO Box. SLiter = SplitLength.find(1); //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE)); IMPPType = wxSPropertySeg2.Mid(0, SLiter->second); intPrevValue = intiter->second; IMPPAddress = wxSPropertySeg2.Mid(intPrevValue); } } // Check what IM type it is. if (IMPPType == wxT("aim")){ IMPPType = wxT("AIM"); } else if (IMPPType == wxT("gg")){ IMPPType = wxT("Gadu-Gadu"); } else if (IMPPType == wxT("icq")){ IMPPType = wxT("ICQ"); } else if (IMPPType == wxT("skype")){ IMPPType = wxT("Skype"); } else if (IMPPType == wxT("xmpp")){ IMPPType = wxT("XMPP"); } else if (IMPPType == wxT("yahoo")){ IMPPType = wxT("Yahoo"); } else { // Do nothing. } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(IMPPType); if (intType == 0){ ListCtrlIndex = lboIM->InsertItem(coldata); lboIM->SetItem(ListCtrlIndex, 1, IMPPAddress); if (intPref > 0 && intPref < 101){ lboIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } GeneralIMList.erase(intValueSeek); GeneralIMListType.erase(intValueSeek); GeneralIMListTokens.erase(intValueSeek); GeneralIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralIMListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeIM->InsertItem(coldata); lboHomeIM->SetItem(ListCtrlIndex, 1, IMPPAddress); if (intPref > 0 && intPref < 101){ lboHomeIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } HomeIMList.erase(intValueSeek); HomeIMListType.erase(intValueSeek); HomeIMListTokens.erase(intValueSeek); HomeIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeIMListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessIM->InsertItem(coldata); lboBusinessIM->SetItem(ListCtrlIndex, 1, IMPPAddress); if (intPref > 0 && intPref < 101){ lboBusinessIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } BusinessIMList.erase(intValueSeek); BusinessIMListType.erase(intValueSeek); BusinessIMListTokens.erase(intValueSeek); BusinessIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessIMListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } IMPPCount++; intValueSeek++; } else if (wxSProperty == wxT("TEL")){ // Check TEL and make sure it is functioning properly. size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map TypeSplitPoints; std::map TypeSplitLength; std::map::iterator SLiter; std::map::iterator SPoint; std::map::iterator TSLiter; std::map::iterator TSPoint; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString TelType; wxString TelNumber; wxString TelTypeUI; wxString TelTypeDetail; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 5; int intPref = 0; int intType = 0; int intSplitPoint = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 4; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ // Process each value in type and translate each // part. // Strip out the quotes if they are there. 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); } TelTypeDetail = PropertyValue; intSplitSize = 0; intSplitsFound = 0; intSplitPoint = 0; for (int i = 0; i <= intPropertyValueLen; i++){ intSplitSize++; if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){ if (intSplitsFound == 0){ TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint)); TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } else { TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint)); TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize)); } intSplitsFound++; i++; intSplitPoint = i; intSplitSize = 0; } } TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint)); TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize)); int intTypeSeek = 0; for (std::map::iterator typeiter = TypeSplitPoints.begin(); typeiter != TypeSplitPoints.end(); ++typeiter){ wxString TypePropertyName; TSLiter = TypeSplitLength.find(typeiter->first); TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second); if (intTypeSeek == 0){ } else { TelTypeUI.Append(wxT(",")); } if (TypePropertyName == wxT("home")){ intType = 1; } else if (TypePropertyName == wxT("work")){ intType = 2; } if (TypePropertyName == wxT("text")){ TelTypeUI.Append(_("text")); intTypeSeek++; } else if (TypePropertyName == wxT("voice")){ TelTypeUI.Append(_("voice")); intTypeSeek++; } else if (TypePropertyName == wxT("fax")){ TelTypeUI.Append(_("fax")); intTypeSeek++; } else if (TypePropertyName == wxT("cell")){ TelTypeUI.Append(_("mobile")); intTypeSeek++; } else if (TypePropertyName == wxT("video")){ TelTypeUI.Append(_("video")); intTypeSeek++; } else if (TypePropertyName == wxT("pager")){ TelTypeUI.Append(_("pager")); intTypeSeek++; } else if (TypePropertyName == wxT("textphone")){ TelTypeUI.Append(_("textphone")); intTypeSeek++; } } } } // Setup blank lines for later on. if (intType == 0){ GeneralTelephoneList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTelephoneListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTelephoneListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTelephoneListPref.insert(std::make_pair(intValueSeek, 0)); GeneralTelephoneListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeTelephoneList.insert(std::make_pair(intValueSeek, wxT(""))); HomeTelephoneListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeTelephoneListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeTelephoneListPref.insert(std::make_pair(intValueSeek, 0)); HomeTelephoneListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessTelephoneList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTelephoneListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTelephoneListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTelephoneListPref.insert(std::make_pair(intValueSeek, 0)); BusinessTelephoneListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 4; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; 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); } ProcessCaptureStrings(&PropertyValue); // Process properties. if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralTelephoneListAltID.erase(intValueSeek); GeneralTelephoneListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeTelephoneListAltID.erase(intValueSeek); HomeTelephoneListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessTelephoneListAltID.erase(intValueSeek); BusinessTelephoneListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralTelephoneListPID.erase(intValueSeek); GeneralTelephoneListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeTelephoneListPID.erase(intValueSeek); HomeTelephoneListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessTelephoneListPID.erase(intValueSeek); BusinessTelephoneListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intPref > 0 && intPref < 101){ if (intType == 0){ GeneralTelephoneListPref.erase(intValueSeek); GeneralTelephoneListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeTelephoneListPref.erase(intValueSeek); HomeTelephoneListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessTelephoneListPref.erase(intValueSeek); BusinessTelephoneListPref.insert(std::make_pair(intValueSeek, intPref)); } } } else { // 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); } } } } // Split the address. //std::map::iterator SLiter; intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 1){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } intSplitSize = 0; } } // Split the data into several parts. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ if (intiter->first == 1){ // Deal with PO Box. SLiter = SplitLength.find(1); //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE)); TelType = wxSPropertySeg2.Mid(0, SLiter->second); intPrevValue = intiter->second; TelNumber = wxSPropertySeg2.Mid(intPrevValue); } } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&PropertyValue); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(TelNumber); if (intType == 0){ ListCtrlIndex = lboTelephone->InsertItem(coldata); lboTelephone->SetItem(ListCtrlIndex, 1, TelTypeUI); if (intPref > 0 && intPref < 101){ lboTelephone->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } GeneralTelephoneList.erase(intValueSeek); GeneralTelephoneListType.erase(intValueSeek); GeneralTelephoneListTokens.erase(intValueSeek); GeneralTelephoneList.insert(std::make_pair(intValueSeek, TelNumber)); GeneralTelephoneListType.insert(std::make_pair(intValueSeek, TelTypeDetail)); GeneralTelephoneListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeTelephone->InsertItem(coldata); lboHomeTelephone->SetItem(ListCtrlIndex, 1, TelTypeUI); if (intPref > 0 && intPref < 101){ lboHomeTelephone->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } HomeTelephoneList.erase(intValueSeek); HomeTelephoneListType.erase(intValueSeek); HomeTelephoneListTokens.erase(intValueSeek); HomeTelephoneList.insert(std::make_pair(intValueSeek, TelNumber)); HomeTelephoneListType.insert(std::make_pair(intValueSeek, TelTypeDetail)); HomeTelephoneListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessTelephone->InsertItem(coldata); lboBusinessTelephone->SetItem(ListCtrlIndex, 1, TelTypeUI); if (intPref > 0 && intPref < 101){ lboBusinessTelephone->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } BusinessTelephoneList.erase(intValueSeek); BusinessTelephoneListType.erase(intValueSeek); BusinessTelephoneListTokens.erase(intValueSeek); BusinessTelephoneList.insert(std::make_pair(intValueSeek, TelNumber)); BusinessTelephoneListType.insert(std::make_pair(intValueSeek, TelTypeDetail)); BusinessTelephoneListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } TelCount++; intValueSeek++; } else if (wxSProperty == wxT("LANG")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 6; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 5; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralLanguageList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralLanguageListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralLanguageListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralLanguageListPref.insert(std::make_pair(intValueSeek, 0)); GeneralLanguageListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeLanguageList.insert(std::make_pair(intValueSeek, wxT(""))); HomeLanguageListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeLanguageListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeLanguageListPref.insert(std::make_pair(intValueSeek, 0)); HomeLanguageListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessLanguageList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessLanguageListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessLanguageListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessLanguageListPref.insert(std::make_pair(intValueSeek, 0)); BusinessLanguageListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 5; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralLanguageListAltID.erase(intValueSeek); GeneralLanguageListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeLanguageListAltID.erase(intValueSeek); HomeLanguageListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessLanguageListAltID.erase(intValueSeek); BusinessLanguageListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralLanguageListPID.erase(intValueSeek); GeneralLanguageListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeLanguageListPID.erase(intValueSeek); HomeLanguageListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessLanguageListPID.erase(intValueSeek); BusinessLanguageListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ GeneralLanguageListPref.erase(intValueSeek); GeneralLanguageListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeLanguageListPref.erase(intValueSeek); HomeLanguageListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessLanguageListPref.erase(intValueSeek); BusinessLanguageListPref.insert(std::make_pair(intValueSeek, intPref)); } } else { // 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); } } } } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); if (intType == 0){ ListCtrlIndex = lboLanguages->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboLanguages->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } GeneralLanguageList.erase(intValueSeek); GeneralLanguageListType.erase(intValueSeek); GeneralLanguageListTokens.erase(intValueSeek); GeneralLanguageList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralLanguageListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralLanguageListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeLanguages->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeLanguages->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } HomeLanguageList.erase(intValueSeek); HomeLanguageListType.erase(intValueSeek); HomeLanguageListTokens.erase(intValueSeek); HomeLanguageList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeLanguageListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeLanguageListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessLanguages->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessLanguages->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } BusinessLanguageList.erase(intValueSeek); BusinessLanguageListType.erase(intValueSeek); BusinessLanguageListTokens.erase(intValueSeek); BusinessLanguageList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessLanguageListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessLanguageListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } LangCount++; intValueSeek++; } else if (wxSProperty == wxT("GEO")){ size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString GeoType; wxString GeoData; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 5; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 4; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralGeographyList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralGeographyListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralGeographyListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralGeographyListPref.insert(std::make_pair(intValueSeek, 0)); GeneralGeographyListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeGeographyList.insert(std::make_pair(intValueSeek, wxT(""))); HomeGeographyListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeGeographyListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeGeographyListPref.insert(std::make_pair(intValueSeek, 0)); HomeGeographyListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessGeographyList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessGeographyListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessGeographyListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessGeographyListPref.insert(std::make_pair(intValueSeek, 0)); BusinessGeographyListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 4; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralGeographyListAltID.erase(intValueSeek); GeneralGeographyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeGeographyListAltID.erase(intValueSeek); HomeGeographyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessGeographyListAltID.erase(intValueSeek); BusinessGeographyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralGeographyListPID.erase(intValueSeek); GeneralGeographyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeGeographyListPID.erase(intValueSeek); HomeGeographyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessGeographyListPID.erase(intValueSeek); BusinessGeographyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("MEDIATYPE")){ if (intType == 0){ GeneralGeographyListMediatype.erase(intValueSeek); GeneralGeographyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeGeographyListMediatype.erase(intValueSeek); HomeGeographyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessGeographyListMediatype.erase(intValueSeek); BusinessGeographyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intPref > 0 && intPref < 101){ if (intType == 0){ GeneralGeographyListPref.erase(intValueSeek); GeneralGeographyListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeGeographyListPref.erase(intValueSeek); HomeGeographyListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessGeographyListPref.erase(intValueSeek); BusinessGeographyListPref.insert(std::make_pair(intValueSeek, intPref)); } } } else { // 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); } } } } // Split the address. //std::map::iterator SLiter; intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 1){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } intSplitSize = 0; } } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ if (intiter->first == 1){ // Deal with PO Box. SLiter = SplitLength.find(1); //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE)); GeoType = wxSPropertySeg2.Mid(0, SLiter->second); intPrevValue = intiter->second; GeoData = wxSPropertySeg2.Mid(intPrevValue); } } ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); if (intType == 0){ /* ListCtrlIndex = lboTimezones->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } */ /* txtGeopositioning->SetValue(GeoData); */ GeneralGeographyList.erase(intValueSeek); GeneralGeographyListType.erase(intValueSeek); GeneralGeographyListTokens.erase(intValueSeek); GeneralGeographyList.insert(std::make_pair(intValueSeek, GeoData)); GeneralGeographyListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralGeographyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); CaptureString(&GeoData, FALSE); coldata.SetText(GeoData); ListCtrlIndex = lboGeoposition->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboGeoposition->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } } else if (intType == 1){ /* ListCtrlIndex = lboHomeTimezones->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } */ /* txtHomeGeopositioning->SetValue(GeoData); */ HomeGeographyList.erase(intValueSeek); HomeGeographyListType.erase(intValueSeek); HomeGeographyListTokens.erase(intValueSeek); HomeGeographyList.insert(std::make_pair(intValueSeek, GeoData)); HomeGeographyListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeGeographyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); CaptureString(&GeoData, FALSE); coldata.SetText(GeoData); ListCtrlIndex = lboHomeGeoposition->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeGeoposition->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } } else if (intType == 2){ ListCtrlIndex = lboBusinessGeoposition->InsertItem(coldata); /* ListCtrlIndex = lboBusinessTimezones->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } */ /* txtBusinessGeopositioning->SetValue(GeoData); */ BusinessGeographyList.erase(intValueSeek); BusinessGeographyListType.erase(intValueSeek); BusinessGeographyListTokens.erase(intValueSeek); BusinessGeographyList.insert(std::make_pair(intValueSeek, GeoData)); BusinessGeographyListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessGeographyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); CaptureString(&GeoData, FALSE); coldata.SetText(GeoData); ListCtrlIndex = lboBusinessGeoposition->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessGeoposition->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } } GeoCount++; intValueSeek++; } else if (wxSProperty == wxT("RELATED")){ size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString RelatedType; wxString RelatedTypeOriginal; wxString RelatedName; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 9; int intPref = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 8; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process these. RelatedTypeOriginal = PropertyValue; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("contact")){ RelatedType = _("Contact"); } else if (PropertyValue == wxT("acquaintance")){ RelatedType = _("Acquaintance"); } else if (PropertyValue == wxT("friend")){ RelatedType = _("Friend"); } else if (PropertyValue == wxT("met")){ RelatedType = _("Met"); } else if (PropertyValue == wxT("co-worker")){ RelatedType = _("Co-worker"); } else if (PropertyValue == wxT("colleague")){ RelatedType = _("Colleague"); } else if (PropertyValue == wxT("co-resident")){ RelatedType = _("Co-resident"); } else if (PropertyValue == wxT("neighbor")){ RelatedType = _("Neighbour"); } else if (PropertyValue == wxT("child")){ RelatedType = _("Child"); } else if (PropertyValue == wxT("parent")){ RelatedType = _("Parent"); } else if (PropertyValue == wxT("sibling")){ RelatedType = _("Sibling"); } else if (PropertyValue == wxT("spouse")){ RelatedType = _("Spouse"); } else if (PropertyValue == wxT("kin")){ RelatedType = _("Kin"); } else if (PropertyValue == wxT("muse")){ RelatedType = _("Muse"); } else if (PropertyValue == wxT("crush")){ RelatedType = _("Crush"); } else if (PropertyValue == wxT("date")){ RelatedType = _("Date"); } else if (PropertyValue == wxT("sweetheart")){ RelatedType = _("Sweetheart"); } else if (PropertyValue == wxT("me")){ RelatedType = _("Me"); } else if (PropertyValue == wxT("agent")){ RelatedType = _("Agent"); } else if (PropertyValue == wxT("emergency")){ RelatedType = _("Emergency"); } else { RelatedType = PropertyValue; } } } intPrevValue = 8; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ GeneralRelatedListAltID.erase(intValueSeek); GeneralRelatedListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PID")){ GeneralRelatedListPID.erase(intValueSeek); GeneralRelatedListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intPref > 0 && intPref < 101){ GeneralRelatedListPref.erase(intValueSeek); GeneralRelatedListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("LANGUAGE")){ GeneralRelatedListLanguage.erase(intValueSeek); GeneralRelatedListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else { // 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); } } } } // Split the address. //std::map::iterator SLiter; intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; // Add the data to the General/Home/Work address variables. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(RelatedType); ProcessCaptureStrings(&wxSPropertySeg2); ListCtrlIndex = lboRelated->InsertItem(coldata); lboRelated->SetItem(ListCtrlIndex, 1, wxSPropertySeg2); if (intPref > 0 && intPref < 101){ lboRelated->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } GeneralRelatedList.erase(intValueSeek); GeneralRelatedListRelType.erase(intValueSeek); GeneralRelatedListType.erase(intValueSeek); GeneralRelatedListTokens.erase(intValueSeek); GeneralRelatedList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralRelatedListRelType.insert(std::make_pair(intValueSeek, RelatedTypeOriginal)); GeneralRelatedListType.insert(std::make_pair(intValueSeek, RelatedTypeOriginal)); GeneralRelatedListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); RelatedCount++; intValueSeek++; } else if (wxSProperty == wxT("URL")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 4; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralWebsiteList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralWebsiteListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralWebsiteListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralWebsiteListPref.insert(std::make_pair(intValueSeek, 0)); GeneralWebsiteListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeWebsiteList.insert(std::make_pair(intValueSeek, wxT(""))); HomeWebsiteListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeWebsiteListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeWebsiteListPref.insert(std::make_pair(intValueSeek, 0)); HomeWebsiteListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessWebsiteList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessWebsiteListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessWebsiteListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessWebsiteListPref.insert(std::make_pair(intValueSeek, 0)); BusinessWebsiteListTokens.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 4; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralWebsiteListAltID.erase(intValueSeek); GeneralWebsiteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeWebsiteListAltID.erase(intValueSeek); HomeWebsiteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessWebsiteListAltID.erase(intValueSeek); BusinessWebsiteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralWebsiteListPID.erase(intValueSeek); GeneralWebsiteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeWebsiteListPID.erase(intValueSeek); HomeWebsiteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessWebsiteListPID.erase(intValueSeek); BusinessWebsiteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ GeneralWebsiteListPref.erase(intValueSeek); GeneralWebsiteListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeWebsiteListPref.erase(intValueSeek); HomeWebsiteListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessWebsiteListPref.erase(intValueSeek); BusinessWebsiteListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("MEDIATYPE")){ if (intType == 0){ GeneralWebsiteListMediatype.erase(intValueSeek); GeneralWebsiteListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeWebsiteListMediatype.erase(intValueSeek); HomeWebsiteListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessWebsiteListMediatype.erase(intValueSeek); BusinessWebsiteListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); if (intType == 0){ ListCtrlIndex = lboWebsites->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboWebsites->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } GeneralWebsiteList.erase(intValueSeek); GeneralWebsiteListType.erase(intValueSeek); GeneralWebsiteListTokens.erase(intValueSeek); GeneralWebsiteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralWebsiteListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralWebsiteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeWebsites->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeWebsites->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } HomeWebsiteList.erase(intValueSeek); HomeWebsiteListType.erase(intValueSeek); HomeWebsiteListTokens.erase(intValueSeek); HomeWebsiteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeWebsiteListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeWebsiteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessWebsites->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessWebsites->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } BusinessWebsiteList.erase(intValueSeek); BusinessWebsiteListType.erase(intValueSeek); BusinessWebsiteListTokens.erase(intValueSeek); BusinessWebsiteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessWebsiteListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessWebsiteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } URLCount++; intValueSeek++; } else if (wxSProperty == wxT("TITLE")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 7; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 6; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralTitleList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTitleListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTitleListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTitleListPref.insert(std::make_pair(intValueSeek, 0)); GeneralTitleListTokens.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTitleListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeTitleList.insert(std::make_pair(intValueSeek, wxT(""))); HomeTitleListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeTitleListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeTitleListPref.insert(std::make_pair(intValueSeek, 0)); HomeTitleListTokens.insert(std::make_pair(intValueSeek, wxT(""))); HomeTitleListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessTitleList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTitleListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTitleListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTitleListPref.insert(std::make_pair(intValueSeek, 0)); BusinessTitleListTokens.insert(std::make_pair(intValueSeek, wxT(""))); BusinessTitleListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 6; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralTitleListAltID.erase(intValueSeek); GeneralTitleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeTitleListAltID.erase(intValueSeek); HomeTitleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessTitleListAltID.erase(intValueSeek); BusinessTitleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralTitleListPID.erase(intValueSeek); GeneralTitleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeTitleListPID.erase(intValueSeek); HomeTitleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessTitleListPID.erase(intValueSeek); BusinessTitleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ GeneralTitleListPref.erase(intValueSeek); GeneralTitleListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeTitleListPref.erase(intValueSeek); HomeTitleListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessTitleListPref.erase(intValueSeek); BusinessTitleListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("LANGUAGE")){ if (intType == 0){ GeneralTitleListLanguage.erase(intValueSeek); GeneralTitleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeTitleListLanguage.erase(intValueSeek); HomeTitleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessTitleListLanguage.erase(intValueSeek); BusinessTitleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); if (intType == 0){ ListCtrlIndex = lboTitles->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboTitles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } GeneralTitleList.erase(intValueSeek); GeneralTitleListType.erase(intValueSeek); GeneralTitleListTokens.erase(intValueSeek); GeneralTitleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralTitleListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralTitleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeTitles->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeTitles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } HomeTitleList.erase(intValueSeek); HomeTitleListType.erase(intValueSeek); HomeTitleListTokens.erase(intValueSeek); HomeTitleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeTitleListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeTitleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessTitles->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessTitles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } BusinessTitleList.erase(intValueSeek); BusinessTitleListType.erase(intValueSeek); BusinessTitleListTokens.erase(intValueSeek); BusinessTitleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessTitleListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessTitleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } TitleCount++; intValueSeek++; } else if (wxSProperty == wxT("ROLE")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 6; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 5; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralRoleList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralRoleListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralRoleListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralRoleListPref.insert(std::make_pair(intValueSeek, 0)); GeneralRoleListTokens.insert(std::make_pair(intValueSeek, wxT(""))); GeneralRoleListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeRoleList.insert(std::make_pair(intValueSeek, wxT(""))); HomeRoleListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeRoleListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeRoleListPref.insert(std::make_pair(intValueSeek, 0)); HomeRoleListTokens.insert(std::make_pair(intValueSeek, wxT(""))); HomeRoleListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessRoleList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessRoleListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessRoleListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessRoleListPref.insert(std::make_pair(intValueSeek, 0)); BusinessRoleListTokens.insert(std::make_pair(intValueSeek, wxT(""))); BusinessRoleListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 5; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralRoleListAltID.erase(intValueSeek); GeneralRoleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeRoleListAltID.erase(intValueSeek); HomeRoleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessRoleListAltID.erase(intValueSeek); BusinessRoleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralRoleListPID.erase(intValueSeek); GeneralRoleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeRoleListPID.erase(intValueSeek); HomeRoleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessRoleListPID.erase(intValueSeek); BusinessRoleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ GeneralRoleListPref.erase(intValueSeek); GeneralRoleListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeRoleListPref.erase(intValueSeek); HomeRoleListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessRoleListPref.erase(intValueSeek); BusinessRoleListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("LANGUAGE")){ if (intType == 0){ GeneralRoleListLanguage.erase(intValueSeek); GeneralRoleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeRoleListLanguage.erase(intValueSeek); HomeRoleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessRoleListLanguage.erase(intValueSeek); BusinessRoleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); if (intType == 0){ ListCtrlIndex = lboRoles->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboRoles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } GeneralRoleList.erase(intValueSeek); GeneralRoleListType.erase(intValueSeek); GeneralRoleListTokens.erase(intValueSeek); GeneralRoleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralRoleListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralRoleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeRoles->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeRoles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } HomeRoleList.erase(intValueSeek); HomeRoleListType.erase(intValueSeek); HomeRoleListTokens.erase(intValueSeek); HomeRoleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeRoleListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeRoleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessRoles->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessRoles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } BusinessRoleList.erase(intValueSeek); BusinessRoleListType.erase(intValueSeek); BusinessRoleListTokens.erase(intValueSeek); BusinessRoleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessRoleListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessRoleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } RoleCount++; intValueSeek++; } else if (wxSProperty == wxT("ORG")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 4; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralOrganisationsList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralOrganisationsListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralOrganisationsListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralOrganisationsListPref.insert(std::make_pair(intValueSeek, 0)); GeneralOrganisationsListTokens.insert(std::make_pair(intValueSeek, wxT(""))); GeneralOrganisationsListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); GeneralOrganisationsListSortAs.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeOrganisationsList.insert(std::make_pair(intValueSeek, wxT(""))); HomeOrganisationsListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeOrganisationsListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeOrganisationsListPref.insert(std::make_pair(intValueSeek, 0)); HomeOrganisationsListTokens.insert(std::make_pair(intValueSeek, wxT(""))); HomeOrganisationsListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); HomeOrganisationsListSortAs.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessOrganisationsList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessOrganisationsListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessOrganisationsListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessOrganisationsListPref.insert(std::make_pair(intValueSeek, 0)); BusinessOrganisationsListTokens.insert(std::make_pair(intValueSeek, wxT(""))); BusinessOrganisationsListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); BusinessOrganisationsListSortAs.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 4; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralOrganisationsListAltID.erase(intValueSeek); GeneralOrganisationsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeOrganisationsListAltID.erase(intValueSeek); HomeOrganisationsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessOrganisationsListAltID.erase(intValueSeek); BusinessOrganisationsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralOrganisationsListPID.erase(intValueSeek); GeneralOrganisationsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeOrganisationsListPID.erase(intValueSeek); HomeOrganisationsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessOrganisationsListPID.erase(intValueSeek); BusinessOrganisationsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ GeneralOrganisationsListPref.erase(intValueSeek); GeneralOrganisationsListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeOrganisationsListPref.erase(intValueSeek); HomeOrganisationsListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessOrganisationsListPref.erase(intValueSeek); BusinessOrganisationsListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("LANGUAGE")){ if (intType == 0){ GeneralOrganisationsListLanguage.erase(intValueSeek); GeneralOrganisationsListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeOrganisationsListLanguage.erase(intValueSeek); HomeOrganisationsListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessOrganisationsListLanguage.erase(intValueSeek); BusinessOrganisationsListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("SORT-AS")){ if (intType == 0){ GeneralOrganisationsListSortAs.erase(intValueSeek); GeneralOrganisationsListSortAs.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeOrganisationsListSortAs.erase(intValueSeek); HomeOrganisationsListSortAs.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessOrganisationsListSortAs.erase(intValueSeek); BusinessOrganisationsListSortAs.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } // Add the data to the General/Home/Work address variables. wxListItem coldata; ProcessCaptureStrings(&wxSPropertySeg2); coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); if (intType == 0){ ListCtrlIndex = lboOrganisations->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboOrganisations->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } GeneralOrganisationsList.erase(intValueSeek); GeneralOrganisationsListType.erase(intValueSeek); GeneralOrganisationsListTokens.erase(intValueSeek); GeneralOrganisationsList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralOrganisationsListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralOrganisationsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 1){ ListCtrlIndex = lboHomeOrganisations->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeOrganisations->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } HomeOrganisationsList.erase(intValueSeek); HomeOrganisationsListType.erase(intValueSeek); HomeOrganisationsListTokens.erase(intValueSeek); HomeOrganisationsList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeOrganisationsListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeOrganisationsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } else if (intType == 2){ ListCtrlIndex = lboBusinessOrganisations->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessOrganisations->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } BusinessOrganisationsList.erase(intValueSeek); BusinessOrganisationsListType.erase(intValueSeek); BusinessOrganisationsListTokens.erase(intValueSeek); BusinessOrganisationsList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessOrganisationsListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessOrganisationsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); } OrgCount++; intValueSeek++; } else if (wxSProperty == wxT("NOTE")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 6; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 5; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. if (intType == 0){ GeneralNoteList.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNoteListAltID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNoteListPID.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNoteListPref.insert(std::make_pair(intValueSeek, 0)); GeneralNoteListTokens.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNoteListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ HomeNoteList.insert(std::make_pair(intValueSeek, wxT(""))); HomeNoteListAltID.insert(std::make_pair(intValueSeek, wxT(""))); HomeNoteListPID.insert(std::make_pair(intValueSeek, wxT(""))); HomeNoteListPref.insert(std::make_pair(intValueSeek, 0)); HomeNoteListTokens.insert(std::make_pair(intValueSeek, wxT(""))); HomeNoteListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 2){ BusinessNoteList.insert(std::make_pair(intValueSeek, wxT(""))); BusinessNoteListAltID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessNoteListPID.insert(std::make_pair(intValueSeek, wxT(""))); BusinessNoteListPref.insert(std::make_pair(intValueSeek, 0)); BusinessNoteListTokens.insert(std::make_pair(intValueSeek, wxT(""))); BusinessNoteListLanguage.insert(std::make_pair(intValueSeek, wxT(""))); } intPrevValue = 5; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ GeneralNoteListAltID.erase(intValueSeek); GeneralNoteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeNoteListAltID.erase(intValueSeek); HomeNoteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessNoteListAltID.erase(intValueSeek); BusinessNoteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ GeneralNoteListPID.erase(intValueSeek); GeneralNoteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeNoteListPID.erase(intValueSeek); HomeNoteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessNoteListPID.erase(intValueSeek); BusinessNoteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ GeneralNoteListPref.erase(intValueSeek); GeneralNoteListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ HomeNoteListPref.erase(intValueSeek); HomeNoteListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ BusinessNoteListPref.erase(intValueSeek); BusinessNoteListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("LANGUAGE")){ if (intType == 0){ GeneralNoteListLanguage.erase(intValueSeek); GeneralNoteListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ HomeNoteListLanguage.erase(intValueSeek); HomeNoteListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ BusinessNoteListLanguage.erase(intValueSeek); BusinessNoteListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } // Add the data to the General/Home/Work address variables. ProcessCaptureStrings(&wxSPropertySeg2); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); if (intType == 0){ GeneralNoteList.erase(intValueSeek); GeneralNoteListType.erase(intValueSeek); GeneralNoteListTokens.erase(intValueSeek); GeneralNoteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); GeneralNoteListType.insert(std::make_pair(intValueSeek, wxT(""))); GeneralNoteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); //CaptureString(&wxSPropertySeg2, FALSE); coldata.SetText(wxSPropertySeg2); ListCtrlIndex = lboNotes->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboNotes->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } } else if (intType == 1){ HomeNoteList.erase(intValueSeek); HomeNoteListType.erase(intValueSeek); HomeNoteListTokens.erase(intValueSeek); HomeNoteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); HomeNoteListType.insert(std::make_pair(intValueSeek, wxT("home"))); HomeNoteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); CaptureString(&wxSPropertySeg2, FALSE); coldata.SetText(wxSPropertySeg2); ListCtrlIndex = lboHomeNotes->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboHomeNotes->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } } else if (intType == 2){ BusinessNoteList.erase(intValueSeek); BusinessNoteListType.erase(intValueSeek); BusinessNoteListTokens.erase(intValueSeek); BusinessNoteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); BusinessNoteListType.insert(std::make_pair(intValueSeek, wxT("work"))); BusinessNoteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); CaptureString(&wxSPropertySeg2, FALSE); coldata.SetText(wxSPropertySeg2); ListCtrlIndex = lboBusinessNotes->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboBusinessNotes->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } } NoteCount++; intValueSeek++; } else if (wxSProperty == wxT("CATEGORIES")) { size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyType; bool AfterFirstToken = FALSE; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 12; int intPref = 0; int intType = 0; int intSplitSeek = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 11; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; PropertyType = wxT("work"); } else if (PropertyValue == wxT("home")){ intType = 1; PropertyType = wxT("home"); } else { intType = 0; } } } // Setup blank lines for later on. CategoriesList.insert(std::make_pair(intValueSeek, wxT(""))); CategoriesListAltID.insert(std::make_pair(intValueSeek, wxT(""))); CategoriesListPID.insert(std::make_pair(intValueSeek, wxT(""))); CategoriesListPref.insert(std::make_pair(intValueSeek, 0)); CategoriesListTokens.insert(std::make_pair(intValueSeek, wxT(""))); intPrevValue = 11; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ CategoriesListAltID.erase(intValueSeek); CategoriesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ CategoriesListAltID.erase(intValueSeek); CategoriesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ CategoriesListAltID.erase(intValueSeek); CategoriesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ CategoriesListPID.erase(intValueSeek); CategoriesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ CategoriesListPID.erase(intValueSeek); CategoriesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ CategoriesListPID.erase(intValueSeek); CategoriesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ CategoriesListPref.erase(intValueSeek); CategoriesListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ CategoriesListPref.erase(intValueSeek); CategoriesListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ CategoriesListPref.erase(intValueSeek); CategoriesListPref.insert(std::make_pair(intValueSeek, intPref)); } } else { // 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); } } } } // Deal with multiple categories. SplitPoints.clear(); SplitLength.clear(); intSplitSize = 0; intSplitsFound = 0; intSplitSeek = 0; intPrevValue = 0; intPropertyLen = wxSPropertySeg2.Len(); for (int i = 0; i <= intPropertyLen; i++){ if (intSplitSize == 0 && wxSPropertySeg2.Mid(i, 1) == wxT(" ")){ continue; } intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(",") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){ if (AfterFirstToken == TRUE){ SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize)); } else { SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); AfterFirstToken = TRUE; } intSplitsFound++; intSplitSeek = i; intSplitSize = 0; } } SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1))); SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize)); intPrevValue = 0; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg2.Mid(intPrevValue, (SLiter->second + 1)); intPrevValue = intiter->second; // Process properties. /* int intPropertyValueLen = PropertyValue.Len(); if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){ PropertyValue.Trim(); PropertyValue.RemoveLast(); } */ // Add the data to the General/Home/Work address variables. // Trim any whitespace from the start and end. PropertyData = PropertyData.Trim(FALSE); PropertyData = PropertyData.Trim(TRUE); ProcessCaptureStrings(&PropertyData); wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(PropertyData); ListCtrlIndex = lboCategories->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboCategories->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } CategoriesList.erase(intValueSeek); CategoriesListType.erase(intValueSeek); CategoriesListTokens.erase(intValueSeek); CategoriesList.insert(std::make_pair(intValueSeek, PropertyData)); CategoriesListType.insert(std::make_pair(intValueSeek, PropertyType)); CategoriesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); CategoryCount++; intValueSeek++; } } else if (wxSProperty == wxT("PHOTO")) { size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 7; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 6; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. PicturesList.insert(std::make_pair(intValueSeek, "")); PicturesListType.insert(std::make_pair(intValueSeek, wxT(""))); PicturesListAltID.insert(std::make_pair(intValueSeek, wxT(""))); PicturesListPID.insert(std::make_pair(intValueSeek, wxT(""))); PicturesListPref.insert(std::make_pair(intValueSeek, 0)); PicturesListPicEncType.insert(std::make_pair(intValueSeek, wxT(""))); PicturesListPictureType.insert(std::make_pair(intValueSeek, wxT(""))); PicturesListTokens.insert(std::make_pair(intValueSeek, wxT(""))); PicturesListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); intPrevValue = 6; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ PicturesListAltID.erase(intValueSeek); PicturesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ PicturesListAltID.erase(intValueSeek); PicturesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ PicturesListAltID.erase(intValueSeek); PicturesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ PicturesListPID.erase(intValueSeek); PicturesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ PicturesListPID.erase(intValueSeek); PicturesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ PicturesListPID.erase(intValueSeek); PicturesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ PicturesListPref.erase(intValueSeek); PicturesListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ PicturesListPref.erase(intValueSeek); PicturesListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ PicturesListPref.erase(intValueSeek); PicturesListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("MEDIATYPE")){ if (intType == 0){ PicturesListMediatype.erase(intValueSeek); PicturesListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ PicturesListMediatype.erase(intValueSeek); PicturesListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ PicturesListMediatype.erase(intValueSeek); PicturesListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; ProcessCaptureStrings(&wxSPropertySeg2); for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(";")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 6){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } else { SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } intSplitSize = 0; } } wxString wxSPhotoURI; wxString wxSPhotoMIME; wxString wxSPhotoEncoding; wxString wxSPhotoData; std::string base64enc; if (intSplitsFound == 0){ } else { std::map::iterator striter; striter = SplitLength.find(1); wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":")); while (wSTDataType.HasMoreTokens() == TRUE){ wxSPhotoURI = wSTDataType.GetNextToken(); wxSPhotoMIME = wSTDataType.GetNextToken(); break; } wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(",")); while (wSTDataInfo.HasMoreTokens() == TRUE){ wxSPhotoEncoding = wSTDataInfo.GetNextToken(); wxSPhotoData = wSTDataInfo.GetNextToken(); base64enc = wxSPhotoData.mb_str(); break; } } // Add the data to the General/Home/Work address variables. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(_("Picture")); ListCtrlIndex = lboPictures->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboPictures->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } PicturesList.erase(intValueSeek); PicturesListType.erase(intValueSeek); PicturesListTokens.erase(intValueSeek); PicturesListPictureType.erase(intValueSeek); PicturesListPicEncType.erase(intValueSeek); PicturesList.insert(std::make_pair(intValueSeek, base64enc)); PicturesListPictureType.insert(std::make_pair(intValueSeek, wxSPhotoMIME)); PicturesListPicEncType.insert(std::make_pair(intValueSeek, wxSPhotoEncoding)); if (intType == 0){ PicturesListType.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ PicturesListType.insert(std::make_pair(intValueSeek, wxT("home"))); lboPictures->SetItem(ListCtrlIndex, 1, _("Home")); } else if (intType == 2){ PicturesListType.insert(std::make_pair(intValueSeek, wxT("work"))); lboPictures->SetItem(ListCtrlIndex, 1, _("Work")); } PicturesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); PhotoCount++; intValueSeek++; } else if (wxSProperty == wxT("LOGO")) { size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 6; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 5; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. LogosList.insert(std::make_pair(intValueSeek, "")); LogosListType.insert(std::make_pair(intValueSeek, wxT(""))); LogosListAltID.insert(std::make_pair(intValueSeek, wxT(""))); LogosListPID.insert(std::make_pair(intValueSeek, wxT(""))); LogosListPref.insert(std::make_pair(intValueSeek, 0)); LogosListPicEncType.insert(std::make_pair(intValueSeek, wxT(""))); LogosListPictureType.insert(std::make_pair(intValueSeek, wxT(""))); LogosListTokens.insert(std::make_pair(intValueSeek, wxT(""))); LogosListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); intPrevValue = 5; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ LogosListAltID.erase(intValueSeek); LogosListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ LogosListAltID.erase(intValueSeek); LogosListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ LogosListAltID.erase(intValueSeek); LogosListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ LogosListPID.erase(intValueSeek); LogosListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ LogosListPID.erase(intValueSeek); LogosListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ LogosListPID.erase(intValueSeek); LogosListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ LogosListPref.erase(intValueSeek); LogosListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ LogosListPref.erase(intValueSeek); LogosListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ LogosListPref.erase(intValueSeek); LogosListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("MEDIATYPE")){ if (intType == 0){ LogosListMediatype.erase(intValueSeek); LogosListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ LogosListMediatype.erase(intValueSeek); LogosListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ LogosListMediatype.erase(intValueSeek); LogosListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; wxString wxSPhotoURI; wxString wxSPhotoMIME; wxString wxSPhotoEncoding; wxString wxSPhotoData; std::string base64enc; ProcessCaptureStrings(&wxSPropertySeg2); if (intSplitsFound == 0){ } else { std::map::iterator striter; striter = SplitLength.find(1); wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":")); while (wSTDataType.HasMoreTokens() == TRUE){ wxSPhotoURI = wSTDataType.GetNextToken(); wxSPhotoMIME = wSTDataType.GetNextToken(); break; } wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(",")); while (wSTDataInfo.HasMoreTokens() == TRUE){ wxSPhotoEncoding = wSTDataInfo.GetNextToken(); wxSPhotoData = wSTDataInfo.GetNextToken(); base64enc = wxSPhotoData.mb_str(); break; } } // Add the data to the General/Home/Work address variables. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(_("Picture")); ListCtrlIndex = lboLogos->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboLogos->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } LogosList.erase(intValueSeek); LogosListType.erase(intValueSeek); LogosListTokens.erase(intValueSeek); LogosListPictureType.erase(intValueSeek); LogosListPicEncType.erase(intValueSeek); LogosList.insert(std::make_pair(intValueSeek, base64enc)); LogosListPictureType.insert(std::make_pair(intValueSeek, wxSPhotoMIME)); LogosListPicEncType.insert(std::make_pair(intValueSeek, wxSPhotoEncoding)); if (intType == 0){ LogosListType.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ LogosListType.insert(std::make_pair(intValueSeek, wxT("home"))); lboLogos->SetItem(ListCtrlIndex, 1, _("Home")); } else if (intType == 2){ LogosListType.insert(std::make_pair(intValueSeek, wxT("work"))); lboLogos->SetItem(ListCtrlIndex, 1, _("Work")); } LogosListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); LogoCount++; intValueSeek++; } else if (wxSProperty == wxT("SOUND")) { size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 7; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 6; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. SoundsList.insert(std::make_pair(intValueSeek, "")); SoundsListType.insert(std::make_pair(intValueSeek, wxT(""))); SoundsListAltID.insert(std::make_pair(intValueSeek, wxT(""))); SoundsListPID.insert(std::make_pair(intValueSeek, wxT(""))); SoundsListPref.insert(std::make_pair(intValueSeek, 0)); SoundsListAudioEncType.insert(std::make_pair(intValueSeek, wxT(""))); SoundsListAudioType.insert(std::make_pair(intValueSeek, wxT(""))); SoundsListTokens.insert(std::make_pair(intValueSeek, wxT(""))); SoundsListMediatype.insert(std::make_pair(intValueSeek, wxT(""))); intPrevValue = 6; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ALTID")){ if (intType == 0){ SoundsListAltID.erase(intValueSeek); SoundsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ SoundsListAltID.erase(intValueSeek); SoundsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ SoundsListAltID.erase(intValueSeek); SoundsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PID")){ if (intType == 0){ SoundsListPID.erase(intValueSeek); SoundsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ SoundsListPID.erase(intValueSeek); SoundsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ SoundsListPID.erase(intValueSeek); SoundsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); if (intType == 0){ SoundsListPref.erase(intValueSeek); SoundsListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 1){ SoundsListPref.erase(intValueSeek); SoundsListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (intType == 2){ SoundsListPref.erase(intValueSeek); SoundsListPref.insert(std::make_pair(intValueSeek, intPref)); } } else if (PropertyName == wxT("MEDIATYPE")){ if (intType == 0){ SoundsListMediatype.erase(intValueSeek); SoundsListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 1){ SoundsListMediatype.erase(intValueSeek); SoundsListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (intType == 2){ SoundsListMediatype.erase(intValueSeek); SoundsListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } } else { // 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); } } } } intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; ProcessCaptureStrings(&wxSPropertySeg2); for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(";")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 6){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } else { SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } intSplitSize = 0; } } wxString wxSSoundURI; wxString wxSSoundMIME; wxString wxSSoundEncoding; wxString wxSSoundData; std::string base64enc; if (intSplitsFound == 0){ } else { std::map::iterator striter; striter = SplitLength.find(1); wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":")); while (wSTDataType.HasMoreTokens() == TRUE){ wxSSoundURI = wSTDataType.GetNextToken(); wxSSoundMIME = wSTDataType.GetNextToken(); break; } wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(",")); while (wSTDataInfo.HasMoreTokens() == TRUE){ wxSSoundEncoding = wSTDataInfo.GetNextToken(); wxSSoundData = wSTDataInfo.GetNextToken(); base64enc = wxSSoundData.mb_str(); break; } } // Add the data to the General/Home/Work address variables. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(_("Sound")); ListCtrlIndex = lboSounds->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboSounds->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } SoundsList.erase(intValueSeek); SoundsListType.erase(intValueSeek); SoundsListTokens.erase(intValueSeek); SoundsListAudioType.erase(intValueSeek); SoundsListAudioEncType.erase(intValueSeek); SoundsList.insert(std::make_pair(intValueSeek, base64enc)); SoundsListAudioType.insert(std::make_pair(intValueSeek, wxSSoundMIME)); SoundsListAudioEncType.insert(std::make_pair(intValueSeek, wxSSoundEncoding)); if (intType == 0){ SoundsListType.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ SoundsListType.insert(std::make_pair(intValueSeek, wxT("home"))); lboLogos->SetItem(ListCtrlIndex, 1, _("Home")); } else if (intType == 2){ SoundsListType.insert(std::make_pair(intValueSeek, wxT("work"))); lboLogos->SetItem(ListCtrlIndex, 1, _("Work")); } SoundsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); SoundCount++; intValueSeek++; } else if (wxSProperty == wxT("CALURI")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 8; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 7; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. CalendarList.insert(std::make_pair(intValueSeek, wxT(""))); CalendarListAltID.insert(std::make_pair(intValueSeek, wxT(""))); CalendarListPID.insert(std::make_pair(intValueSeek, wxT(""))); CalendarListPref.insert(std::make_pair(intValueSeek, 0)); CalendarListTokens.insert(std::make_pair(intValueSeek, wxT(""))); intPrevValue = 6; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } if (PropertyName == wxT("ALTID")){ CalendarListAltID.erase(intValueSeek); CalendarListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PID")){ CalendarListPID.erase(intValueSeek); CalendarListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); CalendarListPref.erase(intValueSeek); CalendarListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (PropertyName == wxT("MEDIATYPE")){ CalendarListMediatype.erase(intValueSeek); CalendarListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else { // 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); } } } } // Add the data to the General/Home/Work address variables. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); ListCtrlIndex = lboCalendarAddresses->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboCalendarAddresses->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } CaptureString(&wxSPropertySeg2, FALSE); CalendarList.erase(intValueSeek); CalendarListType.erase(intValueSeek); CalendarListTokens.erase(intValueSeek); CalendarList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); if (intType == 0){ CalendarListType.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ CalendarListType.insert(std::make_pair(intValueSeek, wxT("home"))); lboCalendarAddresses->SetItem(ListCtrlIndex, 1, _("Home"), intPref); } else if (intType == 2){ CalendarListType.insert(std::make_pair(intValueSeek, wxT("work"))); lboCalendarAddresses->SetItem(ListCtrlIndex, 1, _("Work"), intPref); } CalendarListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); CalAdrCount++; intValueSeek++; } else if (wxSProperty == wxT("CALADRURI")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 11; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 10; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. CalendarRequestList.insert(std::make_pair(intValueSeek, wxT(""))); CalendarRequestListAltID.insert(std::make_pair(intValueSeek, wxT(""))); CalendarRequestListPID.insert(std::make_pair(intValueSeek, wxT(""))); CalendarRequestListPref.insert(std::make_pair(intValueSeek, 0)); CalendarRequestListTokens.insert(std::make_pair(intValueSeek, wxT(""))); intPrevValue = 10; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } if (PropertyName == wxT("ALTID")){ CalendarRequestListAltID.erase(intValueSeek); CalendarRequestListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PID")){ CalendarRequestListPID.erase(intValueSeek); CalendarRequestListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); CalendarRequestListPref.erase(intValueSeek); CalendarRequestListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (PropertyName == wxT("MEDIATYPE")){ CalendarRequestListMediatype.erase(intValueSeek); CalendarRequestListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else { // 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); } } } } // Add the data to the General/Home/Work address variables. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); ListCtrlIndex = lboCalendarRequestAddress->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboCalendarRequestAddress->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } CaptureString(&wxSPropertySeg2, FALSE); CalendarRequestList.erase(intValueSeek); CalendarRequestListType.erase(intValueSeek); CalendarRequestListTokens.erase(intValueSeek); CalendarRequestList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); if (intType == 0){ CalendarRequestListType.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ CalendarRequestListType.insert(std::make_pair(intValueSeek, wxT("home"))); lboCalendarRequestAddress->SetItem(ListCtrlIndex, 1, _("Home"), intPref); } else if (intType == 2){ CalendarRequestListType.insert(std::make_pair(intValueSeek, wxT("work"))); lboCalendarRequestAddress->SetItem(ListCtrlIndex, 1, _("Work"), intPref); } CalendarRequestListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); CalReqAdrCount++; intValueSeek++; } else if (wxSProperty == wxT("FBURL")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 7; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 6; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. FreeBusyList.insert(std::make_pair(intValueSeek, wxT(""))); FreeBusyListAltID.insert(std::make_pair(intValueSeek, wxT(""))); FreeBusyListPID.insert(std::make_pair(intValueSeek, wxT(""))); FreeBusyListPref.insert(std::make_pair(intValueSeek, 0)); FreeBusyListTokens.insert(std::make_pair(intValueSeek, wxT(""))); intPrevValue = 6; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } if (PropertyName == wxT("ALTID")){ FreeBusyListAltID.erase(intValueSeek); FreeBusyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PID")){ FreeBusyListPID.erase(intValueSeek); FreeBusyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); FreeBusyListPref.erase(intValueSeek); FreeBusyListPref.insert(std::make_pair(intValueSeek, intPref)); } else if (PropertyName == wxT("MEDIATYPE")){ FreeBusyListMediatype.erase(intValueSeek); FreeBusyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); } else { // 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); } } } } // Add the data to the General/Home/Work address variables. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg2); ListCtrlIndex = lboFreeBusyAddresses->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboFreeBusyAddresses->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref)); } CaptureString(&wxSPropertySeg2, FALSE); FreeBusyList.erase(intValueSeek); FreeBusyListType.erase(intValueSeek); FreeBusyListTokens.erase(intValueSeek); FreeBusyList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); if (intType == 0){ FreeBusyListType.insert(std::make_pair(intValueSeek, wxT(""))); } else if (intType == 1){ FreeBusyListType.insert(std::make_pair(intValueSeek, wxT("home"))); lboFreeBusyAddresses->SetItem(ListCtrlIndex, 1, _("Home"), intPref); } else if (intType == 2){ FreeBusyListType.insert(std::make_pair(intValueSeek, wxT("work"))); lboFreeBusyAddresses->SetItem(ListCtrlIndex, 1, _("Work"), intPref); } FreeBusyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); FreeBusyCount++; intValueSeek++; } else if (wxSProperty == wxT("KEY")){ size_t intPropertyLen = wxSPropertySeg1.Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 5; int intPref = 0; int intType = 0; long ListCtrlIndex; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 4; // Look for type before continuing. for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("TYPE")){ if (PropertyValue == wxT("work")){ intType = 2; } else if (PropertyValue == wxT("home")){ intType = 1; } else { intType = 0; } } } // Setup blank lines for later on. KeyList.insert(std::make_pair(intValueSeek, wxT(""))); KeyListAltID.insert(std::make_pair(intValueSeek, wxT(""))); KeyListPID.insert(std::make_pair(intValueSeek, wxT(""))); KeyListPref.insert(std::make_pair(intValueSeek, 0)); KeyListKeyType.insert(std::make_pair(intValueSeek, FALSE)); KeyListDataType.insert(std::make_pair(intValueSeek, wxT(""))); KeyListDataEncType.insert(std::make_pair(intValueSeek, wxT(""))); KeyListTokens.insert(std::make_pair(intValueSeek, wxT(""))); intPrevValue = 4; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.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); } if (PropertyName == wxT("ALTID")){ KeyListAltID.erase(intValueSeek); KeyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PID")){ KeyListPID.erase(intValueSeek); KeyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); } else if (PropertyName == wxT("PREF")){ intPref = wxAtoi(PropertyValue); KeyListPref.erase(intValueSeek); KeyListPref.insert(std::make_pair(intValueSeek, intPref)); } else { // 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); } } } } intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; intPrevValue = 0; for (int i = 0; i <= intPropertyLen; i++){ intSplitSize++; if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){ intSplitsFound++; SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1))); if (intSplitsFound == 6){ SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); break; } else { SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } intSplitSize = 0; } } wxString wxSKeyURI; wxString wxSKeyMIME; wxString wxSKeyEncoding; wxString wxSKeyData; std::string base64enc; if (intSplitsFound == 0){ } else { std::map::iterator striter; striter = SplitLength.find(1); wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":")); while (wSTDataType.HasMoreTokens() == TRUE){ wxSKeyURI = wSTDataType.GetNextToken(); wxSKeyMIME = wSTDataType.GetNextToken(); break; } if (wxSKeyURI == wxT("data")){ wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 2)), wxT(",")); while (wSTDataInfo.HasMoreTokens() == TRUE){ wxSKeyEncoding = wSTDataInfo.GetNextToken(); wxSKeyData = wSTDataInfo.GetNextToken(); break; } } } // Add the data to the General/Home/Work address variables. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); if (wxSKeyURI == wxT("data")){ if (wxSKeyMIME == wxT("application/pgp-keys")){ coldata.SetText(_("PGP Key")); } else { coldata.SetText(_("Key")); } KeyListDataEncType.erase(intValueSeek); KeyListKeyType.erase(intValueSeek); KeyListDataEncType.insert(std::make_pair(intValueSeek, wxSKeyEncoding)); KeyListKeyType.insert(std::make_pair(intValueSeek, TRUE)); KeyList.erase(intValueSeek); KeyList.insert(std::make_pair(intValueSeek, wxSKeyData)); } else { coldata.SetText(wxSPropertySeg2); KeyList.erase(intValueSeek); KeyList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); } ListCtrlIndex = lboKeys->InsertItem(coldata); if (intPref > 0 && intPref < 101){ lboKeys->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref)); } KeyListType.erase(intValueSeek); KeyListTokens.erase(intValueSeek); KeyListDataType.erase(intValueSeek); KeyListDataType.insert(std::make_pair(intValueSeek, wxSKeyMIME)); switch (intType){ case 0: KeyListType.insert(std::make_pair(intValueSeek, wxT(""))); case 1: KeyListType.insert(std::make_pair(intValueSeek, wxT("home"))); case 2: KeyListType.insert(std::make_pair(intValueSeek, wxT("work"))); } KeyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens)); KeyCount++; intValueSeek++; } else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){ UIDToken = wxSPropertySeg2; UIDProcessed = TRUE; } else if (wxSProperty.Mid(0, 3) == wxT("VND")){ // Split the Vendor three ways. wxStringTokenizer wSTVendorDetails(wxSPropertySeg1, wxT("-")); wxString wxSVNDID; wxString wxSVNDPropName; long ListCtrlIndex; while (wSTVendorDetails.HasMoreTokens() == TRUE){ wSTVendorDetails.GetNextToken(); wxSVNDID = wSTVendorDetails.GetNextToken(); wxSVNDPropName = wSTVendorDetails.GetNextToken(); break; } if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){ // Setup the values for later processing. VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID)); VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName)); // Add the data to the vendor variables. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSVNDID + wxT("-") + wxSVNDPropName); ListCtrlIndex = lboVendorNamespace->InsertItem(coldata); VendorList.erase(intValueSeek); VendorListPEN.erase(intValueSeek); VendorListElement.erase(intValueSeek); VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID)); VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName)); VendorCount++; intValueSeek++; } } else if (wxSProperty.Mid(0, 2) == wxT("X-")){ long ListCtrlIndex; XTokenList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); XTokenListTokens.insert(std::make_pair(intValueSeek, wxSPropertySeg1.Mid(2))); // Add to the form. wxListItem coldata; coldata.SetId(intValueSeek); coldata.SetData(intValueSeek); coldata.SetText(wxSPropertySeg1.Mid(2)); ListCtrlIndex = lboXToken->InsertItem(coldata); XTokenCount++; intValueSeek++; } // Reset the variables. QuoteMode = FALSE; PropertyFind = TRUE; ExtraLineSeek = TRUE; ContactLineLen = 0; QuoteBreakPoint = 0; ContactLine.Clear(); wxSProperty.Clear(); } FMTimer.SetFilename(Filename); FMTimer.Start(10000, FALSE); EditMode = TRUE; return TRUE; } void frmContactEditor::SplitValues(wxString *PropertyLine, std::map *SplitPoints, std::map *SplitLength, int intSize){ size_t intPropertyLen = PropertyLine->Len(); int intSplitsFound = 0; int intSplitSize = 0; int intSplitSeek = 0; for (int i = intSize; i <= intPropertyLen; i++){ intSplitSize++; if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ if (intSplitsFound == 0){ SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); } else { SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); intSplitsFound++; intSplitSeek = i; intSplitSize = 0; } } if (intSplitsFound == 0){ SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1))); SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize)); } else { SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1))); SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize)); } }