#include "vcard34conv.h" #include "vcard.h" #include "../version.h" #include "../common/textprocessing.h" #include #include #include #include #include #include #include // vcard.cpp - Deals with vCard 4.0 formatted files meeting the // RFC 6350 specification. vCard34Conv::vCard34Conv(){ vCardBegin = FALSE; vCardEnd = FALSE; vCardFN = FALSE; vCardVersion = 0.0; SettingCount = 0; } bool vCard34Conv::ConvertToV3(wxString Filename, wxString *wxSData){ wxString V3Data; wxString V4Data; // Load the contact into the contact editor. wxFFile ContactFile; wxString wxSContactString; wxString ContactLine; vCard ContactData; vCard ContactDatav3; //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 KindProcessed = FALSE; bool FNFirst = FALSE; bool NicknameFirst = FALSE; bool TitleFirst = FALSE; bool OrganisationFirst = FALSE; bool NoteFirst = FALSE; bool PhotoFirst = FALSE; bool LogoFirst = 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 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 ItemSeek = 1; //int intValueSeek = 1; wxString strVer; // Setup the version string. strVer.Append(wxT("-//Xestia//Address Book Version ")); strVer.Append(wxT(XSDAB_VERSION)); strVer.Append(wxT("//KW")); ContactDatav3.AddRaw(wxT("BEGIN"), wxT("VCARD")); ContactDatav3.AddRaw(wxT("VERSION"), wxT("3.0")); ContactDatav3.AddRaw(wxT("PRODID"), strVer); 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. wxSProperty.Clear(); 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("FN")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 4; //SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 3; if (FNFirst == FALSE){ ContactDatav3.AddRaw(wxT("FN"), wxSPropertySeg2); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ } else { ContactDatav3.AddRaw(wxT("X-VCARD4-FN;X-FIRST=TRUE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } FNFirst = TRUE; } else { if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-FN"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-FN;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } } else if (wxSProperty == wxT("N") && NameProcessed == FALSE){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 3; intPrevValue = 2; ContactDatav3.AddRaw(wxT("N"), wxSPropertySeg2); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ } else { ContactDatav3.AddRaw(wxT("X-VCARD4-N;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT("")); } NameProcessed = TRUE; } else if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){ // Process Data. std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 5; intPrevValue = 4; ContactDatav3.AddRaw(wxT("X-ADDRESSBOOKSERVER-KIND"), wxSPropertySeg2); KindProcessed = TRUE; } else if (wxSProperty == wxT("MEMBER")){ // Process Data. std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 7; intPrevValue = 6; ContactDatav3.AddRaw(wxT("X-ADDRESSBOOKSERVER-MEMBER"), wxSPropertySeg2); } else if (wxSProperty == wxT("NICKNAME")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 10; intPrevValue = 9; if (NicknameFirst == FALSE){ ContactDatav3.AddRaw(wxT("NICKNAME"), wxSPropertySeg2); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ } else { ContactDatav3.AddRaw(wxT("X-VCARD4-NICKNAME;X-FIRST=TRUE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT("")); } NicknameFirst = TRUE; ItemSeek++; } else { if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-NICKNAME"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-NICKNAME;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"), wxSPropertySeg2); } } } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ // Do PID/ALTID/LANG things. std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 8; intPrevValue = 7; if (wxSPropertySeg2.Mid(1, 1) == wxT(";")){ if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-GENDER;X-GENDERTEXT=\"") + wxSPropertySeg2.Mid(2) + wxT("\""), wxSPropertySeg2.Mid(0, 1)); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-GENDER;X-GENDERTEXT=\"") + wxSPropertySeg2.Mid(2) + wxT("\";") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2.Mid(0, 1)); } } else { if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-GENDER"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-GENDER;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } 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 NoYear = FALSE; int intPrevValue = 6; wxString strResults; intPrevValue = 5; // Look for type before continuing. if (wxSPropertySeg2.Mid(0, 2) == wxT("--")){ strResults.Append(wxT("1604-")); NoYear = TRUE; strResults.Append(wxSPropertySeg2.Mid(2, 2) + wxT("-")); strResults.Append(wxSPropertySeg2.Mid(4, 2)); } else { strResults.Append(wxSPropertySeg2.Mid(0, 4) + wxT("-")); strResults.Append(wxSPropertySeg2.Mid(4, 2) + wxT("-")); strResults.Append(wxSPropertySeg2.Mid(6, 2)); } if (NoYear == TRUE){ ContactDatav3.AddRaw(wxT("BDAY;X-APPLE-OMIT-YEAR=1604"), strResults); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-BDAY"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-BDAY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else { ContactDatav3.AddRaw(wxT("BDAY"), strResults); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-BDAY"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-BDAY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } 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; int intPrevValue = 13; wxString strResults; bool NoYear = FALSE; intPrevValue = 12; // Look for type before continuing. if (wxSPropertySeg2.Mid(0, 2) == wxT("--")){ strResults.Append(wxT("1604-")); NoYear = TRUE; strResults.Append(wxSPropertySeg2.Mid(2, 2) + wxT("-")); strResults.Append(wxSPropertySeg2.Mid(4, 2)); } else { strResults.Append(wxSPropertySeg2.Mid(0, 4) + wxT("-")); strResults.Append(wxSPropertySeg2.Mid(4, 2) + wxT("-")); strResults.Append(wxSPropertySeg2.Mid(6, 2)); } if (NoYear == TRUE){ ContactDatav3.AddRaw(wxT("ANNIVERSARY;X-APPLE-OMIT-YEAR=1604"), strResults); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-ANNIVERSARY"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-ANNIVERSARY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else { ContactDatav3.AddRaw(wxT("ANNIVERSARY"), strResults); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-ANNIVERSARY"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-ANNIVERSARY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } AnniversaryProcessed = TRUE; } else if (wxSProperty == wxT("TZ")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 4; intPrevValue = 3; // Look for type before continuing. if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-TZ"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-TZ;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("ADR")){ 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; int intPrevValue = 5; intPrevValue = 4; // TODO: Check in value for X-ABLabel and use it if it is there. if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".ADR"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("Address")); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-ADR"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".ADR"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("Address")); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-ADR;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } ItemSeek++; } else if (wxSProperty == wxT("EMAIL")){ // TODO: Continue from here! See ADR for good example (Replace initer with intPrevValue). // Remove inserted comma for Extra Tokens in frmContactEditor.cpp 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; int intPrevValue = 7; intPrevValue = 6; // TODO: Check in value for X-ABLabel and use it if it is there. if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".EMAIL"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("E-mail Address")); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-EMAIL"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".EMAIL"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("E-mail Address")); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-EMAIL;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } ItemSeek++; } else if (wxSProperty == wxT("IMPP")){ 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; int intPrevValue = 6; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); intPrevValue = 5; // TODO: Check in value for X-ABLabel and use it if it is there. if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".IMPP"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("Instant Message")); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-IMPP"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".IMPP"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("Instant Message")); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-IMPP;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } ItemSeek++; } else if (wxSProperty == wxT("TEL")){ // Check TEL and make sure it is functioning properly. 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; wxString TelTypeOut; wxString FinalFriendlyString; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 5; int intType = 0; int intSplitPoint = 0; intPrevValue = 4; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); // 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")){ if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Text")); } else { FinalFriendlyString.Append(_("Text")); } TelTypeOut.Append(wxT(";")); TelTypeOut.Append(wxT("type=TEXT")); } else if (TypePropertyName == wxT("voice")){ if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Voice")); } else { FinalFriendlyString.Append(_("Voice")); } TelTypeOut.Append(wxT(";")); TelTypeOut.Append(wxT("type=VOICE")); intTypeSeek++; } else if (TypePropertyName == wxT("fax")){ if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Fax")); } else { FinalFriendlyString.Append(_("Fax")); } TelTypeOut.Append(wxT(";")); TelTypeOut.Append(wxT("type=FAX")); intTypeSeek++; } else if (TypePropertyName == wxT("cell")){ if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Mobile")); } else { FinalFriendlyString.Append(_("Mobile")); } TelTypeOut.Append(wxT(";")); TelTypeOut.Append(wxT("type=CELL")); intTypeSeek++; } else if (TypePropertyName == wxT("video")){ if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Video")); } else { FinalFriendlyString.Append(_("Video")); } TelTypeOut.Append(wxT(";")); TelTypeOut.Append(wxT("type=VIDEO")); intTypeSeek++; } else if (TypePropertyName == wxT("pager")){ if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Pager")); } else { FinalFriendlyString.Append(_("Pager")); } TelTypeOut.Append(wxT(";")); TelTypeOut.Append(wxT("type=PAGER")); intTypeSeek++; } else if (TypePropertyName == wxT("textphone")){ //if (!TelTypeOut.IsEmpty()){ TelTypeOut.Append(wxT(";")); } if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Textphone")); } else { FinalFriendlyString.Append(_("Textphone")); } TelTypeOut.Append(wxT(";")); TelTypeOut.Append(wxT("type=TEXTPHONE")); intTypeSeek++; } } } } wxString FinalTel; // Remove 'tel:' if it is being used. if (wxSPropertySeg2.Mid(0, 4) == wxT("tel:")){ FinalTel = wxSPropertySeg2.Mid(4); } else { FinalTel = wxSPropertySeg2; } if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".TEL") + TelTypeOut, FinalTel); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), FinalFriendlyString); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-TEL"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".TEL") + TelTypeOut, FinalTel); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), FinalFriendlyString); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-TEL;") + wxSPropertySeg1.Mid(4), wxSPropertySeg2); } ItemSeek++; } else if (wxSProperty == wxT("LANG")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 6; intPrevValue = 5; if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-LANG"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-LANG;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("GEO")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString GeoType; wxString GeoData; int intPrevValue = 5; intPrevValue = 4; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); wxString strFinalGeoValue; wxString strFinalType; if (wxSPropertySeg2.Mid(0, 3) == wxT("geo")){ strFinalGeoValue = wxSPropertySeg2.Mid(5); strFinalType = wxT("geo"); } else { wxStringTokenizer wSTSplit(wxSPropertySeg2, wxT(":")); strFinalType = wSTSplit.GetNextToken(); strFinalGeoValue = wSTSplit.GetNextToken(); } if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-GEO;X-GEOTYPE=") + strFinalType, wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-GEO;X-GEOTYPE=") + strFinalType + wxT(";") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("RELATED")){ 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 intPrevValue = 9; intPrevValue = 8; SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue); wxString strDetail; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second - 1)); wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); if (PropertyName == wxT("TYPE") && FirstToken == TRUE){ if (PropertyValue == wxT("contact")){ strDetail = _("Contact"); } else if (PropertyValue == wxT("acquaintance")){ strDetail = _("Acquaintance"); } else if (PropertyValue == wxT("friend")){ strDetail = _("Friend"); } else if (PropertyValue == wxT("met")){ strDetail = _("Met"); } else if (PropertyValue == wxT("co-worker")){ strDetail = _("Co-worker"); } else if (PropertyValue == wxT("colleague")){ strDetail = _("Colleague"); } else if (PropertyValue == wxT("co-resident")){ strDetail = _("Co-resident"); } else if (PropertyValue == wxT("neighbor")){ strDetail = _("Neighbour"); } else if (PropertyValue == wxT("child")){ strDetail = _("Child"); } else if (PropertyValue == wxT("parent")){ strDetail = _("Parent"); } else if (PropertyValue == wxT("sibling")){ strDetail = _("Sibling"); } else if (PropertyValue == wxT("spouse")){ strDetail = _("Spouse"); } else if (PropertyValue == wxT("kin")){ strDetail = _("Kin"); } else if (PropertyValue == wxT("muse")){ strDetail = _("Muse"); } else if (PropertyValue == wxT("crush")){ strDetail = _("Crush"); } else if (PropertyValue == wxT("date")){ strDetail = _("Date"); } else if (PropertyValue == wxT("sweetheart")){ strDetail = _("Sweetheart"); } else if (PropertyValue == wxT("me")){ strDetail = _("Me"); } else if (PropertyValue == wxT("agent")){ strDetail = _("Agent"); } else if (PropertyValue == wxT("emergency")){ strDetail = _("Emergency"); } else { strDetail = PropertyValue; } FirstToken = FALSE; } } if (strDetail.IsEmpty()){ strDetail = _("Relation"); } if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABRELATEDNAMES"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), strDetail); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-RELATED"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABRELATEDNAMES"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), strDetail); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-RELATED;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } ItemSeek++; } else if (wxSProperty == wxT("URL")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 5; intPrevValue = 4; // Todo: Check for X-ABLabel. if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".URL"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("URL")); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-URL"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".URL"), wxSPropertySeg2); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("URL")); ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-URL;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } ItemSeek++; } else if (wxSProperty == wxT("TITLE")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 7; intPrevValue = 6; // Look for type before continuing. if (TitleFirst == FALSE){ ContactDatav3.AddRaw(wxT("TITLE"), wxSPropertySeg2); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ } else { ContactDatav3.AddRaw(wxT("X-VCARD4-TITLE;X-FIRST=TRUE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT("")); } TitleFirst = TRUE; ItemSeek++; } else { if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-TITLE"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-TITLE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"), wxSPropertySeg2); } } } else if (wxSProperty == wxT("ROLE")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 6; intPrevValue = 5; if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-ROLE"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-ROLE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("ORG")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 5; intPrevValue = 4; if (OrganisationFirst == FALSE){ ContactDatav3.AddRaw(wxT("ORG"), wxSPropertySeg2); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ } else { ContactDatav3.AddRaw(wxT("X-VCARD4-ORG;X-FIRST=TRUE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT("")); } OrganisationFirst = TRUE; ItemSeek++; } else { if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-ORG"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-ORG;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"), wxSPropertySeg2); } } } else if (wxSProperty == wxT("NOTE")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 6; intPrevValue = 5; if (NoteFirst == FALSE){ ContactDatav3.AddRaw(wxT("NOTE"), wxSPropertySeg2); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ } else { ContactDatav3.AddRaw(wxT("X-VCARD4-NOTE;X-FIRST=TRUE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT("")); } NoteFirst = TRUE; ItemSeek++; } else { if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-NOTE"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-NOTE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"), wxSPropertySeg2); } } } else if (wxSProperty == wxT("CATEGORIES")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyType; int intPrevValue = 12; intPrevValue = 11; if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-CATEGORIES"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-CATEGORIES;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } 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; int intSplitsFound = 0; int intSplitSize = 0; int intPrevValue = 7; intPropertyLen = wxSPropertySeg2.Len(); SplitPoints.clear(); SplitLength.clear(); intSplitsFound = 0; intSplitSize = 0; CaptureString(&wxSPropertySeg2, FALSE); 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; } } if (PhotoFirst == FALSE){ bool PhotoKeepData = FALSE; wxString wxSPhotoMIMEF; if (wxSPhotoMIME == wxT("image/png")){ wxSPhotoMIMEF = wxT("PNG"); } else if (wxSPhotoMIME == wxT("image/jpeg")){ wxSPhotoMIMEF = wxT("JPEG"); } else if (wxSPhotoMIME == wxT("image/gif")){ wxSPhotoMIMEF = wxT("GIF"); } else if (wxSPhotoMIME == wxT("image/bmp")){ wxSPhotoMIMEF = wxT("BMP"); } else { wxSPhotoMIMEF = wxT("UNKNOWN"); PhotoKeepData = TRUE; } ContactDatav3.AddRaw(wxT("PHOTO;ENCODING=b;TYPE=") + wxSPhotoMIMEF, wxSPhotoData); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ } else { if (PhotoKeepData == TRUE){ ContactDatav3.AddRaw(wxT("X-VCARD4-PHOTO;X-FIRST=TRUE;") + ContactLine.Mid((intPrevValue - 1), ((QuoteBreakPoint + 1) - (intPrevValue))), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-PHOTO;X-FIRST=TRUE;") + ContactLine.Mid((intPrevValue - 1), ((QuoteBreakPoint + 1) - (intPrevValue))), wxT("")); } } PhotoFirst = TRUE; ItemSeek++; } else { if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-PHOTO"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-PHOTO;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"), wxSPropertySeg2); } } } else if (wxSProperty == wxT("LOGO")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 6; intPrevValue = 5; if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-LOGO"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-LOGO;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("SOUND")) { std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 7; intPrevValue = 6; if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-SOUND"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-SOUND;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("CALURI")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 8; intPrevValue = 7; if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-CALURI"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-CALURI;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("CALADRURI")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 11; intPrevValue = 10; if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-CALADRURI"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-CALADRURI;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("FBURL")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 7; intPrevValue = 6; if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-FBURL"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-FBURL;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("KEY")){ std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 5; intPrevValue = 4; if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-KEY"), wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-KEY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty == wxT("UID")){ ContactDatav3.AddRaw(wxT("UID"), wxSPropertySeg2); } else if (wxSProperty.Mid(0, 3) == wxT("VND")){ // Split the Vendor three ways. wxStringTokenizer wSTVendorDetails(wxSPropertySeg1, wxT("-")); wxString wxSVNDID; wxString wxSVNDPropName; size_t intPrevValue = (wxSProperty.Len() + 1); while (wSTVendorDetails.HasMoreTokens() == TRUE){ wSTVendorDetails.GetNextToken(); wxSVNDID = wSTVendorDetails.GetNextToken(); wxSVNDPropName = wSTVendorDetails.GetNextToken(); break; } if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxT("X-VCARD4-") + wxSProperty, wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxT("X-VCARD4-") + wxSProperty + wxT(";") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } else if (wxSProperty.Mid(0, 2) == wxT("X-")){ size_t intPrevValue = (wxSProperty.Len() + 1); if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){ ContactDatav3.AddRaw(wxSProperty, wxSPropertySeg2); } else { ContactDatav3.AddRaw(wxSProperty + wxT(";") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2); } } // Reset the variables. QuoteMode = FALSE; PropertyFind = TRUE; ExtraLineSeek = TRUE; ContactLineLen = 0; QuoteBreakPoint = 0; ContactLine.Clear(); wxSProperty.Clear(); } ContactDatav3.AddRaw(wxT("END"), wxT("VCARD")); *wxSData = ContactDatav3.WriteString(); return TRUE; } bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ std::map ContactFileLines; std::map ContactFileProcessed; std::map ContactFileProcessedWorking; std::map::iterator striter; std::map::iterator iterbool; std::map::iterator iterboolsub; wxString ContactLineRec; // Process the received data. wxStringTokenizer wSTContactFileLines(*wxSData, wxT("\r\n")); int ContactLineSeek = 0; while (wSTContactFileLines.HasMoreTokens() == TRUE){ ContactLineRec = wSTContactFileLines.GetNextToken(); ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLineRec)); ContactFileProcessed.insert(std::make_pair(ContactLineSeek, FALSE)); ContactLineSeek++; } bool QuoteMode = FALSE; bool PropertyFind = TRUE; bool ExtraLineSeek = TRUE; bool ExtraLineSeekSub = TRUE; bool BirthdayProcessed = FALSE; bool AnniversaryProcessed = FALSE; bool FNProcessed = FALSE; bool GenderProcessed = FALSE; bool NameProcessed = FALSE; bool FNFirst = FALSE; bool NicknameFirst = FALSE; bool TitleFirst = FALSE; bool OrganisationFirst = FALSE; bool NoteFirst = FALSE; bool PhotoFirst = FALSE; bool LogoFirst = FALSE; bool NameFirst = FALSE; bool FoundData = FALSE; int intExtraNickname = 0; wxString wxSProperty; wxString wxSPropertyVCARD4; wxString wxSPropertySeg1; wxString wxSPropertySeg2; wxString wxSPropertyNextLine; wxString ContactLine; wxString ContactLineSub; wxString PropertyName; wxString PropertyValue; wxString PropertyDataStr; size_t ContactLineLen = 0; size_t ContactLineSubLen = 0; int QuoteBreakPoint = 0; size_t intPrevValueSub = 0; std::map PropertyData; std::map PropertyLock; std::map TempPropertyData; std::map TempPropertyLock; std::map TempSplitPoints; std::map TempSplitLength; std::map::iterator SLiter; wxString PropertFindSub; wxString wxSPropertySub; wxString wxSPropertySeg1Sub; wxString wxSPropertySeg2Sub; wxString wxSPropertyValues; wxString wxSPropertyData; wxString wxSPropertyNameConv; wxString wxSPropertyXVCard4Value; wxString ItemProcString; bool XVCard4Value = FALSE; bool VCard3Value = FALSE; bool SeekItemData = FALSE; wxString strVer; // Setup the version string. strVer.Append(wxT("-//Xestia//Address Book Version ")); strVer.Append(wxT(XSDAB_VERSION)); strVer.Append(wxT("//KW")); vCardOut->AddRaw(wxT("BEGIN"), wxT("VCARD")); vCardOut->AddRaw(wxT("VERSION"), wxT("4.0")); vCardOut->AddRaw(wxT("PRODID"), strVer); // FN // NICKNAME // TITLE // ORG // NOTE // PHOTO // Process the properties which have X-FIRST. // Clone the ContactFileProcessed into ContactFileProcessedWorking. ContactFileProcessedWorking.insert(ContactFileProcessed.begin(), ContactFileProcessed.end()); for (std::map::iterator iter = ContactFileLines.begin(); iter != ContactFileLines.end(); ++iter){ ExtraLineSeek = TRUE; iterbool = ContactFileProcessed.find(iter->first); ContactLine = iter->second; // Ignore certain variables as they are not needed. if (ContactLine == wxT("BEGIN:VCARD") || ContactLine == wxT("END:VCARD") || ContactLine.Mid(0, 8) == wxT("VERSION:") || ContactLine.Mid(0, 7) == wxT("PRODID:") || ContactLine.Mid(0, 5) == wxT("X-AIM") || ContactLine.Mid(0, 5) == wxT("X-MSN") || ContactLine.Mid(0, 5) == wxT("X-ICQ") || ContactLine.Mid(0, 10) == wxT("X-GADUGADU") || ContactLine.Mid(0, 7) == wxT("X-YAHOO") || ContactLine.Mid(0, 7) == wxT("X-SKYPE") || ContactLine.Mid(0, 8) == wxT("X-JABBER") || ContactLine.Mid(0, 4) == wxT("REV:")){ iterbool->second = TRUE; continue; } if (iterbool->second == TRUE){ continue; } if (ContactLine.Mid(0, 1) == wxT(" ") || ContactLine.Mid(0, 1) == wxT("\t")){ continue; } if (ContactLine.Mid(0, 4) == wxT("item")){ // Line is a itemn... so ignore. continue; } std::map DataLineProcess; std::map::iterator DLSLiter; std::map DataLineProcessOriginal; int DataLineSeek = 0; int DataLineSeekOrig = 0; std::map::iterator itersub = iter; DataLineProcessOriginal.insert(std::make_pair(DataLineSeekOrig, iterbool->first)); DataLineSeekOrig++; while (ExtraLineSeek == TRUE){ // Check if there is extra data on the next line // (indicated by space or tab at the start) and add data. itersub++; if (itersub == ContactFileLines.end()){ break; } iterboolsub = ContactFileProcessed.find(itersub->first); if (iterboolsub == ContactFileProcessed.end()){ break; } if (iterboolsub->second == TRUE){ continue; } wxSPropertyNextLine = itersub->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); DataLineProcessOriginal.insert(std::make_pair(DataLineSeekOrig, iterboolsub->first)); DataLineSeekOrig++; //iterboolsub->second = TRUE; } else { ExtraLineSeek = FALSE; } } ContactLineLen = ContactLine.Len(); 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; } } wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint); wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1)); wxStringTokenizer wxSPropertySegSplit(wxSPropertySeg1, wxT(";")); wxSProperty = wxSPropertySegSplit.GetNextToken(); // Check what type of property it is. FoundData = FALSE; if ((wxSProperty == wxT("PHOTO") && PhotoFirst == FALSE) || (wxSProperty == wxT("NICKNAME") && NicknameFirst == FALSE) || (wxSProperty == wxT("TITLE") && TitleFirst == FALSE) || (wxSProperty == wxT("FN") && FNFirst == FALSE) || (wxSProperty == wxT("ORG") && OrganisationFirst == FALSE) || (wxSProperty == wxT("NOTE") && NoteFirst == FALSE)){ wxSPropertyVCARD4 = wxT("X-VCARD4-") + wxSProperty; intPrevValueSub = (wxSPropertyVCARD4.Len() + 2); for (std::map::iterator itersub = ContactFileLines.begin(); itersub != ContactFileLines.end(); ++itersub){ //DataLineProcess = DataLineProcessOriginal; //DataLineSeek = DataLineSeekOrig; ContactLineSub = itersub->second; ExtraLineSeekSub = TRUE; iterboolsub = ContactFileProcessed.find(itersub->first); //std::map::iterator iterorig = ContactFileProcessed.find(itersub->first); //std::map::iterator itersuborig; // Ignore certain variables as they are not needed. if (ContactLineSub == wxT("BEGIN:VCARD") || ContactLineSub == wxT("END:VCARD") || ContactLineSub.Mid(0, 8) == wxT("VERSION:") || ContactLineSub.Mid(0, 7) == wxT("PRODID:") || ContactLineSub.Mid(0, 5) == wxT("X-AIM") || ContactLineSub.Mid(0, 5) == wxT("X-MSN") || ContactLineSub.Mid(0, 5) == wxT("X-ICQ") || ContactLineSub.Mid(0, 10) == wxT("X-GADUGADU") || ContactLineSub.Mid(0, 7) == wxT("X-YAHOO") || ContactLineSub.Mid(0, 7) == wxT("X-SKYPE") || ContactLineSub.Mid(0, 8) == wxT("X-JABBER") || ContactLineSub.Mid(0, 4) == wxT("REV:")){ iterboolsub->second = TRUE; continue; } if (iterboolsub->second == TRUE){ continue; } if (ContactLineSub.Mid(0, 1) == wxT(" ") || ContactLineSub.Mid(0, 1) == wxT("\t")){ continue; } if (ContactLineSub.Mid(0, 4) == wxT("item")){ // Line is a itemn... so ignore. continue; } //std::map::iterator itersub = iter; DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first)); DataLineSeek++; while (ExtraLineSeekSub == TRUE){ if (itersub == ContactFileLines.end()){ ExtraLineSeekSub = FALSE; continue; } else { itersub++; } iterboolsub = ContactFileProcessedWorking.find(itersub->first); wxSPropertyNextLine = itersub->second; if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){ wxSPropertyNextLine.Remove(0, 1); //wxSPropertyNextLine.Trim(FALSE); //ContactLine.Trim(); ContactLineSub.Append(wxSPropertyNextLine); //iterboolsub->second = TRUE; DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first)); DataLineSeek++; } else { itersub--; ExtraLineSeekSub = FALSE; } } /*while (ExtraLineSeekSub == TRUE && iterboolsub != ContactFileProcessedWorking.end()){ // Check if there is extra data on the next line // (indicated by space or tab at the start) and add data. itersub++; iterboolsub = ContactFileProcessedWorking.find(itersub->first); if (iterboolsub->second == TRUE){ continue; } if (itersub == ContactFileLines.end()){ break; } wxSPropertyNextLine = itersub->second; if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){ wxSPropertyNextLine.Remove(0, 1); //wxSPropertyNextLine.Trim(FALSE); //ContactLine.Trim(); ContactLineSub.Append(wxSPropertyNextLine); //iterboolsub->second = TRUE; DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first)); DataLineSeek++; } else { itersub--; ExtraLineSeekSub = FALSE; } if (iterboolsub == ContactFileProcessedWorking.end()){ break; ExtraLineSeekSub = FALSE; } }*/ ContactLineSubLen = ContactLineSub.Len(); PropertyFind = TRUE; wxSPropertySub.clear(); for (int i = 0; i <= ContactLineSubLen; i++){ if ((ContactLineSub.Mid(i, 1) == wxT(";") || ContactLineSub.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){ PropertyFind = FALSE; } else if (PropertyFind == TRUE){ wxSPropertySub.Append(ContactLineSub.Mid(i, 1)); } if (ContactLineSub.Mid(i, 1) == wxT("\"")){ if (QuoteMode == TRUE){ QuoteMode = FALSE; } else { QuoteMode = TRUE; } } if (ContactLineSub.Mid(i, 1) == wxT(":") && ContactLineSub.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){ QuoteBreakPoint = i; break; } } if (wxSPropertySub != wxSPropertyVCARD4){ wxSPropertySub.clear(); DataLineSeek = 0; DataLineProcess.clear(); continue; } wxSPropertySeg1Sub = ContactLineSub.Mid(0, QuoteBreakPoint); wxSPropertySeg2Sub = ContactLineSub.Mid((QuoteBreakPoint + 1)); // Split the property name data. // Strip the X-VCARD4- from the variable. wxString wxSPropertyChopped = wxSPropertySeg1Sub.Mid(9); intPrevValueSub = (wxSProperty.Len() + 2); SplitValuesData(&wxSPropertyChopped, &TempSplitPoints, &TempSplitLength, (int)intPrevValueSub, &TempPropertyData); // Process the splitted data into temporary property data. // Look for certain property names and the X-FIRST // property name. bool ProcessData = FALSE; // Check for X-FIRST. for (std::map::iterator xfiter = TempPropertyData.begin(); xfiter != TempPropertyData.end(); ++xfiter){ PropertyName = xfiter->first; PropertyValue = xfiter->second; if (PropertyName == wxT("X-FIRST") && PropertyValue == wxT("TRUE")){ ProcessData = TRUE; if (wxSProperty == wxT("PHOTO")){ PhotoFirst = TRUE; } else if (wxSProperty == wxT("NICKNAME")){ NicknameFirst = TRUE; } else if (wxSProperty == wxT("TITLE")){ TitleFirst = TRUE; } else if (wxSProperty == wxT("FN")){ FNFirst = TRUE; } else if (wxSProperty == wxT("ORG")){ OrganisationFirst = TRUE; } else if (wxSProperty == wxT("NOTE")){ NoteFirst = TRUE; } break; } } if (ProcessData == FALSE){ DataLineProcess.clear(); DataLineSeek = 0; TempPropertyData.clear(); } else { wxT("PHOTODANCEMATCH!"); for (std::map::iterator xfiter = TempPropertyData.begin(); xfiter != TempPropertyData.end(); ++xfiter){ PropertyName = xfiter->first; PropertyValue = xfiter->second; if (PropertyName == wxT("X-FIRST")){ continue; } PropertyData.insert(std::make_pair(PropertyName, PropertyValue)); PropertyLock.insert(std::make_pair(PropertyName, FALSE)); } // Mark all lines as processed. for (std::map::iterator dpiter = DataLineProcess.begin(); dpiter != DataLineProcess.end(); ++dpiter){ DLSLiter = ContactFileProcessed.find(dpiter->second); DLSLiter->second = TRUE; } for (std::map::iterator dpoiter = DataLineProcessOriginal.begin(); dpoiter != DataLineProcessOriginal.end(); ++dpoiter){ DLSLiter = ContactFileProcessed.find(dpoiter->second); DLSLiter->second = TRUE; } DataLineProcess.clear(); DataLineProcessOriginal.clear(); DataLineSeek = 0; DataLineSeekOrig = 0; TempSplitPoints.clear(); TempSplitLength.clear(); TempPropertyData.clear(); FoundData = TRUE; break; } } } else { wxSProperty.clear(); wxSPropertySub.Clear(); wxSPropertySeg1.Clear(); wxSPropertySeg2.Clear(); wxSPropertySeg1Sub.Clear(); wxSPropertySeg2Sub.Clear(); wxSPropertyValues.Clear(); wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); ContactLineSub.clear(); DataLineProcess.clear(); DataLineProcessOriginal.clear(); TempSplitPoints.clear(); TempSplitLength.clear(); wxSPropertyVCARD4.clear(); DataLineSeek = 0; DataLineSeekOrig = 0; XVCard4Value = FALSE; VCard3Value = FALSE; } if (FoundData == FALSE){ wxSProperty.clear(); wxSPropertySub.Clear(); wxSPropertySeg1.Clear(); wxSPropertySeg2.Clear(); wxSPropertySeg1Sub.Clear(); wxSPropertySeg2Sub.Clear(); wxSPropertyValues.Clear(); wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); ContactLineSub.clear(); DataLineProcess.clear(); DataLineProcessOriginal.clear(); TempSplitPoints.clear(); TempSplitLength.clear(); wxSPropertyVCARD4.clear(); DataLineSeek = 0; DataLineSeekOrig = 0; XVCard4Value = FALSE; VCard3Value = FALSE; } ConvertV4PropertyProc(&wxSProperty, &wxSPropertySeg1, &wxSPropertySeg2, &wxSPropertyValues, &wxSPropertyData, &wxSPropertyXVCard4Value, &wxSPropertyNameConv, &PropertyData, &PropertyLock, FALSE, &VCard3Value, &XVCard4Value); wxString FinalPropertyData; FinalPropertyData.Append(wxSPropertyNameConv); for (std::map::iterator striter = PropertyData.begin(); striter != PropertyData.end(); ++striter){ FinalPropertyData.Append(wxT(";")); FinalPropertyData.Append(striter->first); FinalPropertyData.Append(wxT("=")); FinalPropertyData.Append(striter->second); } wxString FinalPropValue; if (wxSPropertyXVCard4Value.IsEmpty()){ FinalPropValue = wxSPropertyData; } else { if (wxSPropertyXVCard4Value != wxSPropertyData){ FinalPropValue = wxSPropertyXVCard4Value; } } if (FinalPropertyData.IsEmpty() && FinalPropValue.IsEmpty()){ continue; } vCardOut->AddRaw(FinalPropertyData, FinalPropValue); wxSProperty.clear(); wxSPropertySub.Clear(); wxSPropertySeg1.Clear(); wxSPropertySeg2.Clear(); wxSPropertySeg1Sub.Clear(); wxSPropertySeg2Sub.Clear(); wxSPropertyValues.Clear(); wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); //FinalPropertyData.clear(); //FinalPropValue.clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); ContactLineSub.clear(); DataLineProcess.clear(); DataLineProcessOriginal.clear(); wxSPropertyVCARD4.clear(); DataLineSeek = 0; DataLineSeekOrig = 0; XVCard4Value = FALSE; VCard3Value = FALSE; } // Process the non-itemn values. for (std::map::iterator iter = ContactFileLines.begin(); iter != ContactFileLines.end(); ++iter){ ExtraLineSeek = TRUE; iterbool = ContactFileProcessed.find(iter->first); ContactLine = iter->second; // Ignore certain variables as they are not needed. if (ContactLine == wxT("BEGIN:VCARD") || ContactLine == wxT("END:VCARD") || ContactLine.Mid(0, 8) == wxT("VERSION:") || ContactLine.Mid(0, 7) == wxT("PRODID:") || ContactLine.Mid(0, 5) == wxT("X-AIM") || ContactLine.Mid(0, 5) == wxT("X-MSN") || ContactLine.Mid(0, 5) == wxT("X-ICQ") || ContactLine.Mid(0, 10) == wxT("X-GADUGADU") || ContactLine.Mid(0, 7) == wxT("X-YAHOO") || ContactLine.Mid(0, 7) == wxT("X-SKYPE") || ContactLine.Mid(0, 8) == wxT("X-JABBER") || ContactLine.Mid(0, 4) == wxT("REV:")){ iterbool->second = TRUE; continue; } if (iterbool->second == TRUE){ continue; } if (ContactLine.Mid(0, 1) == wxT(" ") || ContactLine.Mid(0, 1) == wxT("\t")){ continue; } if (ContactLine.Mid(0, 4) == wxT("item")){ // Line is a itemn... so ignore. continue; } std::map::iterator itersub = iter; while (ExtraLineSeek == TRUE){ // Check if there is extra data on the next line // (indicated by space or tab at the start) and add data. if (itersub == ContactFileLines.end()){ ExtraLineSeekSub = FALSE; continue; } else { itersub++; } iterboolsub = ContactFileProcessedWorking.find(itersub->first); if (iterboolsub == ContactFileProcessedWorking.end()){ break; } if (iterboolsub->second == TRUE){ continue; } if (itersub == ContactFileLines.end()){ break; } wxSPropertyNextLine = itersub->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); iterboolsub->second = TRUE; } else { ExtraLineSeek = FALSE; } } ContactLineLen = ContactLine.Len(); 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; } } wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint); wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1)); wxStringTokenizer wxSPropertySegSplit(wxSPropertySeg1, wxT(";")); wxSProperty = wxSPropertySegSplit.GetNextToken(); std::map DataLineProcess; std::map::iterator DLSLiter; // Look for the X-VCARD4-(variablename) equivilant. wxSPropertyVCARD4 = wxT("X-VCARD4-") + wxSProperty; // Sort out remainder of the types. ConvertV4PropertyProc(&wxSProperty, &wxSPropertySeg1, &wxSPropertySeg2, &wxSPropertyValues, &wxSPropertyData, &wxSPropertyXVCard4Value, &wxSPropertyNameConv, &PropertyData, &PropertyLock, FALSE, &VCard3Value, &XVCard4Value); wxString FinalPropertyData; FinalPropertyData.Append(wxSPropertyNameConv); for (std::map::iterator striter = PropertyData.begin(); striter != PropertyData.end(); ++striter){ FinalPropertyData.Append(wxT(";")); FinalPropertyData.Append(striter->first); FinalPropertyData.Append(wxT("=")); FinalPropertyData.Append(striter->second); } wxString FinalPropValue; if (wxSPropertyXVCard4Value.IsEmpty()){ FinalPropValue = wxSPropertyData; } else { if (wxSPropertyXVCard4Value != wxSPropertyData){ FinalPropValue = wxSPropertyXVCard4Value; } } vCardOut->AddRaw(FinalPropertyData, FinalPropValue); wxSProperty.clear(); wxSPropertySub.Clear(); wxSPropertySeg1.Clear(); wxSPropertySeg2.Clear(); wxSPropertyValues.Clear(); wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); //FinalPropertyData.clear(); //FinalPropValue.clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); XVCard4Value = FALSE; VCard3Value = FALSE; } 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 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 ItemSeek = 1; int MaxItemNumber = 0; int ItemOrdered = 0; int ItemUnordered = 0; int ItemNumber = 0; size_t ItemStringSeekLen = 0; int ItemSeekSub = 0; int ItemSeekSecSub = 0; //int intValueSeek = 1; std::map NumberedName; std::map NumberedData; std::map NumberedPropValues; std::map NumberedPropOldValue; std::map UnNumberedName; std::map UnNumberedData; std::map UnNumberedPropValues; std::map UnNumberedPropOldValue; // Part 1: Get the itemn number. std::map::iterator iterboolsecsub; std::map::iterator itersub; std::map TempData; PropertyData.clear(); PropertyLock.clear(); wxString ItemString; wxString ItemStringSeek; wxString ItemPropName; ContactLineSeek = 0; ContactLineSub.clear(); ExtraLineSeekSub = 0; wxString wxSPropertyNextLineSub; ContactLineSubLen = 0; int ItemIndex = 0; PropertFindSub.clear(); wxSPropertySub.clear(); wxSPropertySeg1Sub.clear(); wxSPropertySeg2Sub.clear(); wxSPropertyValues.clear(); wxSPropertyData.clear(); wxSPropertyNameConv.clear(); wxSPropertyXVCard4Value.clear(); ItemProcString.clear(); XVCard4Value = FALSE; VCard3Value = FALSE; SeekItemData = FALSE; std::map ItemMapIndex; //std::map ItemNameIndex; // Look for item in the initial line, process into a proper line then // look for other lines with the same item association. for (std::map::iterator iter = ContactFileLines.begin(); iter != ContactFileLines.end(); ++iter){ ExtraLineSeek = TRUE; iterbool = ContactFileProcessed.find(iter->first); if (iterbool->second == TRUE){ continue; } ContactLine = iter->second; if (ContactLine.Mid(0, 1) == wxT(" ") || ContactLine.Mid(0, 1) == wxT("\t")){ continue; } if (ContactLine.Mid(0, 4) != wxT("item")){ continue; } // Get Item data. //ContactLineSeekSub = ContactLineSeek; std::map::iterator itersub = iter; while (ExtraLineSeek == TRUE){ // Check if there is extra data on the next line // (indicated by space or tab at the start) and add data. itersub++; iterboolsub = ContactFileProcessed.find(itersub->first); if (iterboolsub == ContactFileProcessed.end()){ break; } if (iterboolsub->second == TRUE){ continue; } if (itersub == ContactFileLines.end()){ break; } wxSPropertyNextLine = itersub->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); iterboolsub->second = TRUE; } else { ExtraLineSeek = FALSE; } } ContactLineLen = ContactLine.Len(); 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; } } wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint); wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1)); // Go through the lines and collect the lines like itemn. std::map *ItemListData; ItemListData = new std::map; wxStringTokenizer ItemData(wxSPropertySeg1, wxT(".")); ItemString = ItemData.GetNextToken(); ItemStringSeek = wxT("item") + ItemString.Mid(4); wxStringTokenizer ItemPropSplit(ItemData.GetNextToken(), wxT(";")); ItemPropName = ItemPropSplit.GetNextToken(); ItemStringSeekLen = ItemStringSeek.Len(); ItemIndex = 0; for (std::map::iterator itersec = ContactFileLines.begin(); itersec != ContactFileLines.end(); ++itersec){ ExtraLineSeek = TRUE; iterboolsub = ContactFileProcessed.find(itersec->first); if (iterboolsub->second == TRUE){ continue; } ContactLineSub = itersec->second; wxStringTokenizer ItemProcData(ContactLineSub, wxT(".")); ItemProcString = ItemData.GetNextToken(); if (ItemStringSeek != ContactLineSub.Mid(0, ItemStringSeekLen)){ continue; } ItemIndex++; ItemListData->insert(std::make_pair(ItemIndex, ContactLineSub)); iterboolsub->second = TRUE; } //ItemNameIndex.insert(std::make_pair(ItemStringSeek, ItemPropName)); ItemListData->insert(std::make_pair(ItemIndex, ContactLineSub)); ItemMapIndex.insert(std::make_pair(ItemStringSeek, ItemListData)); } // Process each itemn set. for (std::map::iterator iter = ItemMapIndex.begin(); iter != ItemMapIndex.end(); ++iter){ std::map *ItemDataPtr; ItemDataPtr = (std::map*)iter->second; for (std::map::iterator itersub = ItemDataPtr->begin(); itersub != ItemDataPtr->end(); ++itersub){ ContactLine = itersub->second; ContactLineLen = ContactLine.Len(); 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; } } wxSPropertySeg1Sub = ContactLine.Mid(0, QuoteBreakPoint); wxSPropertySeg2Sub = ContactLine.Mid((QuoteBreakPoint + 1)); wxStringTokenizer wxSPropertySegSplit(wxSPropertySeg1Sub, wxT(";")); wxSProperty = wxSPropertySegSplit.GetNextToken(); // Sort out remainder of the types. // Skip certain X-* IM variables as they are processed via // IMPP. if (wxSProperty == wxT("X-AIM") || wxSProperty == wxT("X-MSN") || wxSProperty == wxT("X-ICQ") || wxSProperty == wxT("X-GADUGADU") || wxSProperty == wxT("X-YAHOO") || wxSProperty == wxT("X-SKYPE") || wxSProperty == wxT("X-JABBER")){ wxSProperty.clear(); wxSPropertySub.Clear(); wxSPropertySeg1.Clear(); wxSPropertySeg2.Clear(); wxSPropertyValues.Clear(); wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); //FinalPropertyData.clear(); //FinalPropValue.clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); XVCard4Value = FALSE; VCard3Value = FALSE; continue; } ConvertV4PropertyProc(&wxSProperty, &wxSPropertySeg1Sub, &wxSPropertySeg2Sub, &wxSPropertyValues, &wxSPropertyData, &wxSPropertyXVCard4Value, &wxSPropertyNameConv, &PropertyData, &PropertyLock, TRUE, &VCard3Value, &XVCard4Value); } if (wxSPropertyNameConv.IsEmpty()){ wxSProperty.clear(); wxSPropertySub.Clear(); wxSPropertySeg1.Clear(); wxSPropertySeg2.Clear(); wxSPropertyValues.Clear(); wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); //FinalPropertyData.clear(); //FinalPropValue.clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); XVCard4Value = FALSE; VCard3Value = FALSE; continue; } wxString FinalPropertyData; FinalPropertyData.Append(wxSPropertyNameConv); for (std::map::iterator striter = PropertyData.begin(); striter != PropertyData.end(); ++striter){ FinalPropertyData.Append(wxT(";")); FinalPropertyData.Append(striter->first); FinalPropertyData.Append(wxT("=")); FinalPropertyData.Append(striter->second); } wxString FinalPropValue; if (wxSPropertyXVCard4Value.IsEmpty()){ FinalPropValue = wxSPropertyData; } else { if (wxSPropertyXVCard4Value != wxSPropertyData){ FinalPropValue = wxSPropertyData; } else { FinalPropValue = wxSPropertyXVCard4Value; } } vCardOut->AddRaw(FinalPropertyData, FinalPropValue); wxSProperty.clear(); wxSPropertySub.Clear(); wxSPropertySeg1Sub.Clear(); wxSPropertySeg2Sub.Clear(); wxSPropertyValues.Clear(); wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); FinalPropertyData.clear(); FinalPropValue.clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); XVCard4Value = FALSE; VCard3Value = FALSE; TempData.clear(); //PropertyData.clear(); //PropertyLock.clear(); } // Delete data. std::map *ItemEraseData; for (std::map::iterator iter = ItemMapIndex.begin(); iter != ItemMapIndex.end(); ++iter){ ItemEraseData = (std::map*)iter->second; delete ItemEraseData; ItemEraseData = NULL; } ItemMapIndex.clear(); vCardOut->AddRaw(wxT("END"), wxT("VCARD")); return TRUE; } void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString *wxSPropertySeg1Ptr, wxString *wxSPropertySeg2Ptr, wxString *wxSPropertyPropValuesOut, wxString *wxSPropertyDataOut, wxString *wxSPropertyXVCard4Value, wxString *wxSPropertyDataNameOut, std::map *PropertyDataMap, std::map *PropertyLockMap, bool ProcessItemData, bool *VCardV3Value, bool *XVCardV4Value){ wxString wxSProperty; wxString wxSPropertySeg1Chopped; size_t intPropertyLen; if (ProcessItemData == TRUE){ wxStringTokenizer wxSPropertySplit(*wxSPropertyName, wxT(".")); wxSPropertySplit.GetNextToken(); wxSProperty = wxSPropertySplit.GetNextToken(); // Look for . in wxSPropertySeg1Ptr and remove all data before // the . int ItemSeek = wxSPropertySeg1Ptr->Find(wxT(".")); wxSPropertySeg1Chopped = wxSPropertySeg1Ptr->Mid((ItemSeek + 1)); } else { wxSProperty = *wxSPropertyName; } // Go through each of the vCard 3.0 properties. // EMAIL if (wxSProperty == wxT("EMAIL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 7; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("EMAIL"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("INTERNET")){ continue; } if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ if (ProcessItemData == FALSE){ PropertyName = wxT("PREF"); PropertyValue = wxT("50"); } else { continue; } } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // ADR if (wxSProperty == wxT("ADR")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ADR"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ if (ProcessItemData == FALSE){ PropertyName = wxT("PREF"); PropertyValue = wxT("50"); } else { continue; } } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // LABEL if (wxSProperty == wxT("LABEL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 7; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ADR"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } PropertyDataMap->insert(std::make_pair(wxT("X-LABEL"), wxT("TRUE"))); } // IMPP if (wxSProperty == wxT("IMPP")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 6; wxStringTokenizer IMPPSplit(*wxSPropertySeg2Ptr, wxT(":")); wxString IMPPType; wxString IMPPData; IMPPType = IMPPSplit.GetNextToken(); if (IMPPSplit.HasMoreTokens()){ IMPPData = IMPPSplit.GetNextToken(); if (IMPPType == wxT("ymsgr")){ IMPPType = wxT("yahoo"); } *wxSPropertySeg2Ptr = IMPPType + wxT(":") + IMPPData; } wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("IMPP"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } if (PropertyName == wxT("X-SERVICE-TYPE")){ continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // TEL if (wxSProperty == wxT("TEL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map TelType; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(wxT("tel:")); wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("TEL"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ TelType.insert(std::make_pair(wxT("home"), wxT("home"))); continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ TelType.insert(std::make_pair(wxT("work"), wxT("work"))); continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process the telephone type options. // text if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXT") || PropertyValue == wxT("text"))){ TelType.insert(std::make_pair(wxT("text"), wxT("text"))); continue; } // voice if (PropertyName == wxT("type") && (PropertyValue == wxT("VOICE") || PropertyValue == wxT("voice"))){ TelType.insert(std::make_pair(wxT("voice"), wxT("voice"))); continue; } // fax if (PropertyName == wxT("type") && (PropertyValue == wxT("FAX") || PropertyValue == wxT("fax"))){ TelType.insert(std::make_pair(wxT("fax"), wxT("fax"))); continue; } // cell if (PropertyName == wxT("type") && (PropertyValue == wxT("CELL") || PropertyValue == wxT("cell"))){ TelType.insert(std::make_pair(wxT("cell"), wxT("cell"))); continue; } // video if (PropertyName == wxT("type") && (PropertyValue == wxT("VIDEO") || PropertyValue == wxT("video"))){ TelType.insert(std::make_pair(wxT("video"), wxT("video"))); continue; } // pager if (PropertyName == wxT("type") && (PropertyValue == wxT("PAGER") || PropertyValue == wxT("pager"))){ TelType.insert(std::make_pair(wxT("pager"), wxT("pager"))); continue; } // textphone if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXTPHONE") || PropertyValue == wxT("textphone"))){ TelType.insert(std::make_pair(wxT("textphone"), wxT("textphone"))); continue; } if (PropertyName == wxT("type") && PropertyValue.Find(wxT(",")) != wxNOT_FOUND){ wxStringTokenizer TypeSplit(PropertyValue, wxT(",")); wxString TypeSplitData; while (TypeSplit.HasMoreTokens()){ TypeSplitData = TypeSplit.GetNextToken(); TelType.insert(std::make_pair(TypeSplitData, TypeSplitData)); TypeSplitData.clear(); } } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } wxString TelFinalString; bool TelFirstToken = TRUE; for (std::map::iterator intiter = TelType.begin(); intiter != TelType.end(); ++intiter){ // Process the type data into a single value. (e.g. TYPE="work,voice,cell"). if (TelFirstToken == TRUE){ TelFinalString.Append(wxT("\"")); TelFinalString.Append(intiter->first); TelFirstToken = FALSE; } else { TelFinalString.Append(wxT(",")); TelFinalString.Append(intiter->first); } } if (TelFirstToken == FALSE){ TelFinalString.Append(wxT("\"")); } if (!TelFinalString.IsEmpty()){ if (PropertyDataMap->find(wxT("TYPE")) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(wxT("type"), TelFinalString)); PropertyLockMap->insert(std::make_pair(wxT("type"), TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(wxT("type"), TelFinalString)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(wxT("type"), TRUE)); } } } // RELATED if (wxSProperty == wxT("X-ABRELATEDNAMES")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 18; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("RELATED"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // URL if (wxSProperty == wxT("URL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("URL"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // TITLE if (wxSProperty == wxT("TITLE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 7; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("TITLE"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // FN if (wxSProperty == wxT("FN")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 4; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("FN"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // N if (wxSProperty == wxT("N")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 3; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("N"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // UID if (wxSProperty == wxT("UID")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("UID"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // NICKNAME if (wxSProperty == wxT("NICKNAME")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 10; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("NICKNAME"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // GENDER if (wxSProperty == wxT("GENDER")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 8; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("GENDER"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // BDAY if (wxSProperty == wxT("BDAY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 6; *wxSPropertyDataNameOut = wxT("BDAY"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("X-APPLE-OMIT-YEAR")){ PropertyXOmitYear = PropertyValue; } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } // Convert the date from YYYY-MM-DD to YYYYMMDD or --MMDD depending on if the // year matches the X-APPLE-OMIT-YEAR value. wxStringTokenizer DateSplit(*wxSPropertySeg2Ptr, wxT("-")); wxString DateProc; wxString FinalDate; DateProc = DateSplit.GetNextToken(); if (DateProc == PropertyXOmitYear){ FinalDate.Append(wxT("--")); } else { FinalDate.Append(DateProc); } DateProc.clear(); DateProc = DateSplit.GetNextToken(); FinalDate.Append(DateProc); DateProc.clear(); DateProc = DateSplit.GetNextToken(); FinalDate.Append(DateProc); wxSPropertyDataOut->Append(FinalDate); } // ANNIVERSARY if (wxSProperty == wxT("ANNIVERSARY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 13; *wxSPropertyDataNameOut = wxT("ANNIVERSARY"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("X-APPLE-OMIT-YEAR")){ PropertyXOmitYear = PropertyValue; } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } // Convert the date from YYYY-MM-DD to YYYYMMDD or --MMDD depending on if the // year matches the X-APPLE-OMIT-YEAR value. wxStringTokenizer DateSplit(*wxSPropertySeg2Ptr, wxT("-")); wxString DateProc; wxString FinalDate; DateProc = DateSplit.GetNextToken(); if (DateProc == PropertyXOmitYear){ FinalDate.Append(wxT("--")); } else { FinalDate.Append(DateProc); } DateProc.clear(); DateProc = DateSplit.GetNextToken(); FinalDate.Append(DateProc); DateProc.clear(); DateProc = DateSplit.GetNextToken(); FinalDate.Append(DateProc); wxSPropertyDataOut->Append(FinalDate); } // TZ - Not sure how to process this correctly. So data // is kept as X-VCARD3-TZ for the time being. if (wxSProperty == wxT("TZ")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 4; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("X-VCARD3-TZ"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // ROLE if (wxSProperty == wxT("ROLE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 6; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ROLE"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // ORG if (wxSProperty == wxT("ORG")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ORG"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // NOTE if (wxSProperty == wxT("NOTE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 6; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("NOTE"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // PHOTO if (wxSProperty == wxT("PHOTO")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map SplitData; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; int intPrevValue = 7; *wxSPropertyDataNameOut = wxT("PHOTO"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValuesData(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue, &SplitData); } else { SplitValuesData(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue, &SplitData); } wxString wxSMIMEType; wxString wxSEncType; for (std::map::iterator intiter = SplitData.begin(); intiter != SplitData.end(); ++intiter){ PropertyName = intiter->first; PropertyValue = intiter->second; if (PropertyName == wxT("ENCODING") && PropertyValue == wxT("b")){ wxSEncType = wxT("base64"); continue; } if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("PNG")){ wxSMIMEType = wxT("image/png"); continue; } else if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("JPEG")){ wxSMIMEType = wxT("image/jpeg"); continue; } else if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("GIF")){ wxSMIMEType = wxT("image/gif"); continue; } else if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("BMP")){ wxSMIMEType = wxT("image/bmp"); continue; } else if (PropertyName == wxT("TYPE") || PropertyName == wxT("type")) { wxSMIMEType = wxT("image/unknown"); continue; } //intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } wxSPropertyDataOut->Append(wxT("data:")); wxSPropertyDataOut->Append(wxSMIMEType); wxSPropertyDataOut->Append(wxT(";")); wxSPropertyDataOut->Append(wxSEncType); wxSPropertyDataOut->Append(wxT(",")); wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); } // SOUND if (wxSProperty == wxT("SOUND")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 7; *wxSPropertyDataNameOut = wxT("SOUND"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } wxString wxSMIMEType; wxString wxSEncType; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); if (PropertyName == wxT("ENCODING") && PropertyValue == wxT("b")){ wxSEncType = wxT("base64"); continue; } if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type"))){ wxSMIMEType = PropertyValue; continue; } intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } wxSPropertyDataOut->Append(wxT("data:")); wxSPropertyDataOut->Append(wxSMIMEType); wxSPropertyDataOut->Append(wxT(";")); wxSPropertyDataOut->Append(wxSEncType); wxSPropertyDataOut->Append(wxT(",")); wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); } // Look for backward compatability vCard 4.0 properties. // X-VCARD4-FN if (wxSProperty == wxT("X-VCARD4-FN")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); *wxSPropertyDataNameOut = wxT("FN"); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 13; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-N if (wxSProperty == wxT("X-VCARD4-N")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 12; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("N"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-NICKNAME if (wxSProperty == wxT("X-VCARD4-NICKNAME")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 19; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("NICKNAME"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-GENDER if (wxSProperty == wxT("X-VCARD4-GENDER")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 17; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("GENDER"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-BDAY if (wxSProperty == wxT("X-VCARD4-BDAY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("BDAY"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-ANNIVERSARY if (wxSProperty == wxT("X-VCARD4-ANNIVERSARY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 22; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("ANNIVERSARY"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-TZ if (wxSProperty == wxT("X-VCARD4-TZ")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 13; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("TZ"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-ADR if (wxSProperty == wxT("X-VCARD4-ADR")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("ADR"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-EMAIL if (wxSProperty == wxT("X-VCARD4-EMAIL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("EMAIL"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-IMPP if (wxSProperty == wxT("X-VCARD4-IMPP")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("IMPP"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-TEL if (wxSProperty == wxT("X-VCARD4-TEL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("TEL"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-LANG if (wxSProperty == wxT("X-VCARD4-LANG")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("LANG"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-GEO if (wxSProperty == wxT("X-VCARD4-GEO")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("GEO"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-RELATED if (wxSProperty == wxT("X-VCARD4-RELATED")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 18; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("RELATED"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-URL if (wxSProperty == wxT("X-VCARD4-URL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("URL"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-TITLE if (wxSProperty == wxT("X-VCARD4-TITLE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("TITLE"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-ROLE if (wxSProperty == wxT("X-VCARD4-ROLE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("ROLE"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-ORG if (wxSProperty == wxT("X-VCARD4-ORG")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("ORG"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-NOTE if (wxSProperty == wxT("X-VCARD4-NOTE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("NOTE"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-CATEGORIES if (wxSProperty == wxT("X-VCARD4-CATEGORIES")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 21; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("CATEGORIES"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-PHOTO if (wxSProperty == wxT("X-VCARD4-PHOTO")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("PHOTO"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-LOGO if (wxSProperty == wxT("X-VCARD4-LOGO")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("LOGO"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-SOUND if (wxSProperty == wxT("X-VCARD4-SOUND")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("SOUND"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-CALURI if (wxSProperty == wxT("X-VCARD4-CALURI")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 17; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("CALURI"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-CALADRURI if (wxSProperty == wxT("X-VCARD4-CALADRURI")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 20; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("CALADRURI"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-FBURL if (wxSProperty == wxT("X-VCARD4-FBURL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("FBURL"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-KEY if (wxSProperty == wxT("X-VCARD4-KEY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("KEY"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-VND-* if (wxSProperty.Mid(0, 12) == wxT("X-VCARD4-VND")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxSProperty.Mid(9); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-ADDRESSBOOKSERVER-KIND if (wxSProperty == wxT("X-ADDRESSBOOKSERVER-KIND")){ // Process Data. if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 26; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } *wxSPropertyDataNameOut = wxT("KIND"); for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-ADDRESSBOOKSERVER-MEMBER if (wxSProperty == wxT("X-ADDRESSBOOKSERVER-MEMBER")){ // Process Data. if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 28; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } *wxSPropertyDataNameOut = wxT("MEMBER"); for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } //wxSPropertyPropValuesOut->Append(wxT(";")); //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // Deal with X-ABLabel specifically. if (wxSProperty == wxT("X-ABLabel") && ProcessItemData == TRUE){ //int intPropertyLen = wxSPropertySeg1Ptr->Len(); intPropertyLen = wxSPropertySeg1Ptr->Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 11; SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); //EscapeString(wxSPropertySeg2Ptr, FALSE); PropertyDataMap->insert(std::make_pair(wxT("X-ABLabel"), *wxSPropertySeg2Ptr)); } } void vCard34Conv::ProcessCaptureStringsProc(wxString *strCapture){ CaptureString(strCapture, FALSE); } void vCard34Conv::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)); } } void vCard34Conv::SplitValuesData(wxString *PropertyLine, std::map *SplitPoints, std::map *SplitLength, int intSize, std::map *SplitData){ wxString DataStr; wxStringTokenizer PropertyElement; wxString PropertyName; wxString PropertyValue; size_t intPropertyLen = PropertyLine->Len(); int intSplitsFound = 0; int intSplitSize = 0; int intSplitSeek = (intSize - 1); for (int i = intSize; i <= intPropertyLen; i++){ intSplitSize++; if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ if (intSplitsFound == 0){ DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize)); SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); } else { DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize - 1)); SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); intSplitsFound++; intSplitSeek = (i + 1); intSplitSize = 0; if (!DataStr.IsEmpty()){ PropertyElement.SetString(DataStr, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); SplitData->insert(std::make_pair(PropertyName, PropertyValue)); } DataStr.clear(); PropertyName.clear(); PropertyValue.clear(); } } if (intSplitsFound == 0){ DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize)); SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1))); SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize)); } else { DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize - 1)); SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1))); SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize)); } if (!DataStr.IsEmpty()){ PropertyElement.SetString(DataStr, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); SplitData->insert(std::make_pair(PropertyName, PropertyValue)); } }