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 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
608 if (FirstToken == TRUE){
610 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
615 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
623 intPropertyLen = PropertySeg2.Len();
630 CaptureString(&PropertySeg2, FALSE);
632 // Add the data to the General/Home/Work address variables.
638 SourceListType.insert(std::make_pair(*SourceCount, "home"));
641 SourceListType.insert(std::make_pair(*SourceCount, "work"));
645 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
647 if (!PropertyTokens.IsEmpty()){
649 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
655 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
657 std::map<int, int> SplitPoints;
658 std::map<int, int> SplitLength;
660 int intPrevValue = 5;
664 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
668 wxString PropertyName;
669 wxString PropertyValue;
670 wxString PropertyData;
671 wxString PropertyTokens;
672 std::map<int,int>::iterator SLiter;
673 bool FirstToken = TRUE;
674 bool PropertyMatched = FALSE;
676 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
677 intiter != SplitPoints.end(); ++intiter){
679 SLiter = SplitLength.find(intiter->first);
681 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
683 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
684 PropertyName = PropertyElement.GetNextToken();
685 PropertyValue = PropertyElement.GetNextToken();
687 intPrevValue = intiter->second;
689 CaptureString(&PropertyValue, FALSE);
691 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
693 if (PropertyMatched == TRUE){
695 PropertyMatched = FALSE;
702 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
706 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
708 std::map<int, int> SplitPoints;
709 std::map<int, int> SplitLength;
711 int intPrevValue = 8;
715 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
719 wxString PropertyName;
720 wxString PropertyValue;
721 wxString PropertyData;
722 wxString PropertyTokens;
723 std::map<int,int>::iterator SLiter;
724 bool FirstToken = TRUE;
725 bool PropertyMatched = FALSE;
727 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
728 intiter != SplitPoints.end(); ++intiter){
730 SLiter = SplitLength.find(intiter->first);
732 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
734 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
735 PropertyName = PropertyElement.GetNextToken();
736 PropertyValue = PropertyElement.GetNextToken();
738 intPrevValue = intiter->second;
740 CaptureString(&PropertyValue, FALSE);
742 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
743 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
744 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
745 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
747 if (PropertyMatched == TRUE){
749 PropertyMatched = FALSE;
754 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
756 if (FirstToken == TRUE){
758 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
763 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
771 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
773 if (!PropertyTokens.IsEmpty()){
775 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
782 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
784 std::map<int, int> SplitPoints;
785 std::map<int, int> SplitLength;
787 int intPrevValue = 4;
791 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
795 wxString PropertyName;
796 wxString PropertyValue;
797 wxString PropertyData;
798 wxString PropertyTokens;
799 std::map<int,int>::iterator SLiter;
800 bool FirstToken = TRUE;
801 bool PropertyMatched = FALSE;
803 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
804 intiter != SplitPoints.end(); ++intiter){
806 SLiter = SplitLength.find(intiter->first);
808 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
810 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
811 PropertyName = PropertyElement.GetNextToken();
812 PropertyValue = PropertyElement.GetNextToken();
814 intPrevValue = intiter->second;
816 CaptureString(&PropertyValue, FALSE);
818 if (PropertyName == wxT("TYPE")){
820 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
821 PropertyValue == wxT("work") ){
823 FullNamesListType.erase(*FNCount);
824 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
828 PropertyMatched = TRUE;
832 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
833 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
834 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
835 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
837 if (PropertyMatched == TRUE){
839 PropertyMatched = FALSE;
844 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
846 if (FirstToken == TRUE){
848 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
853 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
861 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
863 if (!PropertyTokens.IsEmpty()){
865 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
871 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
873 std::map<int, int> SplitPoints;
874 std::map<int, int> SplitLength;
876 int intPrevValue = 3;
880 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
884 wxString PropertyName;
885 wxString PropertyValue;
886 wxString PropertyData;
887 wxString PropertyTokens;
888 std::map<int,int>::iterator SLiter;
889 bool FirstToken = TRUE;
891 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
892 intiter != SplitPoints.end(); ++intiter){
894 SLiter = SplitLength.find(intiter->first);
896 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
898 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
899 PropertyName = PropertyElement.GetNextToken();
900 PropertyValue = PropertyElement.GetNextToken();
902 intPrevValue = intiter->second;
904 CaptureString(&PropertyValue, FALSE);
906 if (PropertyName == wxT("ALTID")){
908 NameAltID = PropertyValue;
910 } else if (PropertyName == wxT("LANGUAGE")){
912 NameLanguage = PropertyValue;
914 } else if (PropertyName == wxT("SORT-AS")){
916 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
917 PropertyValue.Len() >= 3){
918 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
921 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
923 if (FirstToken == TRUE){
925 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
930 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
938 // Split the name data.
940 int intSplitSeek = 0;
941 int intSplitsFound = 0;
942 int intSplitSize = 0;
943 int intPropertyLen = PropertySeg2.Len();
945 std::map<int,wxString> NameValues;
948 for (int i = 0; i <= intPropertyLen; i++){
950 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
952 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
957 if (intSplitsFound == 4){
959 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
973 // Split the data into several parts.
975 for (std::map<int, wxString>::iterator iter = NameValues.begin();
976 iter != NameValues.end(); ++iter){
978 if (iter->first == 1){
980 // Deal with family name.
982 NameSurname = iter->second;
984 } else if (iter->first == 2){
986 // Deal with given names.
988 NameForename = iter->second;
990 } else if (iter->first == 3){
992 // Deal with additional names.
994 NameOtherNames = iter->second;
996 } else if (iter->first == 4){
998 // Deal with honorifix prefixes and suffixes.
1000 NameTitle = iter->second;
1004 if (iter == NameValues.end()){
1010 NameSuffix = iter->second;
1016 // Add the name token data.
1018 if (!PropertyTokens.IsEmpty()){
1020 NameTokens = PropertyTokens;
1026 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
1028 size_t intPropertyLen = PropertySeg1.Len();
1029 std::map<int, int> SplitPoints;
1030 std::map<int, int> SplitLength;
1031 std::map<int, int>::iterator SLiter;
1032 wxString PropertyData;
1033 wxString PropertyName;
1034 wxString PropertyValue;
1035 wxString PropertyTokens;
1036 bool FirstToken = TRUE;
1037 int intSplitsFound = 0;
1038 int intSplitSize = 0;
1039 int intPrevValue = 14;
1043 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1047 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1048 intiter != SplitPoints.end(); ++intiter){
1050 SLiter = SplitLength.find(intiter->first);
1052 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1054 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1055 PropertyName = PropertyElement.GetNextToken();
1056 PropertyValue = PropertyElement.GetNextToken();
1058 intPrevValue = intiter->second;
1060 // Process properties.
1062 CaptureString(&PropertyValue, FALSE);
1064 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1066 if (FirstToken == TRUE){
1068 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1073 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1081 CaptureString(&PropertySeg2, FALSE);
1083 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
1085 if (!PropertyTokens.IsEmpty()){
1087 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
1093 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
1095 std::map<int, int> SplitPoints;
1096 std::map<int, int> SplitLength;
1098 int intPrevValue = 10;
1101 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1105 PropertyType PropType = PROPERTY_NONE;
1107 // Look for type before continuing.
1109 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1113 std::map<int, wxString> *NicknamesList = NULL;
1114 std::map<int, wxString> *NicknamesListType = NULL;
1115 std::map<int, wxString> *NicknamesListLanguage = NULL;
1116 std::map<int, wxString> *NicknamesListAltID = NULL;
1117 std::map<int, wxString> *NicknamesListPID = NULL;
1118 std::map<int, wxString> *NicknamesListTokens = NULL;
1119 std::map<int, int> *NicknamesListPref = NULL;
1123 NicknamesList = &GeneralNicknamesList;
1124 NicknamesListType = &GeneralNicknamesListType;
1125 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1126 NicknamesListAltID = &GeneralNicknamesListAltID;
1127 NicknamesListPID = &GeneralNicknamesListPID;
1128 NicknamesListTokens = &GeneralNicknamesListTokens;
1129 NicknamesListPref = &GeneralNicknamesListPref;
1132 NicknamesList = &HomeNicknamesList;
1133 NicknamesListType = &HomeNicknamesListType;
1134 NicknamesListLanguage = &HomeNicknamesListLanguage;
1135 NicknamesListAltID = &HomeNicknamesListAltID;
1136 NicknamesListPID = &HomeNicknamesListPID;
1137 NicknamesListTokens = &HomeNicknamesListTokens;
1138 NicknamesListPref = &HomeNicknamesListPref;
1141 NicknamesList = &BusinessNicknamesList;
1142 NicknamesListType = &BusinessNicknamesListType;
1143 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1144 NicknamesListAltID = &BusinessNicknamesListAltID;
1145 NicknamesListPID = &BusinessNicknamesListPID;
1146 NicknamesListTokens = &BusinessNicknamesListTokens;
1147 NicknamesListPref = &BusinessNicknamesListPref;
1151 std::map<int, int>::iterator SLiter;
1152 wxString PropertyData;
1153 wxString PropertyName;
1154 wxString PropertyValue;
1155 wxString PropertyTokens;
1156 bool FirstToken = TRUE;
1157 bool PropertyMatched = FALSE;
1159 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1160 intiter != SplitPoints.end(); ++intiter){
1162 SLiter = SplitLength.find(intiter->first);
1164 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1166 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1167 PropertyName = PropertyElement.GetNextToken();
1168 PropertyValue = PropertyElement.GetNextToken();
1170 intPrevValue = intiter->second;
1172 CaptureString(&PropertyValue, FALSE);
1174 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1175 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1176 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1177 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1179 if (PropertyMatched == TRUE){
1181 PropertyMatched = FALSE;
1186 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1188 if (FirstToken == TRUE){
1190 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1195 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1203 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1205 // Add the name token data.
1207 if (!PropertyTokens.IsEmpty()){
1209 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1215 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1217 std::map<int, int> SplitPoints;
1218 std::map<int, int> SplitLength;
1219 std::map<int, int>::iterator SLiter;
1220 wxString PropertyData;
1221 wxString PropertyName;
1222 wxString PropertyValue;
1223 wxString PropertyTokens;
1224 bool FirstToken = TRUE;
1225 int intPrevValue = 8;
1227 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1231 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1232 intiter != SplitPoints.end(); ++intiter){
1234 SLiter = SplitLength.find(intiter->first);
1236 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1238 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1239 PropertyName = PropertyElement.GetNextToken();
1240 PropertyValue = PropertyElement.GetNextToken();
1242 intPrevValue = intiter->second;
1244 // Process properties.
1246 size_t intPropertyValueLen = PropertyValue.Len();
1248 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1250 PropertyValue.Trim();
1251 PropertyValue.RemoveLast();
1255 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1257 PropertyValue.Remove(0, 1);
1261 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1263 if (FirstToken == TRUE){
1265 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1270 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1278 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1280 wxString GenderComponent;
1282 if (GenderData.CountTokens() >= 2){
1284 Gender = GenderData.GetNextToken();
1285 GenderDetails = GenderData.GetString();
1287 CaptureString(&GenderDetails, FALSE);
1291 Gender = GenderData.GetNextToken();
1295 if (!PropertyTokens.IsEmpty()){
1297 GenderTokens = PropertyTokens;
1303 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1305 // Process date. Preserve the remainder in the string.
1307 std::map<int, int> SplitPoints;
1308 std::map<int, int> SplitLength;
1309 std::map<int, int>::iterator SLiter;
1310 wxString PropertyData;
1311 wxString PropertyName;
1312 wxString PropertyValue;
1313 wxString PropertyTokens;
1314 bool BirthdayText = FALSE;
1315 int intPrevValue = 6;
1317 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1321 // Look for type before continuing.
1323 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1324 intiter != SplitPoints.end(); ++intiter){
1326 SLiter = SplitLength.find(intiter->first);
1328 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1330 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1331 PropertyName = PropertyElement.GetNextToken();
1332 PropertyValue = PropertyElement.GetNextToken();
1334 intPrevValue = intiter->second;
1336 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1338 CaptureString(&PropertySeg2, FALSE);
1339 Birthday = PropertySeg2;
1340 BirthdayText = TRUE;
1346 // Setup blank lines for later on.
1349 bool FirstToken = TRUE;
1351 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1352 intiter != SplitPoints.end(); ++intiter){
1354 SLiter = SplitLength.find(intiter->first);
1356 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1358 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1359 PropertyName = PropertyElement.GetNextToken();
1360 PropertyValue = PropertyElement.GetNextToken();
1362 intPrevValue = intiter->second;
1364 // Process properties.
1366 CaptureString(&PropertyValue, FALSE);
1368 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1370 PropertyValue.Trim();
1371 PropertyValue.RemoveLast();
1375 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1377 PropertyValue.Remove(0, 1);
1381 if (PropertyName == wxT("ALTID")){
1383 BirthdayAltID = PropertyValue;
1385 } else if (PropertyName == wxT("CALSCALE")){
1387 BirthdayCalScale = PropertyValue;
1389 } else if (PropertyName != wxT("VALUE")) {
1391 // Something else we don't know about so append
1392 // to the tokens variable.
1394 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1396 if (FirstToken == TRUE){
1398 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1403 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1413 // Add the data to the variables and form.
1415 if (BirthdayText == FALSE){
1417 Birthday = PropertySeg2;
1421 if (!PropertyTokens.IsEmpty()){
1423 BirthdayTokens = PropertyTokens;
1429 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1431 // Process date. Preserve the remainder in the string.
1433 std::map<int, int> SplitPoints;
1434 std::map<int, int> SplitLength;
1435 std::map<int, int>::iterator SLiter;
1436 wxString PropertyData;
1437 wxString PropertyName;
1438 wxString PropertyValue;
1439 wxString PropertyTokens;
1440 bool AnniversaryText = FALSE;
1441 int intPrevValue = 13;
1443 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1447 // Look for type before continuing.
1449 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1450 intiter != SplitPoints.end(); ++intiter){
1452 SLiter = SplitLength.find(intiter->first);
1454 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1456 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1457 PropertyName = PropertyElement.GetNextToken();
1458 PropertyValue = PropertyElement.GetNextToken();
1460 intPrevValue = intiter->second;
1462 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1464 CaptureString(&PropertySeg2, FALSE);
1465 Anniversary = PropertySeg2;
1466 AnniversaryText = TRUE;
1472 // Setup blank lines for later on.
1475 bool FirstToken = TRUE;
1477 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1478 intiter != SplitPoints.end(); ++intiter){
1480 SLiter = SplitLength.find(intiter->first);
1482 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1484 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1485 PropertyName = PropertyElement.GetNextToken();
1486 PropertyValue = PropertyElement.GetNextToken();
1488 intPrevValue = intiter->second;
1490 // Process properties.
1492 CaptureString(&PropertyValue, FALSE);
1494 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1496 PropertyValue.Trim();
1497 PropertyValue.RemoveLast();
1501 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1503 PropertyValue.Remove(0, 1);
1507 if (PropertyName == wxT("ALTID")){
1509 AnniversaryAltID = PropertyValue;
1511 } else if (PropertyName == wxT("CALSCALE")){
1513 AnniversaryCalScale = PropertyValue;
1515 } else if (PropertyName != wxT("VALUE")) {
1517 // Something else we don't know about so append
1518 // to the tokens variable.
1520 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1522 if (FirstToken == TRUE){
1524 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1529 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1539 // Add the data to the variables and form.
1541 if (AnniversaryText == FALSE){
1543 Anniversary = PropertySeg2;
1547 if (!PropertyTokens.IsEmpty()){
1549 AnniversaryTokens = PropertyTokens;
1555 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1557 std::map<int, int> SplitPoints;
1558 std::map<int, int> SplitLength;
1560 int intPrevValue = 4;
1563 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1567 PropertyType PropType = PROPERTY_NONE;
1569 // Look for type before continuing.
1571 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1575 std::map<int, wxString> *TZList = NULL;
1576 std::map<int, wxString> *TZListType = NULL;
1577 std::map<int, wxString> *TZListMediatype = NULL;
1578 std::map<int, wxString> *TZListAltID = NULL;
1579 std::map<int, wxString> *TZListPID = NULL;
1580 std::map<int, wxString> *TZListTokens = NULL;
1581 std::map<int, int> *TZListPref = NULL;
1585 TZList = &GeneralTZList;
1586 TZListType = &GeneralTZListType;
1587 TZListMediatype = &GeneralTZListMediatype;
1588 TZListAltID = &GeneralTZListAltID;
1589 TZListPID = &GeneralTZListPID;
1590 TZListTokens = &GeneralTZListTokens;
1591 TZListPref = &GeneralTZListPref;
1594 TZList = &HomeTZList;
1595 TZListType = &HomeTZListType;
1596 TZListMediatype = &HomeTZListMediatype;
1597 TZListAltID = &HomeTZListAltID;
1598 TZListPID = &HomeTZListPID;
1599 TZListTokens = &HomeTZListTokens;
1600 TZListPref = &HomeTZListPref;
1603 TZList = &BusinessTZList;
1604 TZListType = &BusinessTZListType;
1605 TZListMediatype = &BusinessTZListMediatype;
1606 TZListAltID = &BusinessTZListAltID;
1607 TZListPID = &BusinessTZListPID;
1608 TZListTokens = &BusinessTZListTokens;
1609 TZListPref = &BusinessTZListPref;
1613 std::map<int, int>::iterator SLiter;
1614 wxString PropertyData;
1615 wxString PropertyName;
1616 wxString PropertyValue;
1617 wxString PropertyTokens;
1618 bool FirstToken = TRUE;
1619 bool PropertyMatched = FALSE;
1621 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1622 intiter != SplitPoints.end(); ++intiter){
1624 SLiter = SplitLength.find(intiter->first);
1626 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1628 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1629 PropertyName = PropertyElement.GetNextToken();
1630 PropertyValue = PropertyElement.GetNextToken();
1632 intPrevValue = intiter->second;
1634 CaptureString(&PropertyValue, FALSE);
1636 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1637 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1638 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1639 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1641 if (PropertyMatched == TRUE){
1643 PropertyMatched = FALSE;
1648 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1650 if (FirstToken == TRUE){
1652 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1657 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1665 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1667 // Add the name token data.
1669 if (!PropertyTokens.IsEmpty()){
1671 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1678 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1680 size_t intPropertyLen = PropertySeg1.Len();
1681 std::map<int, int> SplitPoints;
1682 std::map<int, int> SplitLength;
1683 std::map<int, int>::iterator SLiter;
1684 wxString PropertyData;
1685 wxString PropertyName;
1686 wxString PropertyValue;
1687 wxString PropertyTokens;
1688 wxString AddressLabel;
1689 wxString AddressLang;
1690 wxString AddressAltID;
1691 wxString AddressPID;
1692 wxString AddressTokens;
1693 wxString AddressGeo;
1694 wxString AddressTimezone;
1695 wxString AddressType;
1696 wxString AddressMediatype;
1697 wxString AddressPOBox;
1698 wxString AddressExtended;
1699 wxString AddressStreet;
1700 wxString AddressLocality;
1701 wxString AddressCity;
1702 wxString AddressRegion;
1703 wxString AddressPostalCode;
1704 wxString AddressCountry;
1705 bool FirstToken = TRUE;
1706 int intSplitsFound = 0;
1707 int intSplitSize = 0;
1708 int intPrevValue = 5;
1712 bool PropertyMatched = FALSE;
1714 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1718 PropertyType PropType = PROPERTY_NONE;
1720 // Look for type before continuing.
1722 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1726 std::map<int, wxString> *AddressList = NULL;
1727 std::map<int, wxString> *AddressListTown = NULL;
1728 std::map<int, wxString> *AddressListCounty = NULL;
1729 std::map<int, wxString> *AddressListPostCode = NULL;
1730 std::map<int, wxString> *AddressListCountry = NULL;
1731 std::map<int, wxString> *AddressListLabel = NULL;
1732 std::map<int, wxString> *AddressListLang = NULL;
1733 std::map<int, wxString> *AddressListAltID = NULL;
1734 std::map<int, wxString> *AddressListPID = NULL;
1735 std::map<int, wxString> *AddressListTokens = NULL;
1736 std::map<int, wxString> *AddressListGeo = NULL;
1737 std::map<int, wxString> *AddressListTimezone = NULL;
1738 std::map<int, wxString> *AddressListType = NULL;
1739 std::map<int, wxString> *AddressListMediatype = NULL;
1740 std::map<int, int> *AddressListPref = NULL;
1744 AddressList = &GeneralAddressList;
1745 AddressListTown = &GeneralAddressListTown;
1746 AddressListCounty = &GeneralAddressListCounty;
1747 AddressListPostCode = &GeneralAddressListPostCode;
1748 AddressListCountry = &GeneralAddressListCountry;
1749 AddressListLabel = &GeneralAddressListLabel;
1750 AddressListLang = &GeneralAddressListLang;
1751 AddressListAltID = &GeneralAddressListAltID;
1752 AddressListPID = &GeneralAddressListPID;
1753 AddressListTokens = &GeneralAddressListTokens;
1754 AddressListGeo = &GeneralAddressListGeo;
1755 AddressListTimezone = &GeneralAddressListTimezone;
1756 AddressListType = &GeneralAddressListType;
1757 AddressListMediatype = &GeneralAddressListMediatype;
1758 AddressListPref = &GeneralAddressListPref;
1761 AddressList = &HomeAddressList;
1762 AddressListTown = &HomeAddressListTown;
1763 AddressListCounty = &HomeAddressListCounty;
1764 AddressListPostCode = &HomeAddressListPostCode;
1765 AddressListCountry = &HomeAddressListCountry;
1766 AddressListLabel = &HomeAddressListLabel;
1767 AddressListLang = &HomeAddressListLang;
1768 AddressListAltID = &HomeAddressListAltID;
1769 AddressListPID = &HomeAddressListPID;
1770 AddressListTokens = &HomeAddressListTokens;
1771 AddressListGeo = &HomeAddressListGeo;
1772 AddressListTimezone = &HomeAddressListTimezone;
1773 AddressListType = &HomeAddressListType;
1774 AddressListMediatype = &HomeAddressListMediatype;
1775 AddressListPref = &HomeAddressListPref;
1778 AddressList = &BusinessAddressList;
1779 AddressListTown = &BusinessAddressListTown;
1780 AddressListCounty = &BusinessAddressListCounty;
1781 AddressListPostCode = &BusinessAddressListPostCode;
1782 AddressListCountry = &BusinessAddressListCountry;
1783 AddressListLabel = &BusinessAddressListLabel;
1784 AddressListLang = &BusinessAddressListLang;
1785 AddressListAltID = &BusinessAddressListAltID;
1786 AddressListPID = &BusinessAddressListPID;
1787 AddressListTokens = &BusinessAddressListTokens;
1788 AddressListGeo = &BusinessAddressListGeo;
1789 AddressListTimezone = &BusinessAddressListTimezone;
1790 AddressListType = &BusinessAddressListType;
1791 AddressListMediatype = &BusinessAddressListMediatype;
1792 AddressListPref = &BusinessAddressListPref;
1798 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1799 intiter != SplitPoints.end(); ++intiter){
1801 SLiter = SplitLength.find(intiter->first);
1803 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1805 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1806 PropertyName = PropertyElement.GetNextToken();
1807 PropertyValue = PropertyElement.GetNextToken();
1809 intPrevValue = intiter->second;
1811 CaptureString(&PropertyValue, FALSE);
1813 // Process properties.
1815 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1816 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1817 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1818 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1819 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1820 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1821 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1822 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1824 if (PropertyMatched == TRUE){
1826 PropertyMatched = FALSE;
1831 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1833 if (FirstToken == TRUE){
1835 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1840 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1848 // Split the address.
1850 //std::map<int, int>::iterator SLiter;
1851 intPropertyLen = PropertySeg2.Len();
1852 SplitPoints.clear();
1853 SplitLength.clear();
1858 for (int i = 0; i <= intPropertyLen; i++){
1862 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1865 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1867 if (intSplitsFound == 6){
1869 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1874 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1884 // Split the data into several parts.
1886 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1887 intiter != SplitPoints.end(); ++intiter){
1889 if (intiter->first == 1){
1891 // Deal with PO Box.
1893 SLiter = SplitLength.find(1);
1895 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1896 intPrevValue = intiter->second;
1898 } else if (intiter->first == 2){
1900 // Deal with extended address.
1902 SLiter = SplitLength.find(2);
1904 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1905 intPrevValue = intiter->second;
1907 } else if (intiter->first == 3){
1909 // Deal with street address.
1911 SLiter = SplitLength.find(3);
1913 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1914 intPrevValue = intiter->second;
1916 } else if (intiter->first == 4){
1918 // Deal with locality
1920 SLiter = SplitLength.find(4);
1922 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1923 intPrevValue = intiter->second;
1925 } else if (intiter->first == 5){
1927 // Deal with region.
1929 SLiter = SplitLength.find(5);
1931 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1932 intPrevValue = intiter->second;
1935 } else if (intiter->first == 6){
1937 // Deal with post code.
1939 SLiter = SplitLength.find(6);
1941 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1942 intPrevValue = intiter->second;
1944 // Deal with country.
1946 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1954 // Add the data to the General/Home/Work address variables.
1956 CaptureString(&AddressStreet, FALSE);
1957 CaptureString(&AddressLocality, FALSE);
1958 CaptureString(&AddressRegion, FALSE);
1959 CaptureString(&AddressPostalCode, FALSE);
1960 CaptureString(&AddressCountry, FALSE);
1962 if (!PropertyTokens.IsEmpty()){
1964 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1968 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1969 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1970 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1971 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1972 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1976 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1979 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1982 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1986 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1990 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1992 std::map<int, int> SplitPoints;
1993 std::map<int, int> SplitLength;
1995 int intPrevValue = 7;
1998 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2002 PropertyType PropType = PROPERTY_NONE;
2004 // Look for type before continuing.
2006 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2008 std::map<int, wxString> *EmailList = NULL;
2009 std::map<int, wxString> *EmailListType = NULL;
2010 std::map<int, wxString> *EmailListAltID = NULL;
2011 std::map<int, wxString> *EmailListPID = NULL;
2012 std::map<int, wxString> *EmailListTokens = NULL;
2013 std::map<int, int> *EmailListPref = NULL;
2017 EmailList = &GeneralEmailList;
2018 EmailListType = &GeneralEmailListType;
2019 EmailListAltID = &GeneralEmailListAltID;
2020 EmailListPID = &GeneralEmailListPID;
2021 EmailListTokens = &GeneralEmailListTokens;
2022 EmailListPref = &GeneralEmailListPref;
2025 EmailList = &HomeEmailList;
2026 EmailListType = &HomeEmailListType;
2027 EmailListAltID = &HomeEmailListAltID;
2028 EmailListPID = &HomeEmailListPID;
2029 EmailListTokens = &HomeEmailListTokens;
2030 EmailListPref = &HomeEmailListPref;
2033 EmailList = &BusinessEmailList;
2034 EmailListType = &BusinessEmailListType;
2035 EmailListAltID = &BusinessEmailListAltID;
2036 EmailListPID = &BusinessEmailListPID;
2037 EmailListTokens = &BusinessEmailListTokens;
2038 EmailListPref = &BusinessEmailListPref;
2044 std::map<int,int>::iterator SLiter;
2045 wxString PropertyData;
2046 wxString PropertyName;
2047 wxString PropertyValue;
2048 wxString PropertyTokens;
2049 bool FirstToken = TRUE;
2050 bool PropertyMatched = FALSE;
2052 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2053 intiter != SplitPoints.end(); ++intiter){
2055 SLiter = SplitLength.find(intiter->first);
2057 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2059 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2060 PropertyName = PropertyElement.GetNextToken();
2061 PropertyValue = PropertyElement.GetNextToken();
2063 intPrevValue = intiter->second;
2065 CaptureString(&PropertyValue, FALSE);
2067 // Process properties.
2069 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
2070 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
2071 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
2073 if (PropertyMatched == TRUE){
2075 PropertyMatched = FALSE;
2080 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2082 if (FirstToken == TRUE){
2084 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2089 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2097 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
2099 // Add the name token data.
2101 if (!PropertyTokens.IsEmpty()){
2103 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
2110 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
2112 std::map<int, int> SplitPoints;
2113 std::map<int, int> SplitLength;
2115 int intPrevValue = 6;
2118 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2122 PropertyType PropType = PROPERTY_NONE;
2124 // Look for type before continuing.
2126 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2128 std::map<int, wxString> *IMList = NULL;
2129 std::map<int, wxString> *IMListType = NULL;
2130 std::map<int, wxString> *IMListAltID = NULL;
2131 std::map<int, wxString> *IMListPID = NULL;
2132 std::map<int, wxString> *IMListTokens = NULL;
2133 std::map<int, wxString> *IMListMediatype = NULL;
2134 std::map<int, int> *IMListPref = NULL;
2138 IMList = &GeneralIMList;
2139 IMListType = &GeneralIMListType;
2140 IMListAltID = &GeneralIMListAltID;
2141 IMListPID = &GeneralIMListPID;
2142 IMListTokens = &GeneralIMListTokens;
2143 IMListMediatype = &GeneralIMListMediatype;
2144 IMListPref = &GeneralIMListPref;
2147 IMList = &HomeIMList;
2148 IMListType = &HomeIMListType;
2149 IMListAltID = &HomeIMListAltID;
2150 IMListPID = &HomeIMListPID;
2151 IMListTokens = &HomeIMListTokens;
2152 IMListMediatype = &HomeIMListMediatype;
2153 IMListPref = &HomeIMListPref;
2156 IMList = &BusinessIMList;
2157 IMListType = &BusinessIMListType;
2158 IMListAltID = &BusinessIMListAltID;
2159 IMListPID = &BusinessIMListPID;
2160 IMListTokens = &BusinessIMListTokens;
2161 IMListMediatype = &BusinessIMListMediatype;
2162 IMListPref = &BusinessIMListPref;
2168 std::map<int,int>::iterator SLiter;
2169 wxString PropertyData;
2170 wxString PropertyName;
2171 wxString PropertyValue;
2172 wxString PropertyTokens;
2173 bool FirstToken = TRUE;
2174 bool PropertyMatched = FALSE;
2176 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2177 intiter != SplitPoints.end(); ++intiter){
2179 SLiter = SplitLength.find(intiter->first);
2181 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2183 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2184 PropertyName = PropertyElement.GetNextToken();
2185 PropertyValue = PropertyElement.GetNextToken();
2187 intPrevValue = intiter->second;
2189 CaptureString(&PropertyValue, FALSE);
2191 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
2192 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
2193 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
2194 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
2196 // Process properties.
2198 if (PropertyMatched == TRUE){
2200 PropertyMatched = FALSE;
2205 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2207 if (FirstToken == TRUE){
2209 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2214 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2222 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2224 // Add the name token data.
2226 if (!PropertyTokens.IsEmpty()){
2228 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2234 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2236 std::map<int, int> SplitPoints;
2237 std::map<int, int> SplitLength;
2238 std::map<int, int>::iterator SLiter;
2242 PropertyType PropType = PROPERTY_NONE;
2244 // Look for type before continuing.
2247 wxString TelTypeDetail;
2248 wxString PropertyData;
2249 wxString PropertyName;
2250 wxString PropertyValue;
2251 wxString PropertyTokens;
2253 std::map<int,int> TypeSplitPoints;
2254 std::map<int,int> TypeSplitLength;
2255 std::map<int,int>::iterator TSLiter;
2257 int intSplitSize = 0;
2258 int intSplitsFound = 0;
2259 int intSplitPoint = 0;
2261 int intPrevValue = 5;
2263 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2267 // Look for type before continuing.
2269 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2270 intiter != SplitPoints.end(); ++intiter){
2272 SLiter = SplitLength.find(intiter->first);
2274 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2276 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2277 PropertyName = PropertyElement.GetNextToken();
2278 PropertyValue = PropertyElement.GetNextToken();
2280 intPrevValue = intiter->second;
2282 if (PropertyName == wxT("TYPE")){
2284 // Process each value in type and translate each
2287 // Strip out the quotes if they are there.
2289 size_t intPropertyValueLen = PropertyValue.Len();
2291 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2293 PropertyValue.Trim();
2294 PropertyValue.RemoveLast();
2298 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2300 PropertyValue.Remove(0, 1);
2304 TelTypeDetail = PropertyValue;
2310 for (int i = 0; i <= intPropertyValueLen; i++){
2314 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2316 if (intSplitsFound == 0){
2318 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2319 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2323 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2324 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2337 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2338 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2340 int intTypeSeek = 0;
2342 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2343 typeiter != TypeSplitPoints.end(); ++typeiter){
2345 wxString TypePropertyName;
2347 TSLiter = TypeSplitLength.find(typeiter->first);
2349 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2351 if (intTypeSeek == 0){
2356 TelTypeUI.Append(wxT(","));
2360 if (TypePropertyName == wxT("home")){
2362 PropType = PROPERTY_HOME;
2364 } else if (TypePropertyName == wxT("work")){
2366 PropType = PROPERTY_WORK;
2371 if (TypePropertyName == wxT("text")){
2373 TelTypeUI.Append(_("text"));
2376 } else if (TypePropertyName == wxT("voice")){
2378 TelTypeUI.Append(_("voice"));
2381 } else if (TypePropertyName == wxT("fax")){
2383 TelTypeUI.Append(_("fax"));
2386 } else if (TypePropertyName == wxT("cell")){
2388 TelTypeUI.Append(_("mobile"));
2391 } else if (TypePropertyName == wxT("video")){
2393 TelTypeUI.Append(_("video"));
2396 } else if (TypePropertyName == wxT("pager")){
2398 TelTypeUI.Append(_("pager"));
2401 } else if (TypePropertyName == wxT("textphone")){
2403 TelTypeUI.Append(_("textphone"));
2414 std::map<int, wxString> *TelephoneList = NULL;
2415 std::map<int, wxString> *TelephoneListType = NULL;
2416 std::map<int, wxString> *TelephoneListAltID = NULL;
2417 std::map<int, wxString> *TelephoneListPID = NULL;
2418 std::map<int, wxString> *TelephoneListTokens = NULL;
2419 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2420 std::map<int, int> *TelephoneListPref = NULL;
2424 TelephoneList = &GeneralTelephoneList;
2425 TelephoneListType = &GeneralTelephoneListType;
2426 TelephoneListAltID = &GeneralTelephoneListAltID;
2427 TelephoneListPID = &GeneralTelephoneListPID;
2428 TelephoneListTokens = &GeneralTelephoneListTokens;
2429 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2430 TelephoneListPref = &GeneralTelephoneListPref;
2433 TelephoneList = &HomeTelephoneList;
2434 TelephoneListType = &HomeTelephoneListType;
2435 TelephoneListAltID = &HomeTelephoneListAltID;
2436 TelephoneListPID = &HomeTelephoneListPID;
2437 TelephoneListTokens = &HomeTelephoneListTokens;
2438 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2439 TelephoneListPref = &HomeTelephoneListPref;
2442 TelephoneList = &BusinessTelephoneList;
2443 TelephoneListType = &BusinessTelephoneListType;
2444 TelephoneListAltID = &BusinessTelephoneListAltID;
2445 TelephoneListPID = &BusinessTelephoneListPID;
2446 TelephoneListTokens = &BusinessTelephoneListTokens;
2447 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2448 TelephoneListPref = &BusinessTelephoneListPref;
2452 // Process the properties.
2454 bool FirstToken = TRUE;
2457 SplitPoints.clear();
2458 SplitLength.clear();
2460 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2464 bool PropertyMatched = FALSE;
2466 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2467 intiter != SplitPoints.end(); ++intiter){
2469 SLiter = SplitLength.find(intiter->first);
2471 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2473 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2474 PropertyName = PropertyElement.GetNextToken();
2475 PropertyValue = PropertyElement.GetNextToken();
2477 intPrevValue = intiter->second;
2479 CaptureString(&PropertyValue, FALSE);
2481 // Process properties.
2483 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2484 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2485 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2487 if (PropertyMatched == TRUE){
2489 PropertyMatched = FALSE;
2494 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2496 if (FirstToken == TRUE){
2498 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2503 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2511 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2512 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2514 // Add the name token data.
2516 if (!PropertyTokens.IsEmpty()){
2518 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2524 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2526 std::map<int, int> SplitPoints;
2527 std::map<int, int> SplitLength;
2529 int intPrevValue = 6;
2532 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2536 PropertyType PropType = PROPERTY_NONE;
2538 // Look for type before continuing.
2540 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2542 std::map<int, wxString> *LanguageList = NULL;
2543 std::map<int, wxString> *LanguageListType = NULL;
2544 std::map<int, wxString> *LanguageListAltID = NULL;
2545 std::map<int, wxString> *LanguageListPID = NULL;
2546 std::map<int, wxString> *LanguageListTokens = NULL;
2547 std::map<int, int> *LanguageListPref = NULL;
2551 LanguageList = &GeneralLanguageList;
2552 LanguageListType = &GeneralLanguageListType;
2553 LanguageListAltID = &GeneralLanguageListAltID;
2554 LanguageListPID = &GeneralLanguageListPID;
2555 LanguageListTokens = &GeneralLanguageListTokens;
2556 LanguageListPref = &GeneralLanguageListPref;
2559 LanguageList = &HomeLanguageList;
2560 LanguageListType = &HomeLanguageListType;
2561 LanguageListAltID = &HomeLanguageListAltID;
2562 LanguageListPID = &HomeLanguageListPID;
2563 LanguageListTokens = &HomeLanguageListTokens;
2564 LanguageListPref = &HomeLanguageListPref;
2567 LanguageList = &BusinessLanguageList;
2568 LanguageListType = &BusinessLanguageListType;
2569 LanguageListAltID = &BusinessLanguageListAltID;
2570 LanguageListPID = &BusinessLanguageListPID;
2571 LanguageListTokens = &BusinessLanguageListTokens;
2572 LanguageListPref = &BusinessLanguageListPref;
2578 std::map<int,int>::iterator SLiter;
2579 wxString PropertyData;
2580 wxString PropertyName;
2581 wxString PropertyValue;
2582 wxString PropertyTokens;
2583 bool FirstToken = TRUE;
2584 bool PropertyMatched = FALSE;
2586 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2587 intiter != SplitPoints.end(); ++intiter){
2589 SLiter = SplitLength.find(intiter->first);
2591 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2593 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2594 PropertyName = PropertyElement.GetNextToken();
2595 PropertyValue = PropertyElement.GetNextToken();
2597 intPrevValue = intiter->second;
2599 CaptureString(&PropertyValue, FALSE);
2601 // Process properties.
2603 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2604 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2605 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2607 if (PropertyMatched == TRUE){
2609 PropertyMatched = FALSE;
2614 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2616 if (FirstToken == TRUE){
2618 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2623 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2631 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2633 // Add the name token data.
2635 if (!PropertyTokens.IsEmpty()){
2637 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2643 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2645 std::map<int, int> SplitPoints;
2646 std::map<int, int> SplitLength;
2648 int intPrevValue = 5;
2651 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2655 PropertyType PropType = PROPERTY_NONE;
2657 // Look for type before continuing.
2659 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2661 std::map<int, wxString> *GeopositionList = NULL;
2662 std::map<int, wxString> *GeopositionListType = NULL;
2663 std::map<int, wxString> *GeopositionListAltID = NULL;
2664 std::map<int, wxString> *GeopositionListPID = NULL;
2665 std::map<int, wxString> *GeopositionListTokens = NULL;
2666 std::map<int, wxString> *GeopositionListMediatype = NULL;
2667 std::map<int, int> *GeopositionListPref = NULL;
2671 GeopositionList = &GeneralGeographyList;
2672 GeopositionListType = &GeneralGeographyListType;
2673 GeopositionListAltID = &GeneralGeographyListAltID;
2674 GeopositionListPID = &GeneralGeographyListPID;
2675 GeopositionListTokens = &GeneralGeographyListTokens;
2676 GeopositionListMediatype = &GeneralGeographyListMediatype;
2677 GeopositionListPref = &GeneralGeographyListPref;
2680 GeopositionList = &HomeGeographyList;
2681 GeopositionListType = &HomeGeographyListType;
2682 GeopositionListAltID = &HomeGeographyListAltID;
2683 GeopositionListPID = &HomeGeographyListPID;
2684 GeopositionListTokens = &HomeGeographyListTokens;
2685 GeopositionListMediatype = &HomeGeographyListMediatype;
2686 GeopositionListPref = &HomeGeographyListPref;
2689 GeopositionList = &BusinessGeographyList;
2690 GeopositionListType = &BusinessGeographyListType;
2691 GeopositionListAltID = &BusinessGeographyListAltID;
2692 GeopositionListPID = &BusinessGeographyListPID;
2693 GeopositionListTokens = &BusinessGeographyListTokens;
2694 GeopositionListMediatype = &BusinessGeographyListMediatype;
2695 GeopositionListPref = &BusinessGeographyListPref;
2701 std::map<int,int>::iterator SLiter;
2702 wxString PropertyData;
2703 wxString PropertyName;
2704 wxString PropertyValue;
2705 wxString PropertyTokens;
2706 bool FirstToken = TRUE;
2707 bool PropertyMatched = FALSE;
2709 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2710 intiter != SplitPoints.end(); ++intiter){
2712 SLiter = SplitLength.find(intiter->first);
2714 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2716 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2717 PropertyName = PropertyElement.GetNextToken();
2718 PropertyValue = PropertyElement.GetNextToken();
2720 intPrevValue = intiter->second;
2722 CaptureString(&PropertyValue, FALSE);
2724 // Process properties.
2726 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2727 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2728 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2729 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2731 if (PropertyMatched == TRUE){
2733 PropertyMatched = FALSE;
2738 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2740 if (FirstToken == TRUE){
2742 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2747 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2755 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2757 // Add the name token data.
2759 if (!PropertyTokens.IsEmpty()){
2761 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2767 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2769 size_t intPropertyLen = PropertySeg1.Len();
2770 std::map<int, int> SplitPoints;
2771 std::map<int, int> SplitLength;
2772 std::map<int, int>::iterator SLiter;
2773 wxString PropertyData;
2774 wxString PropertyName;
2775 wxString PropertyValue;
2776 wxString PropertyTokens;
2777 wxString RelatedType;
2778 wxString RelatedTypeOriginal;
2779 wxString RelatedName;
2780 bool FirstToken = TRUE;
2781 int intSplitsFound = 0;
2782 int intSplitSize = 0;
2783 int intPrevValue = 9;
2787 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2791 // Look for type before continuing.
2793 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2794 intiter != SplitPoints.end(); ++intiter){
2796 SLiter = SplitLength.find(intiter->first);
2798 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2800 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2801 PropertyName = PropertyElement.GetNextToken();
2802 PropertyValue = PropertyElement.GetNextToken();
2804 intPrevValue = intiter->second;
2808 RelatedTypeOriginal = PropertyValue;
2810 if (PropertyName == wxT("TYPE")){
2812 if (PropertyValue == wxT("contact")){
2814 RelatedType = _("Contact");
2816 } else if (PropertyValue == wxT("acquaintance")){
2818 RelatedType = _("Acquaintance");
2820 } else if (PropertyValue == wxT("friend")){
2822 RelatedType = _("Friend");
2824 } else if (PropertyValue == wxT("met")){
2826 RelatedType = _("Met");
2828 } else if (PropertyValue == wxT("co-worker")){
2830 RelatedType = _("Co-worker");
2832 } else if (PropertyValue == wxT("colleague")){
2834 RelatedType = _("Colleague");
2836 } else if (PropertyValue == wxT("co-resident")){
2838 RelatedType = _("Co-resident");
2840 } else if (PropertyValue == wxT("neighbor")){
2842 RelatedType = _("Neighbour");
2844 } else if (PropertyValue == wxT("child")){
2846 RelatedType = _("Child");
2848 } else if (PropertyValue == wxT("parent")){
2850 RelatedType = _("Parent");
2852 } else if (PropertyValue == wxT("sibling")){
2854 RelatedType = _("Sibling");
2856 } else if (PropertyValue == wxT("spouse")){
2858 RelatedType = _("Spouse");
2860 } else if (PropertyValue == wxT("kin")){
2862 RelatedType = _("Kin");
2864 } else if (PropertyValue == wxT("muse")){
2866 RelatedType = _("Muse");
2868 } else if (PropertyValue == wxT("crush")){
2870 RelatedType = _("Crush");
2872 } else if (PropertyValue == wxT("date")){
2874 RelatedType = _("Date");
2876 } else if (PropertyValue == wxT("sweetheart")){
2878 RelatedType = _("Sweetheart");
2880 } else if (PropertyValue == wxT("me")){
2882 RelatedType = _("Me");
2884 } else if (PropertyValue == wxT("agent")){
2886 RelatedType = _("Agent");
2888 } else if (PropertyValue == wxT("emergency")){
2890 RelatedType = _("Emergency");
2894 RelatedType = PropertyValue;
2904 bool PropertyMatched = FALSE;
2906 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2907 intiter != SplitPoints.end(); ++intiter){
2909 SLiter = SplitLength.find(intiter->first);
2911 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2913 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2914 PropertyName = PropertyElement.GetNextToken();
2915 PropertyValue = PropertyElement.GetNextToken();
2917 intPrevValue = intiter->second;
2919 // Process properties.
2921 size_t intPropertyValueLen = PropertyValue.Len();
2923 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2925 PropertyValue.Trim();
2926 PropertyValue.RemoveLast();
2930 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2932 PropertyValue.Remove(0, 1);
2936 CaptureString(&PropertyValue, FALSE);
2938 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2939 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2940 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2941 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2943 if (PropertyMatched == TRUE){
2945 PropertyMatched = FALSE;
2950 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2952 if (FirstToken == TRUE){
2954 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2959 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2967 // Add the data to the General/Home/Work address variables.
2969 GeneralRelatedList.erase(*RelatedCount);
2970 GeneralRelatedListRelType.erase(*RelatedCount);
2971 GeneralRelatedListType.erase(*RelatedCount);
2972 GeneralRelatedListTokens.erase(*RelatedCount);
2973 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2974 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2975 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2976 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2980 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2982 std::map<int, int> SplitPoints;
2983 std::map<int, int> SplitLength;
2984 std::map<int, int>::iterator SLiter;
2985 wxString PropertyData;
2986 wxString PropertyName;
2987 wxString PropertyValue;
2988 wxString PropertyTokens;
2989 bool FirstToken = TRUE;
2990 int intPrevValue = 5;
2995 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2999 PropertyType PropType = PROPERTY_NONE;
3001 // Look for type before continuing.
3003 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3005 // Setup the pointers.
3007 std::map<int, wxString> *WebsiteList = NULL;
3008 std::map<int, wxString> *WebsiteListAltID = NULL;
3009 std::map<int, wxString> *WebsiteListPID = NULL;
3010 std::map<int, wxString> *WebsiteListType = NULL;
3011 std::map<int, wxString> *WebsiteListTokens = NULL;
3012 std::map<int, wxString> *WebsiteListMediatype = NULL;
3013 std::map<int, int> *WebsiteListPref = NULL;
3015 // Setup blank lines for later on.
3019 WebsiteList = &GeneralWebsiteList;
3020 WebsiteListType = &GeneralWebsiteListType;
3021 WebsiteListAltID = &GeneralWebsiteListAltID;
3022 WebsiteListPID = &GeneralWebsiteListPID;
3023 WebsiteListTokens = &GeneralWebsiteListTokens;
3024 WebsiteListMediatype = &GeneralWebsiteListMediatype;
3025 WebsiteListPref = &GeneralWebsiteListPref;
3028 WebsiteList = &HomeWebsiteList;
3029 WebsiteListType = &HomeWebsiteListType;
3030 WebsiteListAltID = &HomeWebsiteListAltID;
3031 WebsiteListPID = &HomeWebsiteListPID;
3032 WebsiteListTokens = &HomeWebsiteListTokens;
3033 WebsiteListMediatype = &HomeWebsiteListMediatype;
3034 WebsiteListPref = &HomeWebsiteListPref;
3037 WebsiteList = &BusinessWebsiteList;
3038 WebsiteListType = &BusinessWebsiteListType;
3039 WebsiteListAltID = &BusinessWebsiteListAltID;
3040 WebsiteListPID = &BusinessWebsiteListPID;
3041 WebsiteListTokens = &BusinessWebsiteListTokens;
3042 WebsiteListMediatype = &BusinessWebsiteListMediatype;
3043 WebsiteListPref = &BusinessWebsiteListPref;
3048 bool PropertyMatched = FALSE;
3050 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3051 intiter != SplitPoints.end(); ++intiter){
3053 SLiter = SplitLength.find(intiter->first);
3055 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3057 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3058 PropertyName = PropertyElement.GetNextToken();
3059 PropertyValue = PropertyElement.GetNextToken();
3061 intPrevValue = intiter->second;
3063 // Process properties.
3065 size_t intPropertyValueLen = PropertyValue.Len();
3067 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3069 PropertyValue.Trim();
3070 PropertyValue.RemoveLast();
3074 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3076 PropertyValue.Remove(0, 1);
3080 CaptureString(&PropertyValue, FALSE);
3082 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
3083 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
3084 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
3085 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
3087 if (PropertyMatched == TRUE){
3089 PropertyMatched = FALSE;
3094 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3096 if (FirstToken == TRUE){
3098 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3103 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3111 // Add the data to the General/Home/Work address variables.
3113 CaptureString(&PropertySeg2, FALSE);
3115 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3117 if (!PropertyTokens.IsEmpty()){
3119 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3125 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3127 std::map<int, int> SplitPoints;
3128 std::map<int, int> SplitLength;
3129 std::map<int, int>::iterator SLiter;
3130 wxString PropertyData;
3131 wxString PropertyName;
3132 wxString PropertyValue;
3133 wxString PropertyTokens;
3134 bool FirstToken = TRUE;
3135 int intPrevValue = 7;
3140 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3144 PropertyType PropType = PROPERTY_NONE;
3146 // Look for type before continuing.
3148 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3150 // Setup the pointers.
3152 std::map<int, wxString> *TitleList = NULL;
3153 std::map<int, wxString> *TitleListAltID = NULL;
3154 std::map<int, wxString> *TitleListPID = NULL;
3155 std::map<int, wxString> *TitleListType = NULL;
3156 std::map<int, wxString> *TitleListTokens = NULL;
3157 std::map<int, wxString> *TitleListLanguage = NULL;
3158 std::map<int, int> *TitleListPref = NULL;
3160 // Setup blank lines for later on.
3164 TitleList = &GeneralTitleList;
3165 TitleListType = &GeneralTitleListType;
3166 TitleListAltID = &GeneralTitleListAltID;
3167 TitleListPID = &GeneralTitleListPID;
3168 TitleListTokens = &GeneralTitleListTokens;
3169 TitleListLanguage = &GeneralTitleListLanguage;
3170 TitleListPref = &GeneralTitleListPref;
3173 TitleList = &HomeTitleList;
3174 TitleListType = &HomeTitleListType;
3175 TitleListAltID = &HomeTitleListAltID;
3176 TitleListPID = &HomeTitleListPID;
3177 TitleListTokens = &HomeTitleListTokens;
3178 TitleListLanguage = &HomeTitleListLanguage;
3179 TitleListPref = &HomeTitleListPref;
3182 TitleList = &BusinessTitleList;
3183 TitleListType = &BusinessTitleListType;
3184 TitleListAltID = &BusinessTitleListAltID;
3185 TitleListPID = &BusinessTitleListPID;
3186 TitleListTokens = &BusinessTitleListTokens;
3187 TitleListLanguage = &BusinessTitleListLanguage;
3188 TitleListPref = &BusinessTitleListPref;
3193 bool PropertyMatched = FALSE;
3195 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3196 intiter != SplitPoints.end(); ++intiter){
3198 SLiter = SplitLength.find(intiter->first);
3200 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3202 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3203 PropertyName = PropertyElement.GetNextToken();
3204 PropertyValue = PropertyElement.GetNextToken();
3206 intPrevValue = intiter->second;
3208 // Process properties.
3210 size_t intPropertyValueLen = PropertyValue.Len();
3212 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3214 PropertyValue.Trim();
3215 PropertyValue.RemoveLast();
3219 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3221 PropertyValue.Remove(0, 1);
3225 CaptureString(&PropertyValue, FALSE);
3227 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
3228 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
3229 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
3230 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
3232 if (PropertyMatched == TRUE){
3234 PropertyMatched = FALSE;
3239 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3241 if (FirstToken == TRUE){
3243 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3248 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3256 // Add the data to the General/Home/Work address variables.
3258 CaptureString(&PropertySeg2, FALSE);
3260 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3262 if (!PropertyTokens.IsEmpty()){
3264 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3270 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3272 std::map<int, int> SplitPoints;
3273 std::map<int, int> SplitLength;
3274 std::map<int, int>::iterator SLiter;
3275 wxString PropertyData;
3276 wxString PropertyName;
3277 wxString PropertyValue;
3278 wxString PropertyTokens;
3279 bool FirstToken = TRUE;
3280 int intPrevValue = 6;
3285 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3289 PropertyType PropType = PROPERTY_NONE;
3291 // Look for type before continuing.
3293 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3295 // Setup the pointers.
3297 std::map<int, wxString> *RoleList = NULL;
3298 std::map<int, wxString> *RoleListAltID = NULL;
3299 std::map<int, wxString> *RoleListPID = NULL;
3300 std::map<int, wxString> *RoleListType = NULL;
3301 std::map<int, wxString> *RoleListTokens = NULL;
3302 std::map<int, wxString> *RoleListLanguage = NULL;
3303 std::map<int, int> *RoleListPref = NULL;
3305 // Setup blank lines for later on.
3309 RoleList = &GeneralRoleList;
3310 RoleListType = &GeneralRoleListType;
3311 RoleListAltID = &GeneralRoleListAltID;
3312 RoleListPID = &GeneralRoleListPID;
3313 RoleListTokens = &GeneralRoleListTokens;
3314 RoleListLanguage = &GeneralRoleListLanguage;
3315 RoleListPref = &GeneralRoleListPref;
3318 RoleList = &HomeRoleList;
3319 RoleListType = &HomeRoleListType;
3320 RoleListAltID = &HomeRoleListAltID;
3321 RoleListPID = &HomeRoleListPID;
3322 RoleListTokens = &HomeRoleListTokens;
3323 RoleListLanguage = &HomeRoleListLanguage;
3324 RoleListPref = &HomeRoleListPref;
3327 RoleList = &BusinessRoleList;
3328 RoleListType = &BusinessRoleListType;
3329 RoleListAltID = &BusinessRoleListAltID;
3330 RoleListPID = &BusinessRoleListPID;
3331 RoleListTokens = &BusinessRoleListTokens;
3332 RoleListLanguage = &BusinessRoleListLanguage;
3333 RoleListPref = &BusinessRoleListPref;
3338 bool PropertyMatched = FALSE;
3340 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3341 intiter != SplitPoints.end(); ++intiter){
3343 SLiter = SplitLength.find(intiter->first);
3345 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3347 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3348 PropertyName = PropertyElement.GetNextToken();
3349 PropertyValue = PropertyElement.GetNextToken();
3351 intPrevValue = intiter->second;
3353 // Process properties.
3355 size_t intPropertyValueLen = PropertyValue.Len();
3357 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3359 PropertyValue.Trim();
3360 PropertyValue.RemoveLast();
3364 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3366 PropertyValue.Remove(0, 1);
3370 CaptureString(&PropertyValue, FALSE);
3372 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3373 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3374 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3375 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3377 if (PropertyMatched == TRUE){
3379 PropertyMatched = FALSE;
3384 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3386 if (FirstToken == TRUE){
3388 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3393 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3401 // Add the data to the General/Home/Work address variables.
3403 CaptureString(&PropertySeg2, FALSE);
3405 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3407 if (!PropertyTokens.IsEmpty()){
3409 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3415 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3417 std::map<int, int> SplitPoints;
3418 std::map<int, int> SplitLength;
3419 std::map<int, int>::iterator SLiter;
3420 wxString PropertyData;
3421 wxString PropertyName;
3422 wxString PropertyValue;
3423 wxString PropertyTokens;
3424 bool FirstToken = TRUE;
3425 int intPrevValue = 5;
3430 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3434 PropertyType PropType = PROPERTY_NONE;
3436 // Look for type before continuing.
3438 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3440 // Setup the pointers.
3442 std::map<int, wxString> *OrganisationsList = NULL;
3443 std::map<int, wxString> *OrganisationsListAltID = NULL;
3444 std::map<int, wxString> *OrganisationsListPID = NULL;
3445 std::map<int, wxString> *OrganisationsListType = NULL;
3446 std::map<int, wxString> *OrganisationsListTokens = NULL;
3447 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3448 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3449 std::map<int, int> *OrganisationsListPref = NULL;
3451 // Setup blank lines for later on.
3455 OrganisationsList = &GeneralOrganisationsList;
3456 OrganisationsListType = &GeneralOrganisationsListType;
3457 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3458 OrganisationsListPID = &GeneralOrganisationsListPID;
3459 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3460 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3461 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3462 OrganisationsListPref = &GeneralOrganisationsListPref;
3465 OrganisationsList = &HomeOrganisationsList;
3466 OrganisationsListType = &HomeOrganisationsListType;
3467 OrganisationsListAltID = &HomeOrganisationsListAltID;
3468 OrganisationsListPID = &HomeOrganisationsListPID;
3469 OrganisationsListTokens = &HomeOrganisationsListTokens;
3470 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3471 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3472 OrganisationsListPref = &HomeOrganisationsListPref;
3475 OrganisationsList = &BusinessOrganisationsList;
3476 OrganisationsListType = &BusinessOrganisationsListType;
3477 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3478 OrganisationsListPID = &BusinessOrganisationsListPID;
3479 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3480 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3481 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3482 OrganisationsListPref = &BusinessOrganisationsListPref;
3487 bool PropertyMatched = FALSE;
3489 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3490 intiter != SplitPoints.end(); ++intiter){
3492 SLiter = SplitLength.find(intiter->first);
3494 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3496 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3497 PropertyName = PropertyElement.GetNextToken();
3498 PropertyValue = PropertyElement.GetNextToken();
3500 intPrevValue = intiter->second;
3502 // Process properties.
3504 size_t intPropertyValueLen = PropertyValue.Len();
3506 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3508 PropertyValue.Trim();
3509 PropertyValue.RemoveLast();
3513 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3515 PropertyValue.Remove(0, 1);
3519 CaptureString(&PropertyValue, FALSE);
3521 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3522 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3523 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3524 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3525 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3527 if (PropertyMatched == TRUE){
3529 PropertyMatched = FALSE;
3534 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3536 if (FirstToken == TRUE){
3538 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3543 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3551 // Add the data to the General/Home/Work address variables.
3553 CaptureString(&PropertySeg2, FALSE);
3555 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3557 if (!PropertyTokens.IsEmpty()){
3559 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3565 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3567 std::map<int, int> SplitPoints;
3568 std::map<int, int> SplitLength;
3569 std::map<int, int>::iterator SLiter;
3570 wxString PropertyData;
3571 wxString PropertyName;
3572 wxString PropertyValue;
3573 wxString PropertyTokens;
3574 bool FirstToken = TRUE;
3575 int intPrevValue = 6;
3580 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3584 PropertyType PropType = PROPERTY_NONE;
3586 // Look for type before continuing.
3588 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3590 // Setup the pointers.
3592 std::map<int, wxString> *NoteList = NULL;
3593 std::map<int, wxString> *NoteListAltID = NULL;
3594 std::map<int, wxString> *NoteListPID = NULL;
3595 std::map<int, wxString> *NoteListType = NULL;
3596 std::map<int, wxString> *NoteListTokens = NULL;
3597 std::map<int, wxString> *NoteListLanguage = NULL;
3598 std::map<int, int> *NoteListPref = NULL;
3600 // Setup blank lines for later on.
3604 NoteList = &GeneralNoteList;
3605 NoteListType = &GeneralNoteListType;
3606 NoteListAltID = &GeneralNoteListAltID;
3607 NoteListPID = &GeneralNoteListPID;
3608 NoteListTokens = &GeneralNoteListTokens;
3609 NoteListLanguage = &GeneralNoteListLanguage;
3610 NoteListPref = &GeneralNoteListPref;
3613 NoteList = &HomeNoteList;
3614 NoteListType = &HomeNoteListType;
3615 NoteListAltID = &HomeNoteListAltID;
3616 NoteListPID = &HomeNoteListPID;
3617 NoteListTokens = &HomeNoteListTokens;
3618 NoteListLanguage = &HomeNoteListLanguage;
3619 NoteListPref = &HomeNoteListPref;
3622 NoteList = &BusinessNoteList;
3623 NoteListType = &BusinessNoteListType;
3624 NoteListAltID = &BusinessNoteListAltID;
3625 NoteListPID = &BusinessNoteListPID;
3626 NoteListTokens = &BusinessNoteListTokens;
3627 NoteListLanguage = &BusinessNoteListLanguage;
3628 NoteListPref = &BusinessNoteListPref;
3633 bool PropertyMatched = FALSE;
3635 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3636 intiter != SplitPoints.end(); ++intiter){
3638 SLiter = SplitLength.find(intiter->first);
3640 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3642 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3643 PropertyName = PropertyElement.GetNextToken();
3644 PropertyValue = PropertyElement.GetNextToken();
3646 intPrevValue = intiter->second;
3648 // Process properties.
3650 size_t intPropertyValueLen = PropertyValue.Len();
3652 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3654 PropertyValue.Trim();
3655 PropertyValue.RemoveLast();
3659 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3661 PropertyValue.Remove(0, 1);
3665 CaptureString(&PropertyValue, FALSE);
3667 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3668 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3669 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3670 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3672 if (PropertyMatched == TRUE){
3674 PropertyMatched = FALSE;
3679 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3681 if (FirstToken == TRUE){
3683 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3688 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3696 // Add the data to the General/Home/Work address variables.
3698 CaptureString(&PropertySeg2, FALSE);
3700 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3702 if (!PropertyTokens.IsEmpty()){
3704 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3710 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3712 std::map<int, int> SplitPoints;
3713 std::map<int, int> SplitLength;
3714 std::map<int, int>::iterator SLiter;
3715 wxString PropertyData;
3716 wxString PropertyName;
3717 wxString PropertyValue;
3718 wxString PropertyTokens;
3719 bool FirstToken = TRUE;
3720 int intPrevValue = 12;
3725 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3729 PropertyType PropType = PROPERTY_NONE;
3731 // Look for type before continuing.
3733 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3735 // Setup blank lines for later on.
3741 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3744 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3749 bool PropertyMatched = FALSE;
3751 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3752 intiter != SplitPoints.end(); ++intiter){
3754 SLiter = SplitLength.find(intiter->first);
3756 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3758 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3759 PropertyName = PropertyElement.GetNextToken();
3760 PropertyValue = PropertyElement.GetNextToken();
3762 intPrevValue = intiter->second;
3764 // Process properties.
3766 size_t intPropertyValueLen = PropertyValue.Len();
3768 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3770 PropertyValue.Trim();
3771 PropertyValue.RemoveLast();
3775 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3777 PropertyValue.Remove(0, 1);
3781 CaptureString(&PropertyValue, FALSE);
3783 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3784 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3785 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3786 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3788 if (PropertyMatched == TRUE){
3790 PropertyMatched = FALSE;
3795 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3797 if (FirstToken == TRUE){
3799 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3804 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3812 // Deal with multiple categories.
3814 int intOrigCatCount = *CategoryCount;
3815 bool FirstCategoryProcessed = TRUE;
3816 bool AfterFirstToken = FALSE;
3817 int intSplitSize = 0;
3818 int intSplitsFound = 0;
3819 int intSplitSeek = 0;
3820 int intPropertyLen = PropertySeg2.Len();
3822 SplitPoints.clear();
3823 SplitLength.clear();
3826 for (int i = 0; i <= intPropertyLen; i++){
3828 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3836 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3838 if (AfterFirstToken == TRUE){
3840 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3841 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3845 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3846 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3847 AfterFirstToken = TRUE;
3859 if (SplitPoints.size() > 0){
3861 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3862 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3866 if (SplitPoints.size() == 0){
3868 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3870 if (!PropertyTokens.IsEmpty()){
3872 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3878 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3879 intiter != SplitPoints.end(); ++intiter){
3881 SLiter = SplitLength.find(intiter->first);
3883 intPrevValue = intiter->second;
3885 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3887 // Add the data to the General/Home/Work address variables.
3889 // Trim any whitespace from the start and end.
3891 PropertyData = PropertyData.Trim(FALSE);
3892 PropertyData = PropertyData.Trim(TRUE);
3894 CaptureString(&PropertyData, FALSE);
3896 if (FirstCategoryProcessed == TRUE){
3898 FirstCategoryProcessed = FALSE;
3900 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3902 if (!PropertyTokens.IsEmpty()){
3904 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3914 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3916 if (!PropertyTokens.IsEmpty()){
3918 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3924 // Copy the properties to each of the categories (if it exists).
3926 if (!PropertyTokens.IsEmpty()){
3928 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3932 // Check if ALTID was used.
3934 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3936 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3940 // Check if PID was used.
3942 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3944 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3948 // Check if PREF was used.
3950 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3952 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3956 // Check if LANGUAGE was used.
3958 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3960 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3964 // Check if TYPE was used.
3970 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3973 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3981 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3983 size_t intPropertyLen = PropertySeg1.Len();
3984 std::map<int, int> SplitPoints;
3985 std::map<int, int> SplitLength;
3986 std::map<int, int>::iterator SLiter;
3987 wxString PropertyData;
3988 wxString PropertyName;
3989 wxString PropertyValue;
3990 wxString PropertyTokens;
3991 bool FirstToken = TRUE;
3992 int intSplitsFound = 0;
3993 int intSplitSize = 0;
3994 int intPrevValue = 7;
3998 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4002 PropertyType PropType = PROPERTY_NONE;
4004 // Look for type before continuing.
4006 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4009 bool PropertyMatched = FALSE;
4011 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4012 intiter != SplitPoints.end(); ++intiter){
4014 SLiter = SplitLength.find(intiter->first);
4016 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4018 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4019 PropertyName = PropertyElement.GetNextToken();
4020 PropertyValue = PropertyElement.GetNextToken();
4022 intPrevValue = intiter->second;
4024 // Process properties.
4026 size_t intPropertyValueLen = PropertyValue.Len();
4028 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4030 PropertyValue.Trim();
4031 PropertyValue.RemoveLast();
4035 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4037 PropertyValue.Remove(0, 1);
4041 CaptureString(&PropertyValue, FALSE);
4043 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
4044 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
4045 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
4046 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
4048 if (PropertyMatched == TRUE){
4050 PropertyMatched = FALSE;
4055 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4057 if (FirstToken == TRUE){
4059 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4064 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4072 intPropertyLen = PropertySeg2.Len();
4073 SplitPoints.clear();
4074 SplitLength.clear();
4079 CaptureString(&PropertySeg2, FALSE);
4081 for (int i = 0; i <= intPropertyLen; i++){
4085 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4088 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4090 if (intSplitsFound == 6){
4092 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4097 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4107 wxString wxSPhotoURI;
4108 wxString wxSPhotoMIME;
4109 wxString wxSPhotoEncoding;
4110 wxString wxSPhotoData;
4111 std::string base64enc;
4113 if (intSplitsFound == 0){
4117 std::map<int, int>::iterator striter;
4119 striter = SplitLength.find(1);
4121 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4123 while (wSTDataType.HasMoreTokens() == TRUE){
4125 wxSPhotoURI = wSTDataType.GetNextToken();
4126 wxSPhotoMIME = wSTDataType.GetNextToken();
4131 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4133 while (wSTDataInfo.HasMoreTokens() == TRUE){
4135 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4136 wxSPhotoData = wSTDataInfo.GetNextToken();
4137 base64enc = wxSPhotoData.mb_str();
4144 // Add the data to the General/Home/Work address variables.
4146 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4147 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4148 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4154 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4157 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4161 if (!PropertyTokens.IsEmpty()){
4163 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4169 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4171 size_t intPropertyLen = PropertySeg1.Len();
4172 std::map<int, int> SplitPoints;
4173 std::map<int, int> SplitLength;
4174 std::map<int, int>::iterator SLiter;
4175 wxString PropertyData;
4176 wxString PropertyName;
4177 wxString PropertyValue;
4178 wxString PropertyTokens;
4179 bool FirstToken = TRUE;
4180 int intSplitsFound = 0;
4181 int intSplitSize = 0;
4182 int intPrevValue = 6;
4186 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4190 PropertyType PropType = PROPERTY_NONE;
4192 // Look for type before continuing.
4194 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4197 bool PropertyMatched = FALSE;
4199 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4200 intiter != SplitPoints.end(); ++intiter){
4202 SLiter = SplitLength.find(intiter->first);
4204 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4206 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4207 PropertyName = PropertyElement.GetNextToken();
4208 PropertyValue = PropertyElement.GetNextToken();
4210 intPrevValue = intiter->second;
4212 // Process properties.
4214 size_t intPropertyValueLen = PropertyValue.Len();
4216 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4218 PropertyValue.Trim();
4219 PropertyValue.RemoveLast();
4223 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4225 PropertyValue.Remove(0, 1);
4229 CaptureString(&PropertyValue, FALSE);
4231 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
4232 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
4233 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
4234 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
4236 if (PropertyMatched == TRUE){
4238 PropertyMatched = FALSE;
4243 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4245 if (FirstToken == TRUE){
4247 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4252 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4260 intPropertyLen = PropertySeg2.Len();
4261 SplitPoints.clear();
4262 SplitLength.clear();
4267 CaptureString(&PropertySeg2, FALSE);
4269 for (int i = 0; i <= intPropertyLen; i++){
4273 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4276 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4278 if (intSplitsFound == 6){
4280 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4285 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4295 wxString wxSPhotoURI;
4296 wxString wxSPhotoMIME;
4297 wxString wxSPhotoEncoding;
4298 wxString wxSPhotoData;
4299 std::string base64enc;
4301 if (intSplitsFound == 0){
4305 std::map<int, int>::iterator striter;
4307 striter = SplitLength.find(1);
4309 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4311 while (wSTDataType.HasMoreTokens() == TRUE){
4313 wxSPhotoURI = wSTDataType.GetNextToken();
4314 wxSPhotoMIME = wSTDataType.GetNextToken();
4319 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4321 while (wSTDataInfo.HasMoreTokens() == TRUE){
4323 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4324 wxSPhotoData = wSTDataInfo.GetNextToken();
4325 base64enc = wxSPhotoData.mb_str();
4332 // Add the data to the General/Home/Work address variables.
4334 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4335 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4336 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4342 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4345 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4349 if (!PropertyTokens.IsEmpty()){
4351 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4357 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4359 size_t intPropertyLen = PropertySeg1.Len();
4360 std::map<int, int> SplitPoints;
4361 std::map<int, int> SplitLength;
4362 std::map<int, int>::iterator SLiter;
4363 wxString PropertyData;
4364 wxString PropertyName;
4365 wxString PropertyValue;
4366 wxString PropertyTokens;
4367 bool FirstToken = TRUE;
4368 int intSplitsFound = 0;
4369 int intSplitSize = 0;
4370 int intPrevValue = 7;
4374 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4378 PropertyType PropType = PROPERTY_NONE;
4380 // Look for type before continuing.
4382 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4385 bool PropertyMatched = FALSE;
4387 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4388 intiter != SplitPoints.end(); ++intiter){
4390 SLiter = SplitLength.find(intiter->first);
4392 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4394 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4395 PropertyName = PropertyElement.GetNextToken();
4396 PropertyValue = PropertyElement.GetNextToken();
4398 intPrevValue = intiter->second;
4400 // Process properties.
4402 size_t intPropertyValueLen = PropertyValue.Len();
4404 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4406 PropertyValue.Trim();
4407 PropertyValue.RemoveLast();
4411 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4413 PropertyValue.Remove(0, 1);
4417 CaptureString(&PropertyValue, FALSE);
4419 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
4420 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
4421 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
4422 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
4423 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
4425 if (PropertyMatched == TRUE){
4427 PropertyMatched = FALSE;
4432 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4434 if (FirstToken == TRUE){
4436 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4441 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4449 intPropertyLen = PropertySeg2.Len();
4450 SplitPoints.clear();
4451 SplitLength.clear();
4456 CaptureString(&PropertySeg2, FALSE);
4458 for (int i = 0; i <= intPropertyLen; i++){
4462 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4465 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4467 if (intSplitsFound == 6){
4469 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4474 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4484 wxString wxSSoundURI;
4485 wxString wxSSoundMIME;
4486 wxString wxSSoundEncoding;
4487 wxString wxSSoundData;
4488 std::string base64enc;
4490 if (intSplitsFound == 0){
4494 std::map<int, int>::iterator striter;
4496 striter = SplitLength.find(1);
4498 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4500 while (wSTDataType.HasMoreTokens() == TRUE){
4502 wxSSoundURI = wSTDataType.GetNextToken();
4503 wxSSoundMIME = wSTDataType.GetNextToken();
4508 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4510 while (wSTDataInfo.HasMoreTokens() == TRUE){
4512 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4513 wxSSoundData = wSTDataInfo.GetNextToken();
4514 base64enc = wxSSoundData.mb_str();
4521 // Add the data to the General/Home/Work address variables.
4527 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4530 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4534 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4535 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4536 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4538 if (!PropertyTokens.IsEmpty()){
4540 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4546 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4548 size_t intPropertyLen = PropertySeg1.Len();
4549 std::map<int, int> SplitPoints;
4550 std::map<int, int> SplitLength;
4551 std::map<int, int>::iterator SLiter;
4552 wxString PropertyData;
4553 wxString PropertyName;
4554 wxString PropertyValue;
4555 wxString PropertyTokens;
4556 bool FirstToken = TRUE;
4557 int intSplitsFound = 0;
4558 int intSplitSize = 0;
4559 int intPrevValue = 8;
4563 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4567 PropertyType PropType = PROPERTY_NONE;
4569 // Look for type before continuing.
4571 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4574 bool PropertyMatched = FALSE;
4576 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4577 intiter != SplitPoints.end(); ++intiter){
4579 SLiter = SplitLength.find(intiter->first);
4581 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4583 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4584 PropertyName = PropertyElement.GetNextToken();
4585 PropertyValue = PropertyElement.GetNextToken();
4587 intPrevValue = intiter->second;
4589 // Process properties.
4591 size_t intPropertyValueLen = PropertyValue.Len();
4593 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4595 PropertyValue.Trim();
4596 PropertyValue.RemoveLast();
4600 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4602 PropertyValue.Remove(0, 1);
4606 CaptureString(&PropertyValue, FALSE);
4608 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4609 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4610 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4611 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4613 if (PropertyMatched == TRUE){
4615 PropertyMatched = FALSE;
4620 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4622 if (FirstToken == TRUE){
4624 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4629 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4637 intPropertyLen = PropertySeg2.Len();
4638 SplitPoints.clear();
4639 SplitLength.clear();
4644 CaptureString(&PropertySeg2, FALSE);
4646 // Add the data to the General/Home/Work address variables.
4652 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4655 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4659 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4661 if (!PropertyTokens.IsEmpty()){
4663 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4669 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4671 size_t intPropertyLen = PropertySeg1.Len();
4672 std::map<int, int> SplitPoints;
4673 std::map<int, int> SplitLength;
4674 std::map<int, int>::iterator SLiter;
4675 wxString PropertyData;
4676 wxString PropertyName;
4677 wxString PropertyValue;
4678 wxString PropertyTokens;
4679 bool FirstToken = TRUE;
4680 int intSplitsFound = 0;
4681 int intSplitSize = 0;
4682 int intPrevValue = 8;
4686 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4690 PropertyType PropType = PROPERTY_NONE;
4692 // Look for type before continuing.
4694 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4697 bool PropertyMatched = FALSE;
4699 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4700 intiter != SplitPoints.end(); ++intiter){
4702 SLiter = SplitLength.find(intiter->first);
4704 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4706 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4707 PropertyName = PropertyElement.GetNextToken();
4708 PropertyValue = PropertyElement.GetNextToken();
4710 intPrevValue = intiter->second;
4712 // Process properties.
4714 size_t intPropertyValueLen = PropertyValue.Len();
4716 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4718 PropertyValue.Trim();
4719 PropertyValue.RemoveLast();
4723 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4725 PropertyValue.Remove(0, 1);
4729 CaptureString(&PropertyValue, FALSE);
4731 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4732 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4733 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4734 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4736 if (PropertyMatched == TRUE){
4738 PropertyMatched = FALSE;
4743 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4745 if (FirstToken == TRUE){
4747 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4752 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4760 intPropertyLen = PropertySeg2.Len();
4761 SplitPoints.clear();
4762 SplitLength.clear();
4767 CaptureString(&PropertySeg2, FALSE);
4769 // Add the data to the General/Home/Work address variables.
4775 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4778 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4782 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4784 if (!PropertyTokens.IsEmpty()){
4786 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4792 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4794 size_t intPropertyLen = PropertySeg1.Len();
4795 std::map<int, int> SplitPoints;
4796 std::map<int, int> SplitLength;
4797 std::map<int, int>::iterator SLiter;
4798 wxString PropertyData;
4799 wxString PropertyName;
4800 wxString PropertyValue;
4801 wxString PropertyTokens;
4802 bool FirstToken = TRUE;
4803 int intSplitsFound = 0;
4804 int intSplitSize = 0;
4805 int intPrevValue = 7;
4809 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4813 PropertyType PropType = PROPERTY_NONE;
4815 // Look for type before continuing.
4817 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4820 bool PropertyMatched = FALSE;
4822 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4823 intiter != SplitPoints.end(); ++intiter){
4825 SLiter = SplitLength.find(intiter->first);
4827 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4829 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4830 PropertyName = PropertyElement.GetNextToken();
4831 PropertyValue = PropertyElement.GetNextToken();
4833 intPrevValue = intiter->second;
4835 // Process properties.
4837 size_t intPropertyValueLen = PropertyValue.Len();
4839 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4841 PropertyValue.Trim();
4842 PropertyValue.RemoveLast();
4846 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4848 PropertyValue.Remove(0, 1);
4852 CaptureString(&PropertyValue, FALSE);
4854 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4855 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4856 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4857 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4859 if (PropertyMatched == TRUE){
4861 PropertyMatched = FALSE;
4866 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4868 if (FirstToken == TRUE){
4870 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4875 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4883 intPropertyLen = PropertySeg2.Len();
4884 SplitPoints.clear();
4885 SplitLength.clear();
4890 CaptureString(&PropertySeg2, FALSE);
4892 // Add the data to the General/Home/Work address variables.
4898 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4901 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4905 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4907 if (!PropertyTokens.IsEmpty()){
4909 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4915 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4917 size_t intPropertyLen = PropertySeg1.Len();
4918 std::map<int, int> SplitPoints;
4919 std::map<int, int> SplitLength;
4920 std::map<int, int>::iterator SLiter;
4921 wxString PropertyData;
4922 wxString PropertyName;
4923 wxString PropertyValue;
4924 wxString PropertyTokens;
4925 bool FirstToken = TRUE;
4926 int intSplitsFound = 0;
4927 int intSplitSize = 0;
4928 int intPrevValue = 5;
4933 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4937 PropertyType PropType = PROPERTY_NONE;
4939 // Look for type before continuing.
4941 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4944 bool PropertyMatched = FALSE;
4946 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4947 intiter != SplitPoints.end(); ++intiter){
4949 SLiter = SplitLength.find(intiter->first);
4951 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4953 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4954 PropertyName = PropertyElement.GetNextToken();
4955 PropertyValue = PropertyElement.GetNextToken();
4957 intPrevValue = intiter->second;
4959 // Process properties.
4961 size_t intPropertyValueLen = PropertyValue.Len();
4963 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4965 PropertyValue.Trim();
4966 PropertyValue.RemoveLast();
4970 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4972 PropertyValue.Remove(0, 1);
4976 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4977 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4978 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4980 if (PropertyMatched == TRUE){
4982 PropertyMatched = FALSE;
4987 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4989 if (FirstToken == TRUE){
4991 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4996 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5004 intPropertyLen = PropertySeg2.Len();
5005 SplitPoints.clear();
5006 SplitLength.clear();
5011 for (int i = 0; i <= intPropertyLen; i++){
5015 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
5018 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
5020 if (intSplitsFound == 6){
5022 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5027 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5038 wxString wxSKeyMIME;
5039 wxString wxSKeyEncoding;
5040 wxString wxSKeyData;
5041 std::string base64enc;
5043 if (intSplitsFound == 0){
5047 std::map<int, int>::iterator striter;
5049 striter = SplitLength.find(1);
5051 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
5053 while (wSTDataType.HasMoreTokens() == TRUE){
5055 wxSKeyURI = wSTDataType.GetNextToken();
5056 wxSKeyMIME = wSTDataType.GetNextToken();
5061 if (wxSKeyURI == wxT("data")){
5063 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
5065 while (wSTDataInfo.HasMoreTokens() == TRUE){
5067 wxSKeyEncoding = wSTDataInfo.GetNextToken();
5068 wxSKeyData = wSTDataInfo.GetNextToken();
5077 // Add the data to the General/Home/Work address variables.
5079 if (wxSKeyURI == wxT("data")){
5081 KeyListDataEncType.erase(*KeyCount);
5082 KeyListKeyType.erase(*KeyCount);
5083 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
5084 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
5086 KeyList.erase(*KeyCount);
5087 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
5091 KeyList.erase(*KeyCount);
5092 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
5096 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
5102 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
5105 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
5109 if (!PropertyTokens.IsEmpty()){
5111 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
5117 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
5119 // Split the Vendor three ways.
5121 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
5124 wxString wxSVNDPropName;
5127 while (wSTVendorDetails.HasMoreTokens() == TRUE){
5129 wSTVendorDetails.GetNextToken();
5130 wxSVNDID = wSTVendorDetails.GetNextToken();
5131 wxSVNDPropName = wSTVendorDetails.GetNextToken();
5136 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
5138 // Add the data to the vendor variables.
5140 VendorList.erase(*VendorCount);
5141 VendorListPEN.erase(*VendorCount);
5142 VendorListElement.erase(*VendorCount);
5144 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
5145 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
5146 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
5152 void ProcessTokens(wxString *PropertyName,
5153 wxString *PropertyValue,
5154 wxString *PropertyTokens,
5157 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5159 if (*FirstToken == TRUE){
5161 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5162 *FirstToken = FALSE;
5166 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5174 void ProcessStringValue(wxString *PropertyName,
5175 wxString PropertyNameMatch,
5176 std::map<int,wxString> *MapPtr,
5177 wxString *PropertyValue,
5179 bool *PropertyMatched){
5181 if (*PropertyName == PropertyNameMatch){
5182 MapPtr->erase(*ItemCount);
5183 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5184 *PropertyMatched = TRUE;
5189 void ProcessIntegerValue(wxString *PropertyName,
5190 wxString PropertyNameMatch,
5191 std::map<int,int> *PrefPtr,
5192 wxString *PropertyValue,
5194 bool *PropertyMatched){
5196 if (*PropertyName == PropertyNameMatch){
5197 *PropertyMatched = TRUE;
5202 int PriorityNumber = 0;
5203 bool ValidNumber = TRUE;
5206 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5209 catch(std::invalid_argument &e){
5210 ValidNumber = FALSE;
5213 if (ValidNumber == TRUE){
5215 PrefPtr->erase(*ItemCount);
5216 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5222 void SplitValues(wxString *PropertyLine,
5223 std::map<int,int> *SplitPoints,
5224 std::map<int,int> *SplitLength,
5227 size_t intPropertyLen = PropertyLine->Len();
5228 int intSplitsFound = 0;
5229 int intSplitSize = 0;
5230 int intSplitSeek = 0;
5232 for (int i = intSize; i <= intPropertyLen; i++){
5236 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5237 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5239 if (intSplitsFound == 0){
5241 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5245 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5249 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5259 if (intSplitsFound == 0){
5261 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5262 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5266 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5267 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5273 void CheckType(wxString *PropertySeg1,
5274 std::map<int,int> *SplitPoints,
5275 std::map<int,int> *SplitLength,
5277 PropertyType *PropType){
5279 wxString PropertyData;
5280 wxString PropertyName;
5281 wxString PropertyValue;
5282 std::map<int,int>::iterator SLiter;
5284 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5285 intiter != SplitPoints->end(); ++intiter){
5287 SLiter = SplitLength->find(intiter->first);
5289 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5291 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5292 PropertyName = PropertyElement.GetNextToken();
5293 PropertyValue = PropertyElement.GetNextToken();
5295 *intPrevValue = intiter->second;
5297 if (PropertyName == wxT("TYPE")){
5299 if (PropertyValue == wxT("work")){
5301 *PropType = PROPERTY_WORK;
5303 } else if (PropertyValue == wxT("home")){
5305 *PropType = PROPERTY_HOME;
5309 *PropType = PROPERTY_NONE;