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;
2085 bool TypeFound = FALSE;
2087 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2088 typeiter != TypeSplitPoints.end(); ++typeiter){
2090 wxString TypePropertyName;
2092 TSLiter = TypeSplitLength.find(typeiter->first);
2094 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2096 if (intTypeSeek == 0){
2101 TelTypeUI.Append(wxT(","));
2105 if (TypePropertyName == wxT("home") && TypeFound == FALSE){
2107 PropType = PROPERTY_HOME;
2108 TelTypeUI.Append("home");
2112 } else if (TypePropertyName == wxT("work") && TypeFound == FALSE){
2114 PropType = PROPERTY_WORK;
2115 TelTypeUI.Append("work");
2121 if (TypePropertyName == wxT("text")){
2123 TelTypeUI.Append(_("text"));
2126 } else if (TypePropertyName == wxT("voice")){
2128 TelTypeUI.Append(_("voice"));
2131 } else if (TypePropertyName == wxT("fax")){
2133 TelTypeUI.Append(_("fax"));
2136 } else if (TypePropertyName == wxT("cell")){
2138 TelTypeUI.Append(_("cell"));
2141 } else if (TypePropertyName == wxT("video")){
2143 TelTypeUI.Append(_("video"));
2146 } else if (TypePropertyName == wxT("pager")){
2148 TelTypeUI.Append(_("pager"));
2151 } else if (TypePropertyName == wxT("textphone")){
2153 TelTypeUI.Append(_("textphone"));
2164 std::map<int, wxString> *TelephoneList = NULL;
2165 std::map<int, wxString> *TelephoneListType = NULL;
2166 std::map<int, wxString> *TelephoneListAltID = NULL;
2167 std::map<int, wxString> *TelephoneListPID = NULL;
2168 std::map<int, wxString> *TelephoneListTokens = NULL;
2169 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2170 std::map<int, wxString> *TelephoneListDataType = NULL;
2171 std::map<int, int> *TelephoneListPref = NULL;
2175 TelephoneList = &GeneralTelephoneList;
2176 TelephoneListType = &GeneralTelephoneListType;
2177 TelephoneListAltID = &GeneralTelephoneListAltID;
2178 TelephoneListPID = &GeneralTelephoneListPID;
2179 TelephoneListTokens = &GeneralTelephoneListTokens;
2180 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2181 TelephoneListDataType = &GeneralTelephoneListDataType;
2182 TelephoneListPref = &GeneralTelephoneListPref;
2185 TelephoneList = &HomeTelephoneList;
2186 TelephoneListType = &HomeTelephoneListType;
2187 TelephoneListAltID = &HomeTelephoneListAltID;
2188 TelephoneListPID = &HomeTelephoneListPID;
2189 TelephoneListTokens = &HomeTelephoneListTokens;
2190 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2191 TelephoneListDataType = &HomeTelephoneListDataType;
2192 TelephoneListPref = &HomeTelephoneListPref;
2195 TelephoneList = &BusinessTelephoneList;
2196 TelephoneListType = &BusinessTelephoneListType;
2197 TelephoneListAltID = &BusinessTelephoneListAltID;
2198 TelephoneListPID = &BusinessTelephoneListPID;
2199 TelephoneListTokens = &BusinessTelephoneListTokens;
2200 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2201 TelephoneListDataType = &BusinessTelephoneListDataType;
2202 TelephoneListPref = &BusinessTelephoneListPref;
2206 // Process the properties.
2208 bool FirstToken = TRUE;
2211 SplitPoints.clear();
2212 SplitLength.clear();
2214 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2218 bool PropertyMatched = FALSE;
2220 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2221 intiter != SplitPoints.end(); ++intiter){
2223 SLiter = SplitLength.find(intiter->first);
2224 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2225 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2226 intPrevValue = intiter->second;
2228 CaptureString(&PropertyValue, FALSE);
2230 // Process properties.
2232 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2233 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2234 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2236 if (PropertyMatched == TRUE){
2238 PropertyMatched = FALSE;
2243 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2247 // Check for the type information and split it down.
2249 wxStringTokenizer TelSplitData(PropertySeg2, wxT(":"));
2251 if (TelSplitData.CountTokens() > 1){
2253 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, TelSplitData.GetNextToken()));
2254 TelephoneList->insert(std::make_pair(*TelephoneCount, TelSplitData.GetString()));
2258 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2259 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, "tel"));
2263 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2265 // Add the name token data.
2267 if (!PropertyTokens.IsEmpty()){
2269 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2275 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2277 std::map<int, int> SplitPoints;
2278 std::map<int, int> SplitLength;
2280 int intPrevValue = 6;
2282 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2286 PropertyType PropType = PROPERTY_NONE;
2288 // Look for type before continuing.
2290 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2292 std::map<int, wxString> *LanguageList = NULL;
2293 std::map<int, wxString> *LanguageListType = NULL;
2294 std::map<int, wxString> *LanguageListAltID = NULL;
2295 std::map<int, wxString> *LanguageListPID = NULL;
2296 std::map<int, wxString> *LanguageListTokens = NULL;
2297 std::map<int, int> *LanguageListPref = NULL;
2301 LanguageList = &GeneralLanguageList;
2302 LanguageListType = &GeneralLanguageListType;
2303 LanguageListAltID = &GeneralLanguageListAltID;
2304 LanguageListPID = &GeneralLanguageListPID;
2305 LanguageListTokens = &GeneralLanguageListTokens;
2306 LanguageListPref = &GeneralLanguageListPref;
2309 LanguageList = &HomeLanguageList;
2310 LanguageListType = &HomeLanguageListType;
2311 LanguageListAltID = &HomeLanguageListAltID;
2312 LanguageListPID = &HomeLanguageListPID;
2313 LanguageListTokens = &HomeLanguageListTokens;
2314 LanguageListPref = &HomeLanguageListPref;
2317 LanguageList = &BusinessLanguageList;
2318 LanguageListType = &BusinessLanguageListType;
2319 LanguageListAltID = &BusinessLanguageListAltID;
2320 LanguageListPID = &BusinessLanguageListPID;
2321 LanguageListTokens = &BusinessLanguageListTokens;
2322 LanguageListPref = &BusinessLanguageListPref;
2328 std::map<int,int>::iterator SLiter;
2329 wxString PropertyData;
2330 wxString PropertyName;
2331 wxString PropertyValue;
2332 wxString PropertyTokens;
2333 bool FirstToken = TRUE;
2334 bool PropertyMatched = FALSE;
2336 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2337 intiter != SplitPoints.end(); ++intiter){
2339 SLiter = SplitLength.find(intiter->first);
2340 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2341 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2342 intPrevValue = intiter->second;
2344 CaptureString(&PropertyValue, FALSE);
2346 // Process properties.
2348 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2349 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2350 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2352 if (PropertyMatched == TRUE){
2354 PropertyMatched = FALSE;
2359 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2363 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2365 // Add the name token data.
2367 if (!PropertyTokens.IsEmpty()){
2369 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2375 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2377 std::map<int, int> SplitPoints;
2378 std::map<int, int> SplitLength;
2380 int intPrevValue = 5;
2382 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2386 PropertyType PropType = PROPERTY_NONE;
2388 // Look for type before continuing.
2390 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2392 std::map<int, wxString> *GeopositionList = NULL;
2393 std::map<int, wxString> *GeopositionListType = NULL;
2394 std::map<int, wxString> *GeopositionListAltID = NULL;
2395 std::map<int, wxString> *GeopositionListPID = NULL;
2396 std::map<int, wxString> *GeopositionListTokens = NULL;
2397 std::map<int, wxString> *GeopositionListMediatype = NULL;
2398 std::map<int, wxString> *GeopositionListDataType = NULL;
2399 std::map<int, int> *GeopositionListPref = NULL;
2403 GeopositionList = &GeneralGeographyList;
2404 GeopositionListType = &GeneralGeographyListType;
2405 GeopositionListAltID = &GeneralGeographyListAltID;
2406 GeopositionListPID = &GeneralGeographyListPID;
2407 GeopositionListTokens = &GeneralGeographyListTokens;
2408 GeopositionListMediatype = &GeneralGeographyListMediatype;
2409 GeopositionListDataType = &GeneralGeographyListDataType;
2410 GeopositionListPref = &GeneralGeographyListPref;
2413 GeopositionList = &HomeGeographyList;
2414 GeopositionListType = &HomeGeographyListType;
2415 GeopositionListAltID = &HomeGeographyListAltID;
2416 GeopositionListPID = &HomeGeographyListPID;
2417 GeopositionListTokens = &HomeGeographyListTokens;
2418 GeopositionListMediatype = &HomeGeographyListMediatype;
2419 GeopositionListDataType = &HomeGeographyListDataType;
2420 GeopositionListPref = &HomeGeographyListPref;
2423 GeopositionList = &BusinessGeographyList;
2424 GeopositionListType = &BusinessGeographyListType;
2425 GeopositionListAltID = &BusinessGeographyListAltID;
2426 GeopositionListPID = &BusinessGeographyListPID;
2427 GeopositionListTokens = &BusinessGeographyListTokens;
2428 GeopositionListMediatype = &BusinessGeographyListMediatype;
2429 GeopositionListDataType = &BusinessGeographyListDataType;
2430 GeopositionListPref = &BusinessGeographyListPref;
2436 std::map<int,int>::iterator SLiter;
2437 wxString PropertyData;
2438 wxString PropertyName;
2439 wxString PropertyValue;
2440 wxString PropertyTokens;
2441 bool FirstToken = TRUE;
2442 bool PropertyMatched = FALSE;
2444 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2445 intiter != SplitPoints.end(); ++intiter){
2447 SLiter = SplitLength.find(intiter->first);
2448 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2449 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2450 intPrevValue = intiter->second;
2452 CaptureString(&PropertyValue, FALSE);
2454 // Process properties.
2456 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2457 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2458 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2459 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2461 if (PropertyMatched == TRUE){
2463 PropertyMatched = FALSE;
2468 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2472 wxStringTokenizer GeoSplitData(PropertySeg2, wxT(":"));
2474 if (GeoSplitData.CountTokens() > 1){
2476 GeopositionListDataType->insert(std::make_pair(*GeographicCount, GeoSplitData.GetNextToken()));
2477 GeopositionList->insert(std::make_pair(*GeographicCount, GeoSplitData.GetString()));
2481 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2482 GeopositionListDataType->insert(std::make_pair(*GeographicCount, "tel"));
2486 // Add the name token data.
2488 if (!PropertyTokens.IsEmpty()){
2490 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2496 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2498 size_t intPropertyLen = PropertySeg1.Len();
2499 std::map<int, int> SplitPoints;
2500 std::map<int, int> SplitLength;
2501 std::map<int, int>::iterator SLiter;
2502 wxString PropertyData;
2503 wxString PropertyName;
2504 wxString PropertyValue;
2505 wxString PropertyTokens;
2506 wxString RelatedType;
2507 wxString RelatedTypeOriginal;
2508 wxString RelatedName;
2509 bool FirstToken = TRUE;
2510 int intSplitsFound = 0;
2511 int intSplitSize = 0;
2512 int intPrevValue = 9;
2514 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2518 // Look for type before continuing.
2520 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2521 intiter != SplitPoints.end(); ++intiter){
2523 SLiter = SplitLength.find(intiter->first);
2524 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2525 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2526 intPrevValue = intiter->second;
2530 RelatedTypeOriginal = PropertyValue;
2532 if (PropertyName == wxT("TYPE")){
2534 if (PropertyValue == wxT("contact")){
2536 RelatedType = _("Contact");
2538 } else if (PropertyValue == wxT("acquaintance")){
2540 RelatedType = _("Acquaintance");
2542 } else if (PropertyValue == wxT("friend")){
2544 RelatedType = _("Friend");
2546 } else if (PropertyValue == wxT("met")){
2548 RelatedType = _("Met");
2550 } else if (PropertyValue == wxT("co-worker")){
2552 RelatedType = _("Co-worker");
2554 } else if (PropertyValue == wxT("colleague")){
2556 RelatedType = _("Colleague");
2558 } else if (PropertyValue == wxT("co-resident")){
2560 RelatedType = _("Co-resident");
2562 } else if (PropertyValue == wxT("neighbor")){
2564 RelatedType = _("Neighbour");
2566 } else if (PropertyValue == wxT("child")){
2568 RelatedType = _("Child");
2570 } else if (PropertyValue == wxT("parent")){
2572 RelatedType = _("Parent");
2574 } else if (PropertyValue == wxT("sibling")){
2576 RelatedType = _("Sibling");
2578 } else if (PropertyValue == wxT("spouse")){
2580 RelatedType = _("Spouse");
2582 } else if (PropertyValue == wxT("kin")){
2584 RelatedType = _("Kin");
2586 } else if (PropertyValue == wxT("muse")){
2588 RelatedType = _("Muse");
2590 } else if (PropertyValue == wxT("crush")){
2592 RelatedType = _("Crush");
2594 } else if (PropertyValue == wxT("date")){
2596 RelatedType = _("Date");
2598 } else if (PropertyValue == wxT("sweetheart")){
2600 RelatedType = _("Sweetheart");
2602 } else if (PropertyValue == wxT("me")){
2604 RelatedType = _("Me");
2606 } else if (PropertyValue == wxT("agent")){
2608 RelatedType = _("Agent");
2610 } else if (PropertyValue == wxT("emergency")){
2612 RelatedType = _("Emergency");
2616 RelatedType = PropertyValue;
2626 bool PropertyMatched = FALSE;
2628 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2629 intiter != SplitPoints.end(); ++intiter){
2631 SLiter = SplitLength.find(intiter->first);
2632 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2633 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2634 intPrevValue = intiter->second;
2636 // Process properties.
2638 size_t intPropertyValueLen = PropertyValue.Len();
2640 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2642 PropertyValue.Trim();
2643 PropertyValue.RemoveLast();
2647 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2649 PropertyValue.Remove(0, 1);
2653 CaptureString(&PropertyValue, FALSE);
2655 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2656 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2657 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2658 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2660 if (PropertyMatched == TRUE){
2662 PropertyMatched = FALSE;
2667 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2671 // Add the data to the General/Home/Work address variables.
2673 GeneralRelatedList.erase(*RelatedCount);
2674 GeneralRelatedListRelType.erase(*RelatedCount);
2675 GeneralRelatedListType.erase(*RelatedCount);
2676 GeneralRelatedListTokens.erase(*RelatedCount);
2677 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2678 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2679 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2680 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2684 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2686 std::map<int, int> SplitPoints;
2687 std::map<int, int> SplitLength;
2688 std::map<int, int>::iterator SLiter;
2689 wxString PropertyData;
2690 wxString PropertyName;
2691 wxString PropertyValue;
2692 wxString PropertyTokens;
2693 bool FirstToken = TRUE;
2694 int intPrevValue = 5;
2696 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2700 PropertyType PropType = PROPERTY_NONE;
2702 // Look for type before continuing.
2704 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2706 // Setup the pointers.
2708 std::map<int, wxString> *WebsiteList = NULL;
2709 std::map<int, wxString> *WebsiteListAltID = NULL;
2710 std::map<int, wxString> *WebsiteListPID = NULL;
2711 std::map<int, wxString> *WebsiteListType = NULL;
2712 std::map<int, wxString> *WebsiteListTokens = NULL;
2713 std::map<int, wxString> *WebsiteListMediatype = NULL;
2714 std::map<int, int> *WebsiteListPref = NULL;
2716 // Setup blank lines for later on.
2720 WebsiteList = &GeneralWebsiteList;
2721 WebsiteListType = &GeneralWebsiteListType;
2722 WebsiteListAltID = &GeneralWebsiteListAltID;
2723 WebsiteListPID = &GeneralWebsiteListPID;
2724 WebsiteListTokens = &GeneralWebsiteListTokens;
2725 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2726 WebsiteListPref = &GeneralWebsiteListPref;
2729 WebsiteList = &HomeWebsiteList;
2730 WebsiteListType = &HomeWebsiteListType;
2731 WebsiteListAltID = &HomeWebsiteListAltID;
2732 WebsiteListPID = &HomeWebsiteListPID;
2733 WebsiteListTokens = &HomeWebsiteListTokens;
2734 WebsiteListMediatype = &HomeWebsiteListMediatype;
2735 WebsiteListPref = &HomeWebsiteListPref;
2738 WebsiteList = &BusinessWebsiteList;
2739 WebsiteListType = &BusinessWebsiteListType;
2740 WebsiteListAltID = &BusinessWebsiteListAltID;
2741 WebsiteListPID = &BusinessWebsiteListPID;
2742 WebsiteListTokens = &BusinessWebsiteListTokens;
2743 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2744 WebsiteListPref = &BusinessWebsiteListPref;
2749 bool PropertyMatched = FALSE;
2751 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2752 intiter != SplitPoints.end(); ++intiter){
2754 SLiter = SplitLength.find(intiter->first);
2755 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2756 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2757 intPrevValue = intiter->second;
2759 // Process properties.
2761 size_t intPropertyValueLen = PropertyValue.Len();
2763 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2765 PropertyValue.Trim();
2766 PropertyValue.RemoveLast();
2770 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2772 PropertyValue.Remove(0, 1);
2776 CaptureString(&PropertyValue, FALSE);
2778 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2779 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2780 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2781 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2783 if (PropertyMatched == TRUE){
2785 PropertyMatched = FALSE;
2790 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2794 // Add the data to the General/Home/Work address variables.
2796 CaptureString(&PropertySeg2, FALSE);
2798 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2800 if (!PropertyTokens.IsEmpty()){
2802 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2808 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2810 std::map<int, int> SplitPoints;
2811 std::map<int, int> SplitLength;
2812 std::map<int, int>::iterator SLiter;
2813 wxString PropertyData;
2814 wxString PropertyName;
2815 wxString PropertyValue;
2816 wxString PropertyTokens;
2817 bool FirstToken = TRUE;
2818 int intPrevValue = 7;
2820 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2824 PropertyType PropType = PROPERTY_NONE;
2826 // Look for type before continuing.
2828 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2830 // Setup the pointers.
2832 std::map<int, wxString> *TitleList = NULL;
2833 std::map<int, wxString> *TitleListAltID = NULL;
2834 std::map<int, wxString> *TitleListPID = NULL;
2835 std::map<int, wxString> *TitleListType = NULL;
2836 std::map<int, wxString> *TitleListTokens = NULL;
2837 std::map<int, wxString> *TitleListLanguage = NULL;
2838 std::map<int, int> *TitleListPref = NULL;
2840 // Setup blank lines for later on.
2844 TitleList = &GeneralTitleList;
2845 TitleListType = &GeneralTitleListType;
2846 TitleListAltID = &GeneralTitleListAltID;
2847 TitleListPID = &GeneralTitleListPID;
2848 TitleListTokens = &GeneralTitleListTokens;
2849 TitleListLanguage = &GeneralTitleListLanguage;
2850 TitleListPref = &GeneralTitleListPref;
2853 TitleList = &HomeTitleList;
2854 TitleListType = &HomeTitleListType;
2855 TitleListAltID = &HomeTitleListAltID;
2856 TitleListPID = &HomeTitleListPID;
2857 TitleListTokens = &HomeTitleListTokens;
2858 TitleListLanguage = &HomeTitleListLanguage;
2859 TitleListPref = &HomeTitleListPref;
2862 TitleList = &BusinessTitleList;
2863 TitleListType = &BusinessTitleListType;
2864 TitleListAltID = &BusinessTitleListAltID;
2865 TitleListPID = &BusinessTitleListPID;
2866 TitleListTokens = &BusinessTitleListTokens;
2867 TitleListLanguage = &BusinessTitleListLanguage;
2868 TitleListPref = &BusinessTitleListPref;
2873 bool PropertyMatched = FALSE;
2875 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2876 intiter != SplitPoints.end(); ++intiter){
2878 SLiter = SplitLength.find(intiter->first);
2879 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2880 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2881 intPrevValue = intiter->second;
2883 // Process properties.
2885 size_t intPropertyValueLen = PropertyValue.Len();
2887 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2889 PropertyValue.Trim();
2890 PropertyValue.RemoveLast();
2894 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2896 PropertyValue.Remove(0, 1);
2900 CaptureString(&PropertyValue, FALSE);
2902 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2903 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2904 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2905 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2907 if (PropertyMatched == TRUE){
2909 PropertyMatched = FALSE;
2914 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2918 // Add the data to the General/Home/Work address variables.
2920 CaptureString(&PropertySeg2, FALSE);
2922 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2924 if (!PropertyTokens.IsEmpty()){
2926 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2932 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2934 std::map<int, int> SplitPoints;
2935 std::map<int, int> SplitLength;
2936 std::map<int, int>::iterator SLiter;
2937 wxString PropertyData;
2938 wxString PropertyName;
2939 wxString PropertyValue;
2940 wxString PropertyTokens;
2941 bool FirstToken = TRUE;
2942 int intPrevValue = 6;
2944 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2948 PropertyType PropType = PROPERTY_NONE;
2950 // Look for type before continuing.
2952 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2954 // Setup the pointers.
2956 std::map<int, wxString> *RoleList = NULL;
2957 std::map<int, wxString> *RoleListAltID = NULL;
2958 std::map<int, wxString> *RoleListPID = NULL;
2959 std::map<int, wxString> *RoleListType = NULL;
2960 std::map<int, wxString> *RoleListTokens = NULL;
2961 std::map<int, wxString> *RoleListLanguage = NULL;
2962 std::map<int, int> *RoleListPref = NULL;
2964 // Setup blank lines for later on.
2968 RoleList = &GeneralRoleList;
2969 RoleListType = &GeneralRoleListType;
2970 RoleListAltID = &GeneralRoleListAltID;
2971 RoleListPID = &GeneralRoleListPID;
2972 RoleListTokens = &GeneralRoleListTokens;
2973 RoleListLanguage = &GeneralRoleListLanguage;
2974 RoleListPref = &GeneralRoleListPref;
2977 RoleList = &HomeRoleList;
2978 RoleListType = &HomeRoleListType;
2979 RoleListAltID = &HomeRoleListAltID;
2980 RoleListPID = &HomeRoleListPID;
2981 RoleListTokens = &HomeRoleListTokens;
2982 RoleListLanguage = &HomeRoleListLanguage;
2983 RoleListPref = &HomeRoleListPref;
2986 RoleList = &BusinessRoleList;
2987 RoleListType = &BusinessRoleListType;
2988 RoleListAltID = &BusinessRoleListAltID;
2989 RoleListPID = &BusinessRoleListPID;
2990 RoleListTokens = &BusinessRoleListTokens;
2991 RoleListLanguage = &BusinessRoleListLanguage;
2992 RoleListPref = &BusinessRoleListPref;
2997 bool PropertyMatched = FALSE;
2999 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3000 intiter != SplitPoints.end(); ++intiter){
3002 SLiter = SplitLength.find(intiter->first);
3003 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3004 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3005 intPrevValue = intiter->second;
3007 // Process properties.
3009 size_t intPropertyValueLen = PropertyValue.Len();
3011 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3013 PropertyValue.Trim();
3014 PropertyValue.RemoveLast();
3018 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3020 PropertyValue.Remove(0, 1);
3024 CaptureString(&PropertyValue, FALSE);
3026 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3027 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3028 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3029 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3031 if (PropertyMatched == TRUE){
3033 PropertyMatched = FALSE;
3038 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3042 // Add the data to the General/Home/Work address variables.
3044 CaptureString(&PropertySeg2, FALSE);
3046 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3048 if (!PropertyTokens.IsEmpty()){
3050 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3056 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3058 std::map<int, int> SplitPoints;
3059 std::map<int, int> SplitLength;
3060 std::map<int, int>::iterator SLiter;
3061 wxString PropertyData;
3062 wxString PropertyName;
3063 wxString PropertyValue;
3064 wxString PropertyTokens;
3065 bool FirstToken = TRUE;
3066 int intPrevValue = 5;
3068 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3072 PropertyType PropType = PROPERTY_NONE;
3074 // Look for type before continuing.
3076 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3078 // Setup the pointers.
3080 std::map<int, wxString> *OrganisationsList = NULL;
3081 std::map<int, wxString> *OrganisationsListAltID = NULL;
3082 std::map<int, wxString> *OrganisationsListPID = NULL;
3083 std::map<int, wxString> *OrganisationsListType = NULL;
3084 std::map<int, wxString> *OrganisationsListTokens = NULL;
3085 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3086 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3087 std::map<int, int> *OrganisationsListPref = NULL;
3089 // Setup blank lines for later on.
3093 OrganisationsList = &GeneralOrganisationsList;
3094 OrganisationsListType = &GeneralOrganisationsListType;
3095 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3096 OrganisationsListPID = &GeneralOrganisationsListPID;
3097 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3098 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3099 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3100 OrganisationsListPref = &GeneralOrganisationsListPref;
3103 OrganisationsList = &HomeOrganisationsList;
3104 OrganisationsListType = &HomeOrganisationsListType;
3105 OrganisationsListAltID = &HomeOrganisationsListAltID;
3106 OrganisationsListPID = &HomeOrganisationsListPID;
3107 OrganisationsListTokens = &HomeOrganisationsListTokens;
3108 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3109 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3110 OrganisationsListPref = &HomeOrganisationsListPref;
3113 OrganisationsList = &BusinessOrganisationsList;
3114 OrganisationsListType = &BusinessOrganisationsListType;
3115 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3116 OrganisationsListPID = &BusinessOrganisationsListPID;
3117 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3118 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3119 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3120 OrganisationsListPref = &BusinessOrganisationsListPref;
3125 bool PropertyMatched = FALSE;
3127 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3128 intiter != SplitPoints.end(); ++intiter){
3130 SLiter = SplitLength.find(intiter->first);
3131 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3132 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3133 intPrevValue = intiter->second;
3135 // Process properties.
3137 size_t intPropertyValueLen = PropertyValue.Len();
3139 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3141 PropertyValue.Trim();
3142 PropertyValue.RemoveLast();
3146 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3148 PropertyValue.Remove(0, 1);
3152 CaptureString(&PropertyValue, FALSE);
3154 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3155 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3156 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3157 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3158 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3160 if (PropertyMatched == TRUE){
3162 PropertyMatched = FALSE;
3167 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3171 // Add the data to the General/Home/Work address variables.
3173 CaptureString(&PropertySeg2, FALSE);
3175 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3177 if (!PropertyTokens.IsEmpty()){
3179 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3185 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3187 std::map<int, int> SplitPoints;
3188 std::map<int, int> SplitLength;
3189 std::map<int, int>::iterator SLiter;
3190 wxString PropertyData;
3191 wxString PropertyName;
3192 wxString PropertyValue;
3193 wxString PropertyTokens;
3194 bool FirstToken = TRUE;
3195 int intPrevValue = 6;
3197 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3201 PropertyType PropType = PROPERTY_NONE;
3203 // Look for type before continuing.
3205 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3207 // Setup the pointers.
3209 std::map<int, wxString> *NoteList = NULL;
3210 std::map<int, wxString> *NoteListAltID = NULL;
3211 std::map<int, wxString> *NoteListPID = NULL;
3212 std::map<int, wxString> *NoteListType = NULL;
3213 std::map<int, wxString> *NoteListTokens = NULL;
3214 std::map<int, wxString> *NoteListLanguage = NULL;
3215 std::map<int, int> *NoteListPref = NULL;
3217 // Setup blank lines for later on.
3221 NoteList = &GeneralNoteList;
3222 NoteListType = &GeneralNoteListType;
3223 NoteListAltID = &GeneralNoteListAltID;
3224 NoteListPID = &GeneralNoteListPID;
3225 NoteListTokens = &GeneralNoteListTokens;
3226 NoteListLanguage = &GeneralNoteListLanguage;
3227 NoteListPref = &GeneralNoteListPref;
3230 NoteList = &HomeNoteList;
3231 NoteListType = &HomeNoteListType;
3232 NoteListAltID = &HomeNoteListAltID;
3233 NoteListPID = &HomeNoteListPID;
3234 NoteListTokens = &HomeNoteListTokens;
3235 NoteListLanguage = &HomeNoteListLanguage;
3236 NoteListPref = &HomeNoteListPref;
3239 NoteList = &BusinessNoteList;
3240 NoteListType = &BusinessNoteListType;
3241 NoteListAltID = &BusinessNoteListAltID;
3242 NoteListPID = &BusinessNoteListPID;
3243 NoteListTokens = &BusinessNoteListTokens;
3244 NoteListLanguage = &BusinessNoteListLanguage;
3245 NoteListPref = &BusinessNoteListPref;
3250 bool PropertyMatched = FALSE;
3252 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3253 intiter != SplitPoints.end(); ++intiter){
3255 SLiter = SplitLength.find(intiter->first);
3256 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3257 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3258 intPrevValue = intiter->second;
3260 // Process properties.
3262 size_t intPropertyValueLen = PropertyValue.Len();
3264 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3266 PropertyValue.Trim();
3267 PropertyValue.RemoveLast();
3271 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3273 PropertyValue.Remove(0, 1);
3277 CaptureString(&PropertyValue, FALSE);
3279 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3280 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3281 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3282 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3284 if (PropertyMatched == TRUE){
3286 PropertyMatched = FALSE;
3291 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3295 // Add the data to the General/Home/Work address variables.
3297 CaptureString(&PropertySeg2, FALSE);
3299 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3301 if (!PropertyTokens.IsEmpty()){
3303 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3309 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3311 std::map<int, int> SplitPoints;
3312 std::map<int, int> SplitLength;
3313 std::map<int, int>::iterator SLiter;
3314 wxString PropertyData;
3315 wxString PropertyName;
3316 wxString PropertyValue;
3317 wxString PropertyTokens;
3318 bool FirstToken = TRUE;
3319 int intPrevValue = 12;
3321 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3325 PropertyType PropType = PROPERTY_NONE;
3327 // Look for type before continuing.
3329 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3331 // Setup blank lines for later on.
3337 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3340 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3345 bool PropertyMatched = FALSE;
3347 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3348 intiter != SplitPoints.end(); ++intiter){
3350 SLiter = SplitLength.find(intiter->first);
3351 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3352 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3353 intPrevValue = intiter->second;
3355 // Process properties.
3357 size_t intPropertyValueLen = PropertyValue.Len();
3359 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3361 PropertyValue.Trim();
3362 PropertyValue.RemoveLast();
3366 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3368 PropertyValue.Remove(0, 1);
3372 CaptureString(&PropertyValue, FALSE);
3374 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3375 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3376 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3377 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3379 if (PropertyMatched == TRUE){
3381 PropertyMatched = FALSE;
3386 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3390 // Deal with multiple categories.
3392 int intOrigCatCount = *CategoryCount;
3393 bool FirstCategoryProcessed = TRUE;
3394 bool AfterFirstToken = FALSE;
3395 int intSplitSize = 0;
3396 int intSplitsFound = 0;
3397 int intSplitSeek = 0;
3398 int intPropertyLen = PropertySeg2.Len();
3400 SplitPoints.clear();
3401 SplitLength.clear();
3404 for (int i = 0; i <= intPropertyLen; i++){
3406 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3414 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3416 if (AfterFirstToken == TRUE){
3418 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3419 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3423 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3424 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3425 AfterFirstToken = TRUE;
3437 if (SplitPoints.size() > 0){
3439 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3440 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3444 if (SplitPoints.size() == 0){
3446 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3448 if (!PropertyTokens.IsEmpty()){
3450 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3456 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3457 intiter != SplitPoints.end(); ++intiter){
3459 SLiter = SplitLength.find(intiter->first);
3461 intPrevValue = intiter->second;
3463 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3465 // Add the data to the General/Home/Work address variables.
3467 // Trim any whitespace from the start and end.
3469 PropertyData = PropertyData.Trim(FALSE);
3470 PropertyData = PropertyData.Trim(TRUE);
3472 CaptureString(&PropertyData, FALSE);
3474 if (FirstCategoryProcessed == TRUE){
3476 FirstCategoryProcessed = FALSE;
3478 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3480 if (!PropertyTokens.IsEmpty()){
3482 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3492 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3494 if (!PropertyTokens.IsEmpty()){
3496 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3502 // Copy the properties to each of the categories (if it exists).
3504 if (!PropertyTokens.IsEmpty()){
3506 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3510 // Check if ALTID was used.
3512 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3514 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3518 // Check if PID was used.
3520 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3522 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3526 // Check if PREF was used.
3528 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3530 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3534 // Check if LANGUAGE was used.
3536 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3538 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3542 // Check if TYPE was used.
3548 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3551 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3559 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3561 size_t intPropertyLen = PropertySeg1.Len();
3562 std::map<int, int> SplitPoints;
3563 std::map<int, int> SplitLength;
3564 std::map<int, int>::iterator SLiter;
3565 wxString PropertyData;
3566 wxString PropertyName;
3567 wxString PropertyValue;
3568 wxString PropertyTokens;
3569 bool FirstToken = TRUE;
3570 int intSplitsFound = 0;
3571 int intSplitSize = 0;
3572 int intPrevValue = 7;
3574 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3578 PropertyType PropType = PROPERTY_NONE;
3580 // Look for type before continuing.
3582 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3585 bool PropertyMatched = FALSE;
3587 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3588 intiter != SplitPoints.end(); ++intiter){
3590 SLiter = SplitLength.find(intiter->first);
3591 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3592 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3593 intPrevValue = intiter->second;
3595 // Process properties.
3597 size_t intPropertyValueLen = PropertyValue.Len();
3599 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3601 PropertyValue.Trim();
3602 PropertyValue.RemoveLast();
3606 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3608 PropertyValue.Remove(0, 1);
3612 CaptureString(&PropertyValue, FALSE);
3614 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3615 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3616 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3617 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3619 if (PropertyMatched == TRUE){
3621 PropertyMatched = FALSE;
3626 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3630 intPropertyLen = PropertySeg2.Len();
3631 SplitPoints.clear();
3632 SplitLength.clear();
3637 CaptureString(&PropertySeg2, FALSE);
3639 for (int i = 0; i <= intPropertyLen; i++){
3643 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3646 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3648 if (intSplitsFound == 6){
3650 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3655 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3665 wxString wxSPhotoURI;
3666 wxString wxSPhotoMIME;
3667 wxString wxSPhotoEncoding;
3668 wxString wxSPhotoData;
3669 std::string base64enc;
3671 if (intSplitsFound == 0){
3675 std::map<int, int>::iterator striter;
3677 striter = SplitLength.find(1);
3679 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3681 while (wSTDataType.HasMoreTokens() == TRUE){
3683 wxSPhotoURI = wSTDataType.GetNextToken();
3684 wxSPhotoMIME = wSTDataType.GetNextToken();
3689 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3691 while (wSTDataInfo.HasMoreTokens() == TRUE){
3693 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3694 wxSPhotoData = wSTDataInfo.GetNextToken();
3695 base64enc = wxSPhotoData.mb_str();
3702 // Add the data to the General/Home/Work address variables.
3704 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3705 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3706 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3712 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3715 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3719 if (!PropertyTokens.IsEmpty()){
3721 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3727 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3729 size_t intPropertyLen = PropertySeg1.Len();
3730 std::map<int, int> SplitPoints;
3731 std::map<int, int> SplitLength;
3732 std::map<int, int>::iterator SLiter;
3733 wxString PropertyData;
3734 wxString PropertyName;
3735 wxString PropertyValue;
3736 wxString PropertyTokens;
3737 bool FirstToken = TRUE;
3738 int intSplitsFound = 0;
3739 int intSplitSize = 0;
3740 int intPrevValue = 6;
3742 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3746 PropertyType PropType = PROPERTY_NONE;
3748 // Look for type before continuing.
3750 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3753 bool PropertyMatched = FALSE;
3755 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3756 intiter != SplitPoints.end(); ++intiter){
3758 SLiter = SplitLength.find(intiter->first);
3759 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3760 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3761 intPrevValue = intiter->second;
3763 // Process properties.
3765 size_t intPropertyValueLen = PropertyValue.Len();
3767 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3769 PropertyValue.Trim();
3770 PropertyValue.RemoveLast();
3774 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3776 PropertyValue.Remove(0, 1);
3780 CaptureString(&PropertyValue, FALSE);
3782 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3783 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3784 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3785 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3787 if (PropertyMatched == TRUE){
3789 PropertyMatched = FALSE;
3794 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3798 intPropertyLen = PropertySeg2.Len();
3799 SplitPoints.clear();
3800 SplitLength.clear();
3805 CaptureString(&PropertySeg2, FALSE);
3807 for (int i = 0; i <= intPropertyLen; i++){
3811 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3814 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3816 if (intSplitsFound == 6){
3818 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3823 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3833 wxString wxSPhotoURI;
3834 wxString wxSPhotoMIME;
3835 wxString wxSPhotoEncoding;
3836 wxString wxSPhotoData;
3837 std::string base64enc;
3839 if (intSplitsFound == 0){
3843 std::map<int, int>::iterator striter;
3845 striter = SplitLength.find(1);
3847 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3849 while (wSTDataType.HasMoreTokens() == TRUE){
3851 wxSPhotoURI = wSTDataType.GetNextToken();
3852 wxSPhotoMIME = wSTDataType.GetNextToken();
3857 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3859 while (wSTDataInfo.HasMoreTokens() == TRUE){
3861 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3862 wxSPhotoData = wSTDataInfo.GetNextToken();
3863 base64enc = wxSPhotoData.mb_str();
3870 // Add the data to the General/Home/Work address variables.
3872 LogosList.insert(std::make_pair(*LogoCount, base64enc));
3873 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3874 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3880 LogosListType.insert(std::make_pair(*LogoCount, "home"));
3883 LogosListType.insert(std::make_pair(*LogoCount, "work"));
3887 if (!PropertyTokens.IsEmpty()){
3889 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3895 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3897 size_t intPropertyLen = PropertySeg1.Len();
3898 std::map<int, int> SplitPoints;
3899 std::map<int, int> SplitLength;
3900 std::map<int, int>::iterator SLiter;
3901 wxString PropertyData;
3902 wxString PropertyName;
3903 wxString PropertyValue;
3904 wxString PropertyTokens;
3905 bool FirstToken = TRUE;
3906 int intSplitsFound = 0;
3907 int intSplitSize = 0;
3908 int intPrevValue = 7;
3910 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3914 PropertyType PropType = PROPERTY_NONE;
3916 // Look for type before continuing.
3918 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3921 bool PropertyMatched = FALSE;
3923 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3924 intiter != SplitPoints.end(); ++intiter){
3926 SLiter = SplitLength.find(intiter->first);
3927 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3928 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3929 intPrevValue = intiter->second;
3931 // Process properties.
3933 size_t intPropertyValueLen = PropertyValue.Len();
3935 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3937 PropertyValue.Trim();
3938 PropertyValue.RemoveLast();
3942 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3944 PropertyValue.Remove(0, 1);
3948 CaptureString(&PropertyValue, FALSE);
3950 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
3951 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
3952 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
3953 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
3954 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
3956 if (PropertyMatched == TRUE){
3958 PropertyMatched = FALSE;
3963 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3967 intPropertyLen = PropertySeg2.Len();
3968 SplitPoints.clear();
3969 SplitLength.clear();
3974 CaptureString(&PropertySeg2, FALSE);
3976 for (int i = 0; i <= intPropertyLen; i++){
3980 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3983 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3985 if (intSplitsFound == 6){
3987 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3992 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4002 wxString wxSSoundURI;
4003 wxString wxSSoundMIME;
4004 wxString wxSSoundEncoding;
4005 wxString wxSSoundData;
4006 std::string base64enc;
4008 if (intSplitsFound == 0){
4012 std::map<int, int>::iterator striter;
4014 striter = SplitLength.find(1);
4016 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4018 while (wSTDataType.HasMoreTokens() == TRUE){
4020 wxSSoundURI = wSTDataType.GetNextToken();
4021 wxSSoundMIME = wSTDataType.GetNextToken();
4026 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4028 while (wSTDataInfo.HasMoreTokens() == TRUE){
4030 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4031 wxSSoundData = wSTDataInfo.GetNextToken();
4032 base64enc = wxSSoundData.mb_str();
4039 // Add the data to the General/Home/Work address variables.
4045 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4048 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4052 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4053 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4054 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4056 if (!PropertyTokens.IsEmpty()){
4058 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4064 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4066 size_t intPropertyLen = PropertySeg1.Len();
4067 std::map<int, int> SplitPoints;
4068 std::map<int, int> SplitLength;
4069 std::map<int, int>::iterator SLiter;
4070 wxString PropertyData;
4071 wxString PropertyName;
4072 wxString PropertyValue;
4073 wxString PropertyTokens;
4074 bool FirstToken = TRUE;
4075 int intSplitsFound = 0;
4076 int intSplitSize = 0;
4077 int intPrevValue = 8;
4079 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4083 PropertyType PropType = PROPERTY_NONE;
4085 // Look for type before continuing.
4087 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4090 bool PropertyMatched = FALSE;
4092 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4093 intiter != SplitPoints.end(); ++intiter){
4095 SLiter = SplitLength.find(intiter->first);
4096 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4097 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4098 intPrevValue = intiter->second;
4100 // Process properties.
4102 size_t intPropertyValueLen = PropertyValue.Len();
4104 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4106 PropertyValue.Trim();
4107 PropertyValue.RemoveLast();
4111 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4113 PropertyValue.Remove(0, 1);
4117 CaptureString(&PropertyValue, FALSE);
4119 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4120 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4121 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4122 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4124 if (PropertyMatched == TRUE){
4126 PropertyMatched = FALSE;
4131 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4135 intPropertyLen = PropertySeg2.Len();
4136 SplitPoints.clear();
4137 SplitLength.clear();
4142 CaptureString(&PropertySeg2, FALSE);
4144 // Add the data to the General/Home/Work address variables.
4150 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4153 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4157 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4159 if (!PropertyTokens.IsEmpty()){
4161 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4167 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4169 size_t intPropertyLen = PropertySeg1.Len();
4170 std::map<int, int> SplitPoints;
4171 std::map<int, int> SplitLength;
4172 std::map<int, int>::iterator SLiter;
4173 wxString PropertyData;
4174 wxString PropertyName;
4175 wxString PropertyValue;
4176 wxString PropertyTokens;
4177 bool FirstToken = TRUE;
4178 int intSplitsFound = 0;
4179 int intSplitSize = 0;
4180 int intPrevValue = 8;
4182 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4186 PropertyType PropType = PROPERTY_NONE;
4188 // Look for type before continuing.
4190 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4193 bool PropertyMatched = FALSE;
4195 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4196 intiter != SplitPoints.end(); ++intiter){
4198 SLiter = SplitLength.find(intiter->first);
4199 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4200 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4201 intPrevValue = intiter->second;
4203 // Process properties.
4205 size_t intPropertyValueLen = PropertyValue.Len();
4207 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4209 PropertyValue.Trim();
4210 PropertyValue.RemoveLast();
4214 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4216 PropertyValue.Remove(0, 1);
4220 CaptureString(&PropertyValue, FALSE);
4222 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4223 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4224 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4225 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4227 if (PropertyMatched == TRUE){
4229 PropertyMatched = FALSE;
4234 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4238 intPropertyLen = PropertySeg2.Len();
4239 SplitPoints.clear();
4240 SplitLength.clear();
4245 CaptureString(&PropertySeg2, FALSE);
4247 // Add the data to the General/Home/Work address variables.
4253 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4256 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4260 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4262 if (!PropertyTokens.IsEmpty()){
4264 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4270 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4272 size_t intPropertyLen = PropertySeg1.Len();
4273 std::map<int, int> SplitPoints;
4274 std::map<int, int> SplitLength;
4275 std::map<int, int>::iterator SLiter;
4276 wxString PropertyData;
4277 wxString PropertyName;
4278 wxString PropertyValue;
4279 wxString PropertyTokens;
4280 bool FirstToken = TRUE;
4281 int intSplitsFound = 0;
4282 int intSplitSize = 0;
4283 int intPrevValue = 7;
4285 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4289 PropertyType PropType = PROPERTY_NONE;
4291 // Look for type before continuing.
4293 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4296 bool PropertyMatched = FALSE;
4298 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4299 intiter != SplitPoints.end(); ++intiter){
4301 SLiter = SplitLength.find(intiter->first);
4302 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4303 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4304 intPrevValue = intiter->second;
4306 // Process properties.
4308 size_t intPropertyValueLen = PropertyValue.Len();
4310 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4312 PropertyValue.Trim();
4313 PropertyValue.RemoveLast();
4317 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4319 PropertyValue.Remove(0, 1);
4323 CaptureString(&PropertyValue, FALSE);
4325 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4326 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4327 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4328 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4330 if (PropertyMatched == TRUE){
4332 PropertyMatched = FALSE;
4337 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4341 intPropertyLen = PropertySeg2.Len();
4342 SplitPoints.clear();
4343 SplitLength.clear();
4348 CaptureString(&PropertySeg2, FALSE);
4350 // Add the data to the General/Home/Work address variables.
4356 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4359 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4363 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4365 if (!PropertyTokens.IsEmpty()){
4367 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4373 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4375 size_t intPropertyLen = PropertySeg1.Len();
4376 std::map<int, int> SplitPoints;
4377 std::map<int, int> SplitLength;
4378 std::map<int, int>::iterator SLiter;
4379 wxString PropertyData;
4380 wxString PropertyName;
4381 wxString PropertyValue;
4382 wxString PropertyTokens;
4383 bool FirstToken = TRUE;
4384 int intSplitsFound = 0;
4385 int intSplitSize = 0;
4386 int intPrevValue = 5;
4388 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4392 PropertyType PropType = PROPERTY_NONE;
4394 // Look for type before continuing.
4396 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4399 bool PropertyMatched = FALSE;
4401 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4402 intiter != SplitPoints.end(); ++intiter){
4404 SLiter = SplitLength.find(intiter->first);
4405 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4406 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4407 intPrevValue = intiter->second;
4409 // Process properties.
4411 size_t intPropertyValueLen = PropertyValue.Len();
4413 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4415 PropertyValue.Trim();
4416 PropertyValue.RemoveLast();
4420 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4422 PropertyValue.Remove(0, 1);
4426 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4427 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4428 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4430 if (PropertyMatched == TRUE){
4432 PropertyMatched = FALSE;
4437 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4441 intPropertyLen = PropertySeg2.Len();
4442 SplitPoints.clear();
4443 SplitLength.clear();
4448 for (int i = 0; i <= intPropertyLen; i++){
4452 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4455 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4457 if (intSplitsFound == 6){
4459 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4464 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4475 wxString wxSKeyMIME;
4476 wxString wxSKeyEncoding;
4477 wxString wxSKeyData;
4478 std::string base64enc;
4480 if (intSplitsFound == 0){
4484 std::map<int, int>::iterator striter;
4486 striter = SplitLength.find(1);
4488 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4490 while (wSTDataType.HasMoreTokens() == TRUE){
4492 wxSKeyURI = wSTDataType.GetNextToken();
4493 wxSKeyMIME = wSTDataType.GetNextToken();
4498 if (wxSKeyURI == wxT("data")){
4500 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4502 while (wSTDataInfo.HasMoreTokens() == TRUE){
4504 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4505 wxSKeyData = wSTDataInfo.GetNextToken();
4514 // Add the data to the General/Home/Work address variables.
4516 if (wxSKeyURI == wxT("data")){
4518 KeyListDataEncType.erase(*KeyCount);
4519 KeyListKeyType.erase(*KeyCount);
4520 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4521 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4523 KeyList.erase(*KeyCount);
4524 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4528 KeyList.erase(*KeyCount);
4529 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4533 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4539 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4542 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4546 if (!PropertyTokens.IsEmpty()){
4548 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4554 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4556 // Split the Vendor three ways.
4558 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4561 wxString wxSVNDPropName;
4563 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4565 wSTVendorDetails.GetNextToken();
4566 wxSVNDID = wSTVendorDetails.GetNextToken();
4567 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4572 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4574 // Add the data to the vendor variables.
4576 VendorList.erase(*VendorCount);
4577 VendorListPEN.erase(*VendorCount);
4578 VendorListElement.erase(*VendorCount);
4580 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4581 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4582 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4588 void ContactDataObject::ClearData(){
4591 NameForename.clear();
4592 NameSurname.clear();
4593 NameOtherNames.clear();
4595 NameNickname.clear();
4596 NameDisplayAs.clear();
4597 NameLanguage.clear();
4602 BirthdayAltID.clear();
4603 BirthdayCalScale.clear();
4604 BirthdayTokens.clear();
4605 Anniversary.clear();
4606 AnniversaryAltID.clear();
4607 AnniversaryCalScale.clear();
4608 AnniversaryTokens.clear();
4611 GenderDetails.clear();
4612 GenderTokens.clear();
4616 RevisionTokens.clear();
4619 SourceListAltID.clear();
4620 SourceListPID.clear();
4621 SourceListType.clear();
4622 SourceListTokens.clear();
4623 SourceListMediatype.clear();
4624 SourceListPref.clear();
4627 XMLListAltID.clear();
4629 ClientPIDList.clear();
4630 ClientPIDListTokens.clear();
4632 FullNamesList.clear();
4633 FullNamesListType.clear();
4634 FullNamesListLanguage.clear();
4635 FullNamesListAltID.clear();
4636 FullNamesListPID.clear();
4637 FullNamesListTokens.clear();
4638 FullNamesListPref.clear();
4640 GeneralNicknamesList.clear();
4641 GeneralNicknamesListType.clear();
4642 GeneralNicknamesListLanguage.clear();
4643 GeneralNicknamesListAltID.clear();
4644 GeneralNicknamesListPID.clear();
4645 GeneralNicknamesListTokens.clear();
4646 GeneralNicknamesListPref.clear();
4648 GeneralAddressList.clear();
4649 GeneralAddressListTown.clear();
4650 GeneralAddressListCounty.clear();
4651 GeneralAddressListPostCode.clear();
4652 GeneralAddressListCountry.clear();
4653 GeneralAddressListLabel.clear();
4654 GeneralAddressListLang.clear();
4655 GeneralAddressListAltID.clear();
4656 GeneralAddressListPID.clear();
4657 GeneralAddressListTokens.clear();
4658 GeneralAddressListGeo.clear();
4659 GeneralAddressListTimezone.clear();
4660 GeneralAddressListType.clear();
4661 GeneralAddressListMediatype.clear();
4662 GeneralAddressListPref.clear();
4664 GeneralEmailList.clear();
4665 GeneralEmailListAltID.clear();
4666 GeneralEmailListPID.clear();
4667 GeneralEmailListType.clear();
4668 GeneralEmailListTokens.clear();
4669 GeneralEmailListPref.clear();
4671 GeneralIMList.clear();
4672 GeneralIMListAltID.clear();
4673 GeneralIMListPID.clear();
4674 GeneralIMListType.clear();
4675 GeneralIMListTypeInfo.clear();
4676 GeneralIMListTokens.clear();
4677 GeneralIMListMediatype.clear();
4678 GeneralIMListPref.clear();
4680 GeneralTelephoneList.clear();
4681 GeneralTelephoneListAltID.clear();
4682 GeneralTelephoneListPID.clear();
4683 GeneralTelephoneListType.clear();
4684 GeneralTelephoneListTokens.clear();
4685 GeneralTelephoneListTypeInfo.clear();
4686 GeneralTelephoneListPref.clear();
4688 GeneralLanguageList.clear();
4689 GeneralLanguageListAltID.clear();
4690 GeneralLanguageListPID.clear();
4691 GeneralLanguageListType.clear();
4692 GeneralLanguageListTokens.clear();
4693 GeneralLanguageListPref.clear();
4695 GeneralTZList.clear();
4696 GeneralTZListAltID.clear();
4697 GeneralTZListPID.clear();
4698 GeneralTZListType.clear();
4699 GeneralTZListTokens.clear();
4700 GeneralTZListMediatype.clear();
4701 GeneralTZListPref.clear();
4703 GeneralGeographyList.clear();
4704 GeneralGeographyListAltID.clear();
4705 GeneralGeographyListPID.clear();
4706 GeneralGeographyListType.clear();
4707 GeneralGeographyListTokens.clear();
4708 GeneralGeographyListMediatype.clear();
4709 GeneralGeographyListPref.clear();
4711 GeneralRelatedList.clear();
4712 GeneralRelatedListRelType.clear();
4713 GeneralRelatedListLanguage.clear();
4714 GeneralRelatedListAltID.clear();
4715 GeneralRelatedListPID.clear();
4716 GeneralRelatedListType.clear();
4717 GeneralRelatedListTokens.clear();
4718 GeneralRelatedListPref.clear();
4720 GeneralWebsiteList.clear();
4721 GeneralWebsiteListAltID.clear();
4722 GeneralWebsiteListPID.clear();
4723 GeneralWebsiteListType.clear();
4724 GeneralWebsiteListTokens.clear();
4725 GeneralWebsiteListMediatype.clear();
4726 GeneralWebsiteListPref.clear();
4728 GeneralTitleList.clear();
4729 GeneralTitleListLanguage.clear();
4730 GeneralTitleListAltID.clear();
4731 GeneralTitleListPID.clear();
4732 GeneralTitleListType.clear();
4733 GeneralTitleListTokens.clear();
4734 GeneralTitleListPref.clear();
4736 GeneralRoleList.clear();
4737 GeneralRoleListLanguage.clear();
4738 GeneralRoleListAltID.clear();
4739 GeneralRoleListPID.clear();
4740 GeneralRoleListType.clear();
4741 GeneralRoleListTokens.clear();
4742 GeneralRoleListPref.clear();
4744 GeneralOrganisationsList.clear();
4745 GeneralOrganisationsListLanguage.clear();
4746 GeneralOrganisationsListAltID.clear();
4747 GeneralOrganisationsListPID.clear();
4748 GeneralOrganisationsListType.clear();
4749 GeneralOrganisationsListTokens.clear();
4750 GeneralOrganisationsListSortAs.clear();
4751 GeneralOrganisationsListPref.clear();
4753 GeneralNoteList.clear();
4754 GeneralNoteListLanguage.clear();
4755 GeneralNoteListAltID.clear();
4756 GeneralNoteListPID.clear();
4757 GeneralNoteListType.clear();
4758 GeneralNoteListTokens.clear();
4759 GeneralNoteListPref.clear();
4761 /* Items on Home Tab */
4763 HomeNicknamesList.clear();
4764 HomeNicknamesListType.clear();
4765 HomeNicknamesListLanguage.clear();
4766 HomeNicknamesListAltID.clear();
4767 HomeNicknamesListPID.clear();
4768 HomeNicknamesListTokens.clear();
4769 HomeNicknamesListPref.clear();
4771 HomeAddressList.clear();
4772 HomeAddressListTown.clear();
4773 HomeAddressListCounty.clear();
4774 HomeAddressListPostCode.clear();
4775 HomeAddressListCountry.clear();
4776 HomeAddressListLabel.clear();
4777 HomeAddressListLang.clear();
4778 HomeAddressListAltID.clear();
4779 HomeAddressListPID.clear();
4780 HomeAddressListTokens.clear();
4781 HomeAddressListGeo.clear();
4782 HomeAddressListTimezone.clear();
4783 HomeAddressListType.clear();
4784 HomeAddressListMediatype.clear();
4785 HomeAddressListPref.clear();
4787 HomeEmailList.clear();
4788 HomeEmailListAltID.clear();
4789 HomeEmailListPID.clear();
4790 HomeEmailListType.clear();
4791 HomeEmailListTokens.clear();
4792 HomeEmailListPref.clear();
4795 HomeIMListAltID.clear();
4796 HomeIMListPID.clear();
4797 HomeIMListType.clear();
4798 HomeIMListTypeInfo.clear();
4799 HomeIMListTokens.clear();
4800 HomeIMListMediatype.clear();
4801 HomeIMListPref.clear();
4803 HomeTelephoneList.clear();
4804 HomeTelephoneListAltID.clear();
4805 HomeTelephoneListPID.clear();
4806 HomeTelephoneListType.clear();
4807 HomeTelephoneListTokens.clear();
4808 HomeTelephoneListTypeInfo.clear();
4809 HomeTelephoneListPref.clear();
4811 HomeLanguageList.clear();
4812 HomeLanguageListAltID.clear();
4813 HomeLanguageListPID.clear();
4814 HomeLanguageListType.clear();
4815 HomeLanguageListTokens.clear();
4816 HomeLanguageListPref.clear();
4819 HomeTZListAltID.clear();
4820 HomeTZListPID.clear();
4821 HomeTZListType.clear();
4822 HomeTZListTokens.clear();
4823 HomeTZListMediatype.clear();
4824 HomeTZListPref.clear();
4826 HomeGeographyList.clear();
4827 HomeGeographyListAltID.clear();
4828 HomeGeographyListPID.clear();
4829 HomeGeographyListType.clear();
4830 HomeGeographyListTokens.clear();
4831 HomeGeographyListMediatype.clear();
4832 HomeGeographyListPref.clear();
4834 HomeWebsiteList.clear();
4835 HomeWebsiteListAltID.clear();
4836 HomeWebsiteListPID.clear();
4837 HomeWebsiteListType.clear();
4838 HomeWebsiteListTokens.clear();
4839 HomeWebsiteListMediatype.clear();
4840 HomeWebsiteListPref.clear();
4842 HomeTitleList.clear();
4843 HomeTitleListLanguage.clear();
4844 HomeTitleListAltID.clear();
4845 HomeTitleListPID.clear();
4846 HomeTitleListType.clear();
4847 HomeTitleListTokens.clear();
4848 HomeTitleListPref.clear();
4850 HomeRoleList.clear();
4851 HomeRoleListLanguage.clear();
4852 HomeRoleListAltID.clear();
4853 HomeRoleListPID.clear();
4854 HomeRoleListType.clear();
4855 HomeRoleListTokens.clear();
4856 HomeRoleListPref.clear();
4858 HomeOrganisationsList.clear();
4859 HomeOrganisationsListLanguage.clear();
4860 HomeOrganisationsListAltID.clear();
4861 HomeOrganisationsListPID.clear();
4862 HomeOrganisationsListType.clear();
4863 HomeOrganisationsListTokens.clear();
4864 HomeOrganisationsListSortAs.clear();
4865 HomeOrganisationsListPref.clear();
4867 HomeNoteList.clear();
4868 HomeNoteListLanguage.clear();
4869 HomeNoteListAltID.clear();
4870 HomeNoteListPID.clear();
4871 HomeNoteListType.clear();
4872 HomeNoteListTokens.clear();
4873 HomeNoteListPref.clear();
4875 /* Items on the Business tab */
4877 BusinessNicknamesList.clear();
4878 BusinessNicknamesListType.clear();
4879 BusinessNicknamesListLanguage.clear();
4880 BusinessNicknamesListAltID.clear();
4881 BusinessNicknamesListPID.clear();
4882 BusinessNicknamesListTokens.clear();
4883 BusinessNicknamesListPref.clear();
4885 BusinessAddressList.clear();
4886 BusinessAddressListTown.clear();
4887 BusinessAddressListCounty.clear();
4888 BusinessAddressListPostCode.clear();
4889 BusinessAddressListCountry.clear();
4890 BusinessAddressListLabel.clear();
4891 BusinessAddressListLang.clear();
4892 BusinessAddressListAltID.clear();
4893 BusinessAddressListPID.clear();
4894 BusinessAddressListTokens.clear();
4895 BusinessAddressListGeo.clear();
4896 BusinessAddressListTimezone.clear();
4897 BusinessAddressListType.clear();
4898 BusinessAddressListMediatype.clear();
4899 BusinessAddressListPref.clear();
4901 BusinessEmailList.clear();
4902 BusinessEmailListAltID.clear();
4903 BusinessEmailListPID.clear();
4904 BusinessEmailListType.clear();
4905 BusinessEmailListTokens.clear();
4906 BusinessEmailListPref.clear();
4908 BusinessIMList.clear();
4909 BusinessIMListAltID.clear();
4910 BusinessIMListPID.clear();
4911 BusinessIMListType.clear();
4912 BusinessIMListTokens.clear();
4913 BusinessIMListMediatype.clear();
4914 BusinessIMListPref.clear();
4916 BusinessTelephoneList.clear();
4917 BusinessTelephoneListAltID.clear();
4918 BusinessTelephoneListPID.clear();
4919 BusinessTelephoneListType.clear();
4920 BusinessTelephoneListTokens.clear();
4921 BusinessTelephoneListPref.clear();
4923 BusinessLanguageList.clear();
4924 BusinessLanguageListAltID.clear();
4925 BusinessLanguageListPID.clear();
4926 BusinessLanguageListType.clear();
4927 BusinessLanguageListTokens.clear();
4928 BusinessLanguageListPref.clear();
4930 BusinessTZList.clear();
4931 BusinessTZListAltID.clear();
4932 BusinessTZListPID.clear();
4933 BusinessTZListType.clear();
4934 BusinessTZListTokens.clear();
4935 BusinessTZListMediatype.clear();
4936 BusinessTZListPref.clear();
4938 BusinessGeographyList.clear();
4939 BusinessGeographyListAltID.clear();
4940 BusinessGeographyListPID.clear();
4941 BusinessGeographyListType.clear();
4942 BusinessGeographyListTokens.clear();
4943 BusinessGeographyListMediatype.clear();
4944 BusinessGeographyListPref.clear();
4946 BusinessWebsiteList.clear();
4947 BusinessWebsiteListAltID.clear();
4948 BusinessWebsiteListPID.clear();
4949 BusinessWebsiteListType.clear();
4950 BusinessWebsiteListTokens.clear();
4951 BusinessWebsiteListMediatype.clear();
4952 BusinessWebsiteListPref.clear();
4954 BusinessTitleList.clear();
4955 BusinessTitleListLanguage.clear();
4956 BusinessTitleListAltID.clear();
4957 BusinessTitleListPID.clear();
4958 BusinessTitleListType.clear();
4959 BusinessTitleListTokens.clear();
4960 BusinessTitleListPref.clear();
4962 BusinessRoleList.clear();
4963 BusinessRoleListLanguage.clear();
4964 BusinessRoleListAltID.clear();
4965 BusinessRoleListPID.clear();
4966 BusinessRoleListType.clear();
4967 BusinessRoleListTokens.clear();
4968 BusinessRoleListPref.clear();
4970 BusinessOrganisationsList.clear();
4971 BusinessOrganisationsListLanguage.clear();
4972 BusinessOrganisationsListAltID.clear();
4973 BusinessOrganisationsListPID.clear();
4974 BusinessOrganisationsListType.clear();
4975 BusinessOrganisationsListTokens.clear();
4976 BusinessOrganisationsListSortAs.clear();
4977 BusinessOrganisationsListPref.clear();
4979 BusinessNoteList.clear();
4980 BusinessNoteListLanguage.clear();
4981 BusinessNoteListAltID.clear();
4982 BusinessNoteListPID.clear();
4983 BusinessNoteListType.clear();
4984 BusinessNoteListTokens.clear();
4985 BusinessNoteListPref.clear();
4987 /* Items on the Categories tab */
4989 CategoriesList.clear();
4990 CategoriesListAltID.clear();
4991 CategoriesListPID.clear();
4992 CategoriesListType.clear();
4993 CategoriesListTokens.clear();
4994 CategoriesListLanguage.clear();
4995 CategoriesListPref.clear();
4997 /* Items on the Groups tab */
5000 GroupsListAltID.clear();
5001 GroupsListPID.clear();
5002 GroupsListType.clear();
5003 GroupsListMediaType.clear();
5004 GroupsListTokens.clear();
5005 GroupsListPref.clear();
5007 /* Items on the Pictures tab */
5009 PicturesList.clear();
5010 PicturesListAltID.clear();
5011 PicturesListPID.clear();
5012 PicturesListType.clear();
5013 PicturesListPicEncType.clear();
5014 PicturesListPictureType.clear();
5015 PicturesListTokens.clear();
5016 PicturesListMediatype.clear();
5017 PicturesListPref.clear();
5019 /* Items on the Logos tab */
5022 LogosListAltID.clear();
5023 LogosListPID.clear();
5024 LogosListType.clear();
5025 LogosListPicEncType.clear();
5026 LogosListPictureType.clear();
5027 LogosListTokens.clear();
5028 LogosListMediatype.clear();
5029 LogosListPref.clear();
5031 /* Items on the Sounds tab */
5034 SoundsListAltID.clear();
5035 SoundsListPID.clear();
5036 SoundsListType.clear();
5037 SoundsListAudioEncType.clear();
5038 SoundsListAudioType.clear();
5039 SoundsListTokens.clear();
5040 SoundsListMediatype.clear();
5041 SoundsListPref.clear();
5043 /* Items on the Calendaring tab */
5045 CalendarList.clear();
5046 CalendarListAltID.clear();
5047 CalendarListPID.clear();
5048 CalendarListType.clear();
5049 CalendarListTokens.clear();
5050 CalendarListMediatype.clear();
5051 CalendarListPref.clear();
5053 CalendarRequestList.clear();
5054 CalendarRequestListAltID.clear();
5055 CalendarRequestListPID.clear();
5056 CalendarRequestListType.clear();
5057 CalendarRequestListTokens.clear();
5058 CalendarRequestListMediatype.clear();
5059 CalendarRequestListPref.clear();
5061 FreeBusyList.clear();
5062 FreeBusyListAltID.clear();
5063 FreeBusyListPID.clear();
5064 FreeBusyListType.clear();
5065 FreeBusyListTokens.clear();
5066 FreeBusyListMediatype.clear();
5067 FreeBusyListPref.clear();
5069 /* Items on the Security tab */
5072 KeyListAltID.clear();
5074 KeyListKeyType.clear();
5075 KeyListDataType.clear();
5076 KeyListDataEncType.clear();
5077 KeyListType.clear();
5078 KeyListTokens.clear();
5079 KeyListPref.clear();
5081 /* Items on the Other tab */
5084 VendorListPEN.clear();
5085 VendorListElement.clear();
5088 XTokenListTokens.clear();
5092 void ProcessNameValue(wxString *PropertyData,
5093 wxString *PropertyName,
5094 wxString *PropertyValue){
5096 wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
5097 *PropertyName = PropertyElement.GetNextToken();
5098 *PropertyValue = PropertyElement.GetNextToken();
5102 void ProcessTokens(wxString *PropertyName,
5103 wxString *PropertyValue,
5104 wxString *PropertyTokens,
5107 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5109 if (*FirstToken == TRUE){
5111 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5112 *FirstToken = FALSE;
5116 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5124 void ProcessStringValue(wxString *PropertyName,
5125 wxString PropertyNameMatch,
5126 std::map<int,wxString> *MapPtr,
5127 wxString *PropertyValue,
5129 bool *PropertyMatched){
5131 if (*PropertyName == PropertyNameMatch){
5132 MapPtr->erase(*ItemCount);
5133 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5134 *PropertyMatched = TRUE;
5139 void ProcessIntegerValue(wxString *PropertyName,
5140 wxString PropertyNameMatch,
5141 std::map<int,int> *PrefPtr,
5142 wxString *PropertyValue,
5144 bool *PropertyMatched){
5146 if (*PropertyName == PropertyNameMatch){
5147 *PropertyMatched = TRUE;
5152 int PriorityNumber = 0;
5153 bool ValidNumber = TRUE;
5156 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5159 catch(std::invalid_argument &e){
5160 ValidNumber = FALSE;
5163 if (ValidNumber == TRUE){
5165 PrefPtr->erase(*ItemCount);
5166 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5172 void SplitValues(wxString *PropertyLine,
5173 std::map<int,int> *SplitPoints,
5174 std::map<int,int> *SplitLength,
5177 size_t intPropertyLen = PropertyLine->Len();
5178 int intSplitsFound = 0;
5179 int intSplitSize = 0;
5180 int intSplitSeek = 0;
5182 for (int i = intSize; i <= intPropertyLen; i++){
5186 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5187 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5189 if (intSplitsFound == 0){
5191 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5195 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5199 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5209 if (intSplitsFound == 0){
5211 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5212 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5216 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5217 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5223 void CheckType(wxString *PropertySeg1,
5224 std::map<int,int> *SplitPoints,
5225 std::map<int,int> *SplitLength,
5227 PropertyType *PropType){
5229 wxString PropertyData;
5230 wxString PropertyName;
5231 wxString PropertyValue;
5232 std::map<int,int>::iterator SLiter;
5234 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5235 intiter != SplitPoints->end(); ++intiter){
5237 SLiter = SplitLength->find(intiter->first);
5238 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5239 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
5240 *intPrevValue = intiter->second;
5242 if (PropertyName == wxT("TYPE")){
5244 if (PropertyValue == wxT("work")){
5246 *PropType = PROPERTY_WORK;
5248 } else if (PropertyValue == wxT("home")){
5250 *PropType = PROPERTY_HOME;
5254 *PropType = PROPERTY_NONE;