1 // ContactDataObject.cpp - Client Data Object.
3 // (c) 2012-2016 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("SOUND")) {
380 // See frmContactEditor-LoadSound.cpp
382 ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
385 } else if (Property == wxT("CALURI")){
387 // See frmContactEditor-LoadCalendar.cpp
389 ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
392 } else if (Property == wxT("CALADRURI")){
394 ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
395 CalendarAddressCount++;
397 } else if (Property == wxT("FBURL")){
399 // See frmContactEditor-LoadCalendar.cpp
401 ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
402 FreeBusyAddressCount++;
404 } else if (Property == wxT("KEY")){
406 // See frmContactEditor-LoadKey.cpp
408 ProcessKey(PropertySeg1, PropertySeg2, &KeyCount);
411 } else if (Property.Mid(0, 3) == wxT("VND")){
413 ProcessVendor(PropertySeg1, PropertySeg2, &VendorCount);
416 } else if (Property.Mid(0, 2) == wxT("X-")){
418 XTokenList.insert(std::make_pair(XTokenCount, PropertySeg2));
419 XTokenListTokens.insert(std::make_pair(XTokenCount, PropertySeg1.Mid(2)));
426 return CONTACTLOAD_OK;
430 void ContactDataObject::ProcessKind(wxString KindType){
432 if (KindType == wxT("individual")){
434 ContactKind = CONTACTKIND_INDIVIDUAL;
436 } else if (KindType == wxT("group")){
438 ContactKind = CONTACTKIND_GROUP;
440 } else if (KindType == wxT("org")){
442 ContactKind = CONTACTKIND_ORGANISATION;
444 } else if (KindType == wxT("location")){
446 ContactKind = CONTACTKIND_LOCATION;
450 ContactKind = CONTACTKIND_NONE;
455 void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString PropertySeg2){
457 size_t intPropertyLen = PropertySeg1.Len();
458 std::map<int, int> SplitPoints;
459 std::map<int, int> SplitLength;
460 std::map<int, int>::iterator SLiter;
461 wxString PropertyData;
462 wxString PropertyName;
463 wxString PropertyValue;
464 wxString PropertyTokens;
465 bool FirstToken = TRUE;
466 int intSplitsFound = 0;
467 int intSplitSize = 0;
468 int intPrevValue = 5;
470 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
474 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
475 intiter != SplitPoints.end(); ++intiter){
477 SLiter = SplitLength.find(intiter->first);
478 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
479 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
480 intPrevValue = intiter->second;
482 // Process properties.
484 size_t intPropertyValueLen = PropertyValue.Len();
486 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
488 PropertyValue.Trim();
489 PropertyValue.RemoveLast();
493 if (PropertyValue.Mid(0, 1) == wxT("\"")){
495 PropertyValue.Remove(0, 1);
499 CaptureString(&PropertyValue, FALSE);
501 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
505 CaptureString(&PropertySeg2, FALSE);
507 Revision = PropertySeg2;
509 if (!PropertyTokens.IsEmpty()){
511 RevisionTokens = PropertyTokens;
518 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
520 size_t intPropertyLen = PropertySeg1.Len();
521 std::map<int, int> SplitPoints;
522 std::map<int, int> SplitLength;
523 std::map<int, int>::iterator SLiter;
524 wxString PropertyData;
525 wxString PropertyName;
526 wxString PropertyValue;
527 wxString PropertyTokens;
528 bool FirstToken = TRUE;
529 bool PropertyMatched = FALSE;
530 int intSplitsFound = 0;
531 int intSplitSize = 0;
532 int intPrevValue = 8;
534 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
538 PropertyType PropType = PROPERTY_NONE;
540 // Look for type before continuing.
542 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
546 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
547 intiter != SplitPoints.end(); ++intiter){
549 SLiter = SplitLength.find(intiter->first);
551 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
553 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
555 intPrevValue = intiter->second;
557 // Process properties.
559 size_t intPropertyValueLen = PropertyValue.Len();
561 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
563 PropertyValue.Trim();
564 PropertyValue.RemoveLast();
568 if (PropertyValue.Mid(0, 1) == wxT("\"")){
570 PropertyValue.Remove(0, 1);
574 CaptureString(&PropertyValue, FALSE);
576 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
577 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
578 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
579 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
581 if (PropertyMatched == TRUE){
583 PropertyMatched = FALSE;
588 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
592 intPropertyLen = PropertySeg2.Len();
599 CaptureString(&PropertySeg2, FALSE);
601 // Add the data to the General/Home/Work address variables.
607 SourceListType.insert(std::make_pair(*SourceCount, "home"));
610 SourceListType.insert(std::make_pair(*SourceCount, "work"));
614 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
616 if (!PropertyTokens.IsEmpty()){
618 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
624 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
626 std::map<int, int> SplitPoints;
627 std::map<int, int> SplitLength;
629 int intPrevValue = 5;
631 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
635 wxString PropertyName;
636 wxString PropertyValue;
637 wxString PropertyData;
638 wxString PropertyTokens;
639 std::map<int,int>::iterator SLiter;
640 bool FirstToken = TRUE;
641 bool PropertyMatched = FALSE;
643 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
644 intiter != SplitPoints.end(); ++intiter){
646 SLiter = SplitLength.find(intiter->first);
647 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
648 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
649 intPrevValue = intiter->second;
651 CaptureString(&PropertyValue, FALSE);
653 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
655 if (PropertyMatched == TRUE){
657 PropertyMatched = FALSE;
664 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
668 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
670 std::map<int, int> SplitPoints;
671 std::map<int, int> SplitLength;
673 int intPrevValue = 8;
675 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
679 wxString PropertyName;
680 wxString PropertyValue;
681 wxString PropertyData;
682 wxString PropertyTokens;
683 std::map<int,int>::iterator SLiter;
684 bool FirstToken = TRUE;
685 bool PropertyMatched = FALSE;
687 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
688 intiter != SplitPoints.end(); ++intiter){
690 SLiter = SplitLength.find(intiter->first);
691 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
692 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
693 intPrevValue = intiter->second;
695 CaptureString(&PropertyValue, FALSE);
697 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
698 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
699 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
700 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
702 if (PropertyMatched == TRUE){
704 PropertyMatched = FALSE;
709 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
713 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
715 if (!PropertyTokens.IsEmpty()){
717 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
724 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
726 std::map<int, int> SplitPoints;
727 std::map<int, int> SplitLength;
729 int intPrevValue = 4;
731 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
735 wxString PropertyName;
736 wxString PropertyValue;
737 wxString PropertyData;
738 wxString PropertyTokens;
739 std::map<int,int>::iterator SLiter;
740 bool FirstToken = TRUE;
741 bool PropertyMatched = FALSE;
743 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
744 intiter != SplitPoints.end(); ++intiter){
746 SLiter = SplitLength.find(intiter->first);
747 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
748 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
749 intPrevValue = intiter->second;
751 CaptureString(&PropertyValue, FALSE);
753 if (PropertyName == wxT("TYPE")){
755 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
756 PropertyValue == wxT("work") ){
758 FullNamesListType.erase(*FNCount);
759 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
763 PropertyMatched = TRUE;
767 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
768 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
769 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
770 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
772 if (PropertyMatched == TRUE){
774 PropertyMatched = FALSE;
779 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
783 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
785 if (!PropertyTokens.IsEmpty()){
787 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
793 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
795 std::map<int, int> SplitPoints;
796 std::map<int, int> SplitLength;
798 int intPrevValue = 3;
800 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
804 wxString PropertyName;
805 wxString PropertyValue;
806 wxString PropertyData;
807 wxString PropertyTokens;
808 std::map<int,int>::iterator SLiter;
809 bool FirstToken = TRUE;
811 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
812 intiter != SplitPoints.end(); ++intiter){
814 SLiter = SplitLength.find(intiter->first);
815 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
816 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
817 intPrevValue = intiter->second;
819 CaptureString(&PropertyValue, FALSE);
821 if (PropertyName == wxT("ALTID")){
823 NameAltID = PropertyValue;
825 } else if (PropertyName == wxT("LANGUAGE")){
827 NameLanguage = PropertyValue;
829 } else if (PropertyName == wxT("SORT-AS")){
831 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
832 PropertyValue.Len() >= 3){
833 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
836 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
838 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
844 // Split the name data.
846 int intSplitSeek = 0;
847 int intSplitsFound = 0;
848 int intSplitSize = 0;
849 int intPropertyLen = PropertySeg2.Len();
851 std::map<int,wxString> NameValues;
854 for (int i = 0; i <= intPropertyLen; i++){
856 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
858 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
863 if (intSplitsFound == 4){
865 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
879 // Split the data into several parts.
881 for (std::map<int, wxString>::iterator iter = NameValues.begin();
882 iter != NameValues.end(); ++iter){
884 if (iter->first == 1){
886 // Deal with family name.
888 NameSurname = iter->second;
890 } else if (iter->first == 2){
892 // Deal with given names.
894 NameForename = iter->second;
896 } else if (iter->first == 3){
898 // Deal with additional names.
900 NameOtherNames = iter->second;
902 } else if (iter->first == 4){
904 // Deal with honorifix prefixes and suffixes.
906 NameTitle = iter->second;
910 if (iter == NameValues.end()){
916 NameSuffix = iter->second;
922 // Add the name token data.
924 if (!PropertyTokens.IsEmpty()){
926 NameTokens = PropertyTokens;
932 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
934 size_t intPropertyLen = PropertySeg1.Len();
935 std::map<int, int> SplitPoints;
936 std::map<int, int> SplitLength;
937 std::map<int, int>::iterator SLiter;
938 wxString PropertyData;
939 wxString PropertyName;
940 wxString PropertyValue;
941 wxString PropertyTokens;
942 bool FirstToken = TRUE;
943 int intSplitsFound = 0;
944 int intSplitSize = 0;
945 int intPrevValue = 14;
947 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
951 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
952 intiter != SplitPoints.end(); ++intiter){
954 SLiter = SplitLength.find(intiter->first);
955 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
956 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
957 intPrevValue = intiter->second;
959 // Process properties.
961 CaptureString(&PropertyValue, FALSE);
963 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
967 CaptureString(&PropertySeg2, FALSE);
969 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
971 if (!PropertyTokens.IsEmpty()){
973 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
979 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
981 std::map<int, int> SplitPoints;
982 std::map<int, int> SplitLength;
984 int intPrevValue = 10;
986 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
990 PropertyType PropType = PROPERTY_NONE;
992 // Look for type before continuing.
994 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
998 std::map<int, wxString> *NicknamesList = NULL;
999 std::map<int, wxString> *NicknamesListType = NULL;
1000 std::map<int, wxString> *NicknamesListLanguage = NULL;
1001 std::map<int, wxString> *NicknamesListAltID = NULL;
1002 std::map<int, wxString> *NicknamesListPID = NULL;
1003 std::map<int, wxString> *NicknamesListTokens = NULL;
1004 std::map<int, int> *NicknamesListPref = NULL;
1008 NicknamesList = &GeneralNicknamesList;
1009 NicknamesListType = &GeneralNicknamesListType;
1010 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1011 NicknamesListAltID = &GeneralNicknamesListAltID;
1012 NicknamesListPID = &GeneralNicknamesListPID;
1013 NicknamesListTokens = &GeneralNicknamesListTokens;
1014 NicknamesListPref = &GeneralNicknamesListPref;
1017 NicknamesList = &HomeNicknamesList;
1018 NicknamesListType = &HomeNicknamesListType;
1019 NicknamesListLanguage = &HomeNicknamesListLanguage;
1020 NicknamesListAltID = &HomeNicknamesListAltID;
1021 NicknamesListPID = &HomeNicknamesListPID;
1022 NicknamesListTokens = &HomeNicknamesListTokens;
1023 NicknamesListPref = &HomeNicknamesListPref;
1026 NicknamesList = &BusinessNicknamesList;
1027 NicknamesListType = &BusinessNicknamesListType;
1028 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1029 NicknamesListAltID = &BusinessNicknamesListAltID;
1030 NicknamesListPID = &BusinessNicknamesListPID;
1031 NicknamesListTokens = &BusinessNicknamesListTokens;
1032 NicknamesListPref = &BusinessNicknamesListPref;
1036 std::map<int, int>::iterator SLiter;
1037 wxString PropertyData;
1038 wxString PropertyName;
1039 wxString PropertyValue;
1040 wxString PropertyTokens;
1041 bool FirstToken = TRUE;
1042 bool PropertyMatched = FALSE;
1044 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1045 intiter != SplitPoints.end(); ++intiter){
1047 SLiter = SplitLength.find(intiter->first);
1048 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1049 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1050 intPrevValue = intiter->second;
1052 CaptureString(&PropertyValue, FALSE);
1054 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1055 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1056 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1057 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1059 if (PropertyMatched == TRUE){
1061 PropertyMatched = FALSE;
1066 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1070 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1072 // Add the name token data.
1074 if (!PropertyTokens.IsEmpty()){
1076 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1082 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1084 std::map<int, int> SplitPoints;
1085 std::map<int, int> SplitLength;
1086 std::map<int, int>::iterator SLiter;
1087 wxString PropertyData;
1088 wxString PropertyName;
1089 wxString PropertyValue;
1090 wxString PropertyTokens;
1091 bool FirstToken = TRUE;
1092 int intPrevValue = 8;
1094 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1098 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1099 intiter != SplitPoints.end(); ++intiter){
1101 SLiter = SplitLength.find(intiter->first);
1102 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1103 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1104 intPrevValue = intiter->second;
1106 // Process properties.
1108 size_t intPropertyValueLen = PropertyValue.Len();
1110 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1112 PropertyValue.Trim();
1113 PropertyValue.RemoveLast();
1117 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1119 PropertyValue.Remove(0, 1);
1123 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1127 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1129 wxString GenderComponent;
1131 if (GenderData.CountTokens() >= 2){
1133 Gender = GenderData.GetNextToken();
1134 GenderDetails = GenderData.GetString();
1136 CaptureString(&GenderDetails, FALSE);
1140 Gender = GenderData.GetNextToken();
1144 if (!PropertyTokens.IsEmpty()){
1146 GenderTokens = PropertyTokens;
1152 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1154 // Process date. Preserve the remainder in the string.
1156 std::map<int, int> SplitPoints;
1157 std::map<int, int> SplitLength;
1158 std::map<int, int>::iterator SLiter;
1159 wxString PropertyData;
1160 wxString PropertyName;
1161 wxString PropertyValue;
1162 wxString PropertyTokens;
1163 int intPrevValue = 6;
1165 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1169 // Look for type before continuing.
1171 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1172 intiter != SplitPoints.end(); ++intiter){
1174 SLiter = SplitLength.find(intiter->first);
1175 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1176 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1177 intPrevValue = intiter->second;
1179 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1181 CaptureString(&PropertySeg2, FALSE);
1182 Birthday = PropertySeg2;
1183 BirthdayText = TRUE;
1189 // Setup blank lines for later on.
1192 bool FirstToken = TRUE;
1194 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1195 intiter != SplitPoints.end(); ++intiter){
1197 SLiter = SplitLength.find(intiter->first);
1198 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1199 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1200 intPrevValue = intiter->second;
1202 // Process properties.
1204 CaptureString(&PropertyValue, FALSE);
1206 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1208 PropertyValue.Trim();
1209 PropertyValue.RemoveLast();
1213 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1215 PropertyValue.Remove(0, 1);
1219 if (PropertyName == wxT("ALTID")){
1221 BirthdayAltID = PropertyValue;
1223 } else if (PropertyName == wxT("CALSCALE")){
1225 BirthdayCalScale = PropertyValue;
1227 } else if (PropertyName != wxT("VALUE")) {
1229 // Something else we don't know about so append
1230 // to the tokens variable.
1232 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1238 // Add the data to the variables and form.
1240 if (BirthdayText == FALSE){
1242 Birthday = PropertySeg2;
1246 if (!PropertyTokens.IsEmpty()){
1248 BirthdayTokens = PropertyTokens;
1254 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1256 // Process date. Preserve the remainder in the string.
1258 std::map<int, int> SplitPoints;
1259 std::map<int, int> SplitLength;
1260 std::map<int, int>::iterator SLiter;
1261 wxString PropertyData;
1262 wxString PropertyName;
1263 wxString PropertyValue;
1264 wxString PropertyTokens;
1265 int intPrevValue = 13;
1267 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1271 // Look for type before continuing.
1273 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1274 intiter != SplitPoints.end(); ++intiter){
1276 SLiter = SplitLength.find(intiter->first);
1277 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1278 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1279 intPrevValue = intiter->second;
1281 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1283 CaptureString(&PropertySeg2, FALSE);
1284 Anniversary = PropertySeg2;
1285 AnniversaryText = TRUE;
1291 // Setup blank lines for later on.
1294 bool FirstToken = TRUE;
1296 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1297 intiter != SplitPoints.end(); ++intiter){
1299 SLiter = SplitLength.find(intiter->first);
1300 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1301 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1302 intPrevValue = intiter->second;
1304 // Process properties.
1306 CaptureString(&PropertyValue, FALSE);
1308 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1310 PropertyValue.Trim();
1311 PropertyValue.RemoveLast();
1315 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1317 PropertyValue.Remove(0, 1);
1321 if (PropertyName == wxT("ALTID")){
1323 AnniversaryAltID = PropertyValue;
1325 } else if (PropertyName == wxT("CALSCALE")){
1327 AnniversaryCalScale = PropertyValue;
1329 } else if (PropertyName != wxT("VALUE")) {
1331 // Something else we don't know about so append
1332 // to the tokens variable.
1334 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1340 // Add the data to the variables and form.
1342 if (AnniversaryText == FALSE){
1344 Anniversary = PropertySeg2;
1348 if (!PropertyTokens.IsEmpty()){
1350 AnniversaryTokens = PropertyTokens;
1356 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1358 std::map<int, int> SplitPoints;
1359 std::map<int, int> SplitLength;
1361 int intPrevValue = 4;
1363 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1367 PropertyType PropType = PROPERTY_NONE;
1369 // Look for type before continuing.
1371 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1375 std::map<int, wxString> *TZList = NULL;
1376 std::map<int, wxString> *TZListType = NULL;
1377 std::map<int, wxString> *TZListMediatype = NULL;
1378 std::map<int, wxString> *TZListAltID = NULL;
1379 std::map<int, wxString> *TZListPID = NULL;
1380 std::map<int, wxString> *TZListTokens = NULL;
1381 std::map<int, int> *TZListPref = NULL;
1385 TZList = &GeneralTZList;
1386 TZListType = &GeneralTZListType;
1387 TZListMediatype = &GeneralTZListMediatype;
1388 TZListAltID = &GeneralTZListAltID;
1389 TZListPID = &GeneralTZListPID;
1390 TZListTokens = &GeneralTZListTokens;
1391 TZListPref = &GeneralTZListPref;
1394 TZList = &HomeTZList;
1395 TZListType = &HomeTZListType;
1396 TZListMediatype = &HomeTZListMediatype;
1397 TZListAltID = &HomeTZListAltID;
1398 TZListPID = &HomeTZListPID;
1399 TZListTokens = &HomeTZListTokens;
1400 TZListPref = &HomeTZListPref;
1403 TZList = &BusinessTZList;
1404 TZListType = &BusinessTZListType;
1405 TZListMediatype = &BusinessTZListMediatype;
1406 TZListAltID = &BusinessTZListAltID;
1407 TZListPID = &BusinessTZListPID;
1408 TZListTokens = &BusinessTZListTokens;
1409 TZListPref = &BusinessTZListPref;
1413 std::map<int, int>::iterator SLiter;
1414 wxString PropertyData;
1415 wxString PropertyName;
1416 wxString PropertyValue;
1417 wxString PropertyTokens;
1418 bool FirstToken = TRUE;
1419 bool PropertyMatched = FALSE;
1421 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1422 intiter != SplitPoints.end(); ++intiter){
1424 SLiter = SplitLength.find(intiter->first);
1425 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1426 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1427 intPrevValue = intiter->second;
1429 CaptureString(&PropertyValue, FALSE);
1431 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1432 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1433 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1434 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1436 if (PropertyMatched == TRUE){
1438 PropertyMatched = FALSE;
1443 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1445 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1451 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1453 // Add the name token data.
1455 if (!PropertyTokens.IsEmpty()){
1457 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1464 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1466 size_t intPropertyLen = PropertySeg1.Len();
1467 std::map<int, int> SplitPoints;
1468 std::map<int, int> SplitLength;
1469 std::map<int, int>::iterator SLiter;
1470 wxString PropertyData;
1471 wxString PropertyName;
1472 wxString PropertyValue;
1473 wxString PropertyTokens;
1474 wxString AddressLabel;
1475 wxString AddressLang;
1476 wxString AddressAltID;
1477 wxString AddressPID;
1478 wxString AddressTokens;
1479 wxString AddressGeo;
1480 wxString AddressTimezone;
1481 wxString AddressType;
1482 wxString AddressMediatype;
1483 wxString AddressPOBox;
1484 wxString AddressExtended;
1485 wxString AddressStreet;
1486 wxString AddressLocality;
1487 wxString AddressCity;
1488 wxString AddressRegion;
1489 wxString AddressPostalCode;
1490 wxString AddressCountry;
1491 bool FirstToken = TRUE;
1492 int intSplitsFound = 0;
1493 int intSplitSize = 0;
1494 int intPrevValue = 5;
1495 bool PropertyMatched = FALSE;
1497 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1501 PropertyType PropType = PROPERTY_NONE;
1503 // Look for type before continuing.
1505 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1509 std::map<int, wxString> *AddressList = NULL;
1510 std::map<int, wxString> *AddressListTown = NULL;
1511 std::map<int, wxString> *AddressListCounty = NULL;
1512 std::map<int, wxString> *AddressListPostCode = NULL;
1513 std::map<int, wxString> *AddressListCountry = NULL;
1514 std::map<int, wxString> *AddressListLabel = NULL;
1515 std::map<int, wxString> *AddressListLang = NULL;
1516 std::map<int, wxString> *AddressListAltID = NULL;
1517 std::map<int, wxString> *AddressListPID = NULL;
1518 std::map<int, wxString> *AddressListTokens = NULL;
1519 std::map<int, wxString> *AddressListGeo = NULL;
1520 std::map<int, wxString> *AddressListTimezone = NULL;
1521 std::map<int, wxString> *AddressListType = NULL;
1522 std::map<int, wxString> *AddressListMediatype = NULL;
1523 std::map<int, int> *AddressListPref = NULL;
1527 AddressList = &GeneralAddressList;
1528 AddressListTown = &GeneralAddressListTown;
1529 AddressListCounty = &GeneralAddressListCounty;
1530 AddressListPostCode = &GeneralAddressListPostCode;
1531 AddressListCountry = &GeneralAddressListCountry;
1532 AddressListLabel = &GeneralAddressListLabel;
1533 AddressListLang = &GeneralAddressListLang;
1534 AddressListAltID = &GeneralAddressListAltID;
1535 AddressListPID = &GeneralAddressListPID;
1536 AddressListTokens = &GeneralAddressListTokens;
1537 AddressListGeo = &GeneralAddressListGeo;
1538 AddressListTimezone = &GeneralAddressListTimezone;
1539 AddressListType = &GeneralAddressListType;
1540 AddressListMediatype = &GeneralAddressListMediatype;
1541 AddressListPref = &GeneralAddressListPref;
1544 AddressList = &HomeAddressList;
1545 AddressListTown = &HomeAddressListTown;
1546 AddressListCounty = &HomeAddressListCounty;
1547 AddressListPostCode = &HomeAddressListPostCode;
1548 AddressListCountry = &HomeAddressListCountry;
1549 AddressListLabel = &HomeAddressListLabel;
1550 AddressListLang = &HomeAddressListLang;
1551 AddressListAltID = &HomeAddressListAltID;
1552 AddressListPID = &HomeAddressListPID;
1553 AddressListTokens = &HomeAddressListTokens;
1554 AddressListGeo = &HomeAddressListGeo;
1555 AddressListTimezone = &HomeAddressListTimezone;
1556 AddressListType = &HomeAddressListType;
1557 AddressListMediatype = &HomeAddressListMediatype;
1558 AddressListPref = &HomeAddressListPref;
1561 AddressList = &BusinessAddressList;
1562 AddressListTown = &BusinessAddressListTown;
1563 AddressListCounty = &BusinessAddressListCounty;
1564 AddressListPostCode = &BusinessAddressListPostCode;
1565 AddressListCountry = &BusinessAddressListCountry;
1566 AddressListLabel = &BusinessAddressListLabel;
1567 AddressListLang = &BusinessAddressListLang;
1568 AddressListAltID = &BusinessAddressListAltID;
1569 AddressListPID = &BusinessAddressListPID;
1570 AddressListTokens = &BusinessAddressListTokens;
1571 AddressListGeo = &BusinessAddressListGeo;
1572 AddressListTimezone = &BusinessAddressListTimezone;
1573 AddressListType = &BusinessAddressListType;
1574 AddressListMediatype = &BusinessAddressListMediatype;
1575 AddressListPref = &BusinessAddressListPref;
1581 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1582 intiter != SplitPoints.end(); ++intiter){
1584 SLiter = SplitLength.find(intiter->first);
1585 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1586 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1587 intPrevValue = intiter->second;
1589 if (PropertyName == "GEO"){
1591 CaptureString(&PropertyValue, TRUE);
1595 CaptureString(&PropertyValue, FALSE);
1599 // Process properties.
1601 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1602 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1603 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1604 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1605 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1606 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1607 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1608 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1610 if (PropertyMatched == TRUE){
1612 PropertyMatched = FALSE;
1617 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1621 // Split the address.
1623 //std::map<int, int>::iterator SLiter;
1624 intPropertyLen = PropertySeg2.Len();
1625 SplitPoints.clear();
1626 SplitLength.clear();
1631 for (int i = 0; i <= intPropertyLen; i++){
1635 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1638 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1640 if (intSplitsFound == 6){
1642 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1647 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1657 // Split the data into several parts.
1659 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1660 intiter != SplitPoints.end(); ++intiter){
1662 if (intiter->first == 1){
1664 // Deal with PO Box.
1666 SLiter = SplitLength.find(1);
1668 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1669 intPrevValue = intiter->second;
1671 } else if (intiter->first == 2){
1673 // Deal with extended address.
1675 SLiter = SplitLength.find(2);
1677 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1678 intPrevValue = intiter->second;
1680 } else if (intiter->first == 3){
1682 // Deal with street address.
1684 SLiter = SplitLength.find(3);
1686 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1687 intPrevValue = intiter->second;
1689 } else if (intiter->first == 4){
1691 // Deal with locality
1693 SLiter = SplitLength.find(4);
1695 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1696 intPrevValue = intiter->second;
1698 } else if (intiter->first == 5){
1700 // Deal with region.
1702 SLiter = SplitLength.find(5);
1704 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1705 intPrevValue = intiter->second;
1708 } else if (intiter->first == 6){
1710 // Deal with post code.
1712 SLiter = SplitLength.find(6);
1714 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1715 intPrevValue = intiter->second;
1717 // Deal with country.
1719 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1727 // Add the data to the General/Home/Work address variables.
1729 CaptureString(&AddressStreet, FALSE);
1730 CaptureString(&AddressLocality, FALSE);
1731 CaptureString(&AddressRegion, FALSE);
1732 CaptureString(&AddressPostalCode, FALSE);
1733 CaptureString(&AddressCountry, FALSE);
1735 if (!PropertyTokens.IsEmpty()){
1737 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1741 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1742 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1743 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1744 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1745 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1749 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1752 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1755 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1759 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1763 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1765 std::map<int, int> SplitPoints;
1766 std::map<int, int> SplitLength;
1768 int intPrevValue = 7;
1770 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1774 PropertyType PropType = PROPERTY_NONE;
1776 // Look for type before continuing.
1778 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1780 std::map<int, wxString> *EmailList = NULL;
1781 std::map<int, wxString> *EmailListType = NULL;
1782 std::map<int, wxString> *EmailListAltID = NULL;
1783 std::map<int, wxString> *EmailListPID = NULL;
1784 std::map<int, wxString> *EmailListTokens = NULL;
1785 std::map<int, int> *EmailListPref = NULL;
1789 EmailList = &GeneralEmailList;
1790 EmailListType = &GeneralEmailListType;
1791 EmailListAltID = &GeneralEmailListAltID;
1792 EmailListPID = &GeneralEmailListPID;
1793 EmailListTokens = &GeneralEmailListTokens;
1794 EmailListPref = &GeneralEmailListPref;
1797 EmailList = &HomeEmailList;
1798 EmailListType = &HomeEmailListType;
1799 EmailListAltID = &HomeEmailListAltID;
1800 EmailListPID = &HomeEmailListPID;
1801 EmailListTokens = &HomeEmailListTokens;
1802 EmailListPref = &HomeEmailListPref;
1805 EmailList = &BusinessEmailList;
1806 EmailListType = &BusinessEmailListType;
1807 EmailListAltID = &BusinessEmailListAltID;
1808 EmailListPID = &BusinessEmailListPID;
1809 EmailListTokens = &BusinessEmailListTokens;
1810 EmailListPref = &BusinessEmailListPref;
1816 std::map<int,int>::iterator SLiter;
1817 wxString PropertyData;
1818 wxString PropertyName;
1819 wxString PropertyValue;
1820 wxString PropertyTokens;
1821 bool FirstToken = TRUE;
1822 bool PropertyMatched = FALSE;
1824 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1825 intiter != SplitPoints.end(); ++intiter){
1827 SLiter = SplitLength.find(intiter->first);
1828 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1829 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1830 intPrevValue = intiter->second;
1832 CaptureString(&PropertyValue, FALSE);
1834 // Process properties.
1836 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
1837 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
1838 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
1840 if (PropertyMatched == TRUE){
1842 PropertyMatched = FALSE;
1847 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1851 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1853 // Add the name token data.
1855 if (!PropertyTokens.IsEmpty()){
1857 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1864 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1866 std::map<int, int> SplitPoints;
1867 std::map<int, int> SplitLength;
1869 int intPrevValue = 6;
1871 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1875 PropertyType PropType = PROPERTY_NONE;
1877 // Look for type before continuing.
1879 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1881 std::map<int, wxString> *IMList = NULL;
1882 std::map<int, wxString> *IMListType = NULL;
1883 std::map<int, wxString> *IMListAltID = NULL;
1884 std::map<int, wxString> *IMListPID = NULL;
1885 std::map<int, wxString> *IMListTokens = NULL;
1886 std::map<int, wxString> *IMListMediatype = NULL;
1887 std::map<int, wxString> *IMListTypeInfo = NULL;
1888 std::map<int, int> *IMListPref = NULL;
1892 IMList = &GeneralIMList;
1893 IMListType = &GeneralIMListType;
1894 IMListAltID = &GeneralIMListAltID;
1895 IMListPID = &GeneralIMListPID;
1896 IMListTokens = &GeneralIMListTokens;
1897 IMListMediatype = &GeneralIMListMediatype;
1898 IMListTypeInfo = &GeneralIMListTypeInfo;
1899 IMListPref = &GeneralIMListPref;
1902 IMList = &HomeIMList;
1903 IMListType = &HomeIMListType;
1904 IMListAltID = &HomeIMListAltID;
1905 IMListPID = &HomeIMListPID;
1906 IMListTokens = &HomeIMListTokens;
1907 IMListMediatype = &HomeIMListMediatype;
1908 IMListTypeInfo = &HomeIMListTypeInfo;
1909 IMListPref = &HomeIMListPref;
1912 IMList = &BusinessIMList;
1913 IMListType = &BusinessIMListType;
1914 IMListAltID = &BusinessIMListAltID;
1915 IMListPID = &BusinessIMListPID;
1916 IMListTokens = &BusinessIMListTokens;
1917 IMListMediatype = &BusinessIMListMediatype;
1918 IMListTypeInfo = &BusinessIMListTypeInfo;
1919 IMListPref = &BusinessIMListPref;
1925 std::map<int,int>::iterator SLiter;
1926 wxString PropertyData;
1927 wxString PropertyName;
1928 wxString PropertyValue;
1929 wxString PropertyTokens;
1930 bool FirstToken = TRUE;
1931 bool PropertyMatched = FALSE;
1933 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1934 intiter != SplitPoints.end(); ++intiter){
1936 SLiter = SplitLength.find(intiter->first);
1937 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1938 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1939 intPrevValue = intiter->second;
1941 CaptureString(&PropertyValue, FALSE);
1943 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
1944 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
1945 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
1946 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
1948 // Process properties.
1950 if (PropertyMatched == TRUE){
1952 PropertyMatched = FALSE;
1957 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1961 wxStringTokenizer IMPPSplitData(PropertySeg2, wxT(":"));
1963 if (IMPPSplitData.CountTokens() > 1){
1965 IMListTypeInfo->insert(std::make_pair(*IMCount, IMPPSplitData.GetNextToken()));
1966 IMList->insert(std::make_pair(*IMCount, IMPPSplitData.GetString()));
1970 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
1971 IMListTypeInfo->insert(std::make_pair(*IMCount, "none"));
1975 // Add the name token data.
1977 if (!PropertyTokens.IsEmpty()){
1979 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
1985 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
1987 std::map<int, int> SplitPoints;
1988 std::map<int, int> SplitLength;
1989 std::map<int, int>::iterator SLiter;
1991 PropertyType PropType = PROPERTY_NONE;
1993 // Look for type before continuing.
1996 wxString TelTypeDetail;
1997 wxString PropertyData;
1998 wxString PropertyName;
1999 wxString PropertyValue;
2000 wxString PropertyTokens;
2002 std::map<int,int> TypeSplitPoints;
2003 std::map<int,int> TypeSplitLength;
2004 std::map<int,int>::iterator TSLiter;
2006 int intSplitSize = 0;
2007 int intSplitsFound = 0;
2008 int intSplitPoint = 0;
2010 int intPrevValue = 5;
2012 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2016 // Look for type before continuing.
2018 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2019 intiter != SplitPoints.end(); ++intiter){
2021 SLiter = SplitLength.find(intiter->first);
2022 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2023 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2024 intPrevValue = intiter->second;
2026 if (PropertyName == wxT("TYPE")){
2028 // Process each value in type and translate each
2031 // Strip out the quotes if they are there.
2033 size_t intPropertyValueLen = PropertyValue.Len();
2035 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2037 PropertyValue.Trim();
2038 PropertyValue.RemoveLast();
2042 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2044 PropertyValue.Remove(0, 1);
2048 TelTypeDetail = PropertyValue;
2054 for (int i = 0; i <= intPropertyValueLen; i++){
2058 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2060 if (intSplitsFound == 0){
2062 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2063 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2067 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2068 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2081 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2082 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2084 int intTypeSeek = 0;
2086 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2087 typeiter != TypeSplitPoints.end(); ++typeiter){
2089 wxString TypePropertyName;
2091 TSLiter = TypeSplitLength.find(typeiter->first);
2093 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2095 if (intTypeSeek == 0){
2100 TelTypeUI.Append(wxT(","));
2104 if (TypePropertyName == wxT("home")){
2106 PropType = PROPERTY_HOME;
2108 } else if (TypePropertyName == wxT("work")){
2110 PropType = PROPERTY_WORK;
2115 if (TypePropertyName == wxT("text")){
2117 TelTypeUI.Append(_("text"));
2120 } else if (TypePropertyName == wxT("voice")){
2122 TelTypeUI.Append(_("voice"));
2125 } else if (TypePropertyName == wxT("fax")){
2127 TelTypeUI.Append(_("fax"));
2130 } else if (TypePropertyName == wxT("cell")){
2132 TelTypeUI.Append(_("cell"));
2135 } else if (TypePropertyName == wxT("video")){
2137 TelTypeUI.Append(_("video"));
2140 } else if (TypePropertyName == wxT("pager")){
2142 TelTypeUI.Append(_("pager"));
2145 } else if (TypePropertyName == wxT("textphone")){
2147 TelTypeUI.Append(_("textphone"));
2158 std::map<int, wxString> *TelephoneList = NULL;
2159 std::map<int, wxString> *TelephoneListType = NULL;
2160 std::map<int, wxString> *TelephoneListAltID = NULL;
2161 std::map<int, wxString> *TelephoneListPID = NULL;
2162 std::map<int, wxString> *TelephoneListTokens = NULL;
2163 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2164 std::map<int, wxString> *TelephoneListDataType = NULL;
2165 std::map<int, int> *TelephoneListPref = NULL;
2169 TelephoneList = &GeneralTelephoneList;
2170 TelephoneListType = &GeneralTelephoneListType;
2171 TelephoneListAltID = &GeneralTelephoneListAltID;
2172 TelephoneListPID = &GeneralTelephoneListPID;
2173 TelephoneListTokens = &GeneralTelephoneListTokens;
2174 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2175 TelephoneListDataType = &GeneralTelephoneListDataType;
2176 TelephoneListPref = &GeneralTelephoneListPref;
2179 TelephoneList = &HomeTelephoneList;
2180 TelephoneListType = &HomeTelephoneListType;
2181 TelephoneListAltID = &HomeTelephoneListAltID;
2182 TelephoneListPID = &HomeTelephoneListPID;
2183 TelephoneListTokens = &HomeTelephoneListTokens;
2184 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2185 TelephoneListDataType = &HomeTelephoneListDataType;
2186 TelephoneListPref = &HomeTelephoneListPref;
2189 TelephoneList = &BusinessTelephoneList;
2190 TelephoneListType = &BusinessTelephoneListType;
2191 TelephoneListAltID = &BusinessTelephoneListAltID;
2192 TelephoneListPID = &BusinessTelephoneListPID;
2193 TelephoneListTokens = &BusinessTelephoneListTokens;
2194 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2195 TelephoneListDataType = &BusinessTelephoneListDataType;
2196 TelephoneListPref = &BusinessTelephoneListPref;
2200 // Process the properties.
2202 bool FirstToken = TRUE;
2205 SplitPoints.clear();
2206 SplitLength.clear();
2208 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2212 bool PropertyMatched = FALSE;
2214 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2215 intiter != SplitPoints.end(); ++intiter){
2217 SLiter = SplitLength.find(intiter->first);
2218 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2219 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2220 intPrevValue = intiter->second;
2222 CaptureString(&PropertyValue, FALSE);
2224 // Process properties.
2226 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2227 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2228 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2230 if (PropertyMatched == TRUE){
2232 PropertyMatched = FALSE;
2237 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2241 // Check for the type information and split it down.
2243 wxStringTokenizer TelSplitData(PropertySeg2, wxT(":"));
2245 if (TelSplitData.CountTokens() > 1){
2247 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, TelSplitData.GetNextToken()));
2248 TelephoneList->insert(std::make_pair(*TelephoneCount, TelSplitData.GetString()));
2252 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2253 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, "tel"));
2257 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2259 // Add the name token data.
2261 if (!PropertyTokens.IsEmpty()){
2263 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2269 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2271 std::map<int, int> SplitPoints;
2272 std::map<int, int> SplitLength;
2274 int intPrevValue = 6;
2276 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2280 PropertyType PropType = PROPERTY_NONE;
2282 // Look for type before continuing.
2284 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2286 std::map<int, wxString> *LanguageList = NULL;
2287 std::map<int, wxString> *LanguageListType = NULL;
2288 std::map<int, wxString> *LanguageListAltID = NULL;
2289 std::map<int, wxString> *LanguageListPID = NULL;
2290 std::map<int, wxString> *LanguageListTokens = NULL;
2291 std::map<int, int> *LanguageListPref = NULL;
2295 LanguageList = &GeneralLanguageList;
2296 LanguageListType = &GeneralLanguageListType;
2297 LanguageListAltID = &GeneralLanguageListAltID;
2298 LanguageListPID = &GeneralLanguageListPID;
2299 LanguageListTokens = &GeneralLanguageListTokens;
2300 LanguageListPref = &GeneralLanguageListPref;
2303 LanguageList = &HomeLanguageList;
2304 LanguageListType = &HomeLanguageListType;
2305 LanguageListAltID = &HomeLanguageListAltID;
2306 LanguageListPID = &HomeLanguageListPID;
2307 LanguageListTokens = &HomeLanguageListTokens;
2308 LanguageListPref = &HomeLanguageListPref;
2311 LanguageList = &BusinessLanguageList;
2312 LanguageListType = &BusinessLanguageListType;
2313 LanguageListAltID = &BusinessLanguageListAltID;
2314 LanguageListPID = &BusinessLanguageListPID;
2315 LanguageListTokens = &BusinessLanguageListTokens;
2316 LanguageListPref = &BusinessLanguageListPref;
2322 std::map<int,int>::iterator SLiter;
2323 wxString PropertyData;
2324 wxString PropertyName;
2325 wxString PropertyValue;
2326 wxString PropertyTokens;
2327 bool FirstToken = TRUE;
2328 bool PropertyMatched = FALSE;
2330 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2331 intiter != SplitPoints.end(); ++intiter){
2333 SLiter = SplitLength.find(intiter->first);
2334 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2335 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2336 intPrevValue = intiter->second;
2338 CaptureString(&PropertyValue, FALSE);
2340 // Process properties.
2342 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2343 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2344 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2346 if (PropertyMatched == TRUE){
2348 PropertyMatched = FALSE;
2353 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2357 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2359 // Add the name token data.
2361 if (!PropertyTokens.IsEmpty()){
2363 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2369 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2371 std::map<int, int> SplitPoints;
2372 std::map<int, int> SplitLength;
2374 int intPrevValue = 5;
2376 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2380 PropertyType PropType = PROPERTY_NONE;
2382 // Look for type before continuing.
2384 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2386 std::map<int, wxString> *GeopositionList = NULL;
2387 std::map<int, wxString> *GeopositionListType = NULL;
2388 std::map<int, wxString> *GeopositionListAltID = NULL;
2389 std::map<int, wxString> *GeopositionListPID = NULL;
2390 std::map<int, wxString> *GeopositionListTokens = NULL;
2391 std::map<int, wxString> *GeopositionListMediatype = NULL;
2392 std::map<int, int> *GeopositionListPref = NULL;
2396 GeopositionList = &GeneralGeographyList;
2397 GeopositionListType = &GeneralGeographyListType;
2398 GeopositionListAltID = &GeneralGeographyListAltID;
2399 GeopositionListPID = &GeneralGeographyListPID;
2400 GeopositionListTokens = &GeneralGeographyListTokens;
2401 GeopositionListMediatype = &GeneralGeographyListMediatype;
2402 GeopositionListPref = &GeneralGeographyListPref;
2405 GeopositionList = &HomeGeographyList;
2406 GeopositionListType = &HomeGeographyListType;
2407 GeopositionListAltID = &HomeGeographyListAltID;
2408 GeopositionListPID = &HomeGeographyListPID;
2409 GeopositionListTokens = &HomeGeographyListTokens;
2410 GeopositionListMediatype = &HomeGeographyListMediatype;
2411 GeopositionListPref = &HomeGeographyListPref;
2414 GeopositionList = &BusinessGeographyList;
2415 GeopositionListType = &BusinessGeographyListType;
2416 GeopositionListAltID = &BusinessGeographyListAltID;
2417 GeopositionListPID = &BusinessGeographyListPID;
2418 GeopositionListTokens = &BusinessGeographyListTokens;
2419 GeopositionListMediatype = &BusinessGeographyListMediatype;
2420 GeopositionListPref = &BusinessGeographyListPref;
2426 std::map<int,int>::iterator SLiter;
2427 wxString PropertyData;
2428 wxString PropertyName;
2429 wxString PropertyValue;
2430 wxString PropertyTokens;
2431 bool FirstToken = TRUE;
2432 bool PropertyMatched = FALSE;
2434 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2435 intiter != SplitPoints.end(); ++intiter){
2437 SLiter = SplitLength.find(intiter->first);
2438 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2439 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2440 intPrevValue = intiter->second;
2442 CaptureString(&PropertyValue, FALSE);
2444 // Process properties.
2446 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2447 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2448 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2449 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2451 if (PropertyMatched == TRUE){
2453 PropertyMatched = FALSE;
2458 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2462 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2464 // Add the name token data.
2466 if (!PropertyTokens.IsEmpty()){
2468 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2474 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2476 size_t intPropertyLen = PropertySeg1.Len();
2477 std::map<int, int> SplitPoints;
2478 std::map<int, int> SplitLength;
2479 std::map<int, int>::iterator SLiter;
2480 wxString PropertyData;
2481 wxString PropertyName;
2482 wxString PropertyValue;
2483 wxString PropertyTokens;
2484 wxString RelatedType;
2485 wxString RelatedTypeOriginal;
2486 wxString RelatedName;
2487 bool FirstToken = TRUE;
2488 int intSplitsFound = 0;
2489 int intSplitSize = 0;
2490 int intPrevValue = 9;
2492 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2496 // Look for type before continuing.
2498 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2499 intiter != SplitPoints.end(); ++intiter){
2501 SLiter = SplitLength.find(intiter->first);
2502 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2503 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2504 intPrevValue = intiter->second;
2508 RelatedTypeOriginal = PropertyValue;
2510 if (PropertyName == wxT("TYPE")){
2512 if (PropertyValue == wxT("contact")){
2514 RelatedType = _("Contact");
2516 } else if (PropertyValue == wxT("acquaintance")){
2518 RelatedType = _("Acquaintance");
2520 } else if (PropertyValue == wxT("friend")){
2522 RelatedType = _("Friend");
2524 } else if (PropertyValue == wxT("met")){
2526 RelatedType = _("Met");
2528 } else if (PropertyValue == wxT("co-worker")){
2530 RelatedType = _("Co-worker");
2532 } else if (PropertyValue == wxT("colleague")){
2534 RelatedType = _("Colleague");
2536 } else if (PropertyValue == wxT("co-resident")){
2538 RelatedType = _("Co-resident");
2540 } else if (PropertyValue == wxT("neighbor")){
2542 RelatedType = _("Neighbour");
2544 } else if (PropertyValue == wxT("child")){
2546 RelatedType = _("Child");
2548 } else if (PropertyValue == wxT("parent")){
2550 RelatedType = _("Parent");
2552 } else if (PropertyValue == wxT("sibling")){
2554 RelatedType = _("Sibling");
2556 } else if (PropertyValue == wxT("spouse")){
2558 RelatedType = _("Spouse");
2560 } else if (PropertyValue == wxT("kin")){
2562 RelatedType = _("Kin");
2564 } else if (PropertyValue == wxT("muse")){
2566 RelatedType = _("Muse");
2568 } else if (PropertyValue == wxT("crush")){
2570 RelatedType = _("Crush");
2572 } else if (PropertyValue == wxT("date")){
2574 RelatedType = _("Date");
2576 } else if (PropertyValue == wxT("sweetheart")){
2578 RelatedType = _("Sweetheart");
2580 } else if (PropertyValue == wxT("me")){
2582 RelatedType = _("Me");
2584 } else if (PropertyValue == wxT("agent")){
2586 RelatedType = _("Agent");
2588 } else if (PropertyValue == wxT("emergency")){
2590 RelatedType = _("Emergency");
2594 RelatedType = PropertyValue;
2604 bool PropertyMatched = FALSE;
2606 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2607 intiter != SplitPoints.end(); ++intiter){
2609 SLiter = SplitLength.find(intiter->first);
2610 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2611 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2612 intPrevValue = intiter->second;
2614 // Process properties.
2616 size_t intPropertyValueLen = PropertyValue.Len();
2618 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2620 PropertyValue.Trim();
2621 PropertyValue.RemoveLast();
2625 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2627 PropertyValue.Remove(0, 1);
2631 CaptureString(&PropertyValue, FALSE);
2633 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2634 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2635 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2636 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2638 if (PropertyMatched == TRUE){
2640 PropertyMatched = FALSE;
2645 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2649 // Add the data to the General/Home/Work address variables.
2651 GeneralRelatedList.erase(*RelatedCount);
2652 GeneralRelatedListRelType.erase(*RelatedCount);
2653 GeneralRelatedListType.erase(*RelatedCount);
2654 GeneralRelatedListTokens.erase(*RelatedCount);
2655 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2656 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2657 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2658 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2662 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2664 std::map<int, int> SplitPoints;
2665 std::map<int, int> SplitLength;
2666 std::map<int, int>::iterator SLiter;
2667 wxString PropertyData;
2668 wxString PropertyName;
2669 wxString PropertyValue;
2670 wxString PropertyTokens;
2671 bool FirstToken = TRUE;
2672 int intPrevValue = 5;
2674 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2678 PropertyType PropType = PROPERTY_NONE;
2680 // Look for type before continuing.
2682 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2684 // Setup the pointers.
2686 std::map<int, wxString> *WebsiteList = NULL;
2687 std::map<int, wxString> *WebsiteListAltID = NULL;
2688 std::map<int, wxString> *WebsiteListPID = NULL;
2689 std::map<int, wxString> *WebsiteListType = NULL;
2690 std::map<int, wxString> *WebsiteListTokens = NULL;
2691 std::map<int, wxString> *WebsiteListMediatype = NULL;
2692 std::map<int, int> *WebsiteListPref = NULL;
2694 // Setup blank lines for later on.
2698 WebsiteList = &GeneralWebsiteList;
2699 WebsiteListType = &GeneralWebsiteListType;
2700 WebsiteListAltID = &GeneralWebsiteListAltID;
2701 WebsiteListPID = &GeneralWebsiteListPID;
2702 WebsiteListTokens = &GeneralWebsiteListTokens;
2703 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2704 WebsiteListPref = &GeneralWebsiteListPref;
2707 WebsiteList = &HomeWebsiteList;
2708 WebsiteListType = &HomeWebsiteListType;
2709 WebsiteListAltID = &HomeWebsiteListAltID;
2710 WebsiteListPID = &HomeWebsiteListPID;
2711 WebsiteListTokens = &HomeWebsiteListTokens;
2712 WebsiteListMediatype = &HomeWebsiteListMediatype;
2713 WebsiteListPref = &HomeWebsiteListPref;
2716 WebsiteList = &BusinessWebsiteList;
2717 WebsiteListType = &BusinessWebsiteListType;
2718 WebsiteListAltID = &BusinessWebsiteListAltID;
2719 WebsiteListPID = &BusinessWebsiteListPID;
2720 WebsiteListTokens = &BusinessWebsiteListTokens;
2721 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2722 WebsiteListPref = &BusinessWebsiteListPref;
2727 bool PropertyMatched = FALSE;
2729 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2730 intiter != SplitPoints.end(); ++intiter){
2732 SLiter = SplitLength.find(intiter->first);
2733 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2734 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2735 intPrevValue = intiter->second;
2737 // Process properties.
2739 size_t intPropertyValueLen = PropertyValue.Len();
2741 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2743 PropertyValue.Trim();
2744 PropertyValue.RemoveLast();
2748 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2750 PropertyValue.Remove(0, 1);
2754 CaptureString(&PropertyValue, FALSE);
2756 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2757 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2758 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2759 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2761 if (PropertyMatched == TRUE){
2763 PropertyMatched = FALSE;
2768 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2772 // Add the data to the General/Home/Work address variables.
2774 CaptureString(&PropertySeg2, FALSE);
2776 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2778 if (!PropertyTokens.IsEmpty()){
2780 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2786 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2788 std::map<int, int> SplitPoints;
2789 std::map<int, int> SplitLength;
2790 std::map<int, int>::iterator SLiter;
2791 wxString PropertyData;
2792 wxString PropertyName;
2793 wxString PropertyValue;
2794 wxString PropertyTokens;
2795 bool FirstToken = TRUE;
2796 int intPrevValue = 7;
2798 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2802 PropertyType PropType = PROPERTY_NONE;
2804 // Look for type before continuing.
2806 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2808 // Setup the pointers.
2810 std::map<int, wxString> *TitleList = NULL;
2811 std::map<int, wxString> *TitleListAltID = NULL;
2812 std::map<int, wxString> *TitleListPID = NULL;
2813 std::map<int, wxString> *TitleListType = NULL;
2814 std::map<int, wxString> *TitleListTokens = NULL;
2815 std::map<int, wxString> *TitleListLanguage = NULL;
2816 std::map<int, int> *TitleListPref = NULL;
2818 // Setup blank lines for later on.
2822 TitleList = &GeneralTitleList;
2823 TitleListType = &GeneralTitleListType;
2824 TitleListAltID = &GeneralTitleListAltID;
2825 TitleListPID = &GeneralTitleListPID;
2826 TitleListTokens = &GeneralTitleListTokens;
2827 TitleListLanguage = &GeneralTitleListLanguage;
2828 TitleListPref = &GeneralTitleListPref;
2831 TitleList = &HomeTitleList;
2832 TitleListType = &HomeTitleListType;
2833 TitleListAltID = &HomeTitleListAltID;
2834 TitleListPID = &HomeTitleListPID;
2835 TitleListTokens = &HomeTitleListTokens;
2836 TitleListLanguage = &HomeTitleListLanguage;
2837 TitleListPref = &HomeTitleListPref;
2840 TitleList = &BusinessTitleList;
2841 TitleListType = &BusinessTitleListType;
2842 TitleListAltID = &BusinessTitleListAltID;
2843 TitleListPID = &BusinessTitleListPID;
2844 TitleListTokens = &BusinessTitleListTokens;
2845 TitleListLanguage = &BusinessTitleListLanguage;
2846 TitleListPref = &BusinessTitleListPref;
2851 bool PropertyMatched = FALSE;
2853 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2854 intiter != SplitPoints.end(); ++intiter){
2856 SLiter = SplitLength.find(intiter->first);
2857 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2858 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2859 intPrevValue = intiter->second;
2861 // Process properties.
2863 size_t intPropertyValueLen = PropertyValue.Len();
2865 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2867 PropertyValue.Trim();
2868 PropertyValue.RemoveLast();
2872 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2874 PropertyValue.Remove(0, 1);
2878 CaptureString(&PropertyValue, FALSE);
2880 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2881 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2882 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2883 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2885 if (PropertyMatched == TRUE){
2887 PropertyMatched = FALSE;
2892 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2896 // Add the data to the General/Home/Work address variables.
2898 CaptureString(&PropertySeg2, FALSE);
2900 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2902 if (!PropertyTokens.IsEmpty()){
2904 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2910 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2912 std::map<int, int> SplitPoints;
2913 std::map<int, int> SplitLength;
2914 std::map<int, int>::iterator SLiter;
2915 wxString PropertyData;
2916 wxString PropertyName;
2917 wxString PropertyValue;
2918 wxString PropertyTokens;
2919 bool FirstToken = TRUE;
2920 int intPrevValue = 6;
2922 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2926 PropertyType PropType = PROPERTY_NONE;
2928 // Look for type before continuing.
2930 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2932 // Setup the pointers.
2934 std::map<int, wxString> *RoleList = NULL;
2935 std::map<int, wxString> *RoleListAltID = NULL;
2936 std::map<int, wxString> *RoleListPID = NULL;
2937 std::map<int, wxString> *RoleListType = NULL;
2938 std::map<int, wxString> *RoleListTokens = NULL;
2939 std::map<int, wxString> *RoleListLanguage = NULL;
2940 std::map<int, int> *RoleListPref = NULL;
2942 // Setup blank lines for later on.
2946 RoleList = &GeneralRoleList;
2947 RoleListType = &GeneralRoleListType;
2948 RoleListAltID = &GeneralRoleListAltID;
2949 RoleListPID = &GeneralRoleListPID;
2950 RoleListTokens = &GeneralRoleListTokens;
2951 RoleListLanguage = &GeneralRoleListLanguage;
2952 RoleListPref = &GeneralRoleListPref;
2955 RoleList = &HomeRoleList;
2956 RoleListType = &HomeRoleListType;
2957 RoleListAltID = &HomeRoleListAltID;
2958 RoleListPID = &HomeRoleListPID;
2959 RoleListTokens = &HomeRoleListTokens;
2960 RoleListLanguage = &HomeRoleListLanguage;
2961 RoleListPref = &HomeRoleListPref;
2964 RoleList = &BusinessRoleList;
2965 RoleListType = &BusinessRoleListType;
2966 RoleListAltID = &BusinessRoleListAltID;
2967 RoleListPID = &BusinessRoleListPID;
2968 RoleListTokens = &BusinessRoleListTokens;
2969 RoleListLanguage = &BusinessRoleListLanguage;
2970 RoleListPref = &BusinessRoleListPref;
2975 bool PropertyMatched = FALSE;
2977 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2978 intiter != SplitPoints.end(); ++intiter){
2980 SLiter = SplitLength.find(intiter->first);
2981 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2982 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2983 intPrevValue = intiter->second;
2985 // Process properties.
2987 size_t intPropertyValueLen = PropertyValue.Len();
2989 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2991 PropertyValue.Trim();
2992 PropertyValue.RemoveLast();
2996 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2998 PropertyValue.Remove(0, 1);
3002 CaptureString(&PropertyValue, FALSE);
3004 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3005 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3006 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3007 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3009 if (PropertyMatched == TRUE){
3011 PropertyMatched = FALSE;
3016 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3020 // Add the data to the General/Home/Work address variables.
3022 CaptureString(&PropertySeg2, FALSE);
3024 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3026 if (!PropertyTokens.IsEmpty()){
3028 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3034 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3036 std::map<int, int> SplitPoints;
3037 std::map<int, int> SplitLength;
3038 std::map<int, int>::iterator SLiter;
3039 wxString PropertyData;
3040 wxString PropertyName;
3041 wxString PropertyValue;
3042 wxString PropertyTokens;
3043 bool FirstToken = TRUE;
3044 int intPrevValue = 5;
3046 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3050 PropertyType PropType = PROPERTY_NONE;
3052 // Look for type before continuing.
3054 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3056 // Setup the pointers.
3058 std::map<int, wxString> *OrganisationsList = NULL;
3059 std::map<int, wxString> *OrganisationsListAltID = NULL;
3060 std::map<int, wxString> *OrganisationsListPID = NULL;
3061 std::map<int, wxString> *OrganisationsListType = NULL;
3062 std::map<int, wxString> *OrganisationsListTokens = NULL;
3063 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3064 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3065 std::map<int, int> *OrganisationsListPref = NULL;
3067 // Setup blank lines for later on.
3071 OrganisationsList = &GeneralOrganisationsList;
3072 OrganisationsListType = &GeneralOrganisationsListType;
3073 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3074 OrganisationsListPID = &GeneralOrganisationsListPID;
3075 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3076 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3077 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3078 OrganisationsListPref = &GeneralOrganisationsListPref;
3081 OrganisationsList = &HomeOrganisationsList;
3082 OrganisationsListType = &HomeOrganisationsListType;
3083 OrganisationsListAltID = &HomeOrganisationsListAltID;
3084 OrganisationsListPID = &HomeOrganisationsListPID;
3085 OrganisationsListTokens = &HomeOrganisationsListTokens;
3086 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3087 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3088 OrganisationsListPref = &HomeOrganisationsListPref;
3091 OrganisationsList = &BusinessOrganisationsList;
3092 OrganisationsListType = &BusinessOrganisationsListType;
3093 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3094 OrganisationsListPID = &BusinessOrganisationsListPID;
3095 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3096 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3097 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3098 OrganisationsListPref = &BusinessOrganisationsListPref;
3103 bool PropertyMatched = FALSE;
3105 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3106 intiter != SplitPoints.end(); ++intiter){
3108 SLiter = SplitLength.find(intiter->first);
3109 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3110 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3111 intPrevValue = intiter->second;
3113 // Process properties.
3115 size_t intPropertyValueLen = PropertyValue.Len();
3117 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3119 PropertyValue.Trim();
3120 PropertyValue.RemoveLast();
3124 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3126 PropertyValue.Remove(0, 1);
3130 CaptureString(&PropertyValue, FALSE);
3132 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3133 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3134 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3135 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3136 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3138 if (PropertyMatched == TRUE){
3140 PropertyMatched = FALSE;
3145 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3149 // Add the data to the General/Home/Work address variables.
3151 CaptureString(&PropertySeg2, FALSE);
3153 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3155 if (!PropertyTokens.IsEmpty()){
3157 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3163 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3165 std::map<int, int> SplitPoints;
3166 std::map<int, int> SplitLength;
3167 std::map<int, int>::iterator SLiter;
3168 wxString PropertyData;
3169 wxString PropertyName;
3170 wxString PropertyValue;
3171 wxString PropertyTokens;
3172 bool FirstToken = TRUE;
3173 int intPrevValue = 6;
3175 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3179 PropertyType PropType = PROPERTY_NONE;
3181 // Look for type before continuing.
3183 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3185 // Setup the pointers.
3187 std::map<int, wxString> *NoteList = NULL;
3188 std::map<int, wxString> *NoteListAltID = NULL;
3189 std::map<int, wxString> *NoteListPID = NULL;
3190 std::map<int, wxString> *NoteListType = NULL;
3191 std::map<int, wxString> *NoteListTokens = NULL;
3192 std::map<int, wxString> *NoteListLanguage = NULL;
3193 std::map<int, int> *NoteListPref = NULL;
3195 // Setup blank lines for later on.
3199 NoteList = &GeneralNoteList;
3200 NoteListType = &GeneralNoteListType;
3201 NoteListAltID = &GeneralNoteListAltID;
3202 NoteListPID = &GeneralNoteListPID;
3203 NoteListTokens = &GeneralNoteListTokens;
3204 NoteListLanguage = &GeneralNoteListLanguage;
3205 NoteListPref = &GeneralNoteListPref;
3208 NoteList = &HomeNoteList;
3209 NoteListType = &HomeNoteListType;
3210 NoteListAltID = &HomeNoteListAltID;
3211 NoteListPID = &HomeNoteListPID;
3212 NoteListTokens = &HomeNoteListTokens;
3213 NoteListLanguage = &HomeNoteListLanguage;
3214 NoteListPref = &HomeNoteListPref;
3217 NoteList = &BusinessNoteList;
3218 NoteListType = &BusinessNoteListType;
3219 NoteListAltID = &BusinessNoteListAltID;
3220 NoteListPID = &BusinessNoteListPID;
3221 NoteListTokens = &BusinessNoteListTokens;
3222 NoteListLanguage = &BusinessNoteListLanguage;
3223 NoteListPref = &BusinessNoteListPref;
3228 bool PropertyMatched = FALSE;
3230 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3231 intiter != SplitPoints.end(); ++intiter){
3233 SLiter = SplitLength.find(intiter->first);
3234 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3235 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3236 intPrevValue = intiter->second;
3238 // Process properties.
3240 size_t intPropertyValueLen = PropertyValue.Len();
3242 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3244 PropertyValue.Trim();
3245 PropertyValue.RemoveLast();
3249 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3251 PropertyValue.Remove(0, 1);
3255 CaptureString(&PropertyValue, FALSE);
3257 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3258 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3259 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3260 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3262 if (PropertyMatched == TRUE){
3264 PropertyMatched = FALSE;
3269 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3273 // Add the data to the General/Home/Work address variables.
3275 CaptureString(&PropertySeg2, FALSE);
3277 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3279 if (!PropertyTokens.IsEmpty()){
3281 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3287 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3289 std::map<int, int> SplitPoints;
3290 std::map<int, int> SplitLength;
3291 std::map<int, int>::iterator SLiter;
3292 wxString PropertyData;
3293 wxString PropertyName;
3294 wxString PropertyValue;
3295 wxString PropertyTokens;
3296 bool FirstToken = TRUE;
3297 int intPrevValue = 12;
3299 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3303 PropertyType PropType = PROPERTY_NONE;
3305 // Look for type before continuing.
3307 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3309 // Setup blank lines for later on.
3315 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3318 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3323 bool PropertyMatched = FALSE;
3325 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3326 intiter != SplitPoints.end(); ++intiter){
3328 SLiter = SplitLength.find(intiter->first);
3329 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3330 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3331 intPrevValue = intiter->second;
3333 // Process properties.
3335 size_t intPropertyValueLen = PropertyValue.Len();
3337 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3339 PropertyValue.Trim();
3340 PropertyValue.RemoveLast();
3344 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3346 PropertyValue.Remove(0, 1);
3350 CaptureString(&PropertyValue, FALSE);
3352 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3353 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3354 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3355 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3357 if (PropertyMatched == TRUE){
3359 PropertyMatched = FALSE;
3364 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3368 // Deal with multiple categories.
3370 int intOrigCatCount = *CategoryCount;
3371 bool FirstCategoryProcessed = TRUE;
3372 bool AfterFirstToken = FALSE;
3373 int intSplitSize = 0;
3374 int intSplitsFound = 0;
3375 int intSplitSeek = 0;
3376 int intPropertyLen = PropertySeg2.Len();
3378 SplitPoints.clear();
3379 SplitLength.clear();
3382 for (int i = 0; i <= intPropertyLen; i++){
3384 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3392 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3394 if (AfterFirstToken == TRUE){
3396 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3397 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3401 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3402 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3403 AfterFirstToken = TRUE;
3415 if (SplitPoints.size() > 0){
3417 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3418 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3422 if (SplitPoints.size() == 0){
3424 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3426 if (!PropertyTokens.IsEmpty()){
3428 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3434 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3435 intiter != SplitPoints.end(); ++intiter){
3437 SLiter = SplitLength.find(intiter->first);
3439 intPrevValue = intiter->second;
3441 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3443 // Add the data to the General/Home/Work address variables.
3445 // Trim any whitespace from the start and end.
3447 PropertyData = PropertyData.Trim(FALSE);
3448 PropertyData = PropertyData.Trim(TRUE);
3450 CaptureString(&PropertyData, FALSE);
3452 if (FirstCategoryProcessed == TRUE){
3454 FirstCategoryProcessed = FALSE;
3456 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3458 if (!PropertyTokens.IsEmpty()){
3460 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3470 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3472 if (!PropertyTokens.IsEmpty()){
3474 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3480 // Copy the properties to each of the categories (if it exists).
3482 if (!PropertyTokens.IsEmpty()){
3484 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3488 // Check if ALTID was used.
3490 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3492 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3496 // Check if PID was used.
3498 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3500 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3504 // Check if PREF was used.
3506 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3508 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3512 // Check if LANGUAGE was used.
3514 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3516 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3520 // Check if TYPE was used.
3526 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3529 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3537 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3539 size_t intPropertyLen = PropertySeg1.Len();
3540 std::map<int, int> SplitPoints;
3541 std::map<int, int> SplitLength;
3542 std::map<int, int>::iterator SLiter;
3543 wxString PropertyData;
3544 wxString PropertyName;
3545 wxString PropertyValue;
3546 wxString PropertyTokens;
3547 bool FirstToken = TRUE;
3548 int intSplitsFound = 0;
3549 int intSplitSize = 0;
3550 int intPrevValue = 7;
3552 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3556 PropertyType PropType = PROPERTY_NONE;
3558 // Look for type before continuing.
3560 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3563 bool PropertyMatched = FALSE;
3565 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3566 intiter != SplitPoints.end(); ++intiter){
3568 SLiter = SplitLength.find(intiter->first);
3569 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3570 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3571 intPrevValue = intiter->second;
3573 // Process properties.
3575 size_t intPropertyValueLen = PropertyValue.Len();
3577 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3579 PropertyValue.Trim();
3580 PropertyValue.RemoveLast();
3584 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3586 PropertyValue.Remove(0, 1);
3590 CaptureString(&PropertyValue, FALSE);
3592 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3593 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3594 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3595 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3597 if (PropertyMatched == TRUE){
3599 PropertyMatched = FALSE;
3604 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3608 intPropertyLen = PropertySeg2.Len();
3609 SplitPoints.clear();
3610 SplitLength.clear();
3615 CaptureString(&PropertySeg2, FALSE);
3617 for (int i = 0; i <= intPropertyLen; i++){
3621 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3624 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3626 if (intSplitsFound == 6){
3628 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3633 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3643 wxString wxSPhotoURI;
3644 wxString wxSPhotoMIME;
3645 wxString wxSPhotoEncoding;
3646 wxString wxSPhotoData;
3647 std::string base64enc;
3649 if (intSplitsFound == 0){
3653 std::map<int, int>::iterator striter;
3655 striter = SplitLength.find(1);
3657 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3659 while (wSTDataType.HasMoreTokens() == TRUE){
3661 wxSPhotoURI = wSTDataType.GetNextToken();
3662 wxSPhotoMIME = wSTDataType.GetNextToken();
3667 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3669 while (wSTDataInfo.HasMoreTokens() == TRUE){
3671 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3672 wxSPhotoData = wSTDataInfo.GetNextToken();
3673 base64enc = wxSPhotoData.mb_str();
3680 // Add the data to the General/Home/Work address variables.
3682 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3683 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3684 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3690 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3693 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3697 if (!PropertyTokens.IsEmpty()){
3699 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3705 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3707 size_t intPropertyLen = PropertySeg1.Len();
3708 std::map<int, int> SplitPoints;
3709 std::map<int, int> SplitLength;
3710 std::map<int, int>::iterator SLiter;
3711 wxString PropertyData;
3712 wxString PropertyName;
3713 wxString PropertyValue;
3714 wxString PropertyTokens;
3715 bool FirstToken = TRUE;
3716 int intSplitsFound = 0;
3717 int intSplitSize = 0;
3718 int intPrevValue = 6;
3720 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3724 PropertyType PropType = PROPERTY_NONE;
3726 // Look for type before continuing.
3728 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3731 bool PropertyMatched = FALSE;
3733 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3734 intiter != SplitPoints.end(); ++intiter){
3736 SLiter = SplitLength.find(intiter->first);
3737 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3738 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3739 intPrevValue = intiter->second;
3741 // Process properties.
3743 size_t intPropertyValueLen = PropertyValue.Len();
3745 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3747 PropertyValue.Trim();
3748 PropertyValue.RemoveLast();
3752 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3754 PropertyValue.Remove(0, 1);
3758 CaptureString(&PropertyValue, FALSE);
3760 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3761 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3762 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3763 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3765 if (PropertyMatched == TRUE){
3767 PropertyMatched = FALSE;
3772 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3776 intPropertyLen = PropertySeg2.Len();
3777 SplitPoints.clear();
3778 SplitLength.clear();
3783 CaptureString(&PropertySeg2, FALSE);
3785 for (int i = 0; i <= intPropertyLen; i++){
3789 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3792 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3794 if (intSplitsFound == 6){
3796 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3801 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3811 wxString wxSPhotoURI;
3812 wxString wxSPhotoMIME;
3813 wxString wxSPhotoEncoding;
3814 wxString wxSPhotoData;
3815 std::string base64enc;
3817 if (intSplitsFound == 0){
3821 std::map<int, int>::iterator striter;
3823 striter = SplitLength.find(1);
3825 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3827 while (wSTDataType.HasMoreTokens() == TRUE){
3829 wxSPhotoURI = wSTDataType.GetNextToken();
3830 wxSPhotoMIME = wSTDataType.GetNextToken();
3835 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3837 while (wSTDataInfo.HasMoreTokens() == TRUE){
3839 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3840 wxSPhotoData = wSTDataInfo.GetNextToken();
3841 base64enc = wxSPhotoData.mb_str();
3848 // Add the data to the General/Home/Work address variables.
3850 LogosList.insert(std::make_pair(*LogoCount, base64enc));
3851 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3852 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3858 LogosListType.insert(std::make_pair(*LogoCount, "home"));
3861 LogosListType.insert(std::make_pair(*LogoCount, "work"));
3865 if (!PropertyTokens.IsEmpty()){
3867 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3873 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3875 size_t intPropertyLen = PropertySeg1.Len();
3876 std::map<int, int> SplitPoints;
3877 std::map<int, int> SplitLength;
3878 std::map<int, int>::iterator SLiter;
3879 wxString PropertyData;
3880 wxString PropertyName;
3881 wxString PropertyValue;
3882 wxString PropertyTokens;
3883 bool FirstToken = TRUE;
3884 int intSplitsFound = 0;
3885 int intSplitSize = 0;
3886 int intPrevValue = 7;
3888 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3892 PropertyType PropType = PROPERTY_NONE;
3894 // Look for type before continuing.
3896 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3899 bool PropertyMatched = FALSE;
3901 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3902 intiter != SplitPoints.end(); ++intiter){
3904 SLiter = SplitLength.find(intiter->first);
3905 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3906 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3907 intPrevValue = intiter->second;
3909 // Process properties.
3911 size_t intPropertyValueLen = PropertyValue.Len();
3913 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3915 PropertyValue.Trim();
3916 PropertyValue.RemoveLast();
3920 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3922 PropertyValue.Remove(0, 1);
3926 CaptureString(&PropertyValue, FALSE);
3928 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
3929 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
3930 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
3931 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
3932 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
3934 if (PropertyMatched == TRUE){
3936 PropertyMatched = FALSE;
3941 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3945 intPropertyLen = PropertySeg2.Len();
3946 SplitPoints.clear();
3947 SplitLength.clear();
3952 CaptureString(&PropertySeg2, FALSE);
3954 for (int i = 0; i <= intPropertyLen; i++){
3958 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3961 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3963 if (intSplitsFound == 6){
3965 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3970 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3980 wxString wxSSoundURI;
3981 wxString wxSSoundMIME;
3982 wxString wxSSoundEncoding;
3983 wxString wxSSoundData;
3984 std::string base64enc;
3986 if (intSplitsFound == 0){
3990 std::map<int, int>::iterator striter;
3992 striter = SplitLength.find(1);
3994 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3996 while (wSTDataType.HasMoreTokens() == TRUE){
3998 wxSSoundURI = wSTDataType.GetNextToken();
3999 wxSSoundMIME = wSTDataType.GetNextToken();
4004 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4006 while (wSTDataInfo.HasMoreTokens() == TRUE){
4008 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4009 wxSSoundData = wSTDataInfo.GetNextToken();
4010 base64enc = wxSSoundData.mb_str();
4017 // Add the data to the General/Home/Work address variables.
4023 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4026 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4030 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4031 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4032 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4034 if (!PropertyTokens.IsEmpty()){
4036 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4042 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4044 size_t intPropertyLen = PropertySeg1.Len();
4045 std::map<int, int> SplitPoints;
4046 std::map<int, int> SplitLength;
4047 std::map<int, int>::iterator SLiter;
4048 wxString PropertyData;
4049 wxString PropertyName;
4050 wxString PropertyValue;
4051 wxString PropertyTokens;
4052 bool FirstToken = TRUE;
4053 int intSplitsFound = 0;
4054 int intSplitSize = 0;
4055 int intPrevValue = 8;
4057 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4061 PropertyType PropType = PROPERTY_NONE;
4063 // Look for type before continuing.
4065 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4068 bool PropertyMatched = FALSE;
4070 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4071 intiter != SplitPoints.end(); ++intiter){
4073 SLiter = SplitLength.find(intiter->first);
4074 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4075 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4076 intPrevValue = intiter->second;
4078 // Process properties.
4080 size_t intPropertyValueLen = PropertyValue.Len();
4082 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4084 PropertyValue.Trim();
4085 PropertyValue.RemoveLast();
4089 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4091 PropertyValue.Remove(0, 1);
4095 CaptureString(&PropertyValue, FALSE);
4097 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4098 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4099 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4100 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4102 if (PropertyMatched == TRUE){
4104 PropertyMatched = FALSE;
4109 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4113 intPropertyLen = PropertySeg2.Len();
4114 SplitPoints.clear();
4115 SplitLength.clear();
4120 CaptureString(&PropertySeg2, FALSE);
4122 // Add the data to the General/Home/Work address variables.
4128 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4131 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4135 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4137 if (!PropertyTokens.IsEmpty()){
4139 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4145 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4147 size_t intPropertyLen = PropertySeg1.Len();
4148 std::map<int, int> SplitPoints;
4149 std::map<int, int> SplitLength;
4150 std::map<int, int>::iterator SLiter;
4151 wxString PropertyData;
4152 wxString PropertyName;
4153 wxString PropertyValue;
4154 wxString PropertyTokens;
4155 bool FirstToken = TRUE;
4156 int intSplitsFound = 0;
4157 int intSplitSize = 0;
4158 int intPrevValue = 8;
4160 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4164 PropertyType PropType = PROPERTY_NONE;
4166 // Look for type before continuing.
4168 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4171 bool PropertyMatched = FALSE;
4173 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4174 intiter != SplitPoints.end(); ++intiter){
4176 SLiter = SplitLength.find(intiter->first);
4177 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4178 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4179 intPrevValue = intiter->second;
4181 // Process properties.
4183 size_t intPropertyValueLen = PropertyValue.Len();
4185 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4187 PropertyValue.Trim();
4188 PropertyValue.RemoveLast();
4192 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4194 PropertyValue.Remove(0, 1);
4198 CaptureString(&PropertyValue, FALSE);
4200 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4201 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4202 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4203 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4205 if (PropertyMatched == TRUE){
4207 PropertyMatched = FALSE;
4212 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4216 intPropertyLen = PropertySeg2.Len();
4217 SplitPoints.clear();
4218 SplitLength.clear();
4223 CaptureString(&PropertySeg2, FALSE);
4225 // Add the data to the General/Home/Work address variables.
4231 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4234 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4238 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4240 if (!PropertyTokens.IsEmpty()){
4242 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4248 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4250 size_t intPropertyLen = PropertySeg1.Len();
4251 std::map<int, int> SplitPoints;
4252 std::map<int, int> SplitLength;
4253 std::map<int, int>::iterator SLiter;
4254 wxString PropertyData;
4255 wxString PropertyName;
4256 wxString PropertyValue;
4257 wxString PropertyTokens;
4258 bool FirstToken = TRUE;
4259 int intSplitsFound = 0;
4260 int intSplitSize = 0;
4261 int intPrevValue = 7;
4263 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4267 PropertyType PropType = PROPERTY_NONE;
4269 // Look for type before continuing.
4271 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4274 bool PropertyMatched = FALSE;
4276 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4277 intiter != SplitPoints.end(); ++intiter){
4279 SLiter = SplitLength.find(intiter->first);
4280 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4281 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4282 intPrevValue = intiter->second;
4284 // Process properties.
4286 size_t intPropertyValueLen = PropertyValue.Len();
4288 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4290 PropertyValue.Trim();
4291 PropertyValue.RemoveLast();
4295 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4297 PropertyValue.Remove(0, 1);
4301 CaptureString(&PropertyValue, FALSE);
4303 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4304 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4305 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4306 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4308 if (PropertyMatched == TRUE){
4310 PropertyMatched = FALSE;
4315 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4319 intPropertyLen = PropertySeg2.Len();
4320 SplitPoints.clear();
4321 SplitLength.clear();
4326 CaptureString(&PropertySeg2, FALSE);
4328 // Add the data to the General/Home/Work address variables.
4334 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4337 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4341 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4343 if (!PropertyTokens.IsEmpty()){
4345 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4351 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4353 size_t intPropertyLen = PropertySeg1.Len();
4354 std::map<int, int> SplitPoints;
4355 std::map<int, int> SplitLength;
4356 std::map<int, int>::iterator SLiter;
4357 wxString PropertyData;
4358 wxString PropertyName;
4359 wxString PropertyValue;
4360 wxString PropertyTokens;
4361 bool FirstToken = TRUE;
4362 int intSplitsFound = 0;
4363 int intSplitSize = 0;
4364 int intPrevValue = 5;
4366 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4370 PropertyType PropType = PROPERTY_NONE;
4372 // Look for type before continuing.
4374 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4377 bool PropertyMatched = FALSE;
4379 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4380 intiter != SplitPoints.end(); ++intiter){
4382 SLiter = SplitLength.find(intiter->first);
4383 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4384 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4385 intPrevValue = intiter->second;
4387 // Process properties.
4389 size_t intPropertyValueLen = PropertyValue.Len();
4391 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4393 PropertyValue.Trim();
4394 PropertyValue.RemoveLast();
4398 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4400 PropertyValue.Remove(0, 1);
4404 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4405 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4406 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4408 if (PropertyMatched == TRUE){
4410 PropertyMatched = FALSE;
4415 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4419 intPropertyLen = PropertySeg2.Len();
4420 SplitPoints.clear();
4421 SplitLength.clear();
4426 for (int i = 0; i <= intPropertyLen; i++){
4430 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4433 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4435 if (intSplitsFound == 6){
4437 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4442 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4453 wxString wxSKeyMIME;
4454 wxString wxSKeyEncoding;
4455 wxString wxSKeyData;
4456 std::string base64enc;
4458 if (intSplitsFound == 0){
4462 std::map<int, int>::iterator striter;
4464 striter = SplitLength.find(1);
4466 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4468 while (wSTDataType.HasMoreTokens() == TRUE){
4470 wxSKeyURI = wSTDataType.GetNextToken();
4471 wxSKeyMIME = wSTDataType.GetNextToken();
4476 if (wxSKeyURI == wxT("data")){
4478 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4480 while (wSTDataInfo.HasMoreTokens() == TRUE){
4482 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4483 wxSKeyData = wSTDataInfo.GetNextToken();
4492 // Add the data to the General/Home/Work address variables.
4494 if (wxSKeyURI == wxT("data")){
4496 KeyListDataEncType.erase(*KeyCount);
4497 KeyListKeyType.erase(*KeyCount);
4498 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4499 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4501 KeyList.erase(*KeyCount);
4502 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4506 KeyList.erase(*KeyCount);
4507 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4511 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4517 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4520 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4524 if (!PropertyTokens.IsEmpty()){
4526 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4532 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4534 // Split the Vendor three ways.
4536 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4539 wxString wxSVNDPropName;
4541 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4543 wSTVendorDetails.GetNextToken();
4544 wxSVNDID = wSTVendorDetails.GetNextToken();
4545 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4550 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4552 // Add the data to the vendor variables.
4554 VendorList.erase(*VendorCount);
4555 VendorListPEN.erase(*VendorCount);
4556 VendorListElement.erase(*VendorCount);
4558 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4559 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4560 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4566 void ContactDataObject::ClearData(){
4569 NameForename.clear();
4570 NameSurname.clear();
4571 NameOtherNames.clear();
4573 NameNickname.clear();
4574 NameDisplayAs.clear();
4575 NameLanguage.clear();
4580 BirthdayAltID.clear();
4581 BirthdayCalScale.clear();
4582 BirthdayTokens.clear();
4583 Anniversary.clear();
4584 AnniversaryAltID.clear();
4585 AnniversaryCalScale.clear();
4586 AnniversaryTokens.clear();
4589 GenderDetails.clear();
4590 GenderTokens.clear();
4594 RevisionTokens.clear();
4597 SourceListAltID.clear();
4598 SourceListPID.clear();
4599 SourceListType.clear();
4600 SourceListTokens.clear();
4601 SourceListMediatype.clear();
4602 SourceListPref.clear();
4605 XMLListAltID.clear();
4607 ClientPIDList.clear();
4608 ClientPIDListTokens.clear();
4610 FullNamesList.clear();
4611 FullNamesListType.clear();
4612 FullNamesListLanguage.clear();
4613 FullNamesListAltID.clear();
4614 FullNamesListPID.clear();
4615 FullNamesListTokens.clear();
4616 FullNamesListPref.clear();
4618 GeneralNicknamesList.clear();
4619 GeneralNicknamesListType.clear();
4620 GeneralNicknamesListLanguage.clear();
4621 GeneralNicknamesListAltID.clear();
4622 GeneralNicknamesListPID.clear();
4623 GeneralNicknamesListTokens.clear();
4624 GeneralNicknamesListPref.clear();
4626 GeneralAddressList.clear();
4627 GeneralAddressListTown.clear();
4628 GeneralAddressListCounty.clear();
4629 GeneralAddressListPostCode.clear();
4630 GeneralAddressListCountry.clear();
4631 GeneralAddressListLabel.clear();
4632 GeneralAddressListLang.clear();
4633 GeneralAddressListAltID.clear();
4634 GeneralAddressListPID.clear();
4635 GeneralAddressListTokens.clear();
4636 GeneralAddressListGeo.clear();
4637 GeneralAddressListTimezone.clear();
4638 GeneralAddressListType.clear();
4639 GeneralAddressListMediatype.clear();
4640 GeneralAddressListPref.clear();
4642 GeneralEmailList.clear();
4643 GeneralEmailListAltID.clear();
4644 GeneralEmailListPID.clear();
4645 GeneralEmailListType.clear();
4646 GeneralEmailListTokens.clear();
4647 GeneralEmailListPref.clear();
4649 GeneralIMList.clear();
4650 GeneralIMListAltID.clear();
4651 GeneralIMListPID.clear();
4652 GeneralIMListType.clear();
4653 GeneralIMListTypeInfo.clear();
4654 GeneralIMListTokens.clear();
4655 GeneralIMListMediatype.clear();
4656 GeneralIMListPref.clear();
4658 GeneralTelephoneList.clear();
4659 GeneralTelephoneListAltID.clear();
4660 GeneralTelephoneListPID.clear();
4661 GeneralTelephoneListType.clear();
4662 GeneralTelephoneListTokens.clear();
4663 GeneralTelephoneListTypeInfo.clear();
4664 GeneralTelephoneListPref.clear();
4666 GeneralLanguageList.clear();
4667 GeneralLanguageListAltID.clear();
4668 GeneralLanguageListPID.clear();
4669 GeneralLanguageListType.clear();
4670 GeneralLanguageListTokens.clear();
4671 GeneralLanguageListPref.clear();
4673 GeneralTZList.clear();
4674 GeneralTZListAltID.clear();
4675 GeneralTZListPID.clear();
4676 GeneralTZListType.clear();
4677 GeneralTZListTokens.clear();
4678 GeneralTZListMediatype.clear();
4679 GeneralTZListPref.clear();
4681 GeneralGeographyList.clear();
4682 GeneralGeographyListAltID.clear();
4683 GeneralGeographyListPID.clear();
4684 GeneralGeographyListType.clear();
4685 GeneralGeographyListTokens.clear();
4686 GeneralGeographyListMediatype.clear();
4687 GeneralGeographyListPref.clear();
4689 GeneralRelatedList.clear();
4690 GeneralRelatedListRelType.clear();
4691 GeneralRelatedListLanguage.clear();
4692 GeneralRelatedListAltID.clear();
4693 GeneralRelatedListPID.clear();
4694 GeneralRelatedListType.clear();
4695 GeneralRelatedListTokens.clear();
4696 GeneralRelatedListPref.clear();
4698 GeneralWebsiteList.clear();
4699 GeneralWebsiteListAltID.clear();
4700 GeneralWebsiteListPID.clear();
4701 GeneralWebsiteListType.clear();
4702 GeneralWebsiteListTokens.clear();
4703 GeneralWebsiteListMediatype.clear();
4704 GeneralWebsiteListPref.clear();
4706 GeneralTitleList.clear();
4707 GeneralTitleListLanguage.clear();
4708 GeneralTitleListAltID.clear();
4709 GeneralTitleListPID.clear();
4710 GeneralTitleListType.clear();
4711 GeneralTitleListTokens.clear();
4712 GeneralTitleListPref.clear();
4714 GeneralRoleList.clear();
4715 GeneralRoleListLanguage.clear();
4716 GeneralRoleListAltID.clear();
4717 GeneralRoleListPID.clear();
4718 GeneralRoleListType.clear();
4719 GeneralRoleListTokens.clear();
4720 GeneralRoleListPref.clear();
4722 GeneralOrganisationsList.clear();
4723 GeneralOrganisationsListLanguage.clear();
4724 GeneralOrganisationsListAltID.clear();
4725 GeneralOrganisationsListPID.clear();
4726 GeneralOrganisationsListType.clear();
4727 GeneralOrganisationsListTokens.clear();
4728 GeneralOrganisationsListSortAs.clear();
4729 GeneralOrganisationsListPref.clear();
4731 GeneralNoteList.clear();
4732 GeneralNoteListLanguage.clear();
4733 GeneralNoteListAltID.clear();
4734 GeneralNoteListPID.clear();
4735 GeneralNoteListType.clear();
4736 GeneralNoteListTokens.clear();
4737 GeneralNoteListPref.clear();
4739 /* Items on Home Tab */
4741 HomeNicknamesList.clear();
4742 HomeNicknamesListType.clear();
4743 HomeNicknamesListLanguage.clear();
4744 HomeNicknamesListAltID.clear();
4745 HomeNicknamesListPID.clear();
4746 HomeNicknamesListTokens.clear();
4747 HomeNicknamesListPref.clear();
4749 HomeAddressList.clear();
4750 HomeAddressListTown.clear();
4751 HomeAddressListCounty.clear();
4752 HomeAddressListPostCode.clear();
4753 HomeAddressListCountry.clear();
4754 HomeAddressListLabel.clear();
4755 HomeAddressListLang.clear();
4756 HomeAddressListAltID.clear();
4757 HomeAddressListPID.clear();
4758 HomeAddressListTokens.clear();
4759 HomeAddressListGeo.clear();
4760 HomeAddressListTimezone.clear();
4761 HomeAddressListType.clear();
4762 HomeAddressListMediatype.clear();
4763 HomeAddressListPref.clear();
4765 HomeEmailList.clear();
4766 HomeEmailListAltID.clear();
4767 HomeEmailListPID.clear();
4768 HomeEmailListType.clear();
4769 HomeEmailListTokens.clear();
4770 HomeEmailListPref.clear();
4773 HomeIMListAltID.clear();
4774 HomeIMListPID.clear();
4775 HomeIMListType.clear();
4776 HomeIMListTypeInfo.clear();
4777 HomeIMListTokens.clear();
4778 HomeIMListMediatype.clear();
4779 HomeIMListPref.clear();
4781 HomeTelephoneList.clear();
4782 HomeTelephoneListAltID.clear();
4783 HomeTelephoneListPID.clear();
4784 HomeTelephoneListType.clear();
4785 HomeTelephoneListTokens.clear();
4786 HomeTelephoneListTypeInfo.clear();
4787 HomeTelephoneListPref.clear();
4789 HomeLanguageList.clear();
4790 HomeLanguageListAltID.clear();
4791 HomeLanguageListPID.clear();
4792 HomeLanguageListType.clear();
4793 HomeLanguageListTokens.clear();
4794 HomeLanguageListPref.clear();
4797 HomeTZListAltID.clear();
4798 HomeTZListPID.clear();
4799 HomeTZListType.clear();
4800 HomeTZListTokens.clear();
4801 HomeTZListMediatype.clear();
4802 HomeTZListPref.clear();
4804 HomeGeographyList.clear();
4805 HomeGeographyListAltID.clear();
4806 HomeGeographyListPID.clear();
4807 HomeGeographyListType.clear();
4808 HomeGeographyListTokens.clear();
4809 HomeGeographyListMediatype.clear();
4810 HomeGeographyListPref.clear();
4812 HomeWebsiteList.clear();
4813 HomeWebsiteListAltID.clear();
4814 HomeWebsiteListPID.clear();
4815 HomeWebsiteListType.clear();
4816 HomeWebsiteListTokens.clear();
4817 HomeWebsiteListMediatype.clear();
4818 HomeWebsiteListPref.clear();
4820 HomeTitleList.clear();
4821 HomeTitleListLanguage.clear();
4822 HomeTitleListAltID.clear();
4823 HomeTitleListPID.clear();
4824 HomeTitleListType.clear();
4825 HomeTitleListTokens.clear();
4826 HomeTitleListPref.clear();
4828 HomeRoleList.clear();
4829 HomeRoleListLanguage.clear();
4830 HomeRoleListAltID.clear();
4831 HomeRoleListPID.clear();
4832 HomeRoleListType.clear();
4833 HomeRoleListTokens.clear();
4834 HomeRoleListPref.clear();
4836 HomeOrganisationsList.clear();
4837 HomeOrganisationsListLanguage.clear();
4838 HomeOrganisationsListAltID.clear();
4839 HomeOrganisationsListPID.clear();
4840 HomeOrganisationsListType.clear();
4841 HomeOrganisationsListTokens.clear();
4842 HomeOrganisationsListSortAs.clear();
4843 HomeOrganisationsListPref.clear();
4845 HomeNoteList.clear();
4846 HomeNoteListLanguage.clear();
4847 HomeNoteListAltID.clear();
4848 HomeNoteListPID.clear();
4849 HomeNoteListType.clear();
4850 HomeNoteListTokens.clear();
4851 HomeNoteListPref.clear();
4853 /* Items on the Business tab */
4855 BusinessNicknamesList.clear();
4856 BusinessNicknamesListType.clear();
4857 BusinessNicknamesListLanguage.clear();
4858 BusinessNicknamesListAltID.clear();
4859 BusinessNicknamesListPID.clear();
4860 BusinessNicknamesListTokens.clear();
4861 BusinessNicknamesListPref.clear();
4863 BusinessAddressList.clear();
4864 BusinessAddressListTown.clear();
4865 BusinessAddressListCounty.clear();
4866 BusinessAddressListPostCode.clear();
4867 BusinessAddressListCountry.clear();
4868 BusinessAddressListLabel.clear();
4869 BusinessAddressListLang.clear();
4870 BusinessAddressListAltID.clear();
4871 BusinessAddressListPID.clear();
4872 BusinessAddressListTokens.clear();
4873 BusinessAddressListGeo.clear();
4874 BusinessAddressListTimezone.clear();
4875 BusinessAddressListType.clear();
4876 BusinessAddressListMediatype.clear();
4877 BusinessAddressListPref.clear();
4879 BusinessEmailList.clear();
4880 BusinessEmailListAltID.clear();
4881 BusinessEmailListPID.clear();
4882 BusinessEmailListType.clear();
4883 BusinessEmailListTokens.clear();
4884 BusinessEmailListPref.clear();
4886 BusinessIMList.clear();
4887 BusinessIMListAltID.clear();
4888 BusinessIMListPID.clear();
4889 BusinessIMListType.clear();
4890 BusinessIMListTokens.clear();
4891 BusinessIMListMediatype.clear();
4892 BusinessIMListPref.clear();
4894 BusinessTelephoneList.clear();
4895 BusinessTelephoneListAltID.clear();
4896 BusinessTelephoneListPID.clear();
4897 BusinessTelephoneListType.clear();
4898 BusinessTelephoneListTokens.clear();
4899 BusinessTelephoneListPref.clear();
4901 BusinessLanguageList.clear();
4902 BusinessLanguageListAltID.clear();
4903 BusinessLanguageListPID.clear();
4904 BusinessLanguageListType.clear();
4905 BusinessLanguageListTokens.clear();
4906 BusinessLanguageListPref.clear();
4908 BusinessTZList.clear();
4909 BusinessTZListAltID.clear();
4910 BusinessTZListPID.clear();
4911 BusinessTZListType.clear();
4912 BusinessTZListTokens.clear();
4913 BusinessTZListMediatype.clear();
4914 BusinessTZListPref.clear();
4916 BusinessGeographyList.clear();
4917 BusinessGeographyListAltID.clear();
4918 BusinessGeographyListPID.clear();
4919 BusinessGeographyListType.clear();
4920 BusinessGeographyListTokens.clear();
4921 BusinessGeographyListMediatype.clear();
4922 BusinessGeographyListPref.clear();
4924 BusinessWebsiteList.clear();
4925 BusinessWebsiteListAltID.clear();
4926 BusinessWebsiteListPID.clear();
4927 BusinessWebsiteListType.clear();
4928 BusinessWebsiteListTokens.clear();
4929 BusinessWebsiteListMediatype.clear();
4930 BusinessWebsiteListPref.clear();
4932 BusinessTitleList.clear();
4933 BusinessTitleListLanguage.clear();
4934 BusinessTitleListAltID.clear();
4935 BusinessTitleListPID.clear();
4936 BusinessTitleListType.clear();
4937 BusinessTitleListTokens.clear();
4938 BusinessTitleListPref.clear();
4940 BusinessRoleList.clear();
4941 BusinessRoleListLanguage.clear();
4942 BusinessRoleListAltID.clear();
4943 BusinessRoleListPID.clear();
4944 BusinessRoleListType.clear();
4945 BusinessRoleListTokens.clear();
4946 BusinessRoleListPref.clear();
4948 BusinessOrganisationsList.clear();
4949 BusinessOrganisationsListLanguage.clear();
4950 BusinessOrganisationsListAltID.clear();
4951 BusinessOrganisationsListPID.clear();
4952 BusinessOrganisationsListType.clear();
4953 BusinessOrganisationsListTokens.clear();
4954 BusinessOrganisationsListSortAs.clear();
4955 BusinessOrganisationsListPref.clear();
4957 BusinessNoteList.clear();
4958 BusinessNoteListLanguage.clear();
4959 BusinessNoteListAltID.clear();
4960 BusinessNoteListPID.clear();
4961 BusinessNoteListType.clear();
4962 BusinessNoteListTokens.clear();
4963 BusinessNoteListPref.clear();
4965 /* Items on the Categories tab */
4967 CategoriesList.clear();
4968 CategoriesListAltID.clear();
4969 CategoriesListPID.clear();
4970 CategoriesListType.clear();
4971 CategoriesListTokens.clear();
4972 CategoriesListLanguage.clear();
4973 CategoriesListPref.clear();
4975 /* Items on the Groups tab */
4978 GroupsListAltID.clear();
4979 GroupsListPID.clear();
4980 GroupsListType.clear();
4981 GroupsListMediaType.clear();
4982 GroupsListTokens.clear();
4983 GroupsListPref.clear();
4985 /* Items on the Pictures tab */
4987 PicturesList.clear();
4988 PicturesListAltID.clear();
4989 PicturesListPID.clear();
4990 PicturesListType.clear();
4991 PicturesListPicEncType.clear();
4992 PicturesListPictureType.clear();
4993 PicturesListTokens.clear();
4994 PicturesListMediatype.clear();
4995 PicturesListPref.clear();
4997 /* Items on the Logos tab */
5000 LogosListAltID.clear();
5001 LogosListPID.clear();
5002 LogosListType.clear();
5003 LogosListPicEncType.clear();
5004 LogosListPictureType.clear();
5005 LogosListTokens.clear();
5006 LogosListMediatype.clear();
5007 LogosListPref.clear();
5009 /* Items on the Sounds tab */
5012 SoundsListAltID.clear();
5013 SoundsListPID.clear();
5014 SoundsListType.clear();
5015 SoundsListAudioEncType.clear();
5016 SoundsListAudioType.clear();
5017 SoundsListTokens.clear();
5018 SoundsListMediatype.clear();
5019 SoundsListPref.clear();
5021 /* Items on the Calendaring tab */
5023 CalendarList.clear();
5024 CalendarListAltID.clear();
5025 CalendarListPID.clear();
5026 CalendarListType.clear();
5027 CalendarListTokens.clear();
5028 CalendarListMediatype.clear();
5029 CalendarListPref.clear();
5031 CalendarRequestList.clear();
5032 CalendarRequestListAltID.clear();
5033 CalendarRequestListPID.clear();
5034 CalendarRequestListType.clear();
5035 CalendarRequestListTokens.clear();
5036 CalendarRequestListMediatype.clear();
5037 CalendarRequestListPref.clear();
5039 FreeBusyList.clear();
5040 FreeBusyListAltID.clear();
5041 FreeBusyListPID.clear();
5042 FreeBusyListType.clear();
5043 FreeBusyListTokens.clear();
5044 FreeBusyListMediatype.clear();
5045 FreeBusyListPref.clear();
5047 /* Items on the Security tab */
5050 KeyListAltID.clear();
5052 KeyListKeyType.clear();
5053 KeyListDataType.clear();
5054 KeyListDataEncType.clear();
5055 KeyListType.clear();
5056 KeyListTokens.clear();
5057 KeyListPref.clear();
5059 /* Items on the Other tab */
5062 VendorListPEN.clear();
5063 VendorListElement.clear();
5066 XTokenListTokens.clear();
5070 void ProcessNameValue(wxString *PropertyData,
5071 wxString *PropertyName,
5072 wxString *PropertyValue){
5074 wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
5075 *PropertyName = PropertyElement.GetNextToken();
5076 *PropertyValue = PropertyElement.GetNextToken();
5080 void ProcessTokens(wxString *PropertyName,
5081 wxString *PropertyValue,
5082 wxString *PropertyTokens,
5085 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5087 if (*FirstToken == TRUE){
5089 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5090 *FirstToken = FALSE;
5094 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5102 void ProcessStringValue(wxString *PropertyName,
5103 wxString PropertyNameMatch,
5104 std::map<int,wxString> *MapPtr,
5105 wxString *PropertyValue,
5107 bool *PropertyMatched){
5109 if (*PropertyName == PropertyNameMatch){
5110 MapPtr->erase(*ItemCount);
5111 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5112 *PropertyMatched = TRUE;
5117 void ProcessIntegerValue(wxString *PropertyName,
5118 wxString PropertyNameMatch,
5119 std::map<int,int> *PrefPtr,
5120 wxString *PropertyValue,
5122 bool *PropertyMatched){
5124 if (*PropertyName == PropertyNameMatch){
5125 *PropertyMatched = TRUE;
5130 int PriorityNumber = 0;
5131 bool ValidNumber = TRUE;
5134 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5137 catch(std::invalid_argument &e){
5138 ValidNumber = FALSE;
5141 if (ValidNumber == TRUE){
5143 PrefPtr->erase(*ItemCount);
5144 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5150 void SplitValues(wxString *PropertyLine,
5151 std::map<int,int> *SplitPoints,
5152 std::map<int,int> *SplitLength,
5155 size_t intPropertyLen = PropertyLine->Len();
5156 int intSplitsFound = 0;
5157 int intSplitSize = 0;
5158 int intSplitSeek = 0;
5160 for (int i = intSize; i <= intPropertyLen; i++){
5164 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5165 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5167 if (intSplitsFound == 0){
5169 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5173 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5177 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5187 if (intSplitsFound == 0){
5189 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5190 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5194 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5195 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5201 void CheckType(wxString *PropertySeg1,
5202 std::map<int,int> *SplitPoints,
5203 std::map<int,int> *SplitLength,
5205 PropertyType *PropType){
5207 wxString PropertyData;
5208 wxString PropertyName;
5209 wxString PropertyValue;
5210 std::map<int,int>::iterator SLiter;
5212 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5213 intiter != SplitPoints->end(); ++intiter){
5215 SLiter = SplitLength->find(intiter->first);
5216 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5217 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
5218 *intPrevValue = intiter->second;
5220 if (PropertyName == wxT("TYPE")){
5222 if (PropertyValue == wxT("work")){
5224 *PropType = PROPERTY_WORK;
5226 } else if (PropertyValue == wxT("home")){
5228 *PropType = PROPERTY_HOME;
5232 *PropType = PROPERTY_NONE;