-#include "vcard34conv.h"
-#include "vcard.h"
-#include "../version.h"
-#include "../common/textprocessing.h"
-#include <wx/file.h>
-#include <cmath>
-#include <map>
-
-#include <wx/ffile.h>
-#include <wx/tokenzr.h>
-#include <wx/datetime.h>
-#include <wx/wx.h>
-
-// 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<int, wxString> ContactFileLines;
- std::map<int, wxString>::iterator striter;
-
- wxStringTokenizer wSTContactFileLines(wxSContactString, wxT("\r\n"));
-
- int ContactLineSeek = 0;
-
- while (wSTContactFileLines.HasMoreTokens() == TRUE){
-
- ContactLine = wSTContactFileLines.GetNextToken();
- ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
- ContactLineSeek++;
-
- }
-
- // Get the line.
-
- bool QuoteMode = FALSE;
- bool PropertyFind = TRUE;
- bool HasExtraNicknames = FALSE;
- bool IgnoreGender = FALSE;
- bool ExtraLineSeek = TRUE;
- bool BirthdayProcessed = FALSE;
- bool AnniversaryProcessed = FALSE;
- bool FNProcessed = FALSE;
- bool GenderProcessed = FALSE;
- bool NameProcessed = FALSE;
- bool KindProcessed = FALSE;
- bool FNFirst = FALSE;
- bool NicknameFirst = FALSE;
- bool TitleFirst = FALSE;
- bool OrganisationFirst = FALSE;
- bool NoteFirst = FALSE;
- bool PhotoFirst = FALSE;
- bool LogoFirst = FALSE;
- int intExtraNickname = 0;
- wxString wxSProperty;
- wxString wxSPropertySeg1;
- wxString wxSPropertySeg2;
- wxString wxSPropertyNextLine;
- size_t ContactLineLen = 0;
- int QuoteBreakPoint = 0;
- int FNCount = 0;
- int NameCount = 0;
- int NicknameCount = 0;
- int ADRCount = 0;
- int EmailCount = 0;
- int IMPPCount = 0;
- int TelCount = 0;
- int LangCount = 0;
- int TZCount = 0;
- int GeoCount = 0;
- int URLCount = 0;
- int RelatedCount = 0;
- int TitleCount = 0;
- int RoleCount = 0;
- int OrgCount = 0;
- int NoteCount = 0;
- int CategoryCount = 0;
- int PhotoCount = 0;
- int LogoCount = 0;
- int SoundCount = 0;
- int CalAdrCount = 0;
- int CalReqAdrCount = 0;
- int FreeBusyCount = 0;
- int KeyCount = 0;
- int VendorCount = 0;
- int XTokenCount = 0;
- int ItemSeek = 1;
- //int intValueSeek = 1;
-
- wxString strVer;
-
- // Setup the version string.
-
- strVer.Append(wxT("-//Xestia//Address Book Version "));
- strVer.Append(wxT(XSDAB_VERSION));
- strVer.Append(wxT("//KW"));
-
- ContactDatav3.AddRaw(wxT("BEGIN"), wxT("VCARD"));
- ContactDatav3.AddRaw(wxT("VERSION"), wxT("3.0"));
- ContactDatav3.AddRaw(wxT("PRODID"), strVer);
-
- for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
- iter != ContactFileLines.end(); ++iter){
-
- // Find the colon which splits the start bit from the data part.
-
- ContactLine = iter->second;
-
- while (ExtraLineSeek == TRUE){
-
- // Check if there is extra data on the next line
- // (indicated by space or tab at the start) and add data.
-
- iter++;
-
- if (iter == ContactFileLines.end()){
-
- iter--;
- break;
-
- }
-
- wxSPropertyNextLine = iter->second;
-
-
- if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
-
- wxSPropertyNextLine.Remove(0, 1);
- //wxSPropertyNextLine.Trim(FALSE);
- //ContactLine.Trim();
- ContactLine.Append(wxSPropertyNextLine);
-
- } else {
-
- iter--;
- ExtraLineSeek = FALSE;
-
- }
-
- }
-
- ContactLineLen = ContactLine.Len();
-
- // Make sure we are not in quotation mode.
- // Make sure colon does not have \ or \\ before it.
-
- wxSProperty.Clear();
-
- for (int i = 0; i <= ContactLineLen; i++){
-
- if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
-
- PropertyFind = FALSE;
-
- } else if (PropertyFind == TRUE){
-
- wxSProperty.Append(ContactLine.Mid(i, 1));
-
- }
-
- if (ContactLine.Mid(i, 1) == wxT("\"")){
-
- if (QuoteMode == TRUE){
-
- QuoteMode = FALSE;
-
- } else {
-
- QuoteMode = TRUE;
-
- }
-
- }
-
- if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
-
- QuoteBreakPoint = i;
- break;
-
- }
-
- }
-
- // Split that line at the point into two variables (ignore the colon).
-
- wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
- wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
-
- // Add the data into the contact editor depending on what it is.
-
- if (wxSProperty == wxT("FN")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 4;
-
- //SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 3;
-
- if (FNFirst == FALSE){
-
- ContactDatav3.AddRaw(wxT("FN"), wxSPropertySeg2);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-FN;X-FIRST=TRUE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
- FNFirst = TRUE;
-
- } else {
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-FN"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-FN;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))),
- wxSPropertySeg2);
-
- }
-
- }
-
- } else if (wxSProperty == wxT("N") && NameProcessed == FALSE){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 3;
-
- intPrevValue = 2;
-
- ContactDatav3.AddRaw(wxT("N"), wxSPropertySeg2);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
-
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-N;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT(""));
-
- }
-
- NameProcessed = TRUE;
-
- } else if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){
-
- // Process Data.
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 5;
-
- intPrevValue = 4;
-
- ContactDatav3.AddRaw(wxT("X-ADDRESSBOOKSERVER-KIND"), wxSPropertySeg2);
-
- KindProcessed = TRUE;
-
- } else if (wxSProperty == wxT("MEMBER")){
-
- // Process Data.
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 7;
-
- intPrevValue = 6;
-
- ContactDatav3.AddRaw(wxT("X-ADDRESSBOOKSERVER-MEMBER"), wxSPropertySeg2);
-
- } else if (wxSProperty == wxT("NICKNAME")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 10;
-
- intPrevValue = 9;
-
- if (NicknameFirst == FALSE){
-
- ContactDatav3.AddRaw(wxT("NICKNAME"), wxSPropertySeg2);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-NICKNAME;X-FIRST=TRUE;")
- + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT(""));
-
- }
- NicknameFirst = TRUE;
- ItemSeek++;
-
- } else {
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-NICKNAME"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-NICKNAME;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"),
- wxSPropertySeg2);
-
- }
-
- }
-
-
- } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){
-
- // Do PID/ALTID/LANG things.
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 8;
-
-
- intPrevValue = 7;
-
- if (wxSPropertySeg2.Mid(1, 1) == wxT(";")){
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-GENDER;X-GENDERTEXT=\"") + wxSPropertySeg2.Mid(2) + wxT("\""), wxSPropertySeg2.Mid(0, 1));
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-GENDER;X-GENDERTEXT=\"") + wxSPropertySeg2.Mid(2) + wxT("\";")
- + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))),
- wxSPropertySeg2.Mid(0, 1));
-
- }
-
- } else {
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-GENDER"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-GENDER;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- }
-
- GenderProcessed = TRUE;
-
- } else if (wxSProperty == wxT("BDAY") && BirthdayProcessed == FALSE){
-
- // Process date. Preserve the remainder in the string.
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool NoYear = FALSE;
- int intPrevValue = 6;
-
- wxString strResults;
-
- intPrevValue = 5;
-
- // Look for type before continuing.
-
- if (wxSPropertySeg2.Mid(0, 2) == wxT("--")){
-
- strResults.Append(wxT("1604-"));
- NoYear = TRUE;
-
- strResults.Append(wxSPropertySeg2.Mid(2, 2) + wxT("-"));
- strResults.Append(wxSPropertySeg2.Mid(4, 2));
-
- } else {
-
- strResults.Append(wxSPropertySeg2.Mid(0, 4) + wxT("-"));
- strResults.Append(wxSPropertySeg2.Mid(4, 2) + wxT("-"));
- strResults.Append(wxSPropertySeg2.Mid(6, 2));
-
- }
-
-
-
- if (NoYear == TRUE){
-
- ContactDatav3.AddRaw(wxT("BDAY;X-APPLE-OMIT-YEAR=1604"), strResults);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-BDAY"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-BDAY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else {
-
- ContactDatav3.AddRaw(wxT("BDAY"), strResults);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-BDAY"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-BDAY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- }
-
- BirthdayProcessed = TRUE;
-
- } else if (wxSProperty == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
-
- // Process date. Preserve the remainder in the string.
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 13;
-
- wxString strResults;
- bool NoYear = FALSE;
-
- intPrevValue = 12;
-
- // Look for type before continuing.
-
- if (wxSPropertySeg2.Mid(0, 2) == wxT("--")){
-
- strResults.Append(wxT("1604-"));
- NoYear = TRUE;
-
- strResults.Append(wxSPropertySeg2.Mid(2, 2) + wxT("-"));
- strResults.Append(wxSPropertySeg2.Mid(4, 2));
-
- } else {
-
- strResults.Append(wxSPropertySeg2.Mid(0, 4) + wxT("-"));
- strResults.Append(wxSPropertySeg2.Mid(4, 2) + wxT("-"));
- strResults.Append(wxSPropertySeg2.Mid(6, 2));
-
- }
-
- if (NoYear == TRUE){
-
- ContactDatav3.AddRaw(wxT("ANNIVERSARY;X-APPLE-OMIT-YEAR=1604"), strResults);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-ANNIVERSARY"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-ANNIVERSARY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else {
-
- ContactDatav3.AddRaw(wxT("ANNIVERSARY"), strResults);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-ANNIVERSARY"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-ANNIVERSARY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- }
-
- AnniversaryProcessed = TRUE;
-
- } else if (wxSProperty == wxT("TZ")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 4;
-
- intPrevValue = 3;
-
- // Look for type before continuing.
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-TZ"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-TZ;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("ADR")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString AddressLabel;
- wxString AddressLang;
- wxString AddressAltID;
- wxString AddressPID;
- wxString AddressTokens;
- wxString AddressGeo;
- wxString AddressTimezone;
- wxString AddressType;
- wxString AddressMediatype;
- wxString AddressPOBox;
- wxString AddressExtended;
- wxString AddressStreet;
- wxString AddressLocality;
- wxString AddressCity;
- wxString AddressRegion;
- wxString AddressPostalCode;
- wxString AddressCountry;
- int intPrevValue = 5;
-
- intPrevValue = 4;
-
- // TODO: Check in value for X-ABLabel and use it if it is there.
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".ADR"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("Address"));
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-ADR"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".ADR"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("Address"));
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-ADR;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- ItemSeek++;
-
- } else if (wxSProperty == wxT("EMAIL")){
-
- // TODO: Continue from here! See ADR for good example (Replace initer with intPrevValue).
- // Remove inserted comma for Extra Tokens in frmContactEditor.cpp
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- std::map<int, int>::iterator SPoint;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString AddressLabel;
- wxString AddressLang;
- wxString AddressAltID;
- wxString AddressPID;
- wxString AddressTokens;
- wxString AddressGeo;
- wxString AddressTimezone;
- wxString AddressType;
- wxString AddressMediatype;
- wxString AddressPOBox;
- wxString AddressExtended;
- wxString AddressStreet;
- wxString AddressLocality;
- wxString AddressCity;
- wxString AddressRegion;
- wxString AddressPostalCode;
- wxString AddressCountry;
- int intPrevValue = 7;
-
- intPrevValue = 6;
-
- // TODO: Check in value for X-ABLabel and use it if it is there.
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".EMAIL"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("E-mail Address"));
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-EMAIL"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".EMAIL"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("E-mail Address"));
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-EMAIL;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- ItemSeek++;
-
- } else if (wxSProperty == wxT("IMPP")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- std::map<int, int>::iterator SPoint;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString IMPPType;
- wxString IMPPAddress;
- int intPrevValue = 6;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 5;
-
- // TODO: Check in value for X-ABLabel and use it if it is there.
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".IMPP"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("Instant Message"));
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-IMPP"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".IMPP"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("Instant Message"));
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-IMPP;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- ItemSeek++;
-
- } else if (wxSProperty == wxT("TEL")){
-
- // Check TEL and make sure it is functioning properly.
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int> TypeSplitPoints;
- std::map<int, int> TypeSplitLength;
- std::map<int, int>::iterator SLiter;
- std::map<int, int>::iterator SPoint;
- std::map<int, int>::iterator TSLiter;
- std::map<int, int>::iterator TSPoint;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString TelType;
- wxString TelNumber;
- wxString TelTypeUI;
- wxString TelTypeDetail;
- wxString TelTypeOut;
- wxString FinalFriendlyString;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 5;
- int intType = 0;
- int intSplitPoint = 0;
-
- intPrevValue = 4;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- // Process each value in type and translate each
- // part.
-
- // Strip out the quotes if they are there.
-
- size_t intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- TelTypeDetail = PropertyValue;
-
- intSplitSize = 0;
- intSplitsFound = 0;
- intSplitPoint = 0;
-
- for (int i = 0; i <= intPropertyValueLen; i++){
-
- intSplitSize++;
-
- if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
-
- if (intSplitsFound == 0){
-
- TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
- TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- } else {
-
- TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
- TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
-
- }
-
- intSplitsFound++;
- i++;
- intSplitPoint = i;
- intSplitSize = 0;
-
- }
-
- }
-
- TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
- TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
-
- int intTypeSeek = 0;
-
- for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
- typeiter != TypeSplitPoints.end(); ++typeiter){
-
- wxString TypePropertyName;
-
- TSLiter = TypeSplitLength.find(typeiter->first);
-
- TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
-
- if (intTypeSeek == 0){
-
-
- } else {
-
- TelTypeUI.Append(wxT(","));
-
- }
-
- if (TypePropertyName == wxT("home")){
-
- intType = 1;
-
- } else if (TypePropertyName == wxT("work")){
-
- intType = 2;
-
- }
-
- if (TypePropertyName == wxT("text")){
-
- if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Text")); } else { FinalFriendlyString.Append(_("Text")); }
-
- TelTypeOut.Append(wxT(";"));
- TelTypeOut.Append(wxT("type=TEXT"));
-
- } else if (TypePropertyName == wxT("voice")){
-
- if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Voice")); } else { FinalFriendlyString.Append(_("Voice")); }
-
- TelTypeOut.Append(wxT(";"));
- TelTypeOut.Append(wxT("type=VOICE"));
-
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("fax")){
-
- if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Fax")); } else { FinalFriendlyString.Append(_("Fax")); }
-
- TelTypeOut.Append(wxT(";"));
- TelTypeOut.Append(wxT("type=FAX"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("cell")){
-
- if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Mobile")); } else { FinalFriendlyString.Append(_("Mobile")); }
-
- TelTypeOut.Append(wxT(";"));
- TelTypeOut.Append(wxT("type=CELL"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("video")){
-
- if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Video")); } else { FinalFriendlyString.Append(_("Video")); }
-
- TelTypeOut.Append(wxT(";"));
- TelTypeOut.Append(wxT("type=VIDEO"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("pager")){
-
- if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Pager")); } else { FinalFriendlyString.Append(_("Pager")); }
-
- TelTypeOut.Append(wxT(";"));
- TelTypeOut.Append(wxT("type=PAGER"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("textphone")){
-
- //if (!TelTypeOut.IsEmpty()){ TelTypeOut.Append(wxT(";")); }
-
- if (!FinalFriendlyString.IsEmpty()){ FinalFriendlyString.Append(_(", Textphone")); } else { FinalFriendlyString.Append(_("Textphone")); }
-
- TelTypeOut.Append(wxT(";"));
- TelTypeOut.Append(wxT("type=TEXTPHONE"));
- intTypeSeek++;
-
- }
-
-
-
- }
-
- }
-
-
-
- }
-
- wxString FinalTel;
-
- // Remove 'tel:' if it is being used.
-
- if (wxSPropertySeg2.Mid(0, 4) == wxT("tel:")){
-
- FinalTel = wxSPropertySeg2.Mid(4);
-
- } else {
-
- FinalTel = wxSPropertySeg2;
-
- }
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".TEL") + TelTypeOut, FinalTel);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), FinalFriendlyString);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-TEL"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".TEL") + TelTypeOut, FinalTel);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), FinalFriendlyString);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-TEL;") + wxSPropertySeg1.Mid(4), wxSPropertySeg2);
-
- }
-
- ItemSeek++;
-
- } else if (wxSProperty == wxT("LANG")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 6;
-
- intPrevValue = 5;
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-LANG"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-LANG;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("GEO")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString GeoType;
- wxString GeoData;
- int intPrevValue = 5;
-
- intPrevValue = 4;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- wxString strFinalGeoValue;
- wxString strFinalType;
-
- if (wxSPropertySeg2.Mid(0, 3) == wxT("geo")){
-
- strFinalGeoValue = wxSPropertySeg2.Mid(5);
- strFinalType = wxT("geo");
-
- } else {
-
- wxStringTokenizer wSTSplit(wxSPropertySeg2, wxT(":"));
- strFinalType = wSTSplit.GetNextToken();
- strFinalGeoValue = wSTSplit.GetNextToken();
-
- }
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-GEO;X-GEOTYPE=") + strFinalType, wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-GEO;X-GEOTYPE=") + strFinalType + wxT(";") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("RELATED")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString RelatedType;
- wxString RelatedTypeOriginal;
- wxString RelatedName;
- bool FirstToken = TRUE;
- int intPrevValue = 9;
-
- intPrevValue = 8;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- wxString strDetail;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second - 1));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- if (PropertyName == wxT("TYPE") && FirstToken == TRUE){
-
- if (PropertyValue == wxT("contact")){
-
- strDetail = _("Contact");
-
- } else if (PropertyValue == wxT("acquaintance")){
-
- strDetail = _("Acquaintance");
-
- } else if (PropertyValue == wxT("friend")){
-
- strDetail = _("Friend");
-
- } else if (PropertyValue == wxT("met")){
-
- strDetail = _("Met");
-
- } else if (PropertyValue == wxT("co-worker")){
-
- strDetail = _("Co-worker");
-
- } else if (PropertyValue == wxT("colleague")){
-
- strDetail = _("Colleague");
-
- } else if (PropertyValue == wxT("co-resident")){
-
- strDetail = _("Co-resident");
-
- } else if (PropertyValue == wxT("neighbor")){
-
- strDetail = _("Neighbour");
-
- } else if (PropertyValue == wxT("child")){
-
- strDetail = _("Child");
-
- } else if (PropertyValue == wxT("parent")){
-
- strDetail = _("Parent");
-
- } else if (PropertyValue == wxT("sibling")){
-
- strDetail = _("Sibling");
-
- } else if (PropertyValue == wxT("spouse")){
-
- strDetail = _("Spouse");
-
- } else if (PropertyValue == wxT("kin")){
-
- strDetail = _("Kin");
-
- } else if (PropertyValue == wxT("muse")){
-
- strDetail = _("Muse");
-
- } else if (PropertyValue == wxT("crush")){
-
- strDetail = _("Crush");
-
- } else if (PropertyValue == wxT("date")){
-
- strDetail = _("Date");
-
- } else if (PropertyValue == wxT("sweetheart")){
-
- strDetail = _("Sweetheart");
-
- } else if (PropertyValue == wxT("me")){
-
- strDetail = _("Me");
-
- } else if (PropertyValue == wxT("agent")){
-
- strDetail = _("Agent");
-
- } else if (PropertyValue == wxT("emergency")){
-
- strDetail = _("Emergency");
-
- } else {
-
- strDetail = PropertyValue;
-
- }
-
- FirstToken = FALSE;
-
- }
-
- }
-
- if (strDetail.IsEmpty()){
-
- strDetail = _("Relation");
-
- }
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABRELATEDNAMES"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), strDetail);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-RELATED"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABRELATEDNAMES"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), strDetail);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-RELATED;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- ItemSeek++;
-
- } else if (wxSProperty == wxT("URL")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 5;
-
- intPrevValue = 4;
-
- // Todo: Check for X-ABLabel.
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".URL"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("URL"));
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-URL"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".URL"), wxSPropertySeg2);
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-ABLabel"), _("URL"));
- ContactDatav3.AddRaw(wxT("item") + wxString::Format(wxT("%i"), ItemSeek) + wxT(".X-VCARD4-URL;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- ItemSeek++;
-
- } else if (wxSProperty == wxT("TITLE")) {
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 7;
-
- intPrevValue = 6;
-
- // Look for type before continuing.
-
- if (TitleFirst == FALSE){
-
- ContactDatav3.AddRaw(wxT("TITLE"), wxSPropertySeg2);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-TITLE;X-FIRST=TRUE;")
- + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT(""));
-
- }
- TitleFirst = TRUE;
- ItemSeek++;
-
- } else {
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-TITLE"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-TITLE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"),
- wxSPropertySeg2);
-
- }
-
- }
-
- } else if (wxSProperty == wxT("ROLE")) {
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 6;
-
- intPrevValue = 5;
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-ROLE"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-ROLE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("ORG")) {
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 5;
-
- intPrevValue = 4;
-
- if (OrganisationFirst == FALSE){
-
- ContactDatav3.AddRaw(wxT("ORG"), wxSPropertySeg2);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-ORG;X-FIRST=TRUE;")
- + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT(""));
-
- }
- OrganisationFirst = TRUE;
- ItemSeek++;
-
- } else {
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-ORG"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-ORG;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"),
- wxSPropertySeg2);
-
- }
-
- }
-
- } else if (wxSProperty == wxT("NOTE")) {
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 6;
-
- intPrevValue = 5;
-
- if (NoteFirst == FALSE){
-
- ContactDatav3.AddRaw(wxT("NOTE"), wxSPropertySeg2);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-NOTE;X-FIRST=TRUE;")
- + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxT(""));
-
- }
- NoteFirst = TRUE;
- ItemSeek++;
-
- } else {
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-NOTE"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-NOTE;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"),
- wxSPropertySeg2);
-
- }
-
- }
-
- } else if (wxSProperty == wxT("CATEGORIES")) {
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString PropertyType;
- int intPrevValue = 12;
-
- intPrevValue = 11;
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-CATEGORIES"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-CATEGORIES;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("PHOTO")) {
-
- size_t intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 7;
-
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
-
- CaptureString(&wxSPropertySeg2, FALSE);
-
- for (int i = 0; i <= intPropertyLen; i++){
-
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(";")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 6){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- } else {
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- }
-
- intSplitSize = 0;
-
- }
-
- }
-
- wxString wxSPhotoURI;
- wxString wxSPhotoMIME;
- wxString wxSPhotoEncoding;
- wxString wxSPhotoData;
- std::string base64enc;
-
- if (intSplitsFound == 0){
-
- } else {
-
- std::map<int, int>::iterator striter;
-
- striter = SplitLength.find(1);
-
- wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":"));
-
- while (wSTDataType.HasMoreTokens() == TRUE){
-
- wxSPhotoURI = wSTDataType.GetNextToken();
- wxSPhotoMIME = wSTDataType.GetNextToken();
- break;
-
- }
-
- wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(","));
-
- while (wSTDataInfo.HasMoreTokens() == TRUE){
-
- wxSPhotoEncoding = wSTDataInfo.GetNextToken();
- wxSPhotoData = wSTDataInfo.GetNextToken();
- base64enc = wxSPhotoData.mb_str();
- break;
-
- }
-
- }
-
-
- if (PhotoFirst == FALSE){
-
- bool PhotoKeepData = FALSE;
-
- wxString wxSPhotoMIMEF;
-
- if (wxSPhotoMIME == wxT("image/png")){
- wxSPhotoMIMEF = wxT("PNG");
- } else if (wxSPhotoMIME == wxT("image/jpeg")){
- wxSPhotoMIMEF = wxT("JPEG");
- } else if (wxSPhotoMIME == wxT("image/gif")){
- wxSPhotoMIMEF = wxT("GIF");
- } else if (wxSPhotoMIME == wxT("image/bmp")){
- wxSPhotoMIMEF = wxT("BMP");
- } else {
- wxSPhotoMIMEF = wxT("UNKNOWN");
- PhotoKeepData = TRUE;
- }
-
- ContactDatav3.AddRaw(wxT("PHOTO;ENCODING=b;TYPE=") + wxSPhotoMIMEF, wxSPhotoData);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- } else {
-
- if (PhotoKeepData == TRUE){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-PHOTO;X-FIRST=TRUE;")
- + ContactLine.Mid((intPrevValue - 1), ((QuoteBreakPoint + 1) - (intPrevValue))), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-PHOTO;X-FIRST=TRUE;")
- + ContactLine.Mid((intPrevValue - 1), ((QuoteBreakPoint + 1) - (intPrevValue))), wxT(""));
-
- }
-
- }
- PhotoFirst = TRUE;
- ItemSeek++;
-
- } else {
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-PHOTO"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-PHOTO;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))) + wxT(":"),
- wxSPropertySeg2);
- }
-
- }
-
- } else if (wxSProperty == wxT("LOGO")) {
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 6;
-
- intPrevValue = 5;
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-LOGO"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-LOGO;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("SOUND")) {
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 7;
-
- intPrevValue = 6;
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-SOUND"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-SOUND;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("CALURI")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 8;
-
- intPrevValue = 7;
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-CALURI"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-CALURI;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("CALADRURI")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 11;
-
- intPrevValue = 10;
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-CALADRURI"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-CALADRURI;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("FBURL")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 7;
-
- intPrevValue = 6;
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-FBURL"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-FBURL;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("KEY")){
-
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- int intPrevValue = 5;
-
- intPrevValue = 4;
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-KEY"), wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-KEY;") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty == wxT("UID")){
-
- ContactDatav3.AddRaw(wxT("UID"), wxSPropertySeg2);
-
- } else if (wxSProperty.Mid(0, 3) == wxT("VND")){
-
- // Split the Vendor three ways.
-
- wxStringTokenizer wSTVendorDetails(wxSPropertySeg1, wxT("-"));
-
- wxString wxSVNDID;
- wxString wxSVNDPropName;
-
- size_t intPrevValue = (wxSProperty.Len() + 1);
-
- while (wSTVendorDetails.HasMoreTokens() == TRUE){
-
- wSTVendorDetails.GetNextToken();
- wxSVNDID = wSTVendorDetails.GetNextToken();
- wxSVNDPropName = wSTVendorDetails.GetNextToken();
- break;
-
- }
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-") + wxSProperty, wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxT("X-VCARD4-") + wxSProperty + wxT(";") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- } else if (wxSProperty.Mid(0, 2) == wxT("X-")){
-
- size_t intPrevValue = (wxSProperty.Len() + 1);
-
- if (((QuoteBreakPoint + 1) - intPrevValue) <= 0){
-
- ContactDatav3.AddRaw(wxSProperty, wxSPropertySeg2);
-
- } else {
-
- ContactDatav3.AddRaw(wxSProperty + wxT(";") + ContactLine.Mid(intPrevValue, ((QuoteBreakPoint + 1) - (intPrevValue + 1))), wxSPropertySeg2);
-
- }
-
- }
-
- // Reset the variables.
-
- QuoteMode = FALSE;
- PropertyFind = TRUE;
- ExtraLineSeek = TRUE;
- ContactLineLen = 0;
- QuoteBreakPoint = 0;
- ContactLine.Clear();
- wxSProperty.Clear();
-
- }
-
- ContactDatav3.AddRaw(wxT("END"), wxT("VCARD"));
- *wxSData = ContactDatav3.WriteString();
-
- return TRUE;
-
-}
-
-bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
-
- std::map<int, wxString> ContactFileLines;
- std::map<int, bool> ContactFileProcessed;
- std::map<int, bool> ContactFileProcessedWorking;
- std::map<int, wxString>::iterator striter;
- std::map<int,bool>::iterator iterbool;
- std::map<int,bool>::iterator iterboolsub;
- wxString ContactLineRec;
-
- // Process the received data.
-
- wxStringTokenizer wSTContactFileLines(*wxSData, wxT("\r\n"));
-
- int ContactLineSeek = 0;
-
- while (wSTContactFileLines.HasMoreTokens() == TRUE){
-
- ContactLineRec = wSTContactFileLines.GetNextToken();
- ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLineRec));
- ContactFileProcessed.insert(std::make_pair(ContactLineSeek, FALSE));
- ContactLineSeek++;
-
- }
-
- bool QuoteMode = FALSE;
- bool PropertyFind = TRUE;
- bool ExtraLineSeek = TRUE;
- bool ExtraLineSeekSub = TRUE;
- bool BirthdayProcessed = FALSE;
- bool AnniversaryProcessed = FALSE;
- bool FNProcessed = FALSE;
- bool GenderProcessed = FALSE;
- bool NameProcessed = FALSE;
- bool FNFirst = FALSE;
- bool NicknameFirst = FALSE;
- bool TitleFirst = FALSE;
- bool OrganisationFirst = FALSE;
- bool NoteFirst = FALSE;
- bool PhotoFirst = FALSE;
- bool LogoFirst = FALSE;
- bool NameFirst = FALSE;
- bool FoundData = FALSE;
- int intExtraNickname = 0;
- wxString wxSProperty;
- wxString wxSPropertyVCARD4;
- wxString wxSPropertySeg1;
- wxString wxSPropertySeg2;
- wxString wxSPropertyNextLine;
- wxString ContactLine;
- wxString ContactLineSub;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyDataStr;
- size_t ContactLineLen = 0;
- size_t ContactLineSubLen = 0;
- int QuoteBreakPoint = 0;
- size_t intPrevValueSub = 0;
-
- std::map<wxString, wxString> PropertyData;
- std::map<wxString, bool> PropertyLock;
- std::map<wxString, wxString> TempPropertyData;
- std::map<wxString, bool> TempPropertyLock;
- std::map<int, int> TempSplitPoints;
- std::map<int, int> TempSplitLength;
- std::map<int, int>::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<int,wxString>::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<int,int> DataLineProcess;
- std::map<int, bool>::iterator DLSLiter;
- std::map<int,int> DataLineProcessOriginal;
- int DataLineSeek = 0;
- int DataLineSeekOrig = 0;
-
- std::map<int,wxString>::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<int,wxString>::iterator itersub = ContactFileLines.begin();
- itersub != ContactFileLines.end(); ++itersub){
-
- //DataLineProcess = DataLineProcessOriginal;
- //DataLineSeek = DataLineSeekOrig;
-
- ContactLineSub = itersub->second;
-
- ExtraLineSeekSub = TRUE;
-
- iterboolsub = ContactFileProcessed.find(itersub->first);
- //std::map<int,bool>::iterator iterorig = ContactFileProcessed.find(itersub->first);
- //std::map<int,bool>::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<int,wxString>::iterator itersub = iter;
-
- DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first));
- DataLineSeek++;
-
-
-
- while (ExtraLineSeekSub == TRUE){
-
- if (itersub == ContactFileLines.end()){
- ExtraLineSeekSub = FALSE;
- continue;
- } else {
- itersub++;
-
- }
-
- iterboolsub = ContactFileProcessedWorking.find(itersub->first);
-
- wxSPropertyNextLine = itersub->second;
-
- if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
-
- wxSPropertyNextLine.Remove(0, 1);
- //wxSPropertyNextLine.Trim(FALSE);
- //ContactLine.Trim();
- ContactLineSub.Append(wxSPropertyNextLine);
- //iterboolsub->second = TRUE;
- DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first));
- DataLineSeek++;
-
- } else {
-
- itersub--;
- ExtraLineSeekSub = FALSE;
-
- }
-
- }
-
- /*while (ExtraLineSeekSub == TRUE && iterboolsub != ContactFileProcessedWorking.end()){
-
- // Check if there is extra data on the next line
- // (indicated by space or tab at the start) and add data.
-
- itersub++;
-
- iterboolsub = ContactFileProcessedWorking.find(itersub->first);
-
- if (iterboolsub->second == TRUE){
-
- continue;
-
- }
-
- if (itersub == ContactFileLines.end()){
-
- break;
-
- }
-
- wxSPropertyNextLine = itersub->second;
-
- if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
-
- wxSPropertyNextLine.Remove(0, 1);
- //wxSPropertyNextLine.Trim(FALSE);
- //ContactLine.Trim();
- ContactLineSub.Append(wxSPropertyNextLine);
- //iterboolsub->second = TRUE;
- DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first));
- DataLineSeek++;
-
- } else {
-
- itersub--;
- ExtraLineSeekSub = FALSE;
-
- }
-
- if (iterboolsub == ContactFileProcessedWorking.end()){
-
- break;
- ExtraLineSeekSub = FALSE;
-
- }
-
- }*/
-
- ContactLineSubLen = ContactLineSub.Len();
- PropertyFind = TRUE;
- wxSPropertySub.clear();
-
- for (int i = 0; i <= ContactLineSubLen; i++){
-
- if ((ContactLineSub.Mid(i, 1) == wxT(";") || ContactLineSub.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
-
- PropertyFind = FALSE;
-
- } else if (PropertyFind == TRUE){
-
- wxSPropertySub.Append(ContactLineSub.Mid(i, 1));
-
- }
-
- if (ContactLineSub.Mid(i, 1) == wxT("\"")){
-
- if (QuoteMode == TRUE){
-
- QuoteMode = FALSE;
-
- } else {
-
- QuoteMode = TRUE;
-
- }
-
- }
-
- if (ContactLineSub.Mid(i, 1) == wxT(":") && ContactLineSub.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
-
- QuoteBreakPoint = i;
- break;
-
- }
-
- }
-
- if (wxSPropertySub != wxSPropertyVCARD4){
-
- wxSPropertySub.clear();
- DataLineSeek = 0;
- DataLineProcess.clear();
- continue;
-
- }
-
- wxSPropertySeg1Sub = ContactLineSub.Mid(0, QuoteBreakPoint);
- wxSPropertySeg2Sub = ContactLineSub.Mid((QuoteBreakPoint + 1));
-
- // Split the property name data.
-
- // Strip the X-VCARD4- from the variable.
-
- wxString wxSPropertyChopped = wxSPropertySeg1Sub.Mid(9);
-
- intPrevValueSub = (wxSProperty.Len() + 2);
-
- SplitValuesData(&wxSPropertyChopped, &TempSplitPoints, &TempSplitLength, (int)intPrevValueSub, &TempPropertyData);
-
- // Process the splitted data into temporary property data.
-
- // Look for certain property names and the X-FIRST
- // property name.
-
- bool ProcessData = FALSE;
-
- // Check for X-FIRST.
-
- for (std::map<wxString, wxString>::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<wxString, wxString>::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<int,int>::iterator dpiter = DataLineProcess.begin();
- dpiter != DataLineProcess.end(); ++dpiter){
-
- DLSLiter = ContactFileProcessed.find(dpiter->second);
- DLSLiter->second = TRUE;
-
- }
-
- for (std::map<int,int>::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<wxString, wxString>::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<int,wxString>::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<int,wxString>::iterator itersub = iter;
-
- while (ExtraLineSeek == TRUE){
-
- // Check if there is extra data on the next line
- // (indicated by space or tab at the start) and add data.
-
- if (itersub == ContactFileLines.end()){
- ExtraLineSeekSub = FALSE;
- continue;
- }
- else {
- itersub++;
-
- }
-
- iterboolsub = ContactFileProcessedWorking.find(itersub->first);
-
- if (iterboolsub == ContactFileProcessedWorking.end()){
-
- break;
-
- }
-
- if (iterboolsub->second == TRUE){
-
- continue;
-
- }
-
- if (itersub == ContactFileLines.end()){
-
- break;
-
- }
-
- wxSPropertyNextLine = itersub->second;
-
- if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
-
- wxSPropertyNextLine.Remove(0, 1);
- //wxSPropertyNextLine.Trim(FALSE);
- //ContactLine.Trim();
- ContactLine.Append(wxSPropertyNextLine);
- iterboolsub->second = TRUE;
-
- } else {
-
- ExtraLineSeek = FALSE;
-
- }
-
- }
-
- ContactLineLen = ContactLine.Len();
-
- for (int i = 0; i <= ContactLineLen; i++){
-
- if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
-
- PropertyFind = FALSE;
-
- } else if (PropertyFind == TRUE){
-
- wxSProperty.Append(ContactLine.Mid(i, 1));
-
- }
-
- if (ContactLine.Mid(i, 1) == wxT("\"")){
-
- if (QuoteMode == TRUE){
-
- QuoteMode = FALSE;
-
- } else {
-
- QuoteMode = TRUE;
-
- }
-
- }
-
- if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
-
- QuoteBreakPoint = i;
- break;
-
- }
-
- }
-
- wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
- wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
-
- wxStringTokenizer wxSPropertySegSplit(wxSPropertySeg1, wxT(";"));
- wxSProperty = wxSPropertySegSplit.GetNextToken();
-
- std::map<int,int> DataLineProcess;
- std::map<int, bool>::iterator DLSLiter;
-
- // Look for the X-VCARD4-(variablename) equivilant.
-
- wxSPropertyVCARD4 = wxT("X-VCARD4-") + wxSProperty;
-
- // Sort out remainder of the types.
-
- ConvertV4PropertyProc(&wxSProperty, &wxSPropertySeg1, &wxSPropertySeg2,
- &wxSPropertyValues, &wxSPropertyData, &wxSPropertyXVCard4Value,
- &wxSPropertyNameConv, &PropertyData, &PropertyLock, FALSE, &VCard3Value, &XVCard4Value);
-
- wxString FinalPropertyData;
-
- FinalPropertyData.Append(wxSPropertyNameConv);
-
- for (std::map<wxString, wxString>::iterator striter = PropertyData.begin();
- striter != PropertyData.end(); ++striter){
-
- FinalPropertyData.Append(wxT(";"));
- FinalPropertyData.Append(striter->first);
- FinalPropertyData.Append(wxT("="));
- FinalPropertyData.Append(striter->second);
-
- }
-
- wxString FinalPropValue;
-
- if (wxSPropertyXVCard4Value.IsEmpty()){
-
- FinalPropValue = wxSPropertyData;
-
- } else {
-
- if (wxSPropertyXVCard4Value != wxSPropertyData){
-
- FinalPropValue = wxSPropertyXVCard4Value;
-
- }
-
- }
-
- vCardOut->AddRaw(FinalPropertyData, FinalPropValue);
-
- wxSProperty.clear();
- wxSPropertySub.Clear();
- wxSPropertySeg1.Clear();
- wxSPropertySeg2.Clear();
- wxSPropertyValues.Clear();
- wxSPropertyData.Clear();
- wxSPropertyXVCard4Value.Clear();
- wxSPropertyNameConv.Clear();
- //FinalPropertyData.clear();
- //FinalPropValue.clear();
- PropertyData.clear();
- PropertyLock.clear();
- ContactLine.clear();
- XVCard4Value = FALSE;
- VCard3Value = FALSE;
-
- }
-
- int FNCount = 0;
- int NameCount = 0;
- int NicknameCount = 0;
- int ADRCount = 0;
- int EmailCount = 0;
- int IMPPCount = 0;
- int TelCount = 0;
- int LangCount = 0;
- int TZCount = 0;
- int GeoCount = 0;
- int URLCount = 0;
- int RelatedCount = 0;
- int TitleCount = 0;
- int RoleCount = 0;
- int OrgCount = 0;
- int NoteCount = 0;
- int CategoryCount = 0;
- int PhotoCount = 0;
- int LogoCount = 0;
- int SoundCount = 0;
- int CalAdrCount = 0;
- int CalReqAdrCount = 0;
- int FreeBusyCount = 0;
- int KeyCount = 0;
- int VendorCount = 0;
- int XTokenCount = 0;
- int ItemSeek = 1;
- int MaxItemNumber = 0;
- int ItemOrdered = 0;
- int ItemUnordered = 0;
- int ItemNumber = 0;
- size_t ItemStringSeekLen = 0;
- int ItemSeekSub = 0;
- int ItemSeekSecSub = 0;
- //int intValueSeek = 1;
-
- std::map<int, wxString> NumberedName;
- std::map<int, wxString> NumberedData;
- std::map<int, wxString> NumberedPropValues;
- std::map<int, wxString> NumberedPropOldValue;
-
- std::map<int, wxString> UnNumberedName;
- std::map<int, wxString> UnNumberedData;
- std::map<int, wxString> UnNumberedPropValues;
- std::map<int, wxString> UnNumberedPropOldValue;
-
- // Part 1: Get the itemn number.
-
- std::map<int,bool>::iterator iterboolsecsub;
- std::map<int,wxString>::iterator itersub;
- std::map<int, wxString> TempData;
- PropertyData.clear();
- PropertyLock.clear();
- wxString ItemString;
- wxString ItemStringSeek;
- wxString ItemPropName;
- ContactLineSeek = 0;
-
- ContactLineSub.clear();
- ExtraLineSeekSub = 0;
- wxString wxSPropertyNextLineSub;
- ContactLineSubLen = 0;
- int ItemIndex = 0;
- PropertFindSub.clear();
- wxSPropertySub.clear();
- wxSPropertySeg1Sub.clear();
- wxSPropertySeg2Sub.clear();
- wxSPropertyValues.clear();
- wxSPropertyData.clear();
- wxSPropertyNameConv.clear();
- wxSPropertyXVCard4Value.clear();
- ItemProcString.clear();
-
- XVCard4Value = FALSE;
- VCard3Value = FALSE;
- SeekItemData = FALSE;
-
- std::map<wxString, void*> ItemMapIndex;
- //std::map<wxString, wxString> 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<int,wxString>::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<int,wxString>::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<int,wxString> *ItemListData;
- ItemListData = new std::map<int,wxString>;
-
- 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<int,wxString>::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<wxString, void*>::iterator iter = ItemMapIndex.begin();
- iter != ItemMapIndex.end(); ++iter){
-
- std::map<int, wxString> *ItemDataPtr;
-
- ItemDataPtr = (std::map<int,wxString>*)iter->second;
-
- for (std::map<int,wxString>::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<wxString, wxString>::iterator striter = PropertyData.begin();
- striter != PropertyData.end(); ++striter){
-
- FinalPropertyData.Append(wxT(";"));
- FinalPropertyData.Append(striter->first);
- FinalPropertyData.Append(wxT("="));
- FinalPropertyData.Append(striter->second);
-
- }
-
- wxString FinalPropValue;
-
- if (wxSPropertyXVCard4Value.IsEmpty()){
-
- FinalPropValue = wxSPropertyData;
-
- } else {
-
- if (wxSPropertyXVCard4Value != wxSPropertyData){
-
- FinalPropValue = wxSPropertyData;
-
- } else {
-
- FinalPropValue = wxSPropertyXVCard4Value;
-
- }
-
- }
-
- vCardOut->AddRaw(FinalPropertyData, FinalPropValue);
-
- wxSProperty.clear();
- wxSPropertySub.Clear();
- wxSPropertySeg1Sub.Clear();
- wxSPropertySeg2Sub.Clear();
- wxSPropertyValues.Clear();
- wxSPropertyData.Clear();
- wxSPropertyXVCard4Value.Clear();
- wxSPropertyNameConv.Clear();
- FinalPropertyData.clear();
- FinalPropValue.clear();
- PropertyData.clear();
- PropertyLock.clear();
- ContactLine.clear();
- XVCard4Value = FALSE;
- VCard3Value = FALSE;
-
- TempData.clear();
- //PropertyData.clear();
- //PropertyLock.clear();
-
- }
-
- // Delete data.
-
- std::map<int, wxString> *ItemEraseData;
-
- for (std::map<wxString, void*>::iterator iter = ItemMapIndex.begin();
- iter != ItemMapIndex.end(); ++iter){
-
- ItemEraseData = (std::map<int,wxString>*)iter->second;