1 // ContactDataObject.cpp - Client Data Object.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "ContactDataObject.h"
21 ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
23 if (!wxFileExists(Filename)){
25 return CONTACTLOAD_FILEMISSING;
31 if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
33 return CONTACTLOAD_FILEERROR;
37 // Check that the vCard is a valid vCard 4.0 file.
39 vCard vCard4FormatCheck;
41 vCard4FormatCheck.LoadFile(Filename);
43 if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){
45 return CONTACTLOAD_FILEINVALIDFORMAT;
49 // Check that the vCard meets the base specification.
51 if (!vCard4FormatCheck.MeetBaseSpecification()){
53 return CONTACTLOAD_FILEBASESPECFAIL;
57 wxStringTokenizer wSTContactFileLines(vCard4FormatCheck.WriteString(), wxT("\r\n"));
59 std::map<int, wxString> ContactFileLines;
61 int ContactLineSeek = 0;
63 while (wSTContactFileLines.HasMoreTokens() == TRUE){
65 wxString ContactLine = wSTContactFileLines.GetNextToken();
66 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
71 wxString wxSPropertyNextLine;
73 bool ExtraLineSeek = TRUE;
74 bool QuoteMode = FALSE;
75 bool PropertyFind = TRUE;
76 bool KindProcessed = FALSE;
77 bool NameProcessed = FALSE;
78 bool GenderProcessed = FALSE;
79 bool BirthdayProcessed = FALSE;
80 bool AnniversaryProcessed = FALSE;
81 bool UIDProcessed = FALSE;
82 bool RevisionProcessed = FALSE;
83 int ContactLineLen = 0;
84 int QuoteBreakPoint = 0;
88 int NicknameCount = 0;
89 int TimeZoneCount = 0;
93 int TelephoneCount = 0;
94 int LanguageCount = 0;
95 int GeographicCount = 0;
100 int OrganisationCount = 0;
102 int CategoryCount = 0;
106 int CalendarCount = 0;
107 int CalendarAddressCount = 0;
108 int FreeBusyAddressCount = 0;
113 int ClientPIDCount = 0;
114 wxString ContactLine;
115 wxString PropertyLine;
116 wxString PropertySeg1;
117 wxString PropertySeg2;
118 wxString PropertyNextLine;
121 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
122 iter != ContactFileLines.end(); ++iter){
124 ExtraLineSeek = TRUE;
130 PropertyLine.Clear();
131 PropertySeg1.Clear();
132 PropertySeg2.Clear();
135 ContactLine = iter->second;
137 while (ExtraLineSeek == TRUE){
139 // Check if there is extra data on the next line
140 // (indicated by space or tab at the start) and add data.
144 if (iter == ContactFileLines.end()){
151 PropertyNextLine = iter->second;
153 if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
155 PropertyNextLine.Remove(0, 1);
156 ContactLine.Append(PropertyNextLine);
161 ExtraLineSeek = FALSE;
167 ContactLineLen = ContactLine.Len();
169 // Make sure we are not in quotation mode.
170 // Make sure colon does not have \ or \\ before it.
172 for (int i = 0; i <= ContactLineLen; i++){
174 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
176 PropertyFind = FALSE;
178 } else if (PropertyFind == TRUE){
180 Property.Append(ContactLine.Mid(i, 1));
184 if (ContactLine.Mid(i, 1) == wxT("\"")){
186 if (QuoteMode == TRUE){
198 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
207 // Split that line at the point into two variables (ignore the colon).
209 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
210 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
212 if (Property == wxT("KIND") && KindProcessed == FALSE){
214 ProcessKind(PropertySeg2);
216 } else if (Property == wxT("UID") && UIDProcessed == FALSE){
218 UIDToken = PropertySeg2;
221 } else if (Property == wxT("SOURCE")){
223 ProcessSource(PropertySeg1, PropertySeg2, &SourceCount);
226 } else if (Property == wxT("XML")){
228 ProcessXML(PropertySeg1, PropertySeg2, &XMLCount);
231 } else if (Property == wxT("REV") && RevisionProcessed == FALSE){
233 ProcessRevision(PropertySeg1, PropertySeg2);
234 RevisionProcessed = TRUE;
236 } else if (Property == wxT("MEMBER")){
238 ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
241 } else if (Property == wxT("FN")){
243 ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
246 } else if (Property == wxT("N") && NameProcessed == FALSE){
248 ProcessN(PropertySeg1, PropertySeg2);
249 NameProcessed = TRUE;
251 } else if (Property == wxT("CLIENTPIDMAP")){
253 ProcessClientPIDMap(PropertySeg1, PropertySeg2, &ClientPIDCount);
256 } else if (Property == wxT("NICKNAME")){
258 ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
261 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
263 ProcessGender(PropertySeg1, PropertySeg2);
264 GenderProcessed = TRUE;
266 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
268 ProcessBirthday(PropertySeg1, PropertySeg2);
269 BirthdayProcessed = TRUE;
271 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
273 ProcessAnniversary(PropertySeg1, PropertySeg2);
274 AnniversaryProcessed = TRUE;
276 } else if (Property == wxT("TZ")){
278 ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
281 } else if (Property == wxT("ADR")){
283 ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
286 } else if (Property == wxT("EMAIL")){
288 ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);
291 } else if (Property == wxT("IMPP")){
293 ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
296 } else if (Property == wxT("TEL")){
298 ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
301 } else if (Property == wxT("LANG")){
303 // See frmContactEditor-LoadLanguage.cpp
305 ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
308 } else if (Property == wxT("GEO")){
310 // See frmContactEditor-LoadGeo.cpp
312 ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);
315 } else if (Property == wxT("RELATED")){
317 // See fromContactEditor-LoadRelated.cpp
319 ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);
322 } else if (Property == wxT("URL")){
324 // See frmContactEditor-LoadURL.cpp
326 ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
329 } else if (Property == wxT("TITLE")) {
331 // See frmContactEditor-LoadTitle.cpp
333 ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
336 } else if (Property == wxT("ROLE")) {
338 // See frmContactEditor-LoadTitle.cpp
340 ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
343 } else if (Property == wxT("ORG")) {
345 // See frmContactEditor-LoadOrg.cpp
347 ProcessOrganisation(PropertySeg1, PropertySeg2, &OrganisationCount);
350 } else if (Property == wxT("NOTE")) {
352 // See frmContactEditor-LoadNote.cpp
354 ProcessNote(PropertySeg1, PropertySeg2, &NoteCount);
357 } else if (Property == wxT("CATEGORIES")) {
359 // See frmContactEditor-LoadCategory.cpp
361 ProcessCategory(PropertySeg1, PropertySeg2, &CategoryCount);
364 } else if (Property == wxT("PHOTO")) {
366 // See frmContactEditor-LoadPhoto.cpp
368 ProcessPhoto(PropertySeg1, PropertySeg2, &PhotoCount);
371 } else if (Property == wxT("LOGO")) {
373 // See frmContactEditor-LoadPhoto.cpp
375 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
378 } else if (Property == wxT("LOGO")) {
380 // See frmContactEditor-LoadPhoto.cpp
382 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
385 } else if (Property == wxT("SOUND")) {
387 // See frmContactEditor-LoadSound.cpp
389 ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
392 } else if (Property == wxT("CALURI")){
394 // See frmContactEditor-LoadCalendar.cpp
396 ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
399 } else if (Property == wxT("CALADRURI")){
401 ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
402 CalendarAddressCount++;
404 } else if (Property == wxT("FBURL")){
406 // See frmContactEditor-LoadCalendar.cpp
408 ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
409 FreeBusyAddressCount++;
411 } else if (Property == wxT("KEY")){
413 // See frmContactEditor-LoadKey.cpp
415 ProcessKey(PropertySeg1, PropertySeg2, &KeyCount);
418 } else if (Property.Mid(0, 3) == wxT("VND")){
420 ProcessVendor(PropertySeg1, PropertySeg2, &VendorCount);
423 } else if (Property.Mid(0, 2) == wxT("X-")){
425 XTokenList.insert(std::make_pair(XTokenCount, PropertySeg2));
426 XTokenListTokens.insert(std::make_pair(XTokenCount, PropertySeg1.Mid(2)));
433 return CONTACTLOAD_OK;
437 void ContactDataObject::ProcessKind(wxString KindType){
439 if (KindType == wxT("individual")){
441 ContactKind = CONTACTKIND_INDIVIDUAL;
443 } else if (KindType == wxT("group")){
445 ContactKind = CONTACTKIND_GROUP;
447 } else if (KindType == wxT("org")){
449 ContactKind = CONTACTKIND_ORGANISATION;
451 } else if (KindType == wxT("location")){
453 ContactKind = CONTACTKIND_LOCATION;
457 ContactKind = CONTACTKIND_NONE;
462 void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString PropertySeg2){
464 size_t intPropertyLen = PropertySeg1.Len();
465 std::map<int, int> SplitPoints;
466 std::map<int, int> SplitLength;
467 std::map<int, int>::iterator SLiter;
468 wxString PropertyData;
469 wxString PropertyName;
470 wxString PropertyValue;
471 wxString PropertyTokens;
472 bool FirstToken = TRUE;
473 int intSplitsFound = 0;
474 int intSplitSize = 0;
475 int intPrevValue = 5;
479 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
483 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
484 intiter != SplitPoints.end(); ++intiter){
486 SLiter = SplitLength.find(intiter->first);
488 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
490 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
491 PropertyName = PropertyElement.GetNextToken();
492 PropertyValue = PropertyElement.GetNextToken();
494 intPrevValue = intiter->second;
496 // Process properties.
498 size_t intPropertyValueLen = PropertyValue.Len();
500 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
502 PropertyValue.Trim();
503 PropertyValue.RemoveLast();
507 if (PropertyValue.Mid(0, 1) == wxT("\"")){
509 PropertyValue.Remove(0, 1);
513 CaptureString(&PropertyValue, FALSE);
515 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
519 CaptureString(&PropertySeg2, FALSE);
521 Revision = PropertySeg2;
523 if (!PropertyTokens.IsEmpty()){
525 RevisionTokens = PropertyTokens;
532 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
534 size_t intPropertyLen = PropertySeg1.Len();
535 std::map<int, int> SplitPoints;
536 std::map<int, int> SplitLength;
537 std::map<int, int>::iterator SLiter;
538 wxString PropertyData;
539 wxString PropertyName;
540 wxString PropertyValue;
541 wxString PropertyTokens;
542 bool FirstToken = TRUE;
543 bool PropertyMatched = FALSE;
544 int intSplitsFound = 0;
545 int intSplitSize = 0;
546 int intPrevValue = 8;
550 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
554 PropertyType PropType = PROPERTY_NONE;
556 // Look for type before continuing.
558 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
562 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
563 intiter != SplitPoints.end(); ++intiter){
565 SLiter = SplitLength.find(intiter->first);
567 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
569 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
570 PropertyName = PropertyElement.GetNextToken();
571 PropertyValue = PropertyElement.GetNextToken();
573 intPrevValue = intiter->second;
575 // Process properties.
577 size_t intPropertyValueLen = PropertyValue.Len();
579 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
581 PropertyValue.Trim();
582 PropertyValue.RemoveLast();
586 if (PropertyValue.Mid(0, 1) == wxT("\"")){
588 PropertyValue.Remove(0, 1);
592 CaptureString(&PropertyValue, FALSE);
594 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
595 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
596 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
597 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
599 if (PropertyMatched == TRUE){
601 PropertyMatched = FALSE;
606 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
610 intPropertyLen = PropertySeg2.Len();
617 CaptureString(&PropertySeg2, FALSE);
619 // Add the data to the General/Home/Work address variables.
625 SourceListType.insert(std::make_pair(*SourceCount, "home"));
628 SourceListType.insert(std::make_pair(*SourceCount, "work"));
632 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
634 if (!PropertyTokens.IsEmpty()){
636 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
642 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
644 std::map<int, int> SplitPoints;
645 std::map<int, int> SplitLength;
647 int intPrevValue = 5;
651 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
655 wxString PropertyName;
656 wxString PropertyValue;
657 wxString PropertyData;
658 wxString PropertyTokens;
659 std::map<int,int>::iterator SLiter;
660 bool FirstToken = TRUE;
661 bool PropertyMatched = FALSE;
663 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
664 intiter != SplitPoints.end(); ++intiter){
666 SLiter = SplitLength.find(intiter->first);
668 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
670 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
671 PropertyName = PropertyElement.GetNextToken();
672 PropertyValue = PropertyElement.GetNextToken();
674 intPrevValue = intiter->second;
676 CaptureString(&PropertyValue, FALSE);
678 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
680 if (PropertyMatched == TRUE){
682 PropertyMatched = FALSE;
689 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
693 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
695 std::map<int, int> SplitPoints;
696 std::map<int, int> SplitLength;
698 int intPrevValue = 8;
702 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
706 wxString PropertyName;
707 wxString PropertyValue;
708 wxString PropertyData;
709 wxString PropertyTokens;
710 std::map<int,int>::iterator SLiter;
711 bool FirstToken = TRUE;
712 bool PropertyMatched = FALSE;
714 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
715 intiter != SplitPoints.end(); ++intiter){
717 SLiter = SplitLength.find(intiter->first);
719 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
721 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
722 PropertyName = PropertyElement.GetNextToken();
723 PropertyValue = PropertyElement.GetNextToken();
725 intPrevValue = intiter->second;
727 CaptureString(&PropertyValue, FALSE);
729 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
730 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
731 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
732 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
734 if (PropertyMatched == TRUE){
736 PropertyMatched = FALSE;
741 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
745 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
747 if (!PropertyTokens.IsEmpty()){
749 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
756 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
758 std::map<int, int> SplitPoints;
759 std::map<int, int> SplitLength;
761 int intPrevValue = 4;
765 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
769 wxString PropertyName;
770 wxString PropertyValue;
771 wxString PropertyData;
772 wxString PropertyTokens;
773 std::map<int,int>::iterator SLiter;
774 bool FirstToken = TRUE;
775 bool PropertyMatched = FALSE;
777 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
778 intiter != SplitPoints.end(); ++intiter){
780 SLiter = SplitLength.find(intiter->first);
782 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
784 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
785 PropertyName = PropertyElement.GetNextToken();
786 PropertyValue = PropertyElement.GetNextToken();
788 intPrevValue = intiter->second;
790 CaptureString(&PropertyValue, FALSE);
792 if (PropertyName == wxT("TYPE")){
794 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
795 PropertyValue == wxT("work") ){
797 FullNamesListType.erase(*FNCount);
798 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
802 PropertyMatched = TRUE;
806 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
807 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
808 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
809 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
811 if (PropertyMatched == TRUE){
813 PropertyMatched = FALSE;
818 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
820 if (FirstToken == TRUE){
822 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
827 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
835 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
837 if (!PropertyTokens.IsEmpty()){
839 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
845 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
847 std::map<int, int> SplitPoints;
848 std::map<int, int> SplitLength;
850 int intPrevValue = 3;
854 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
858 wxString PropertyName;
859 wxString PropertyValue;
860 wxString PropertyData;
861 wxString PropertyTokens;
862 std::map<int,int>::iterator SLiter;
863 bool FirstToken = TRUE;
865 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
866 intiter != SplitPoints.end(); ++intiter){
868 SLiter = SplitLength.find(intiter->first);
870 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
872 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
873 PropertyName = PropertyElement.GetNextToken();
874 PropertyValue = PropertyElement.GetNextToken();
876 intPrevValue = intiter->second;
878 CaptureString(&PropertyValue, FALSE);
880 if (PropertyName == wxT("ALTID")){
882 NameAltID = PropertyValue;
884 } else if (PropertyName == wxT("LANGUAGE")){
886 NameLanguage = PropertyValue;
888 } else if (PropertyName == wxT("SORT-AS")){
890 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
891 PropertyValue.Len() >= 3){
892 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
895 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
897 if (FirstToken == TRUE){
899 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
904 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
912 // Split the name data.
914 int intSplitSeek = 0;
915 int intSplitsFound = 0;
916 int intSplitSize = 0;
917 int intPropertyLen = PropertySeg2.Len();
919 std::map<int,wxString> NameValues;
922 for (int i = 0; i <= intPropertyLen; i++){
924 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
926 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
931 if (intSplitsFound == 4){
933 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
947 // Split the data into several parts.
949 for (std::map<int, wxString>::iterator iter = NameValues.begin();
950 iter != NameValues.end(); ++iter){
952 if (iter->first == 1){
954 // Deal with family name.
956 NameSurname = iter->second;
958 } else if (iter->first == 2){
960 // Deal with given names.
962 NameForename = iter->second;
964 } else if (iter->first == 3){
966 // Deal with additional names.
968 NameOtherNames = iter->second;
970 } else if (iter->first == 4){
972 // Deal with honorifix prefixes and suffixes.
974 NameTitle = iter->second;
978 if (iter == NameValues.end()){
984 NameSuffix = iter->second;
990 // Add the name token data.
992 if (!PropertyTokens.IsEmpty()){
994 NameTokens = PropertyTokens;
1000 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
1002 size_t intPropertyLen = PropertySeg1.Len();
1003 std::map<int, int> SplitPoints;
1004 std::map<int, int> SplitLength;
1005 std::map<int, int>::iterator SLiter;
1006 wxString PropertyData;
1007 wxString PropertyName;
1008 wxString PropertyValue;
1009 wxString PropertyTokens;
1010 bool FirstToken = TRUE;
1011 int intSplitsFound = 0;
1012 int intSplitSize = 0;
1013 int intPrevValue = 14;
1017 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1021 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1022 intiter != SplitPoints.end(); ++intiter){
1024 SLiter = SplitLength.find(intiter->first);
1026 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1028 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1029 PropertyName = PropertyElement.GetNextToken();
1030 PropertyValue = PropertyElement.GetNextToken();
1032 intPrevValue = intiter->second;
1034 // Process properties.
1036 CaptureString(&PropertyValue, FALSE);
1038 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1040 if (FirstToken == TRUE){
1042 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1047 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1055 CaptureString(&PropertySeg2, FALSE);
1057 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
1059 if (!PropertyTokens.IsEmpty()){
1061 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
1067 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
1069 std::map<int, int> SplitPoints;
1070 std::map<int, int> SplitLength;
1072 int intPrevValue = 10;
1075 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1079 PropertyType PropType = PROPERTY_NONE;
1081 // Look for type before continuing.
1083 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1087 std::map<int, wxString> *NicknamesList = NULL;
1088 std::map<int, wxString> *NicknamesListType = NULL;
1089 std::map<int, wxString> *NicknamesListLanguage = NULL;
1090 std::map<int, wxString> *NicknamesListAltID = NULL;
1091 std::map<int, wxString> *NicknamesListPID = NULL;
1092 std::map<int, wxString> *NicknamesListTokens = NULL;
1093 std::map<int, int> *NicknamesListPref = NULL;
1097 NicknamesList = &GeneralNicknamesList;
1098 NicknamesListType = &GeneralNicknamesListType;
1099 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1100 NicknamesListAltID = &GeneralNicknamesListAltID;
1101 NicknamesListPID = &GeneralNicknamesListPID;
1102 NicknamesListTokens = &GeneralNicknamesListTokens;
1103 NicknamesListPref = &GeneralNicknamesListPref;
1106 NicknamesList = &HomeNicknamesList;
1107 NicknamesListType = &HomeNicknamesListType;
1108 NicknamesListLanguage = &HomeNicknamesListLanguage;
1109 NicknamesListAltID = &HomeNicknamesListAltID;
1110 NicknamesListPID = &HomeNicknamesListPID;
1111 NicknamesListTokens = &HomeNicknamesListTokens;
1112 NicknamesListPref = &HomeNicknamesListPref;
1115 NicknamesList = &BusinessNicknamesList;
1116 NicknamesListType = &BusinessNicknamesListType;
1117 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1118 NicknamesListAltID = &BusinessNicknamesListAltID;
1119 NicknamesListPID = &BusinessNicknamesListPID;
1120 NicknamesListTokens = &BusinessNicknamesListTokens;
1121 NicknamesListPref = &BusinessNicknamesListPref;
1125 std::map<int, int>::iterator SLiter;
1126 wxString PropertyData;
1127 wxString PropertyName;
1128 wxString PropertyValue;
1129 wxString PropertyTokens;
1130 bool FirstToken = TRUE;
1131 bool PropertyMatched = FALSE;
1133 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1134 intiter != SplitPoints.end(); ++intiter){
1136 SLiter = SplitLength.find(intiter->first);
1138 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1140 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1141 PropertyName = PropertyElement.GetNextToken();
1142 PropertyValue = PropertyElement.GetNextToken();
1144 intPrevValue = intiter->second;
1146 CaptureString(&PropertyValue, FALSE);
1148 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1149 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1150 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1151 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1153 if (PropertyMatched == TRUE){
1155 PropertyMatched = FALSE;
1160 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1162 if (FirstToken == TRUE){
1164 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1169 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1177 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1179 // Add the name token data.
1181 if (!PropertyTokens.IsEmpty()){
1183 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1189 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1191 std::map<int, int> SplitPoints;
1192 std::map<int, int> SplitLength;
1193 std::map<int, int>::iterator SLiter;
1194 wxString PropertyData;
1195 wxString PropertyName;
1196 wxString PropertyValue;
1197 wxString PropertyTokens;
1198 bool FirstToken = TRUE;
1199 int intPrevValue = 8;
1201 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1205 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1206 intiter != SplitPoints.end(); ++intiter){
1208 SLiter = SplitLength.find(intiter->first);
1210 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1212 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1213 PropertyName = PropertyElement.GetNextToken();
1214 PropertyValue = PropertyElement.GetNextToken();
1216 intPrevValue = intiter->second;
1218 // Process properties.
1220 size_t intPropertyValueLen = PropertyValue.Len();
1222 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1224 PropertyValue.Trim();
1225 PropertyValue.RemoveLast();
1229 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1231 PropertyValue.Remove(0, 1);
1235 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1237 if (FirstToken == TRUE){
1239 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1244 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1252 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1254 wxString GenderComponent;
1256 if (GenderData.CountTokens() >= 2){
1258 Gender = GenderData.GetNextToken();
1259 GenderDetails = GenderData.GetString();
1261 CaptureString(&GenderDetails, FALSE);
1265 Gender = GenderData.GetNextToken();
1269 if (!PropertyTokens.IsEmpty()){
1271 GenderTokens = PropertyTokens;
1277 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1279 // Process date. Preserve the remainder in the string.
1281 std::map<int, int> SplitPoints;
1282 std::map<int, int> SplitLength;
1283 std::map<int, int>::iterator SLiter;
1284 wxString PropertyData;
1285 wxString PropertyName;
1286 wxString PropertyValue;
1287 wxString PropertyTokens;
1288 bool BirthdayText = FALSE;
1289 int intPrevValue = 6;
1291 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1295 // Look for type before continuing.
1297 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1298 intiter != SplitPoints.end(); ++intiter){
1300 SLiter = SplitLength.find(intiter->first);
1302 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1304 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1305 PropertyName = PropertyElement.GetNextToken();
1306 PropertyValue = PropertyElement.GetNextToken();
1308 intPrevValue = intiter->second;
1310 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1312 CaptureString(&PropertySeg2, FALSE);
1313 Birthday = PropertySeg2;
1314 BirthdayText = TRUE;
1320 // Setup blank lines for later on.
1323 bool FirstToken = TRUE;
1325 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1326 intiter != SplitPoints.end(); ++intiter){
1328 SLiter = SplitLength.find(intiter->first);
1330 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1332 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1333 PropertyName = PropertyElement.GetNextToken();
1334 PropertyValue = PropertyElement.GetNextToken();
1336 intPrevValue = intiter->second;
1338 // Process properties.
1340 CaptureString(&PropertyValue, FALSE);
1342 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1344 PropertyValue.Trim();
1345 PropertyValue.RemoveLast();
1349 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1351 PropertyValue.Remove(0, 1);
1355 if (PropertyName == wxT("ALTID")){
1357 BirthdayAltID = PropertyValue;
1359 } else if (PropertyName == wxT("CALSCALE")){
1361 BirthdayCalScale = PropertyValue;
1363 } else if (PropertyName != wxT("VALUE")) {
1365 // Something else we don't know about so append
1366 // to the tokens variable.
1368 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1370 if (FirstToken == TRUE){
1372 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1377 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1387 // Add the data to the variables and form.
1389 if (BirthdayText == FALSE){
1391 Birthday = PropertySeg2;
1395 if (!PropertyTokens.IsEmpty()){
1397 BirthdayTokens = PropertyTokens;
1403 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1405 // Process date. Preserve the remainder in the string.
1407 std::map<int, int> SplitPoints;
1408 std::map<int, int> SplitLength;
1409 std::map<int, int>::iterator SLiter;
1410 wxString PropertyData;
1411 wxString PropertyName;
1412 wxString PropertyValue;
1413 wxString PropertyTokens;
1414 bool AnniversaryText = FALSE;
1415 int intPrevValue = 13;
1417 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1421 // Look for type before continuing.
1423 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1424 intiter != SplitPoints.end(); ++intiter){
1426 SLiter = SplitLength.find(intiter->first);
1428 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1430 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1431 PropertyName = PropertyElement.GetNextToken();
1432 PropertyValue = PropertyElement.GetNextToken();
1434 intPrevValue = intiter->second;
1436 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1438 CaptureString(&PropertySeg2, FALSE);
1439 Anniversary = PropertySeg2;
1440 AnniversaryText = TRUE;
1446 // Setup blank lines for later on.
1449 bool FirstToken = TRUE;
1451 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1452 intiter != SplitPoints.end(); ++intiter){
1454 SLiter = SplitLength.find(intiter->first);
1456 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1458 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1459 PropertyName = PropertyElement.GetNextToken();
1460 PropertyValue = PropertyElement.GetNextToken();
1462 intPrevValue = intiter->second;
1464 // Process properties.
1466 CaptureString(&PropertyValue, FALSE);
1468 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1470 PropertyValue.Trim();
1471 PropertyValue.RemoveLast();
1475 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1477 PropertyValue.Remove(0, 1);
1481 if (PropertyName == wxT("ALTID")){
1483 AnniversaryAltID = PropertyValue;
1485 } else if (PropertyName == wxT("CALSCALE")){
1487 AnniversaryCalScale = PropertyValue;
1489 } else if (PropertyName != wxT("VALUE")) {
1491 // Something else we don't know about so append
1492 // to the tokens variable.
1494 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1496 if (FirstToken == TRUE){
1498 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1503 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1513 // Add the data to the variables and form.
1515 if (AnniversaryText == FALSE){
1517 Anniversary = PropertySeg2;
1521 if (!PropertyTokens.IsEmpty()){
1523 AnniversaryTokens = PropertyTokens;
1529 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1531 std::map<int, int> SplitPoints;
1532 std::map<int, int> SplitLength;
1534 int intPrevValue = 4;
1537 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1541 PropertyType PropType = PROPERTY_NONE;
1543 // Look for type before continuing.
1545 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1549 std::map<int, wxString> *TZList = NULL;
1550 std::map<int, wxString> *TZListType = NULL;
1551 std::map<int, wxString> *TZListMediatype = NULL;
1552 std::map<int, wxString> *TZListAltID = NULL;
1553 std::map<int, wxString> *TZListPID = NULL;
1554 std::map<int, wxString> *TZListTokens = NULL;
1555 std::map<int, int> *TZListPref = NULL;
1559 TZList = &GeneralTZList;
1560 TZListType = &GeneralTZListType;
1561 TZListMediatype = &GeneralTZListMediatype;
1562 TZListAltID = &GeneralTZListAltID;
1563 TZListPID = &GeneralTZListPID;
1564 TZListTokens = &GeneralTZListTokens;
1565 TZListPref = &GeneralTZListPref;
1568 TZList = &HomeTZList;
1569 TZListType = &HomeTZListType;
1570 TZListMediatype = &HomeTZListMediatype;
1571 TZListAltID = &HomeTZListAltID;
1572 TZListPID = &HomeTZListPID;
1573 TZListTokens = &HomeTZListTokens;
1574 TZListPref = &HomeTZListPref;
1577 TZList = &BusinessTZList;
1578 TZListType = &BusinessTZListType;
1579 TZListMediatype = &BusinessTZListMediatype;
1580 TZListAltID = &BusinessTZListAltID;
1581 TZListPID = &BusinessTZListPID;
1582 TZListTokens = &BusinessTZListTokens;
1583 TZListPref = &BusinessTZListPref;
1587 std::map<int, int>::iterator SLiter;
1588 wxString PropertyData;
1589 wxString PropertyName;
1590 wxString PropertyValue;
1591 wxString PropertyTokens;
1592 bool FirstToken = TRUE;
1593 bool PropertyMatched = FALSE;
1595 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1596 intiter != SplitPoints.end(); ++intiter){
1598 SLiter = SplitLength.find(intiter->first);
1600 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1602 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1603 PropertyName = PropertyElement.GetNextToken();
1604 PropertyValue = PropertyElement.GetNextToken();
1606 intPrevValue = intiter->second;
1608 CaptureString(&PropertyValue, FALSE);
1610 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1611 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1612 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1613 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1615 if (PropertyMatched == TRUE){
1617 PropertyMatched = FALSE;
1622 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1624 if (FirstToken == TRUE){
1626 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1631 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1639 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1641 // Add the name token data.
1643 if (!PropertyTokens.IsEmpty()){
1645 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1652 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1654 size_t intPropertyLen = PropertySeg1.Len();
1655 std::map<int, int> SplitPoints;
1656 std::map<int, int> SplitLength;
1657 std::map<int, int>::iterator SLiter;
1658 wxString PropertyData;
1659 wxString PropertyName;
1660 wxString PropertyValue;
1661 wxString PropertyTokens;
1662 wxString AddressLabel;
1663 wxString AddressLang;
1664 wxString AddressAltID;
1665 wxString AddressPID;
1666 wxString AddressTokens;
1667 wxString AddressGeo;
1668 wxString AddressTimezone;
1669 wxString AddressType;
1670 wxString AddressMediatype;
1671 wxString AddressPOBox;
1672 wxString AddressExtended;
1673 wxString AddressStreet;
1674 wxString AddressLocality;
1675 wxString AddressCity;
1676 wxString AddressRegion;
1677 wxString AddressPostalCode;
1678 wxString AddressCountry;
1679 bool FirstToken = TRUE;
1680 int intSplitsFound = 0;
1681 int intSplitSize = 0;
1682 int intPrevValue = 5;
1686 bool PropertyMatched = FALSE;
1688 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1692 PropertyType PropType = PROPERTY_NONE;
1694 // Look for type before continuing.
1696 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1700 std::map<int, wxString> *AddressList = NULL;
1701 std::map<int, wxString> *AddressListTown = NULL;
1702 std::map<int, wxString> *AddressListCounty = NULL;
1703 std::map<int, wxString> *AddressListPostCode = NULL;
1704 std::map<int, wxString> *AddressListCountry = NULL;
1705 std::map<int, wxString> *AddressListLabel = NULL;
1706 std::map<int, wxString> *AddressListLang = NULL;
1707 std::map<int, wxString> *AddressListAltID = NULL;
1708 std::map<int, wxString> *AddressListPID = NULL;
1709 std::map<int, wxString> *AddressListTokens = NULL;
1710 std::map<int, wxString> *AddressListGeo = NULL;
1711 std::map<int, wxString> *AddressListTimezone = NULL;
1712 std::map<int, wxString> *AddressListType = NULL;
1713 std::map<int, wxString> *AddressListMediatype = NULL;
1714 std::map<int, int> *AddressListPref = NULL;
1718 AddressList = &GeneralAddressList;
1719 AddressListTown = &GeneralAddressListTown;
1720 AddressListCounty = &GeneralAddressListCounty;
1721 AddressListPostCode = &GeneralAddressListPostCode;
1722 AddressListCountry = &GeneralAddressListCountry;
1723 AddressListLabel = &GeneralAddressListLabel;
1724 AddressListLang = &GeneralAddressListLang;
1725 AddressListAltID = &GeneralAddressListAltID;
1726 AddressListPID = &GeneralAddressListPID;
1727 AddressListTokens = &GeneralAddressListTokens;
1728 AddressListGeo = &GeneralAddressListGeo;
1729 AddressListTimezone = &GeneralAddressListTimezone;
1730 AddressListType = &GeneralAddressListType;
1731 AddressListMediatype = &GeneralAddressListMediatype;
1732 AddressListPref = &GeneralAddressListPref;
1735 AddressList = &HomeAddressList;
1736 AddressListTown = &HomeAddressListTown;
1737 AddressListCounty = &HomeAddressListCounty;
1738 AddressListPostCode = &HomeAddressListPostCode;
1739 AddressListCountry = &HomeAddressListCountry;
1740 AddressListLabel = &HomeAddressListLabel;
1741 AddressListLang = &HomeAddressListLang;
1742 AddressListAltID = &HomeAddressListAltID;
1743 AddressListPID = &HomeAddressListPID;
1744 AddressListTokens = &HomeAddressListTokens;
1745 AddressListGeo = &HomeAddressListGeo;
1746 AddressListTimezone = &HomeAddressListTimezone;
1747 AddressListType = &HomeAddressListType;
1748 AddressListMediatype = &HomeAddressListMediatype;
1749 AddressListPref = &HomeAddressListPref;
1752 AddressList = &BusinessAddressList;
1753 AddressListTown = &BusinessAddressListTown;
1754 AddressListCounty = &BusinessAddressListCounty;
1755 AddressListPostCode = &BusinessAddressListPostCode;
1756 AddressListCountry = &BusinessAddressListCountry;
1757 AddressListLabel = &BusinessAddressListLabel;
1758 AddressListLang = &BusinessAddressListLang;
1759 AddressListAltID = &BusinessAddressListAltID;
1760 AddressListPID = &BusinessAddressListPID;
1761 AddressListTokens = &BusinessAddressListTokens;
1762 AddressListGeo = &BusinessAddressListGeo;
1763 AddressListTimezone = &BusinessAddressListTimezone;
1764 AddressListType = &BusinessAddressListType;
1765 AddressListMediatype = &BusinessAddressListMediatype;
1766 AddressListPref = &BusinessAddressListPref;
1772 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1773 intiter != SplitPoints.end(); ++intiter){
1775 SLiter = SplitLength.find(intiter->first);
1777 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1779 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1780 PropertyName = PropertyElement.GetNextToken();
1781 PropertyValue = PropertyElement.GetNextToken();
1783 intPrevValue = intiter->second;
1785 CaptureString(&PropertyValue, FALSE);
1787 // Process properties.
1789 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1790 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1791 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1792 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1793 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1794 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1795 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1796 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1798 if (PropertyMatched == TRUE){
1800 PropertyMatched = FALSE;
1805 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1807 if (FirstToken == TRUE){
1809 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1814 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1822 // Split the address.
1824 //std::map<int, int>::iterator SLiter;
1825 intPropertyLen = PropertySeg2.Len();
1826 SplitPoints.clear();
1827 SplitLength.clear();
1832 for (int i = 0; i <= intPropertyLen; i++){
1836 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1839 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1841 if (intSplitsFound == 6){
1843 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1848 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1858 // Split the data into several parts.
1860 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1861 intiter != SplitPoints.end(); ++intiter){
1863 if (intiter->first == 1){
1865 // Deal with PO Box.
1867 SLiter = SplitLength.find(1);
1869 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1870 intPrevValue = intiter->second;
1872 } else if (intiter->first == 2){
1874 // Deal with extended address.
1876 SLiter = SplitLength.find(2);
1878 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1879 intPrevValue = intiter->second;
1881 } else if (intiter->first == 3){
1883 // Deal with street address.
1885 SLiter = SplitLength.find(3);
1887 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1888 intPrevValue = intiter->second;
1890 } else if (intiter->first == 4){
1892 // Deal with locality
1894 SLiter = SplitLength.find(4);
1896 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1897 intPrevValue = intiter->second;
1899 } else if (intiter->first == 5){
1901 // Deal with region.
1903 SLiter = SplitLength.find(5);
1905 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1906 intPrevValue = intiter->second;
1909 } else if (intiter->first == 6){
1911 // Deal with post code.
1913 SLiter = SplitLength.find(6);
1915 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1916 intPrevValue = intiter->second;
1918 // Deal with country.
1920 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1928 // Add the data to the General/Home/Work address variables.
1930 CaptureString(&AddressStreet, FALSE);
1931 CaptureString(&AddressLocality, FALSE);
1932 CaptureString(&AddressRegion, FALSE);
1933 CaptureString(&AddressPostalCode, FALSE);
1934 CaptureString(&AddressCountry, FALSE);
1936 if (!PropertyTokens.IsEmpty()){
1938 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1942 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1943 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1944 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1945 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1946 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1950 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1953 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1956 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1960 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1964 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1966 std::map<int, int> SplitPoints;
1967 std::map<int, int> SplitLength;
1969 int intPrevValue = 7;
1972 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1976 PropertyType PropType = PROPERTY_NONE;
1978 // Look for type before continuing.
1980 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1982 std::map<int, wxString> *EmailList = NULL;
1983 std::map<int, wxString> *EmailListType = NULL;
1984 std::map<int, wxString> *EmailListAltID = NULL;
1985 std::map<int, wxString> *EmailListPID = NULL;
1986 std::map<int, wxString> *EmailListTokens = NULL;
1987 std::map<int, int> *EmailListPref = NULL;
1991 EmailList = &GeneralEmailList;
1992 EmailListType = &GeneralEmailListType;
1993 EmailListAltID = &GeneralEmailListAltID;
1994 EmailListPID = &GeneralEmailListPID;
1995 EmailListTokens = &GeneralEmailListTokens;
1996 EmailListPref = &GeneralEmailListPref;
1999 EmailList = &HomeEmailList;
2000 EmailListType = &HomeEmailListType;
2001 EmailListAltID = &HomeEmailListAltID;
2002 EmailListPID = &HomeEmailListPID;
2003 EmailListTokens = &HomeEmailListTokens;
2004 EmailListPref = &HomeEmailListPref;
2007 EmailList = &BusinessEmailList;
2008 EmailListType = &BusinessEmailListType;
2009 EmailListAltID = &BusinessEmailListAltID;
2010 EmailListPID = &BusinessEmailListPID;
2011 EmailListTokens = &BusinessEmailListTokens;
2012 EmailListPref = &BusinessEmailListPref;
2018 std::map<int,int>::iterator SLiter;
2019 wxString PropertyData;
2020 wxString PropertyName;
2021 wxString PropertyValue;
2022 wxString PropertyTokens;
2023 bool FirstToken = TRUE;
2024 bool PropertyMatched = FALSE;
2026 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2027 intiter != SplitPoints.end(); ++intiter){
2029 SLiter = SplitLength.find(intiter->first);
2031 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2033 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2034 PropertyName = PropertyElement.GetNextToken();
2035 PropertyValue = PropertyElement.GetNextToken();
2037 intPrevValue = intiter->second;
2039 CaptureString(&PropertyValue, FALSE);
2041 // Process properties.
2043 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
2044 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
2045 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
2047 if (PropertyMatched == TRUE){
2049 PropertyMatched = FALSE;
2054 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2056 if (FirstToken == TRUE){
2058 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2063 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2071 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
2073 // Add the name token data.
2075 if (!PropertyTokens.IsEmpty()){
2077 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
2084 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
2086 std::map<int, int> SplitPoints;
2087 std::map<int, int> SplitLength;
2089 int intPrevValue = 6;
2092 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2096 PropertyType PropType = PROPERTY_NONE;
2098 // Look for type before continuing.
2100 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2102 std::map<int, wxString> *IMList = NULL;
2103 std::map<int, wxString> *IMListType = NULL;
2104 std::map<int, wxString> *IMListAltID = NULL;
2105 std::map<int, wxString> *IMListPID = NULL;
2106 std::map<int, wxString> *IMListTokens = NULL;
2107 std::map<int, wxString> *IMListMediatype = NULL;
2108 std::map<int, int> *IMListPref = NULL;
2112 IMList = &GeneralIMList;
2113 IMListType = &GeneralIMListType;
2114 IMListAltID = &GeneralIMListAltID;
2115 IMListPID = &GeneralIMListPID;
2116 IMListTokens = &GeneralIMListTokens;
2117 IMListMediatype = &GeneralIMListMediatype;
2118 IMListPref = &GeneralIMListPref;
2121 IMList = &HomeIMList;
2122 IMListType = &HomeIMListType;
2123 IMListAltID = &HomeIMListAltID;
2124 IMListPID = &HomeIMListPID;
2125 IMListTokens = &HomeIMListTokens;
2126 IMListMediatype = &HomeIMListMediatype;
2127 IMListPref = &HomeIMListPref;
2130 IMList = &BusinessIMList;
2131 IMListType = &BusinessIMListType;
2132 IMListAltID = &BusinessIMListAltID;
2133 IMListPID = &BusinessIMListPID;
2134 IMListTokens = &BusinessIMListTokens;
2135 IMListMediatype = &BusinessIMListMediatype;
2136 IMListPref = &BusinessIMListPref;
2142 std::map<int,int>::iterator SLiter;
2143 wxString PropertyData;
2144 wxString PropertyName;
2145 wxString PropertyValue;
2146 wxString PropertyTokens;
2147 bool FirstToken = TRUE;
2148 bool PropertyMatched = FALSE;
2150 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2151 intiter != SplitPoints.end(); ++intiter){
2153 SLiter = SplitLength.find(intiter->first);
2155 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2157 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2158 PropertyName = PropertyElement.GetNextToken();
2159 PropertyValue = PropertyElement.GetNextToken();
2161 intPrevValue = intiter->second;
2163 CaptureString(&PropertyValue, FALSE);
2165 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
2166 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
2167 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
2168 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
2170 // Process properties.
2172 if (PropertyMatched == TRUE){
2174 PropertyMatched = FALSE;
2179 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2181 if (FirstToken == TRUE){
2183 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2188 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2196 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2198 // Add the name token data.
2200 if (!PropertyTokens.IsEmpty()){
2202 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2208 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2210 std::map<int, int> SplitPoints;
2211 std::map<int, int> SplitLength;
2212 std::map<int, int>::iterator SLiter;
2216 PropertyType PropType = PROPERTY_NONE;
2218 // Look for type before continuing.
2221 wxString TelTypeDetail;
2222 wxString PropertyData;
2223 wxString PropertyName;
2224 wxString PropertyValue;
2225 wxString PropertyTokens;
2227 std::map<int,int> TypeSplitPoints;
2228 std::map<int,int> TypeSplitLength;
2229 std::map<int,int>::iterator TSLiter;
2231 int intSplitSize = 0;
2232 int intSplitsFound = 0;
2233 int intSplitPoint = 0;
2235 int intPrevValue = 5;
2237 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2241 // Look for type before continuing.
2243 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2244 intiter != SplitPoints.end(); ++intiter){
2246 SLiter = SplitLength.find(intiter->first);
2248 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2250 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2251 PropertyName = PropertyElement.GetNextToken();
2252 PropertyValue = PropertyElement.GetNextToken();
2254 intPrevValue = intiter->second;
2256 if (PropertyName == wxT("TYPE")){
2258 // Process each value in type and translate each
2261 // Strip out the quotes if they are there.
2263 size_t intPropertyValueLen = PropertyValue.Len();
2265 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2267 PropertyValue.Trim();
2268 PropertyValue.RemoveLast();
2272 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2274 PropertyValue.Remove(0, 1);
2278 TelTypeDetail = PropertyValue;
2284 for (int i = 0; i <= intPropertyValueLen; i++){
2288 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2290 if (intSplitsFound == 0){
2292 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2293 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2297 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2298 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2311 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2312 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2314 int intTypeSeek = 0;
2316 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2317 typeiter != TypeSplitPoints.end(); ++typeiter){
2319 wxString TypePropertyName;
2321 TSLiter = TypeSplitLength.find(typeiter->first);
2323 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2325 if (intTypeSeek == 0){
2330 TelTypeUI.Append(wxT(","));
2334 if (TypePropertyName == wxT("home")){
2336 PropType = PROPERTY_HOME;
2338 } else if (TypePropertyName == wxT("work")){
2340 PropType = PROPERTY_WORK;
2345 if (TypePropertyName == wxT("text")){
2347 TelTypeUI.Append(_("text"));
2350 } else if (TypePropertyName == wxT("voice")){
2352 TelTypeUI.Append(_("voice"));
2355 } else if (TypePropertyName == wxT("fax")){
2357 TelTypeUI.Append(_("fax"));
2360 } else if (TypePropertyName == wxT("cell")){
2362 TelTypeUI.Append(_("mobile"));
2365 } else if (TypePropertyName == wxT("video")){
2367 TelTypeUI.Append(_("video"));
2370 } else if (TypePropertyName == wxT("pager")){
2372 TelTypeUI.Append(_("pager"));
2375 } else if (TypePropertyName == wxT("textphone")){
2377 TelTypeUI.Append(_("textphone"));
2388 std::map<int, wxString> *TelephoneList = NULL;
2389 std::map<int, wxString> *TelephoneListType = NULL;
2390 std::map<int, wxString> *TelephoneListAltID = NULL;
2391 std::map<int, wxString> *TelephoneListPID = NULL;
2392 std::map<int, wxString> *TelephoneListTokens = NULL;
2393 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2394 std::map<int, int> *TelephoneListPref = NULL;
2398 TelephoneList = &GeneralTelephoneList;
2399 TelephoneListType = &GeneralTelephoneListType;
2400 TelephoneListAltID = &GeneralTelephoneListAltID;
2401 TelephoneListPID = &GeneralTelephoneListPID;
2402 TelephoneListTokens = &GeneralTelephoneListTokens;
2403 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2404 TelephoneListPref = &GeneralTelephoneListPref;
2407 TelephoneList = &HomeTelephoneList;
2408 TelephoneListType = &HomeTelephoneListType;
2409 TelephoneListAltID = &HomeTelephoneListAltID;
2410 TelephoneListPID = &HomeTelephoneListPID;
2411 TelephoneListTokens = &HomeTelephoneListTokens;
2412 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2413 TelephoneListPref = &HomeTelephoneListPref;
2416 TelephoneList = &BusinessTelephoneList;
2417 TelephoneListType = &BusinessTelephoneListType;
2418 TelephoneListAltID = &BusinessTelephoneListAltID;
2419 TelephoneListPID = &BusinessTelephoneListPID;
2420 TelephoneListTokens = &BusinessTelephoneListTokens;
2421 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2422 TelephoneListPref = &BusinessTelephoneListPref;
2426 // Process the properties.
2428 bool FirstToken = TRUE;
2431 SplitPoints.clear();
2432 SplitLength.clear();
2434 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2438 bool PropertyMatched = FALSE;
2440 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2441 intiter != SplitPoints.end(); ++intiter){
2443 SLiter = SplitLength.find(intiter->first);
2445 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2447 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2448 PropertyName = PropertyElement.GetNextToken();
2449 PropertyValue = PropertyElement.GetNextToken();
2451 intPrevValue = intiter->second;
2453 CaptureString(&PropertyValue, FALSE);
2455 // Process properties.
2457 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2458 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2459 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2461 if (PropertyMatched == TRUE){
2463 PropertyMatched = FALSE;
2468 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2470 if (FirstToken == TRUE){
2472 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2477 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2485 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2486 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2488 // Add the name token data.
2490 if (!PropertyTokens.IsEmpty()){
2492 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2498 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2500 std::map<int, int> SplitPoints;
2501 std::map<int, int> SplitLength;
2503 int intPrevValue = 6;
2506 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2510 PropertyType PropType = PROPERTY_NONE;
2512 // Look for type before continuing.
2514 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2516 std::map<int, wxString> *LanguageList = NULL;
2517 std::map<int, wxString> *LanguageListType = NULL;
2518 std::map<int, wxString> *LanguageListAltID = NULL;
2519 std::map<int, wxString> *LanguageListPID = NULL;
2520 std::map<int, wxString> *LanguageListTokens = NULL;
2521 std::map<int, int> *LanguageListPref = NULL;
2525 LanguageList = &GeneralLanguageList;
2526 LanguageListType = &GeneralLanguageListType;
2527 LanguageListAltID = &GeneralLanguageListAltID;
2528 LanguageListPID = &GeneralLanguageListPID;
2529 LanguageListTokens = &GeneralLanguageListTokens;
2530 LanguageListPref = &GeneralLanguageListPref;
2533 LanguageList = &HomeLanguageList;
2534 LanguageListType = &HomeLanguageListType;
2535 LanguageListAltID = &HomeLanguageListAltID;
2536 LanguageListPID = &HomeLanguageListPID;
2537 LanguageListTokens = &HomeLanguageListTokens;
2538 LanguageListPref = &HomeLanguageListPref;
2541 LanguageList = &BusinessLanguageList;
2542 LanguageListType = &BusinessLanguageListType;
2543 LanguageListAltID = &BusinessLanguageListAltID;
2544 LanguageListPID = &BusinessLanguageListPID;
2545 LanguageListTokens = &BusinessLanguageListTokens;
2546 LanguageListPref = &BusinessLanguageListPref;
2552 std::map<int,int>::iterator SLiter;
2553 wxString PropertyData;
2554 wxString PropertyName;
2555 wxString PropertyValue;
2556 wxString PropertyTokens;
2557 bool FirstToken = TRUE;
2558 bool PropertyMatched = FALSE;
2560 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2561 intiter != SplitPoints.end(); ++intiter){
2563 SLiter = SplitLength.find(intiter->first);
2565 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2567 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2568 PropertyName = PropertyElement.GetNextToken();
2569 PropertyValue = PropertyElement.GetNextToken();
2571 intPrevValue = intiter->second;
2573 CaptureString(&PropertyValue, FALSE);
2575 // Process properties.
2577 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2578 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2579 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2581 if (PropertyMatched == TRUE){
2583 PropertyMatched = FALSE;
2588 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2590 if (FirstToken == TRUE){
2592 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2597 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2605 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2607 // Add the name token data.
2609 if (!PropertyTokens.IsEmpty()){
2611 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2617 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2619 std::map<int, int> SplitPoints;
2620 std::map<int, int> SplitLength;
2622 int intPrevValue = 5;
2625 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2629 PropertyType PropType = PROPERTY_NONE;
2631 // Look for type before continuing.
2633 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2635 std::map<int, wxString> *GeopositionList = NULL;
2636 std::map<int, wxString> *GeopositionListType = NULL;
2637 std::map<int, wxString> *GeopositionListAltID = NULL;
2638 std::map<int, wxString> *GeopositionListPID = NULL;
2639 std::map<int, wxString> *GeopositionListTokens = NULL;
2640 std::map<int, wxString> *GeopositionListMediatype = NULL;
2641 std::map<int, int> *GeopositionListPref = NULL;
2645 GeopositionList = &GeneralGeographyList;
2646 GeopositionListType = &GeneralGeographyListType;
2647 GeopositionListAltID = &GeneralGeographyListAltID;
2648 GeopositionListPID = &GeneralGeographyListPID;
2649 GeopositionListTokens = &GeneralGeographyListTokens;
2650 GeopositionListMediatype = &GeneralGeographyListMediatype;
2651 GeopositionListPref = &GeneralGeographyListPref;
2654 GeopositionList = &HomeGeographyList;
2655 GeopositionListType = &HomeGeographyListType;
2656 GeopositionListAltID = &HomeGeographyListAltID;
2657 GeopositionListPID = &HomeGeographyListPID;
2658 GeopositionListTokens = &HomeGeographyListTokens;
2659 GeopositionListMediatype = &HomeGeographyListMediatype;
2660 GeopositionListPref = &HomeGeographyListPref;
2663 GeopositionList = &BusinessGeographyList;
2664 GeopositionListType = &BusinessGeographyListType;
2665 GeopositionListAltID = &BusinessGeographyListAltID;
2666 GeopositionListPID = &BusinessGeographyListPID;
2667 GeopositionListTokens = &BusinessGeographyListTokens;
2668 GeopositionListMediatype = &BusinessGeographyListMediatype;
2669 GeopositionListPref = &BusinessGeographyListPref;
2675 std::map<int,int>::iterator SLiter;
2676 wxString PropertyData;
2677 wxString PropertyName;
2678 wxString PropertyValue;
2679 wxString PropertyTokens;
2680 bool FirstToken = TRUE;
2681 bool PropertyMatched = FALSE;
2683 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2684 intiter != SplitPoints.end(); ++intiter){
2686 SLiter = SplitLength.find(intiter->first);
2688 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2690 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2691 PropertyName = PropertyElement.GetNextToken();
2692 PropertyValue = PropertyElement.GetNextToken();
2694 intPrevValue = intiter->second;
2696 CaptureString(&PropertyValue, FALSE);
2698 // Process properties.
2700 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2701 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2702 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2703 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2705 if (PropertyMatched == TRUE){
2707 PropertyMatched = FALSE;
2712 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2714 if (FirstToken == TRUE){
2716 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2721 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2729 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2731 // Add the name token data.
2733 if (!PropertyTokens.IsEmpty()){
2735 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2741 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2743 size_t intPropertyLen = PropertySeg1.Len();
2744 std::map<int, int> SplitPoints;
2745 std::map<int, int> SplitLength;
2746 std::map<int, int>::iterator SLiter;
2747 wxString PropertyData;
2748 wxString PropertyName;
2749 wxString PropertyValue;
2750 wxString PropertyTokens;
2751 wxString RelatedType;
2752 wxString RelatedTypeOriginal;
2753 wxString RelatedName;
2754 bool FirstToken = TRUE;
2755 int intSplitsFound = 0;
2756 int intSplitSize = 0;
2757 int intPrevValue = 9;
2761 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2765 // Look for type before continuing.
2767 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2768 intiter != SplitPoints.end(); ++intiter){
2770 SLiter = SplitLength.find(intiter->first);
2772 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2774 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2775 PropertyName = PropertyElement.GetNextToken();
2776 PropertyValue = PropertyElement.GetNextToken();
2778 intPrevValue = intiter->second;
2782 RelatedTypeOriginal = PropertyValue;
2784 if (PropertyName == wxT("TYPE")){
2786 if (PropertyValue == wxT("contact")){
2788 RelatedType = _("Contact");
2790 } else if (PropertyValue == wxT("acquaintance")){
2792 RelatedType = _("Acquaintance");
2794 } else if (PropertyValue == wxT("friend")){
2796 RelatedType = _("Friend");
2798 } else if (PropertyValue == wxT("met")){
2800 RelatedType = _("Met");
2802 } else if (PropertyValue == wxT("co-worker")){
2804 RelatedType = _("Co-worker");
2806 } else if (PropertyValue == wxT("colleague")){
2808 RelatedType = _("Colleague");
2810 } else if (PropertyValue == wxT("co-resident")){
2812 RelatedType = _("Co-resident");
2814 } else if (PropertyValue == wxT("neighbor")){
2816 RelatedType = _("Neighbour");
2818 } else if (PropertyValue == wxT("child")){
2820 RelatedType = _("Child");
2822 } else if (PropertyValue == wxT("parent")){
2824 RelatedType = _("Parent");
2826 } else if (PropertyValue == wxT("sibling")){
2828 RelatedType = _("Sibling");
2830 } else if (PropertyValue == wxT("spouse")){
2832 RelatedType = _("Spouse");
2834 } else if (PropertyValue == wxT("kin")){
2836 RelatedType = _("Kin");
2838 } else if (PropertyValue == wxT("muse")){
2840 RelatedType = _("Muse");
2842 } else if (PropertyValue == wxT("crush")){
2844 RelatedType = _("Crush");
2846 } else if (PropertyValue == wxT("date")){
2848 RelatedType = _("Date");
2850 } else if (PropertyValue == wxT("sweetheart")){
2852 RelatedType = _("Sweetheart");
2854 } else if (PropertyValue == wxT("me")){
2856 RelatedType = _("Me");
2858 } else if (PropertyValue == wxT("agent")){
2860 RelatedType = _("Agent");
2862 } else if (PropertyValue == wxT("emergency")){
2864 RelatedType = _("Emergency");
2868 RelatedType = PropertyValue;
2878 bool PropertyMatched = FALSE;
2880 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2881 intiter != SplitPoints.end(); ++intiter){
2883 SLiter = SplitLength.find(intiter->first);
2885 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2887 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2888 PropertyName = PropertyElement.GetNextToken();
2889 PropertyValue = PropertyElement.GetNextToken();
2891 intPrevValue = intiter->second;
2893 // Process properties.
2895 size_t intPropertyValueLen = PropertyValue.Len();
2897 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2899 PropertyValue.Trim();
2900 PropertyValue.RemoveLast();
2904 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2906 PropertyValue.Remove(0, 1);
2910 CaptureString(&PropertyValue, FALSE);
2912 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2913 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2914 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2915 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2917 if (PropertyMatched == TRUE){
2919 PropertyMatched = FALSE;
2924 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2926 if (FirstToken == TRUE){
2928 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2933 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2941 // Add the data to the General/Home/Work address variables.
2943 GeneralRelatedList.erase(*RelatedCount);
2944 GeneralRelatedListRelType.erase(*RelatedCount);
2945 GeneralRelatedListType.erase(*RelatedCount);
2946 GeneralRelatedListTokens.erase(*RelatedCount);
2947 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2948 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2949 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2950 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2954 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2956 std::map<int, int> SplitPoints;
2957 std::map<int, int> SplitLength;
2958 std::map<int, int>::iterator SLiter;
2959 wxString PropertyData;
2960 wxString PropertyName;
2961 wxString PropertyValue;
2962 wxString PropertyTokens;
2963 bool FirstToken = TRUE;
2964 int intPrevValue = 5;
2969 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2973 PropertyType PropType = PROPERTY_NONE;
2975 // Look for type before continuing.
2977 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2979 // Setup the pointers.
2981 std::map<int, wxString> *WebsiteList = NULL;
2982 std::map<int, wxString> *WebsiteListAltID = NULL;
2983 std::map<int, wxString> *WebsiteListPID = NULL;
2984 std::map<int, wxString> *WebsiteListType = NULL;
2985 std::map<int, wxString> *WebsiteListTokens = NULL;
2986 std::map<int, wxString> *WebsiteListMediatype = NULL;
2987 std::map<int, int> *WebsiteListPref = NULL;
2989 // Setup blank lines for later on.
2993 WebsiteList = &GeneralWebsiteList;
2994 WebsiteListType = &GeneralWebsiteListType;
2995 WebsiteListAltID = &GeneralWebsiteListAltID;
2996 WebsiteListPID = &GeneralWebsiteListPID;
2997 WebsiteListTokens = &GeneralWebsiteListTokens;
2998 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2999 WebsiteListPref = &GeneralWebsiteListPref;
3002 WebsiteList = &HomeWebsiteList;
3003 WebsiteListType = &HomeWebsiteListType;
3004 WebsiteListAltID = &HomeWebsiteListAltID;
3005 WebsiteListPID = &HomeWebsiteListPID;
3006 WebsiteListTokens = &HomeWebsiteListTokens;
3007 WebsiteListMediatype = &HomeWebsiteListMediatype;
3008 WebsiteListPref = &HomeWebsiteListPref;
3011 WebsiteList = &BusinessWebsiteList;
3012 WebsiteListType = &BusinessWebsiteListType;
3013 WebsiteListAltID = &BusinessWebsiteListAltID;
3014 WebsiteListPID = &BusinessWebsiteListPID;
3015 WebsiteListTokens = &BusinessWebsiteListTokens;
3016 WebsiteListMediatype = &BusinessWebsiteListMediatype;
3017 WebsiteListPref = &BusinessWebsiteListPref;
3022 bool PropertyMatched = FALSE;
3024 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3025 intiter != SplitPoints.end(); ++intiter){
3027 SLiter = SplitLength.find(intiter->first);
3029 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3031 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3032 PropertyName = PropertyElement.GetNextToken();
3033 PropertyValue = PropertyElement.GetNextToken();
3035 intPrevValue = intiter->second;
3037 // Process properties.
3039 size_t intPropertyValueLen = PropertyValue.Len();
3041 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3043 PropertyValue.Trim();
3044 PropertyValue.RemoveLast();
3048 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3050 PropertyValue.Remove(0, 1);
3054 CaptureString(&PropertyValue, FALSE);
3056 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
3057 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
3058 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
3059 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
3061 if (PropertyMatched == TRUE){
3063 PropertyMatched = FALSE;
3068 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3070 if (FirstToken == TRUE){
3072 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3077 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3085 // Add the data to the General/Home/Work address variables.
3087 CaptureString(&PropertySeg2, FALSE);
3089 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3091 if (!PropertyTokens.IsEmpty()){
3093 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3099 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3101 std::map<int, int> SplitPoints;
3102 std::map<int, int> SplitLength;
3103 std::map<int, int>::iterator SLiter;
3104 wxString PropertyData;
3105 wxString PropertyName;
3106 wxString PropertyValue;
3107 wxString PropertyTokens;
3108 bool FirstToken = TRUE;
3109 int intPrevValue = 7;
3114 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3118 PropertyType PropType = PROPERTY_NONE;
3120 // Look for type before continuing.
3122 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3124 // Setup the pointers.
3126 std::map<int, wxString> *TitleList = NULL;
3127 std::map<int, wxString> *TitleListAltID = NULL;
3128 std::map<int, wxString> *TitleListPID = NULL;
3129 std::map<int, wxString> *TitleListType = NULL;
3130 std::map<int, wxString> *TitleListTokens = NULL;
3131 std::map<int, wxString> *TitleListLanguage = NULL;
3132 std::map<int, int> *TitleListPref = NULL;
3134 // Setup blank lines for later on.
3138 TitleList = &GeneralTitleList;
3139 TitleListType = &GeneralTitleListType;
3140 TitleListAltID = &GeneralTitleListAltID;
3141 TitleListPID = &GeneralTitleListPID;
3142 TitleListTokens = &GeneralTitleListTokens;
3143 TitleListLanguage = &GeneralTitleListLanguage;
3144 TitleListPref = &GeneralTitleListPref;
3147 TitleList = &HomeTitleList;
3148 TitleListType = &HomeTitleListType;
3149 TitleListAltID = &HomeTitleListAltID;
3150 TitleListPID = &HomeTitleListPID;
3151 TitleListTokens = &HomeTitleListTokens;
3152 TitleListLanguage = &HomeTitleListLanguage;
3153 TitleListPref = &HomeTitleListPref;
3156 TitleList = &BusinessTitleList;
3157 TitleListType = &BusinessTitleListType;
3158 TitleListAltID = &BusinessTitleListAltID;
3159 TitleListPID = &BusinessTitleListPID;
3160 TitleListTokens = &BusinessTitleListTokens;
3161 TitleListLanguage = &BusinessTitleListLanguage;
3162 TitleListPref = &BusinessTitleListPref;
3167 bool PropertyMatched = FALSE;
3169 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3170 intiter != SplitPoints.end(); ++intiter){
3172 SLiter = SplitLength.find(intiter->first);
3174 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3176 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3177 PropertyName = PropertyElement.GetNextToken();
3178 PropertyValue = PropertyElement.GetNextToken();
3180 intPrevValue = intiter->second;
3182 // Process properties.
3184 size_t intPropertyValueLen = PropertyValue.Len();
3186 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3188 PropertyValue.Trim();
3189 PropertyValue.RemoveLast();
3193 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3195 PropertyValue.Remove(0, 1);
3199 CaptureString(&PropertyValue, FALSE);
3201 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
3202 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
3203 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
3204 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
3206 if (PropertyMatched == TRUE){
3208 PropertyMatched = FALSE;
3213 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3215 if (FirstToken == TRUE){
3217 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3222 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3230 // Add the data to the General/Home/Work address variables.
3232 CaptureString(&PropertySeg2, FALSE);
3234 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3236 if (!PropertyTokens.IsEmpty()){
3238 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3244 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3246 std::map<int, int> SplitPoints;
3247 std::map<int, int> SplitLength;
3248 std::map<int, int>::iterator SLiter;
3249 wxString PropertyData;
3250 wxString PropertyName;
3251 wxString PropertyValue;
3252 wxString PropertyTokens;
3253 bool FirstToken = TRUE;
3254 int intPrevValue = 6;
3259 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3263 PropertyType PropType = PROPERTY_NONE;
3265 // Look for type before continuing.
3267 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3269 // Setup the pointers.
3271 std::map<int, wxString> *RoleList = NULL;
3272 std::map<int, wxString> *RoleListAltID = NULL;
3273 std::map<int, wxString> *RoleListPID = NULL;
3274 std::map<int, wxString> *RoleListType = NULL;
3275 std::map<int, wxString> *RoleListTokens = NULL;
3276 std::map<int, wxString> *RoleListLanguage = NULL;
3277 std::map<int, int> *RoleListPref = NULL;
3279 // Setup blank lines for later on.
3283 RoleList = &GeneralRoleList;
3284 RoleListType = &GeneralRoleListType;
3285 RoleListAltID = &GeneralRoleListAltID;
3286 RoleListPID = &GeneralRoleListPID;
3287 RoleListTokens = &GeneralRoleListTokens;
3288 RoleListLanguage = &GeneralRoleListLanguage;
3289 RoleListPref = &GeneralRoleListPref;
3292 RoleList = &HomeRoleList;
3293 RoleListType = &HomeRoleListType;
3294 RoleListAltID = &HomeRoleListAltID;
3295 RoleListPID = &HomeRoleListPID;
3296 RoleListTokens = &HomeRoleListTokens;
3297 RoleListLanguage = &HomeRoleListLanguage;
3298 RoleListPref = &HomeRoleListPref;
3301 RoleList = &BusinessRoleList;
3302 RoleListType = &BusinessRoleListType;
3303 RoleListAltID = &BusinessRoleListAltID;
3304 RoleListPID = &BusinessRoleListPID;
3305 RoleListTokens = &BusinessRoleListTokens;
3306 RoleListLanguage = &BusinessRoleListLanguage;
3307 RoleListPref = &BusinessRoleListPref;
3312 bool PropertyMatched = FALSE;
3314 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3315 intiter != SplitPoints.end(); ++intiter){
3317 SLiter = SplitLength.find(intiter->first);
3319 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3321 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3322 PropertyName = PropertyElement.GetNextToken();
3323 PropertyValue = PropertyElement.GetNextToken();
3325 intPrevValue = intiter->second;
3327 // Process properties.
3329 size_t intPropertyValueLen = PropertyValue.Len();
3331 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3333 PropertyValue.Trim();
3334 PropertyValue.RemoveLast();
3338 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3340 PropertyValue.Remove(0, 1);
3344 CaptureString(&PropertyValue, FALSE);
3346 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3347 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3348 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3349 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3351 if (PropertyMatched == TRUE){
3353 PropertyMatched = FALSE;
3358 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3360 if (FirstToken == TRUE){
3362 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3367 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3375 // Add the data to the General/Home/Work address variables.
3377 CaptureString(&PropertySeg2, FALSE);
3379 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3381 if (!PropertyTokens.IsEmpty()){
3383 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3389 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3391 std::map<int, int> SplitPoints;
3392 std::map<int, int> SplitLength;
3393 std::map<int, int>::iterator SLiter;
3394 wxString PropertyData;
3395 wxString PropertyName;
3396 wxString PropertyValue;
3397 wxString PropertyTokens;
3398 bool FirstToken = TRUE;
3399 int intPrevValue = 5;
3404 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3408 PropertyType PropType = PROPERTY_NONE;
3410 // Look for type before continuing.
3412 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3414 // Setup the pointers.
3416 std::map<int, wxString> *OrganisationsList = NULL;
3417 std::map<int, wxString> *OrganisationsListAltID = NULL;
3418 std::map<int, wxString> *OrganisationsListPID = NULL;
3419 std::map<int, wxString> *OrganisationsListType = NULL;
3420 std::map<int, wxString> *OrganisationsListTokens = NULL;
3421 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3422 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3423 std::map<int, int> *OrganisationsListPref = NULL;
3425 // Setup blank lines for later on.
3429 OrganisationsList = &GeneralOrganisationsList;
3430 OrganisationsListType = &GeneralOrganisationsListType;
3431 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3432 OrganisationsListPID = &GeneralOrganisationsListPID;
3433 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3434 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3435 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3436 OrganisationsListPref = &GeneralOrganisationsListPref;
3439 OrganisationsList = &HomeOrganisationsList;
3440 OrganisationsListType = &HomeOrganisationsListType;
3441 OrganisationsListAltID = &HomeOrganisationsListAltID;
3442 OrganisationsListPID = &HomeOrganisationsListPID;
3443 OrganisationsListTokens = &HomeOrganisationsListTokens;
3444 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3445 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3446 OrganisationsListPref = &HomeOrganisationsListPref;
3449 OrganisationsList = &BusinessOrganisationsList;
3450 OrganisationsListType = &BusinessOrganisationsListType;
3451 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3452 OrganisationsListPID = &BusinessOrganisationsListPID;
3453 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3454 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3455 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3456 OrganisationsListPref = &BusinessOrganisationsListPref;
3461 bool PropertyMatched = FALSE;
3463 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3464 intiter != SplitPoints.end(); ++intiter){
3466 SLiter = SplitLength.find(intiter->first);
3468 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3470 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3471 PropertyName = PropertyElement.GetNextToken();
3472 PropertyValue = PropertyElement.GetNextToken();
3474 intPrevValue = intiter->second;
3476 // Process properties.
3478 size_t intPropertyValueLen = PropertyValue.Len();
3480 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3482 PropertyValue.Trim();
3483 PropertyValue.RemoveLast();
3487 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3489 PropertyValue.Remove(0, 1);
3493 CaptureString(&PropertyValue, FALSE);
3495 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3496 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3497 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3498 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3499 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3501 if (PropertyMatched == TRUE){
3503 PropertyMatched = FALSE;
3508 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3510 if (FirstToken == TRUE){
3512 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3517 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3525 // Add the data to the General/Home/Work address variables.
3527 CaptureString(&PropertySeg2, FALSE);
3529 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3531 if (!PropertyTokens.IsEmpty()){
3533 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3539 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3541 std::map<int, int> SplitPoints;
3542 std::map<int, int> SplitLength;
3543 std::map<int, int>::iterator SLiter;
3544 wxString PropertyData;
3545 wxString PropertyName;
3546 wxString PropertyValue;
3547 wxString PropertyTokens;
3548 bool FirstToken = TRUE;
3549 int intPrevValue = 6;
3554 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3558 PropertyType PropType = PROPERTY_NONE;
3560 // Look for type before continuing.
3562 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3564 // Setup the pointers.
3566 std::map<int, wxString> *NoteList = NULL;
3567 std::map<int, wxString> *NoteListAltID = NULL;
3568 std::map<int, wxString> *NoteListPID = NULL;
3569 std::map<int, wxString> *NoteListType = NULL;
3570 std::map<int, wxString> *NoteListTokens = NULL;
3571 std::map<int, wxString> *NoteListLanguage = NULL;
3572 std::map<int, int> *NoteListPref = NULL;
3574 // Setup blank lines for later on.
3578 NoteList = &GeneralNoteList;
3579 NoteListType = &GeneralNoteListType;
3580 NoteListAltID = &GeneralNoteListAltID;
3581 NoteListPID = &GeneralNoteListPID;
3582 NoteListTokens = &GeneralNoteListTokens;
3583 NoteListLanguage = &GeneralNoteListLanguage;
3584 NoteListPref = &GeneralNoteListPref;
3587 NoteList = &HomeNoteList;
3588 NoteListType = &HomeNoteListType;
3589 NoteListAltID = &HomeNoteListAltID;
3590 NoteListPID = &HomeNoteListPID;
3591 NoteListTokens = &HomeNoteListTokens;
3592 NoteListLanguage = &HomeNoteListLanguage;
3593 NoteListPref = &HomeNoteListPref;
3596 NoteList = &BusinessNoteList;
3597 NoteListType = &BusinessNoteListType;
3598 NoteListAltID = &BusinessNoteListAltID;
3599 NoteListPID = &BusinessNoteListPID;
3600 NoteListTokens = &BusinessNoteListTokens;
3601 NoteListLanguage = &BusinessNoteListLanguage;
3602 NoteListPref = &BusinessNoteListPref;
3607 bool PropertyMatched = FALSE;
3609 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3610 intiter != SplitPoints.end(); ++intiter){
3612 SLiter = SplitLength.find(intiter->first);
3614 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3616 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3617 PropertyName = PropertyElement.GetNextToken();
3618 PropertyValue = PropertyElement.GetNextToken();
3620 intPrevValue = intiter->second;
3622 // Process properties.
3624 size_t intPropertyValueLen = PropertyValue.Len();
3626 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3628 PropertyValue.Trim();
3629 PropertyValue.RemoveLast();
3633 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3635 PropertyValue.Remove(0, 1);
3639 CaptureString(&PropertyValue, FALSE);
3641 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3642 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3643 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3644 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3646 if (PropertyMatched == TRUE){
3648 PropertyMatched = FALSE;
3653 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3655 if (FirstToken == TRUE){
3657 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3662 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3670 // Add the data to the General/Home/Work address variables.
3672 CaptureString(&PropertySeg2, FALSE);
3674 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3676 if (!PropertyTokens.IsEmpty()){
3678 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3684 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3686 std::map<int, int> SplitPoints;
3687 std::map<int, int> SplitLength;
3688 std::map<int, int>::iterator SLiter;
3689 wxString PropertyData;
3690 wxString PropertyName;
3691 wxString PropertyValue;
3692 wxString PropertyTokens;
3693 bool FirstToken = TRUE;
3694 int intPrevValue = 12;
3699 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3703 PropertyType PropType = PROPERTY_NONE;
3705 // Look for type before continuing.
3707 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3709 // Setup blank lines for later on.
3715 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3718 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3723 bool PropertyMatched = FALSE;
3725 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3726 intiter != SplitPoints.end(); ++intiter){
3728 SLiter = SplitLength.find(intiter->first);
3730 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3732 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3733 PropertyName = PropertyElement.GetNextToken();
3734 PropertyValue = PropertyElement.GetNextToken();
3736 intPrevValue = intiter->second;
3738 // Process properties.
3740 size_t intPropertyValueLen = PropertyValue.Len();
3742 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3744 PropertyValue.Trim();
3745 PropertyValue.RemoveLast();
3749 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3751 PropertyValue.Remove(0, 1);
3755 CaptureString(&PropertyValue, FALSE);
3757 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3758 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3759 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3760 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3762 if (PropertyMatched == TRUE){
3764 PropertyMatched = FALSE;
3769 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3771 if (FirstToken == TRUE){
3773 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3778 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3786 // Deal with multiple categories.
3788 int intOrigCatCount = *CategoryCount;
3789 bool FirstCategoryProcessed = TRUE;
3790 bool AfterFirstToken = FALSE;
3791 int intSplitSize = 0;
3792 int intSplitsFound = 0;
3793 int intSplitSeek = 0;
3794 int intPropertyLen = PropertySeg2.Len();
3796 SplitPoints.clear();
3797 SplitLength.clear();
3800 for (int i = 0; i <= intPropertyLen; i++){
3802 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3810 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3812 if (AfterFirstToken == TRUE){
3814 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3815 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3819 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3820 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3821 AfterFirstToken = TRUE;
3833 if (SplitPoints.size() > 0){
3835 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3836 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3840 if (SplitPoints.size() == 0){
3842 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3844 if (!PropertyTokens.IsEmpty()){
3846 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3852 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3853 intiter != SplitPoints.end(); ++intiter){
3855 SLiter = SplitLength.find(intiter->first);
3857 intPrevValue = intiter->second;
3859 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3861 // Add the data to the General/Home/Work address variables.
3863 // Trim any whitespace from the start and end.
3865 PropertyData = PropertyData.Trim(FALSE);
3866 PropertyData = PropertyData.Trim(TRUE);
3868 CaptureString(&PropertyData, FALSE);
3870 if (FirstCategoryProcessed == TRUE){
3872 FirstCategoryProcessed = FALSE;
3874 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3876 if (!PropertyTokens.IsEmpty()){
3878 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3888 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3890 if (!PropertyTokens.IsEmpty()){
3892 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3898 // Copy the properties to each of the categories (if it exists).
3900 if (!PropertyTokens.IsEmpty()){
3902 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3906 // Check if ALTID was used.
3908 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3910 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3914 // Check if PID was used.
3916 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3918 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3922 // Check if PREF was used.
3924 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3926 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3930 // Check if LANGUAGE was used.
3932 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3934 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3938 // Check if TYPE was used.
3944 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3947 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3955 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3957 size_t intPropertyLen = PropertySeg1.Len();
3958 std::map<int, int> SplitPoints;
3959 std::map<int, int> SplitLength;
3960 std::map<int, int>::iterator SLiter;
3961 wxString PropertyData;
3962 wxString PropertyName;
3963 wxString PropertyValue;
3964 wxString PropertyTokens;
3965 bool FirstToken = TRUE;
3966 int intSplitsFound = 0;
3967 int intSplitSize = 0;
3968 int intPrevValue = 7;
3972 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3976 PropertyType PropType = PROPERTY_NONE;
3978 // Look for type before continuing.
3980 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3983 bool PropertyMatched = FALSE;
3985 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3986 intiter != SplitPoints.end(); ++intiter){
3988 SLiter = SplitLength.find(intiter->first);
3990 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3992 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3993 PropertyName = PropertyElement.GetNextToken();
3994 PropertyValue = PropertyElement.GetNextToken();
3996 intPrevValue = intiter->second;
3998 // Process properties.
4000 size_t intPropertyValueLen = PropertyValue.Len();
4002 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4004 PropertyValue.Trim();
4005 PropertyValue.RemoveLast();
4009 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4011 PropertyValue.Remove(0, 1);
4015 CaptureString(&PropertyValue, FALSE);
4017 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
4018 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
4019 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
4020 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
4022 if (PropertyMatched == TRUE){
4024 PropertyMatched = FALSE;
4029 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4031 if (FirstToken == TRUE){
4033 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4038 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4046 intPropertyLen = PropertySeg2.Len();
4047 SplitPoints.clear();
4048 SplitLength.clear();
4053 CaptureString(&PropertySeg2, FALSE);
4055 for (int i = 0; i <= intPropertyLen; i++){
4059 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4062 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4064 if (intSplitsFound == 6){
4066 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4071 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4081 wxString wxSPhotoURI;
4082 wxString wxSPhotoMIME;
4083 wxString wxSPhotoEncoding;
4084 wxString wxSPhotoData;
4085 std::string base64enc;
4087 if (intSplitsFound == 0){
4091 std::map<int, int>::iterator striter;
4093 striter = SplitLength.find(1);
4095 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4097 while (wSTDataType.HasMoreTokens() == TRUE){
4099 wxSPhotoURI = wSTDataType.GetNextToken();
4100 wxSPhotoMIME = wSTDataType.GetNextToken();
4105 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4107 while (wSTDataInfo.HasMoreTokens() == TRUE){
4109 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4110 wxSPhotoData = wSTDataInfo.GetNextToken();
4111 base64enc = wxSPhotoData.mb_str();
4118 // Add the data to the General/Home/Work address variables.
4120 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4121 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4122 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4128 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4131 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4135 if (!PropertyTokens.IsEmpty()){
4137 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4143 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4145 size_t intPropertyLen = PropertySeg1.Len();
4146 std::map<int, int> SplitPoints;
4147 std::map<int, int> SplitLength;
4148 std::map<int, int>::iterator SLiter;
4149 wxString PropertyData;
4150 wxString PropertyName;
4151 wxString PropertyValue;
4152 wxString PropertyTokens;
4153 bool FirstToken = TRUE;
4154 int intSplitsFound = 0;
4155 int intSplitSize = 0;
4156 int intPrevValue = 6;
4160 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4164 PropertyType PropType = PROPERTY_NONE;
4166 // Look for type before continuing.
4168 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4171 bool PropertyMatched = FALSE;
4173 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4174 intiter != SplitPoints.end(); ++intiter){
4176 SLiter = SplitLength.find(intiter->first);
4178 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4180 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4181 PropertyName = PropertyElement.GetNextToken();
4182 PropertyValue = PropertyElement.GetNextToken();
4184 intPrevValue = intiter->second;
4186 // Process properties.
4188 size_t intPropertyValueLen = PropertyValue.Len();
4190 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4192 PropertyValue.Trim();
4193 PropertyValue.RemoveLast();
4197 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4199 PropertyValue.Remove(0, 1);
4203 CaptureString(&PropertyValue, FALSE);
4205 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
4206 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
4207 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
4208 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
4210 if (PropertyMatched == TRUE){
4212 PropertyMatched = FALSE;
4217 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4219 if (FirstToken == TRUE){
4221 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4226 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4234 intPropertyLen = PropertySeg2.Len();
4235 SplitPoints.clear();
4236 SplitLength.clear();
4241 CaptureString(&PropertySeg2, FALSE);
4243 for (int i = 0; i <= intPropertyLen; i++){
4247 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4250 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4252 if (intSplitsFound == 6){
4254 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4259 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4269 wxString wxSPhotoURI;
4270 wxString wxSPhotoMIME;
4271 wxString wxSPhotoEncoding;
4272 wxString wxSPhotoData;
4273 std::string base64enc;
4275 if (intSplitsFound == 0){
4279 std::map<int, int>::iterator striter;
4281 striter = SplitLength.find(1);
4283 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4285 while (wSTDataType.HasMoreTokens() == TRUE){
4287 wxSPhotoURI = wSTDataType.GetNextToken();
4288 wxSPhotoMIME = wSTDataType.GetNextToken();
4293 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4295 while (wSTDataInfo.HasMoreTokens() == TRUE){
4297 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4298 wxSPhotoData = wSTDataInfo.GetNextToken();
4299 base64enc = wxSPhotoData.mb_str();
4306 // Add the data to the General/Home/Work address variables.
4308 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4309 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4310 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4316 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4319 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4323 if (!PropertyTokens.IsEmpty()){
4325 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4331 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4333 size_t intPropertyLen = PropertySeg1.Len();
4334 std::map<int, int> SplitPoints;
4335 std::map<int, int> SplitLength;
4336 std::map<int, int>::iterator SLiter;
4337 wxString PropertyData;
4338 wxString PropertyName;
4339 wxString PropertyValue;
4340 wxString PropertyTokens;
4341 bool FirstToken = TRUE;
4342 int intSplitsFound = 0;
4343 int intSplitSize = 0;
4344 int intPrevValue = 7;
4348 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4352 PropertyType PropType = PROPERTY_NONE;
4354 // Look for type before continuing.
4356 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4359 bool PropertyMatched = FALSE;
4361 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4362 intiter != SplitPoints.end(); ++intiter){
4364 SLiter = SplitLength.find(intiter->first);
4366 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4368 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4369 PropertyName = PropertyElement.GetNextToken();
4370 PropertyValue = PropertyElement.GetNextToken();
4372 intPrevValue = intiter->second;
4374 // Process properties.
4376 size_t intPropertyValueLen = PropertyValue.Len();
4378 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4380 PropertyValue.Trim();
4381 PropertyValue.RemoveLast();
4385 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4387 PropertyValue.Remove(0, 1);
4391 CaptureString(&PropertyValue, FALSE);
4393 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
4394 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
4395 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
4396 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
4397 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
4399 if (PropertyMatched == TRUE){
4401 PropertyMatched = FALSE;
4406 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4408 if (FirstToken == TRUE){
4410 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4415 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4423 intPropertyLen = PropertySeg2.Len();
4424 SplitPoints.clear();
4425 SplitLength.clear();
4430 CaptureString(&PropertySeg2, FALSE);
4432 for (int i = 0; i <= intPropertyLen; i++){
4436 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4439 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4441 if (intSplitsFound == 6){
4443 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4448 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4458 wxString wxSSoundURI;
4459 wxString wxSSoundMIME;
4460 wxString wxSSoundEncoding;
4461 wxString wxSSoundData;
4462 std::string base64enc;
4464 if (intSplitsFound == 0){
4468 std::map<int, int>::iterator striter;
4470 striter = SplitLength.find(1);
4472 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4474 while (wSTDataType.HasMoreTokens() == TRUE){
4476 wxSSoundURI = wSTDataType.GetNextToken();
4477 wxSSoundMIME = wSTDataType.GetNextToken();
4482 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4484 while (wSTDataInfo.HasMoreTokens() == TRUE){
4486 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4487 wxSSoundData = wSTDataInfo.GetNextToken();
4488 base64enc = wxSSoundData.mb_str();
4495 // Add the data to the General/Home/Work address variables.
4501 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4504 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4508 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4509 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4510 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4512 if (!PropertyTokens.IsEmpty()){
4514 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4520 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4522 size_t intPropertyLen = PropertySeg1.Len();
4523 std::map<int, int> SplitPoints;
4524 std::map<int, int> SplitLength;
4525 std::map<int, int>::iterator SLiter;
4526 wxString PropertyData;
4527 wxString PropertyName;
4528 wxString PropertyValue;
4529 wxString PropertyTokens;
4530 bool FirstToken = TRUE;
4531 int intSplitsFound = 0;
4532 int intSplitSize = 0;
4533 int intPrevValue = 8;
4537 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4541 PropertyType PropType = PROPERTY_NONE;
4543 // Look for type before continuing.
4545 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4548 bool PropertyMatched = FALSE;
4550 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4551 intiter != SplitPoints.end(); ++intiter){
4553 SLiter = SplitLength.find(intiter->first);
4555 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4557 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4558 PropertyName = PropertyElement.GetNextToken();
4559 PropertyValue = PropertyElement.GetNextToken();
4561 intPrevValue = intiter->second;
4563 // Process properties.
4565 size_t intPropertyValueLen = PropertyValue.Len();
4567 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4569 PropertyValue.Trim();
4570 PropertyValue.RemoveLast();
4574 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4576 PropertyValue.Remove(0, 1);
4580 CaptureString(&PropertyValue, FALSE);
4582 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4583 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4584 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4585 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4587 if (PropertyMatched == TRUE){
4589 PropertyMatched = FALSE;
4594 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4596 if (FirstToken == TRUE){
4598 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4603 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4611 intPropertyLen = PropertySeg2.Len();
4612 SplitPoints.clear();
4613 SplitLength.clear();
4618 CaptureString(&PropertySeg2, FALSE);
4620 // Add the data to the General/Home/Work address variables.
4626 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4629 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4633 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4635 if (!PropertyTokens.IsEmpty()){
4637 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4643 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4645 size_t intPropertyLen = PropertySeg1.Len();
4646 std::map<int, int> SplitPoints;
4647 std::map<int, int> SplitLength;
4648 std::map<int, int>::iterator SLiter;
4649 wxString PropertyData;
4650 wxString PropertyName;
4651 wxString PropertyValue;
4652 wxString PropertyTokens;
4653 bool FirstToken = TRUE;
4654 int intSplitsFound = 0;
4655 int intSplitSize = 0;
4656 int intPrevValue = 8;
4660 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4664 PropertyType PropType = PROPERTY_NONE;
4666 // Look for type before continuing.
4668 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4671 bool PropertyMatched = FALSE;
4673 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4674 intiter != SplitPoints.end(); ++intiter){
4676 SLiter = SplitLength.find(intiter->first);
4678 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4680 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4681 PropertyName = PropertyElement.GetNextToken();
4682 PropertyValue = PropertyElement.GetNextToken();
4684 intPrevValue = intiter->second;
4686 // Process properties.
4688 size_t intPropertyValueLen = PropertyValue.Len();
4690 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4692 PropertyValue.Trim();
4693 PropertyValue.RemoveLast();
4697 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4699 PropertyValue.Remove(0, 1);
4703 CaptureString(&PropertyValue, FALSE);
4705 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4706 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4707 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4708 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4710 if (PropertyMatched == TRUE){
4712 PropertyMatched = FALSE;
4717 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4719 if (FirstToken == TRUE){
4721 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4726 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4734 intPropertyLen = PropertySeg2.Len();
4735 SplitPoints.clear();
4736 SplitLength.clear();
4741 CaptureString(&PropertySeg2, FALSE);
4743 // Add the data to the General/Home/Work address variables.
4749 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4752 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4756 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4758 if (!PropertyTokens.IsEmpty()){
4760 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4766 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4768 size_t intPropertyLen = PropertySeg1.Len();
4769 std::map<int, int> SplitPoints;
4770 std::map<int, int> SplitLength;
4771 std::map<int, int>::iterator SLiter;
4772 wxString PropertyData;
4773 wxString PropertyName;
4774 wxString PropertyValue;
4775 wxString PropertyTokens;
4776 bool FirstToken = TRUE;
4777 int intSplitsFound = 0;
4778 int intSplitSize = 0;
4779 int intPrevValue = 7;
4783 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4787 PropertyType PropType = PROPERTY_NONE;
4789 // Look for type before continuing.
4791 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4794 bool PropertyMatched = FALSE;
4796 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4797 intiter != SplitPoints.end(); ++intiter){
4799 SLiter = SplitLength.find(intiter->first);
4801 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4803 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4804 PropertyName = PropertyElement.GetNextToken();
4805 PropertyValue = PropertyElement.GetNextToken();
4807 intPrevValue = intiter->second;
4809 // Process properties.
4811 size_t intPropertyValueLen = PropertyValue.Len();
4813 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4815 PropertyValue.Trim();
4816 PropertyValue.RemoveLast();
4820 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4822 PropertyValue.Remove(0, 1);
4826 CaptureString(&PropertyValue, FALSE);
4828 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4829 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4830 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4831 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4833 if (PropertyMatched == TRUE){
4835 PropertyMatched = FALSE;
4840 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4842 if (FirstToken == TRUE){
4844 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4849 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4857 intPropertyLen = PropertySeg2.Len();
4858 SplitPoints.clear();
4859 SplitLength.clear();
4864 CaptureString(&PropertySeg2, FALSE);
4866 // Add the data to the General/Home/Work address variables.
4872 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4875 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4879 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4881 if (!PropertyTokens.IsEmpty()){
4883 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4889 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4891 size_t intPropertyLen = PropertySeg1.Len();
4892 std::map<int, int> SplitPoints;
4893 std::map<int, int> SplitLength;
4894 std::map<int, int>::iterator SLiter;
4895 wxString PropertyData;
4896 wxString PropertyName;
4897 wxString PropertyValue;
4898 wxString PropertyTokens;
4899 bool FirstToken = TRUE;
4900 int intSplitsFound = 0;
4901 int intSplitSize = 0;
4902 int intPrevValue = 5;
4907 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4911 PropertyType PropType = PROPERTY_NONE;
4913 // Look for type before continuing.
4915 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4918 bool PropertyMatched = FALSE;
4920 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4921 intiter != SplitPoints.end(); ++intiter){
4923 SLiter = SplitLength.find(intiter->first);
4925 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4927 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4928 PropertyName = PropertyElement.GetNextToken();
4929 PropertyValue = PropertyElement.GetNextToken();
4931 intPrevValue = intiter->second;
4933 // Process properties.
4935 size_t intPropertyValueLen = PropertyValue.Len();
4937 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4939 PropertyValue.Trim();
4940 PropertyValue.RemoveLast();
4944 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4946 PropertyValue.Remove(0, 1);
4950 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4951 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4952 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4954 if (PropertyMatched == TRUE){
4956 PropertyMatched = FALSE;
4961 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4963 if (FirstToken == TRUE){
4965 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4970 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4978 intPropertyLen = PropertySeg2.Len();
4979 SplitPoints.clear();
4980 SplitLength.clear();
4985 for (int i = 0; i <= intPropertyLen; i++){
4989 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4992 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4994 if (intSplitsFound == 6){
4996 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5001 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5012 wxString wxSKeyMIME;
5013 wxString wxSKeyEncoding;
5014 wxString wxSKeyData;
5015 std::string base64enc;
5017 if (intSplitsFound == 0){
5021 std::map<int, int>::iterator striter;
5023 striter = SplitLength.find(1);
5025 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
5027 while (wSTDataType.HasMoreTokens() == TRUE){
5029 wxSKeyURI = wSTDataType.GetNextToken();
5030 wxSKeyMIME = wSTDataType.GetNextToken();
5035 if (wxSKeyURI == wxT("data")){
5037 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
5039 while (wSTDataInfo.HasMoreTokens() == TRUE){
5041 wxSKeyEncoding = wSTDataInfo.GetNextToken();
5042 wxSKeyData = wSTDataInfo.GetNextToken();
5051 // Add the data to the General/Home/Work address variables.
5053 if (wxSKeyURI == wxT("data")){
5055 KeyListDataEncType.erase(*KeyCount);
5056 KeyListKeyType.erase(*KeyCount);
5057 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
5058 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
5060 KeyList.erase(*KeyCount);
5061 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
5065 KeyList.erase(*KeyCount);
5066 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
5070 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
5076 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
5079 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
5083 if (!PropertyTokens.IsEmpty()){
5085 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
5091 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
5093 // Split the Vendor three ways.
5095 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
5098 wxString wxSVNDPropName;
5101 while (wSTVendorDetails.HasMoreTokens() == TRUE){
5103 wSTVendorDetails.GetNextToken();
5104 wxSVNDID = wSTVendorDetails.GetNextToken();
5105 wxSVNDPropName = wSTVendorDetails.GetNextToken();
5110 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
5112 // Add the data to the vendor variables.
5114 VendorList.erase(*VendorCount);
5115 VendorListPEN.erase(*VendorCount);
5116 VendorListElement.erase(*VendorCount);
5118 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
5119 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
5120 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
5126 void ProcessTokens(wxString *PropertyName,
5127 wxString *PropertyValue,
5128 wxString *PropertyTokens,
5131 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5133 if (*FirstToken == TRUE){
5135 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5136 *FirstToken = FALSE;
5140 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5148 void ProcessStringValue(wxString *PropertyName,
5149 wxString PropertyNameMatch,
5150 std::map<int,wxString> *MapPtr,
5151 wxString *PropertyValue,
5153 bool *PropertyMatched){
5155 if (*PropertyName == PropertyNameMatch){
5156 MapPtr->erase(*ItemCount);
5157 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5158 *PropertyMatched = TRUE;
5163 void ProcessIntegerValue(wxString *PropertyName,
5164 wxString PropertyNameMatch,
5165 std::map<int,int> *PrefPtr,
5166 wxString *PropertyValue,
5168 bool *PropertyMatched){
5170 if (*PropertyName == PropertyNameMatch){
5171 *PropertyMatched = TRUE;
5176 int PriorityNumber = 0;
5177 bool ValidNumber = TRUE;
5180 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5183 catch(std::invalid_argument &e){
5184 ValidNumber = FALSE;
5187 if (ValidNumber == TRUE){
5189 PrefPtr->erase(*ItemCount);
5190 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5196 void SplitValues(wxString *PropertyLine,
5197 std::map<int,int> *SplitPoints,
5198 std::map<int,int> *SplitLength,
5201 size_t intPropertyLen = PropertyLine->Len();
5202 int intSplitsFound = 0;
5203 int intSplitSize = 0;
5204 int intSplitSeek = 0;
5206 for (int i = intSize; i <= intPropertyLen; i++){
5210 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5211 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5213 if (intSplitsFound == 0){
5215 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5219 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5223 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5233 if (intSplitsFound == 0){
5235 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5236 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5240 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5241 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5247 void CheckType(wxString *PropertySeg1,
5248 std::map<int,int> *SplitPoints,
5249 std::map<int,int> *SplitLength,
5251 PropertyType *PropType){
5253 wxString PropertyData;
5254 wxString PropertyName;
5255 wxString PropertyValue;
5256 std::map<int,int>::iterator SLiter;
5258 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5259 intiter != SplitPoints->end(); ++intiter){
5261 SLiter = SplitLength->find(intiter->first);
5263 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5265 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5266 PropertyName = PropertyElement.GetNextToken();
5267 PropertyValue = PropertyElement.GetNextToken();
5269 *intPrevValue = intiter->second;
5271 if (PropertyName == wxT("TYPE")){
5273 if (PropertyValue == wxT("work")){
5275 *PropType = PROPERTY_WORK;
5277 } else if (PropertyValue == wxT("home")){
5279 *PropType = PROPERTY_HOME;
5283 *PropType = PROPERTY_NONE;