X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fvcard%2Fvcard34conv.cpp;h=9137a58eac5f06bcbe16032cf49de91411c2b71e;hb=ee9b71949005734012f18251774807c38b989ae2;hp=62efc909ac0382d1861138a052fb371e16702918;hpb=45729fca56479bd9158486e0cda0c4a94b4dd1dc;p=xestiaab%2F.git diff --git a/source/vcard/vcard34conv.cpp b/source/vcard/vcard34conv.cpp index 62efc90..9137a58 100644 --- a/source/vcard/vcard34conv.cpp +++ b/source/vcard/vcard34conv.cpp @@ -1,3344 +1,47 @@ -#include "vcard34conv.h" -#include "vcard.h" -#include "../version.h" -#include "../common/textprocessing.h" -#include -#include -#include - -#include -#include -#include -#include - -// vcard.cpp - Deals with vCard 4.0 formatted files meeting the -// RFC 6350 specification. - -vCard34Conv::vCard34Conv(){ - vCardBegin = FALSE; - vCardEnd = FALSE; - vCardFN = FALSE; - vCardVersion = 0.0; - SettingCount = 0; -} - -bool vCard34Conv::ConvertToV3(wxString Filename, wxString *wxSData){ - - wxString V3Data; - wxString V4Data; - - // Load the contact into the contact editor. - - wxFFile ContactFile; - wxString wxSContactString; - wxString ContactLine; - vCard ContactData; - - vCard ContactDatav3; - - //wxSContactFilename = Filename; - - // Check if we are using wxWidgets version 2.8 or less and - // execute the required command accordingly. - -#if wxABI_VERSION < 20900 - ContactFile.Open(Filename.c_str(), wxT("r")); -#else - ContactFile.Open(Filename, wxT("r")); -#endif - - if (ContactFile.IsOpened() == FALSE){ - - return FALSE; - - } - - ContactFile.ReadAll(&wxSContactString, wxConvAuto()); - - // Split the lines. - - std::map ContactFileLines; - std::map::iterator striter; - - wxStringTokenizer wSTContactFileLines(wxSContactString, wxT("\r\n")); - - int ContactLineSeek = 0; - - while (wSTContactFileLines.HasMoreTokens() == TRUE){ - - ContactLine = wSTContactFileLines.GetNextToken(); - ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine)); - ContactLineSeek++; - - } - - // Get the line. - - bool QuoteMode = FALSE; - bool PropertyFind = TRUE; - bool HasExtraNicknames = FALSE; - bool IgnoreGender = FALSE; - bool ExtraLineSeek = TRUE; - bool BirthdayProcessed = FALSE; - bool AnniversaryProcessed = FALSE; - bool FNProcessed = FALSE; - bool GenderProcessed = FALSE; - bool NameProcessed = FALSE; - bool KindProcessed = FALSE; - bool FNFirst = FALSE; - bool NicknameFirst = FALSE; - bool TitleFirst = FALSE; - bool OrganisationFirst = FALSE; - bool NoteFirst = FALSE; - bool PhotoFirst = FALSE; - bool LogoFirst = FALSE; - int intExtraNickname = 0; - wxString wxSProperty; - wxString wxSPropertySeg1; - wxString wxSPropertySeg2; - wxString wxSPropertyNextLine; - int 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 4; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - //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){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 3; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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. - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - intPrevValue = 4; - - ContactDatav3.AddRaw(wxT("X-ADDRESSBOOKSERVER-KIND"), wxSPropertySeg2); - - KindProcessed = TRUE; - - } else if (wxSProperty == wxT("MEMBER")){ - - // Process Data. - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - intPrevValue = 6; - - ContactDatav3.AddRaw(wxT("X-ADDRESSBOOKSERVER-MEMBER"), wxSPropertySeg2); - - } else if (wxSProperty == wxT("NICKNAME")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 10; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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. - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE;; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 8; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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. - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool BirthdayText = FALSE; - bool FirstToken = TRUE; - bool NoYear = FALSE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - 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. - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool AnniversaryText = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 13; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 4; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - wxString AddressLabel; - wxString AddressLang; - wxString AddressAltID; - wxString AddressPID; - wxString AddressTokens; - wxString AddressGeo; - wxString AddressTimezone; - wxString AddressType; - wxString AddressMediatype; - wxString AddressPOBox; - wxString AddressExtended; - wxString AddressStreet; - wxString AddressLocality; - wxString AddressCity; - wxString AddressRegion; - wxString AddressPostalCode; - wxString AddressCountry; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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 - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - std::map::iterator SPoint; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - wxString AddressLabel; - wxString AddressLang; - wxString AddressAltID; - wxString AddressPID; - wxString AddressTokens; - wxString AddressGeo; - wxString AddressTimezone; - wxString AddressType; - wxString AddressMediatype; - wxString AddressPOBox; - wxString AddressExtended; - wxString AddressStreet; - wxString AddressLocality; - wxString AddressCity; - wxString AddressRegion; - wxString AddressPostalCode; - wxString AddressCountry; - bool AfterFirstProperty = FALSE; - bool FirstToken = TRUE; - int intSplitSeek = 0; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitPoint = 0; - - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - std::map::iterator SPoint; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - wxString IMPPType; - wxString IMPPAddress; - bool AfterFirstProperty = FALSE; - bool FirstToken = TRUE; - int intSplitSeek = 0; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitPoint = 0; - - - 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. - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map TypeSplitPoints; - std::map TypeSplitLength; - std::map::iterator SLiter; - std::map::iterator SPoint; - std::map::iterator TSLiter; - std::map::iterator TSPoint; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - wxString TelType; - wxString TelNumber; - wxString TelTypeUI; - wxString TelTypeDetail; - wxString TelTypeOut; - wxString FinalFriendlyString; - bool AfterFirstProperty = FALSE; - bool FirstToken = TRUE; - bool SkipFirst = TRUE; - int intSplitSeek = 0; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 5; - int intPref = 0; - 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. - - int 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - wxString GeoType; - wxString GeoData; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - wxString RelatedType; - wxString RelatedTypeOriginal; - wxString RelatedName; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 9; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")) { - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")) { - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")) { - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")) { - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")) { - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - wxString PropertyType; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 12; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")) { - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")) { - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")) { - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 8; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 11; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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")){ - - int intPropertyLen = wxSPropertySeg1.Len(); - std::map SplitPoints; - std::map SplitLength; - std::map::iterator SLiter; - wxString PropertyData; - wxString PropertyName; - wxString PropertyValue; - wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; - int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - - 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; - - - int 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-")){ - - - - int 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 HasExtraNicknames = FALSE; - bool IgnoreGender = FALSE; - 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; - int ContactLineLen = 0; - int ContactLineSubLen = 0; - int QuoteBreakPoint = 0; - int 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; - 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, intPrevValueSub, &TempPropertyData); - - // Process the splitted data into temporary property data. - - bool FirstToken = TRUE; - - // 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; - 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; - int DataLineSeek = 0; - - // 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; - int 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 ContactLineSeekSub = 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){ +// vcard34conv.cpp - vCard34Conv Object +// +// (c) 2012-2015 Xestia Software Development. +// +// This file is part of Xestia Address Book. +// +// Xestia Address Book is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Address Book is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Address Book. If not, see - 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; +#include "vcard34conv.h" +#include "vcard.h" +#include "../version.h" +#include "../common/textprocessing.h" +#include +#include +#include - delete ItemEraseData; - ItemEraseData = NULL; - - } +#include +#include +#include +#include - ItemMapIndex.clear(); - - vCardOut->AddRaw(wxT("END"), wxT("VCARD")); +// vcard.cpp - Deals with vCard 4.0 formatted files meeting the +// RFC 6350 specification. - return TRUE; +vCard34Conv::vCard34Conv(){ + // Setup the vCard34Conv object. + + vCardBegin = FALSE; + vCardEnd = FALSE; + vCardFN = FALSE; + vCardVersion = 0.0; + SettingCount = 0; + } void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, @@ -3349,9 +52,12 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, std::map *PropertyLockMap, bool ProcessItemData, bool *VCardV3Value, bool *XVCardV4Value){ + // Convert and format data to vCard 4.0 specifications. + wxString wxSProperty; wxString wxSPropertySeg1Chopped; - + size_t intPropertyLen; + if (ProcessItemData == TRUE){ wxStringTokenizer wxSPropertySplit(*wxSPropertyName, wxT(".")); @@ -3378,9 +84,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // EMAIL if (wxSProperty == wxT("EMAIL")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -3398,15 +102,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("EMAIL"); @@ -3464,31 +161,43 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("INTERNET")){ + continue; + } if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ if (ProcessItemData == FALSE){ + PropertyName = wxT("PREF"); PropertyValue = wxT("50"); + } else { + continue; + } } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -3520,9 +229,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // ADR if (wxSProperty == wxT("ADR")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -3540,15 +247,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ADR"); @@ -3601,32 +301,40 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ if (ProcessItemData == FALSE){ + PropertyName = wxT("PREF"); PropertyValue = wxT("50"); + } else { + continue; + } } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -3658,9 +366,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // LABEL if (wxSProperty == wxT("LABEL")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -3678,15 +384,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ADR"); @@ -3739,25 +438,31 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -3791,9 +496,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // IMPP if (wxSProperty == wxT("IMPP")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -3811,15 +514,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxStringTokenizer IMPPSplit(*wxSPropertySeg2Ptr, wxT(":")); wxString IMPPType; @@ -3892,29 +588,37 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } if (PropertyName == wxT("X-SERVICE-TYPE")){ + continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -3946,9 +650,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // TEL if (wxSProperty == wxT("TEL")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -3967,15 +669,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(wxT("tel:")); wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); @@ -4029,27 +724,33 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + TelType.insert(std::make_pair(wxT("home"), wxT("home"))); continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + TelType.insert(std::make_pair(wxT("work"), wxT("work"))); continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process the telephone type options. @@ -4057,53 +758,68 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // text if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXT") || PropertyValue == wxT("text"))){ + TelType.insert(std::make_pair(wxT("text"), wxT("text"))); continue; + } // voice if (PropertyName == wxT("type") && (PropertyValue == wxT("VOICE") || PropertyValue == wxT("voice"))){ + TelType.insert(std::make_pair(wxT("voice"), wxT("voice"))); continue; + } // fax if (PropertyName == wxT("type") && (PropertyValue == wxT("FAX") || PropertyValue == wxT("fax"))){ + TelType.insert(std::make_pair(wxT("fax"), wxT("fax"))); continue; + } // cell if (PropertyName == wxT("type") && (PropertyValue == wxT("CELL") || PropertyValue == wxT("cell"))){ + TelType.insert(std::make_pair(wxT("cell"), wxT("cell"))); continue; + } // video if (PropertyName == wxT("type") && (PropertyValue == wxT("VIDEO") || PropertyValue == wxT("video"))){ + TelType.insert(std::make_pair(wxT("video"), wxT("video"))); continue; + } // pager if (PropertyName == wxT("type") && (PropertyValue == wxT("PAGER") || PropertyValue == wxT("pager"))){ + TelType.insert(std::make_pair(wxT("pager"), wxT("pager"))); continue; + } // textphone if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXTPHONE") || PropertyValue == wxT("textphone"))){ + TelType.insert(std::make_pair(wxT("textphone"), wxT("textphone"))); continue; + } if (PropertyName == wxT("type") && PropertyValue.Find(wxT(",")) != wxNOT_FOUND){ + wxStringTokenizer TypeSplit(PropertyValue, wxT(",")); wxString TypeSplitData; while (TypeSplit.HasMoreTokens()){ @@ -4192,9 +908,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // RELATED if (wxSProperty == wxT("X-ABRELATEDNAMES")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -4212,15 +926,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 18; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("RELATED"); @@ -4278,7 +985,9 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } // Process properties. @@ -4310,9 +1019,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // URL if (wxSProperty == wxT("URL")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -4330,15 +1037,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("URL"); @@ -4391,25 +1091,31 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ + PropertyValue = wxT("home"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ + PropertyValue = wxT("work"); + } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ + PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); + } // Process properties. @@ -4442,8 +1148,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, if (wxSProperty == wxT("TITLE")){ - int intPropertyLen; - if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -4461,15 +1165,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("TITLE"); @@ -4521,9 +1218,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -4555,9 +1250,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // FN if (wxSProperty == wxT("FN")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -4575,15 +1268,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 4; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("FN"); @@ -4636,8 +1322,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -4669,9 +1353,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // N if (wxSProperty == wxT("N")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -4689,16 +1371,9 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 3; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - - + wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("N"); *VCardV3Value = TRUE; @@ -4750,8 +1425,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -4783,9 +1456,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // UID if (wxSProperty == wxT("UID")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -4803,15 +1474,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("UID"); @@ -4864,8 +1528,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -4897,9 +1559,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // NICKNAME if (wxSProperty == wxT("NICKNAME")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -4917,15 +1577,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 10; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("NICKNAME"); @@ -4978,8 +1631,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -5011,9 +1662,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // GENDER if (wxSProperty == wxT("GENDER")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -5031,15 +1680,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 8; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("GENDER"); @@ -5091,9 +1733,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5125,9 +1765,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // BDAY if (wxSProperty == wxT("BDAY")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -5146,15 +1784,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - *wxSPropertyDataNameOut = wxT("BDAY"); *VCardV3Value = TRUE; @@ -5205,9 +1836,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")){ @@ -5275,9 +1904,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // ANNIVERSARY if (wxSProperty == wxT("ANNIVERSARY")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -5296,15 +1923,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 13; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - *wxSPropertyDataNameOut = wxT("ANNIVERSARY"); *VCardV3Value = TRUE; @@ -5356,8 +1976,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; if (PropertyName == wxT("X-APPLE-OMIT-YEAR")){ @@ -5426,9 +2044,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // is kept as X-VCARD3-TZ for the time being. if (wxSProperty == wxT("TZ")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -5447,15 +2063,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 4; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("X-VCARD3-TZ"); @@ -5507,9 +2116,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5541,9 +2148,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // ROLE if (wxSProperty == wxT("ROLE")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -5562,15 +2167,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ROLE"); @@ -5622,9 +2220,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5656,9 +2252,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // ORG if (wxSProperty == wxT("ORG")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -5677,15 +2271,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 5; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ORG"); @@ -5737,9 +2324,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5771,9 +2356,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // NOTE if (wxSProperty == wxT("NOTE")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -5792,15 +2375,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 6; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("NOTE"); @@ -5852,9 +2428,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -5887,8 +2461,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, if (wxSProperty == wxT("PHOTO")){ - int intPropertyLen; - if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -5908,15 +2480,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - *wxSPropertyDataNameOut = wxT("PHOTO"); *VCardV3Value = TRUE; @@ -5961,9 +2525,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxSMIMEType = wxT("image/unknown"); continue; } - - //intPrevValue = intiter->second; - + // Process properties. if (PropertyName.IsEmpty()){ @@ -6000,9 +2562,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // SOUND if (wxSProperty == wxT("SOUND")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -6021,15 +2581,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 7; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - *wxSPropertyDataNameOut = wxT("SOUND"); *VCardV3Value = TRUE; @@ -6083,9 +2636,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; @@ -6137,8 +2688,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, if (wxSProperty == wxT("X-VCARD4-FN")){ - int intPropertyLen; - if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -6158,15 +2707,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 13; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -6215,8 +2757,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -6244,10 +2784,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - + } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -6258,9 +2795,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-N if (wxSProperty == wxT("X-VCARD4-N")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -6279,15 +2814,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 12; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -6336,9 +2864,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -6367,9 +2893,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -6380,9 +2903,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-NICKNAME if (wxSProperty == wxT("X-VCARD4-NICKNAME")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -6401,15 +2922,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 19; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -6459,8 +2973,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -6488,9 +3000,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -6502,9 +3011,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-GENDER if (wxSProperty == wxT("X-VCARD4-GENDER")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -6523,15 +3030,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 17; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -6610,9 +3110,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -6624,9 +3121,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-BDAY if (wxSProperty == wxT("X-VCARD4-BDAY")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -6645,15 +3140,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 15; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -6702,9 +3190,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -6732,10 +3218,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - + } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -6746,9 +3229,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-ANNIVERSARY if (wxSProperty == wxT("X-VCARD4-ANNIVERSARY")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -6767,15 +3248,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 22; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -6824,9 +3298,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -6854,10 +3326,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - + } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -6868,9 +3337,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-TZ if (wxSProperty == wxT("X-VCARD4-TZ")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -6889,15 +3356,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 13; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -6947,8 +3407,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -6976,9 +3434,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -6990,9 +3445,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-ADR if (wxSProperty == wxT("X-VCARD4-ADR")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -7011,15 +3464,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 14; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -7068,9 +3514,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -7098,9 +3542,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7112,9 +3553,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-EMAIL if (wxSProperty == wxT("X-VCARD4-EMAIL")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -7133,15 +3572,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 16; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -7191,8 +3623,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7220,10 +3650,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); - + } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); @@ -7234,9 +3661,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-IMPP if (wxSProperty == wxT("X-VCARD4-IMPP")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -7255,15 +3680,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 15; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -7312,9 +3730,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); - + intPrevValue = intiter->second; // Process properties. @@ -7342,9 +3758,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7356,9 +3769,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-TEL if (wxSProperty == wxT("X-VCARD4-TEL")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -7377,15 +3788,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 14; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -7435,8 +3839,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7464,9 +3866,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7478,9 +3877,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-LANG if (wxSProperty == wxT("X-VCARD4-LANG")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -7499,15 +3896,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 15; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -7557,8 +3947,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7586,9 +3974,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7600,9 +3985,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-GEO if (wxSProperty == wxT("X-VCARD4-GEO")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -7621,15 +4004,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 14; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -7679,8 +4055,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7708,9 +4082,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7722,9 +4093,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-RELATED if (wxSProperty == wxT("X-VCARD4-RELATED")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -7743,15 +4112,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 18; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -7801,8 +4163,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7830,9 +4190,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7844,9 +4201,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-URL if (wxSProperty == wxT("X-VCARD4-URL")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -7865,15 +4220,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 14; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -7923,8 +4271,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -7952,9 +4298,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -7966,9 +4309,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-TITLE if (wxSProperty == wxT("X-VCARD4-TITLE")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -7987,15 +4328,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 16; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -8045,8 +4379,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8074,9 +4406,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8088,9 +4417,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-ROLE if (wxSProperty == wxT("X-VCARD4-ROLE")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -8109,15 +4436,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 15; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -8167,8 +4487,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8196,9 +4514,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8210,9 +4525,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-ORG if (wxSProperty == wxT("X-VCARD4-ORG")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -8231,15 +4544,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 14; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -8289,8 +4595,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8318,9 +4622,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8332,9 +4633,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-NOTE if (wxSProperty == wxT("X-VCARD4-NOTE")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -8353,15 +4652,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 15; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -8411,8 +4703,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8440,9 +4730,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8454,9 +4741,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-CATEGORIES if (wxSProperty == wxT("X-VCARD4-CATEGORIES")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -8475,15 +4760,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 21; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -8533,8 +4811,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8562,9 +4838,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8576,9 +4849,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-PHOTO if (wxSProperty == wxT("X-VCARD4-PHOTO")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -8597,15 +4868,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 16; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -8655,8 +4919,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8684,9 +4946,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8698,9 +4957,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-LOGO if (wxSProperty == wxT("X-VCARD4-LOGO")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -8719,15 +4976,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 15; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -8777,8 +5027,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8806,9 +5054,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8820,9 +5065,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-SOUND if (wxSProperty == wxT("X-VCARD4-SOUND")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -8841,15 +5084,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 16; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -8899,8 +5135,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -8928,9 +5162,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -8942,9 +5173,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-CALURI if (wxSProperty == wxT("X-VCARD4-CALURI")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -8963,15 +5192,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 17; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -9021,8 +5243,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -9050,9 +5270,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -9064,9 +5281,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-CALADRURI if (wxSProperty == wxT("X-VCARD4-CALADRURI")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -9085,15 +5300,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 20; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -9143,8 +5351,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -9172,9 +5378,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -9186,9 +5389,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-FBURL if (wxSProperty == wxT("X-VCARD4-FBURL")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -9207,15 +5408,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 16; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -9265,8 +5459,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -9294,9 +5486,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -9308,9 +5497,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-KEY if (wxSProperty == wxT("X-VCARD4-KEY")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -9329,15 +5516,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 14; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -9386,8 +5566,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - - //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; @@ -9416,9 +5594,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -9430,9 +5605,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // X-VCARD4-VND-* if (wxSProperty.Mid(0, 12) == wxT("X-VCARD4-VND")){ - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -9451,15 +5624,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 14; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -9509,8 +5675,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -9538,9 +5702,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -9554,9 +5715,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, if (wxSProperty == wxT("X-ADDRESSBOOKSERVER-KIND")){ // Process Data. - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -9575,15 +5734,8 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 26; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -9634,8 +5786,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -9663,9 +5813,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -9679,9 +5826,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, if (wxSProperty == wxT("X-ADDRESSBOOKSERVER-MEMBER")){ // Process Data. - - int intPropertyLen; - + if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); @@ -9695,20 +5840,13 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; - std::map::iterator BIter;; + std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; + bool FirstToken = TRUE; int intPrevValue = 28; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - if (ProcessItemData == TRUE){ @@ -9759,8 +5897,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); - //ProcessCaptureStrings(&PropertyValue); - intPrevValue = intiter->second; // Process properties. @@ -9788,9 +5924,6 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, } } - - //wxSPropertyPropValuesOut->Append(wxT(";")); - //wxSPropertyPropValuesOut->Append(PropertyName + wxT("=") + PropertyValue); } @@ -9804,27 +5937,18 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, if (wxSProperty == wxT("X-ABLabel") && ProcessItemData == TRUE){ - int intPropertyLen = wxSPropertySeg1Ptr->Len(); - std::map SplitPoints; + intPropertyLen = wxSPropertySeg1Ptr->Len(); + std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool AfterFirstToken = FALSE; - bool FirstToken = TRUE; - int intSplitsFound = 0; - int intSplitSize = 0; int intPrevValue = 11; - int intPref = 0; - int intType = 0; - int intSplitSeek = 0; - SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); - - //EscapeString(wxSPropertySeg2Ptr, FALSE); + PropertyDataMap->insert(std::make_pair(wxT("X-ABLabel"), *wxSPropertySeg2Ptr)); } @@ -9833,7 +5957,9 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, void vCard34Conv::ProcessCaptureStringsProc(wxString *strCapture){ - CaptureString(strCapture, FALSE); + // Process code for capturing the strings. + + CaptureString(strCapture, FALSE); } @@ -9842,7 +5968,9 @@ void vCard34Conv::SplitValues(wxString *PropertyLine, std::map *SplitLength, int intSize){ - int intPropertyLen = PropertyLine->Len(); + // Split the values as required. + + size_t intPropertyLen = PropertyLine->Len(); int intSplitsFound = 0; int intSplitSize = 0; int intSplitSeek = 0; @@ -9854,21 +5982,21 @@ void vCard34Conv::SplitValues(wxString *PropertyLine, if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ - if (intSplitsFound == 0){ + if (intSplitsFound == 0){ - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); - } else { + } else { - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); - } + } - SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); - intSplitsFound++; - intSplitSeek = i; - intSplitSize = 0; + intSplitsFound++; + intSplitSeek = i; + intSplitSize = 0; } @@ -9894,11 +6022,14 @@ void vCard34Conv::SplitValuesData(wxString *PropertyLine, int intSize, std::map *SplitData){ + + // Split the data values as required. + wxString DataStr; wxStringTokenizer PropertyElement; wxString PropertyName; wxString PropertyValue; - int intPropertyLen = PropertyLine->Len(); + size_t intPropertyLen = PropertyLine->Len(); int intSplitsFound = 0; int intSplitSize = 0; int intSplitSeek = (intSize - 1); @@ -9910,7 +6041,7 @@ void vCard34Conv::SplitValuesData(wxString *PropertyLine, if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ - if (intSplitsFound == 0){ + if (intSplitsFound == 0){ DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize)); SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); @@ -9922,24 +6053,24 @@ void vCard34Conv::SplitValuesData(wxString *PropertyLine, } - SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); - intSplitsFound++; - intSplitSeek = (i + 1); - intSplitSize = 0; + intSplitsFound++; + intSplitSeek = (i + 1); + intSplitSize = 0; - if (!DataStr.IsEmpty()){ + if (!DataStr.IsEmpty()){ - PropertyElement.SetString(DataStr, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - SplitData->insert(std::make_pair(PropertyName, PropertyValue)); + PropertyElement.SetString(DataStr, wxT("=")); + PropertyName = PropertyElement.GetNextToken(); + PropertyValue = PropertyElement.GetNextToken(); + SplitData->insert(std::make_pair(PropertyName, PropertyValue)); - } + } - DataStr.clear(); - PropertyName.clear(); - PropertyValue.clear(); + DataStr.clear(); + PropertyName.clear(); + PropertyValue.clear(); }