X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fvcard%2Fvcard34conv.cpp;h=103d7ae9be768c299b5a401aaf221e0ef00dc06b;hb=fb95962b20989702f8d689875a977d150c087660;hp=0c3c545fe6ebf3d313348c44ef947475e396a966;hpb=0f855c5d57f952d2aae11759a60de90146e03c68;p=xestiaab%2F.git diff --git a/source/vcard/vcard34conv.cpp b/source/vcard/vcard34conv.cpp index 0c3c545..103d7ae 100644 --- a/source/vcard/vcard34conv.cpp +++ b/source/vcard/vcard34conv.cpp @@ -22,3061 +22,6 @@ vCard34Conv::vCard34Conv(){ 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, @@ -3320,8 +265,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ @@ -3396,7 +339,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; - int intPrevValue = 7; + int intPrevValue = 7; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ADR"); @@ -3449,8 +392,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ @@ -3593,8 +534,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ @@ -3721,8 +660,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ @@ -4065,8 +1002,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ @@ -4186,9 +1121,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -4292,8 +1225,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -4397,8 +1328,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -4502,8 +1431,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -4607,8 +1534,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -4711,9 +1636,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -4816,9 +1739,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; if (PropertyName == wxT("X-APPLE-OMIT-YEAR")){ @@ -4958,8 +1879,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("X-APPLE-OMIT-YEAR")){ @@ -5100,9 +2019,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5206,9 +2123,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5312,9 +2227,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5418,9 +2331,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5517,9 +2428,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxSMIMEType = wxT("image/unknown"); continue; } - - //intPrevValue = intiter->second; - + // Process properties. if (PropertyName.IsEmpty()){ @@ -5630,9 +2539,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + if (PropertyName == wxT("ENCODING") && PropertyValue == wxT("b")){ wxSEncType = wxT("base64"); continue; @@ -5753,8 +2660,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -5782,10 +2687,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - + } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -5865,9 +2767,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5896,9 +2796,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -5979,8 +2876,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -6008,9 +2903,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -6121,9 +3013,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -6204,9 +3093,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -6234,10 +3121,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - + } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -6317,9 +3201,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -6347,10 +3229,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - + } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -6431,8 +3310,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -6460,9 +3337,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -6543,9 +3417,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -6573,9 +3445,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -6657,8 +3526,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -6686,10 +3553,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - + } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -6769,9 +3633,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -6799,9 +3661,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -6883,8 +3742,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -6912,9 +3769,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -6996,8 +3850,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7025,9 +3877,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7109,8 +3958,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7138,9 +3985,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7222,8 +4066,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7251,9 +4093,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7335,8 +4174,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7364,9 +4201,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7448,8 +4282,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7477,9 +4309,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7561,8 +4390,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7590,9 +4417,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7674,8 +4498,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7703,9 +4525,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7787,8 +4606,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7816,9 +4633,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7900,8 +4714,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7929,9 +4741,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8013,8 +4822,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8042,9 +4849,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8126,8 +4930,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8155,9 +4957,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8239,8 +5038,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8268,9 +5065,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8352,8 +5146,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8381,9 +5173,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8465,8 +5254,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8494,9 +5281,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8578,8 +5362,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8607,9 +5389,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8690,8 +5469,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; @@ -8720,9 +5497,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8804,8 +5578,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8833,9 +5605,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8920,8 +5689,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8949,9 +5716,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -9036,8 +5800,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -9065,9 +5827,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -9081,7 +5840,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, if (wxSProperty == wxT("X-ABLabel") && ProcessItemData == TRUE){ - //int intPropertyLen = wxSPropertySeg1Ptr->Len(); intPropertyLen = wxSPropertySeg1Ptr->Len(); std::map SplitPoints; std::map SplitLength; @@ -9093,8 +5851,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, int intPrevValue = 11; SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); - - //EscapeString(wxSPropertySeg2Ptr, FALSE); + PropertyDataMap->insert(std::make_pair(wxT("X-ABLabel"), *wxSPropertySeg2Ptr)); }