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 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2474 // Add the name token data.
2476 if (!PropertyTokens.IsEmpty()){
2478 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2484 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2486 size_t intPropertyLen = PropertySeg1.Len();
2487 std::map<int, int> SplitPoints;
2488 std::map<int, int> SplitLength;
2489 std::map<int, int>::iterator SLiter;
2490 wxString PropertyData;
2491 wxString PropertyName;
2492 wxString PropertyValue;
2493 wxString PropertyTokens;
2494 wxString RelatedType;
2495 wxString RelatedTypeOriginal;
2496 wxString RelatedName;
2497 bool FirstToken = TRUE;
2498 int intSplitsFound = 0;
2499 int intSplitSize = 0;
2500 int intPrevValue = 9;
2502 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2506 // Look for type before continuing.
2508 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2509 intiter != SplitPoints.end(); ++intiter){
2511 SLiter = SplitLength.find(intiter->first);
2512 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2513 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2514 intPrevValue = intiter->second;
2518 RelatedTypeOriginal = PropertyValue;
2520 if (PropertyName == wxT("TYPE")){
2522 if (PropertyValue == wxT("contact")){
2524 RelatedType = _("Contact");
2526 } else if (PropertyValue == wxT("acquaintance")){
2528 RelatedType = _("Acquaintance");
2530 } else if (PropertyValue == wxT("friend")){
2532 RelatedType = _("Friend");
2534 } else if (PropertyValue == wxT("met")){
2536 RelatedType = _("Met");
2538 } else if (PropertyValue == wxT("co-worker")){
2540 RelatedType = _("Co-worker");
2542 } else if (PropertyValue == wxT("colleague")){
2544 RelatedType = _("Colleague");
2546 } else if (PropertyValue == wxT("co-resident")){
2548 RelatedType = _("Co-resident");
2550 } else if (PropertyValue == wxT("neighbor")){
2552 RelatedType = _("Neighbour");
2554 } else if (PropertyValue == wxT("child")){
2556 RelatedType = _("Child");
2558 } else if (PropertyValue == wxT("parent")){
2560 RelatedType = _("Parent");
2562 } else if (PropertyValue == wxT("sibling")){
2564 RelatedType = _("Sibling");
2566 } else if (PropertyValue == wxT("spouse")){
2568 RelatedType = _("Spouse");
2570 } else if (PropertyValue == wxT("kin")){
2572 RelatedType = _("Kin");
2574 } else if (PropertyValue == wxT("muse")){
2576 RelatedType = _("Muse");
2578 } else if (PropertyValue == wxT("crush")){
2580 RelatedType = _("Crush");
2582 } else if (PropertyValue == wxT("date")){
2584 RelatedType = _("Date");
2586 } else if (PropertyValue == wxT("sweetheart")){
2588 RelatedType = _("Sweetheart");
2590 } else if (PropertyValue == wxT("me")){
2592 RelatedType = _("Me");
2594 } else if (PropertyValue == wxT("agent")){
2596 RelatedType = _("Agent");
2598 } else if (PropertyValue == wxT("emergency")){
2600 RelatedType = _("Emergency");
2604 RelatedType = PropertyValue;
2614 bool PropertyMatched = FALSE;
2616 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2617 intiter != SplitPoints.end(); ++intiter){
2619 SLiter = SplitLength.find(intiter->first);
2620 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2621 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2622 intPrevValue = intiter->second;
2624 // Process properties.
2626 size_t intPropertyValueLen = PropertyValue.Len();
2628 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2630 PropertyValue.Trim();
2631 PropertyValue.RemoveLast();
2635 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2637 PropertyValue.Remove(0, 1);
2641 CaptureString(&PropertyValue, FALSE);
2643 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2644 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2645 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2646 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2648 if (PropertyMatched == TRUE){
2650 PropertyMatched = FALSE;
2655 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2659 // Add the data to the General/Home/Work address variables.
2661 GeneralRelatedList.erase(*RelatedCount);
2662 GeneralRelatedListRelType.erase(*RelatedCount);
2663 GeneralRelatedListType.erase(*RelatedCount);
2664 GeneralRelatedListTokens.erase(*RelatedCount);
2665 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2666 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2667 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2668 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2672 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2674 std::map<int, int> SplitPoints;
2675 std::map<int, int> SplitLength;
2676 std::map<int, int>::iterator SLiter;
2677 wxString PropertyData;
2678 wxString PropertyName;
2679 wxString PropertyValue;
2680 wxString PropertyTokens;
2681 bool FirstToken = TRUE;
2682 int intPrevValue = 5;
2684 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2688 PropertyType PropType = PROPERTY_NONE;
2690 // Look for type before continuing.
2692 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2694 // Setup the pointers.
2696 std::map<int, wxString> *WebsiteList = NULL;
2697 std::map<int, wxString> *WebsiteListAltID = NULL;
2698 std::map<int, wxString> *WebsiteListPID = NULL;
2699 std::map<int, wxString> *WebsiteListType = NULL;
2700 std::map<int, wxString> *WebsiteListTokens = NULL;
2701 std::map<int, wxString> *WebsiteListMediatype = NULL;
2702 std::map<int, int> *WebsiteListPref = NULL;
2704 // Setup blank lines for later on.
2708 WebsiteList = &GeneralWebsiteList;
2709 WebsiteListType = &GeneralWebsiteListType;
2710 WebsiteListAltID = &GeneralWebsiteListAltID;
2711 WebsiteListPID = &GeneralWebsiteListPID;
2712 WebsiteListTokens = &GeneralWebsiteListTokens;
2713 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2714 WebsiteListPref = &GeneralWebsiteListPref;
2717 WebsiteList = &HomeWebsiteList;
2718 WebsiteListType = &HomeWebsiteListType;
2719 WebsiteListAltID = &HomeWebsiteListAltID;
2720 WebsiteListPID = &HomeWebsiteListPID;
2721 WebsiteListTokens = &HomeWebsiteListTokens;
2722 WebsiteListMediatype = &HomeWebsiteListMediatype;
2723 WebsiteListPref = &HomeWebsiteListPref;
2726 WebsiteList = &BusinessWebsiteList;
2727 WebsiteListType = &BusinessWebsiteListType;
2728 WebsiteListAltID = &BusinessWebsiteListAltID;
2729 WebsiteListPID = &BusinessWebsiteListPID;
2730 WebsiteListTokens = &BusinessWebsiteListTokens;
2731 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2732 WebsiteListPref = &BusinessWebsiteListPref;
2737 bool PropertyMatched = FALSE;
2739 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2740 intiter != SplitPoints.end(); ++intiter){
2742 SLiter = SplitLength.find(intiter->first);
2743 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2744 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2745 intPrevValue = intiter->second;
2747 // Process properties.
2749 size_t intPropertyValueLen = PropertyValue.Len();
2751 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2753 PropertyValue.Trim();
2754 PropertyValue.RemoveLast();
2758 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2760 PropertyValue.Remove(0, 1);
2764 CaptureString(&PropertyValue, FALSE);
2766 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2767 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2768 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2769 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2771 if (PropertyMatched == TRUE){
2773 PropertyMatched = FALSE;
2778 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2782 // Add the data to the General/Home/Work address variables.
2784 CaptureString(&PropertySeg2, FALSE);
2786 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2788 if (!PropertyTokens.IsEmpty()){
2790 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2796 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2798 std::map<int, int> SplitPoints;
2799 std::map<int, int> SplitLength;
2800 std::map<int, int>::iterator SLiter;
2801 wxString PropertyData;
2802 wxString PropertyName;
2803 wxString PropertyValue;
2804 wxString PropertyTokens;
2805 bool FirstToken = TRUE;
2806 int intPrevValue = 7;
2808 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2812 PropertyType PropType = PROPERTY_NONE;
2814 // Look for type before continuing.
2816 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2818 // Setup the pointers.
2820 std::map<int, wxString> *TitleList = NULL;
2821 std::map<int, wxString> *TitleListAltID = NULL;
2822 std::map<int, wxString> *TitleListPID = NULL;
2823 std::map<int, wxString> *TitleListType = NULL;
2824 std::map<int, wxString> *TitleListTokens = NULL;
2825 std::map<int, wxString> *TitleListLanguage = NULL;
2826 std::map<int, int> *TitleListPref = NULL;
2828 // Setup blank lines for later on.
2832 TitleList = &GeneralTitleList;
2833 TitleListType = &GeneralTitleListType;
2834 TitleListAltID = &GeneralTitleListAltID;
2835 TitleListPID = &GeneralTitleListPID;
2836 TitleListTokens = &GeneralTitleListTokens;
2837 TitleListLanguage = &GeneralTitleListLanguage;
2838 TitleListPref = &GeneralTitleListPref;
2841 TitleList = &HomeTitleList;
2842 TitleListType = &HomeTitleListType;
2843 TitleListAltID = &HomeTitleListAltID;
2844 TitleListPID = &HomeTitleListPID;
2845 TitleListTokens = &HomeTitleListTokens;
2846 TitleListLanguage = &HomeTitleListLanguage;
2847 TitleListPref = &HomeTitleListPref;
2850 TitleList = &BusinessTitleList;
2851 TitleListType = &BusinessTitleListType;
2852 TitleListAltID = &BusinessTitleListAltID;
2853 TitleListPID = &BusinessTitleListPID;
2854 TitleListTokens = &BusinessTitleListTokens;
2855 TitleListLanguage = &BusinessTitleListLanguage;
2856 TitleListPref = &BusinessTitleListPref;
2861 bool PropertyMatched = FALSE;
2863 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2864 intiter != SplitPoints.end(); ++intiter){
2866 SLiter = SplitLength.find(intiter->first);
2867 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2868 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2869 intPrevValue = intiter->second;
2871 // Process properties.
2873 size_t intPropertyValueLen = PropertyValue.Len();
2875 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2877 PropertyValue.Trim();
2878 PropertyValue.RemoveLast();
2882 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2884 PropertyValue.Remove(0, 1);
2888 CaptureString(&PropertyValue, FALSE);
2890 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2891 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2892 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2893 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2895 if (PropertyMatched == TRUE){
2897 PropertyMatched = FALSE;
2902 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2906 // Add the data to the General/Home/Work address variables.
2908 CaptureString(&PropertySeg2, FALSE);
2910 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2912 if (!PropertyTokens.IsEmpty()){
2914 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2920 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2922 std::map<int, int> SplitPoints;
2923 std::map<int, int> SplitLength;
2924 std::map<int, int>::iterator SLiter;
2925 wxString PropertyData;
2926 wxString PropertyName;
2927 wxString PropertyValue;
2928 wxString PropertyTokens;
2929 bool FirstToken = TRUE;
2930 int intPrevValue = 6;
2932 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2936 PropertyType PropType = PROPERTY_NONE;
2938 // Look for type before continuing.
2940 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2942 // Setup the pointers.
2944 std::map<int, wxString> *RoleList = NULL;
2945 std::map<int, wxString> *RoleListAltID = NULL;
2946 std::map<int, wxString> *RoleListPID = NULL;
2947 std::map<int, wxString> *RoleListType = NULL;
2948 std::map<int, wxString> *RoleListTokens = NULL;
2949 std::map<int, wxString> *RoleListLanguage = NULL;
2950 std::map<int, int> *RoleListPref = NULL;
2952 // Setup blank lines for later on.
2956 RoleList = &GeneralRoleList;
2957 RoleListType = &GeneralRoleListType;
2958 RoleListAltID = &GeneralRoleListAltID;
2959 RoleListPID = &GeneralRoleListPID;
2960 RoleListTokens = &GeneralRoleListTokens;
2961 RoleListLanguage = &GeneralRoleListLanguage;
2962 RoleListPref = &GeneralRoleListPref;
2965 RoleList = &HomeRoleList;
2966 RoleListType = &HomeRoleListType;
2967 RoleListAltID = &HomeRoleListAltID;
2968 RoleListPID = &HomeRoleListPID;
2969 RoleListTokens = &HomeRoleListTokens;
2970 RoleListLanguage = &HomeRoleListLanguage;
2971 RoleListPref = &HomeRoleListPref;
2974 RoleList = &BusinessRoleList;
2975 RoleListType = &BusinessRoleListType;
2976 RoleListAltID = &BusinessRoleListAltID;
2977 RoleListPID = &BusinessRoleListPID;
2978 RoleListTokens = &BusinessRoleListTokens;
2979 RoleListLanguage = &BusinessRoleListLanguage;
2980 RoleListPref = &BusinessRoleListPref;
2985 bool PropertyMatched = FALSE;
2987 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2988 intiter != SplitPoints.end(); ++intiter){
2990 SLiter = SplitLength.find(intiter->first);
2991 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2992 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2993 intPrevValue = intiter->second;
2995 // Process properties.
2997 size_t intPropertyValueLen = PropertyValue.Len();
2999 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3001 PropertyValue.Trim();
3002 PropertyValue.RemoveLast();
3006 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3008 PropertyValue.Remove(0, 1);
3012 CaptureString(&PropertyValue, FALSE);
3014 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3015 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3016 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3017 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3019 if (PropertyMatched == TRUE){
3021 PropertyMatched = FALSE;
3026 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3030 // Add the data to the General/Home/Work address variables.
3032 CaptureString(&PropertySeg2, FALSE);
3034 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3036 if (!PropertyTokens.IsEmpty()){
3038 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3044 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3046 std::map<int, int> SplitPoints;
3047 std::map<int, int> SplitLength;
3048 std::map<int, int>::iterator SLiter;
3049 wxString PropertyData;
3050 wxString PropertyName;
3051 wxString PropertyValue;
3052 wxString PropertyTokens;
3053 bool FirstToken = TRUE;
3054 int intPrevValue = 5;
3056 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3060 PropertyType PropType = PROPERTY_NONE;
3062 // Look for type before continuing.
3064 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3066 // Setup the pointers.
3068 std::map<int, wxString> *OrganisationsList = NULL;
3069 std::map<int, wxString> *OrganisationsListAltID = NULL;
3070 std::map<int, wxString> *OrganisationsListPID = NULL;
3071 std::map<int, wxString> *OrganisationsListType = NULL;
3072 std::map<int, wxString> *OrganisationsListTokens = NULL;
3073 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3074 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3075 std::map<int, int> *OrganisationsListPref = NULL;
3077 // Setup blank lines for later on.
3081 OrganisationsList = &GeneralOrganisationsList;
3082 OrganisationsListType = &GeneralOrganisationsListType;
3083 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3084 OrganisationsListPID = &GeneralOrganisationsListPID;
3085 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3086 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3087 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3088 OrganisationsListPref = &GeneralOrganisationsListPref;
3091 OrganisationsList = &HomeOrganisationsList;
3092 OrganisationsListType = &HomeOrganisationsListType;
3093 OrganisationsListAltID = &HomeOrganisationsListAltID;
3094 OrganisationsListPID = &HomeOrganisationsListPID;
3095 OrganisationsListTokens = &HomeOrganisationsListTokens;
3096 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3097 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3098 OrganisationsListPref = &HomeOrganisationsListPref;
3101 OrganisationsList = &BusinessOrganisationsList;
3102 OrganisationsListType = &BusinessOrganisationsListType;
3103 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3104 OrganisationsListPID = &BusinessOrganisationsListPID;
3105 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3106 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3107 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3108 OrganisationsListPref = &BusinessOrganisationsListPref;
3113 bool PropertyMatched = FALSE;
3115 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3116 intiter != SplitPoints.end(); ++intiter){
3118 SLiter = SplitLength.find(intiter->first);
3119 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3120 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3121 intPrevValue = intiter->second;
3123 // Process properties.
3125 size_t intPropertyValueLen = PropertyValue.Len();
3127 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3129 PropertyValue.Trim();
3130 PropertyValue.RemoveLast();
3134 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3136 PropertyValue.Remove(0, 1);
3140 CaptureString(&PropertyValue, FALSE);
3142 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3143 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3144 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3145 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3146 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3148 if (PropertyMatched == TRUE){
3150 PropertyMatched = FALSE;
3155 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3159 // Add the data to the General/Home/Work address variables.
3161 CaptureString(&PropertySeg2, FALSE);
3163 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3165 if (!PropertyTokens.IsEmpty()){
3167 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3173 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3175 std::map<int, int> SplitPoints;
3176 std::map<int, int> SplitLength;
3177 std::map<int, int>::iterator SLiter;
3178 wxString PropertyData;
3179 wxString PropertyName;
3180 wxString PropertyValue;
3181 wxString PropertyTokens;
3182 bool FirstToken = TRUE;
3183 int intPrevValue = 6;
3185 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3189 PropertyType PropType = PROPERTY_NONE;
3191 // Look for type before continuing.
3193 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3195 // Setup the pointers.
3197 std::map<int, wxString> *NoteList = NULL;
3198 std::map<int, wxString> *NoteListAltID = NULL;
3199 std::map<int, wxString> *NoteListPID = NULL;
3200 std::map<int, wxString> *NoteListType = NULL;
3201 std::map<int, wxString> *NoteListTokens = NULL;
3202 std::map<int, wxString> *NoteListLanguage = NULL;
3203 std::map<int, int> *NoteListPref = NULL;
3205 // Setup blank lines for later on.
3209 NoteList = &GeneralNoteList;
3210 NoteListType = &GeneralNoteListType;
3211 NoteListAltID = &GeneralNoteListAltID;
3212 NoteListPID = &GeneralNoteListPID;
3213 NoteListTokens = &GeneralNoteListTokens;
3214 NoteListLanguage = &GeneralNoteListLanguage;
3215 NoteListPref = &GeneralNoteListPref;
3218 NoteList = &HomeNoteList;
3219 NoteListType = &HomeNoteListType;
3220 NoteListAltID = &HomeNoteListAltID;
3221 NoteListPID = &HomeNoteListPID;
3222 NoteListTokens = &HomeNoteListTokens;
3223 NoteListLanguage = &HomeNoteListLanguage;
3224 NoteListPref = &HomeNoteListPref;
3227 NoteList = &BusinessNoteList;
3228 NoteListType = &BusinessNoteListType;
3229 NoteListAltID = &BusinessNoteListAltID;
3230 NoteListPID = &BusinessNoteListPID;
3231 NoteListTokens = &BusinessNoteListTokens;
3232 NoteListLanguage = &BusinessNoteListLanguage;
3233 NoteListPref = &BusinessNoteListPref;
3238 bool PropertyMatched = FALSE;
3240 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3241 intiter != SplitPoints.end(); ++intiter){
3243 SLiter = SplitLength.find(intiter->first);
3244 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3245 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3246 intPrevValue = intiter->second;
3248 // Process properties.
3250 size_t intPropertyValueLen = PropertyValue.Len();
3252 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3254 PropertyValue.Trim();
3255 PropertyValue.RemoveLast();
3259 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3261 PropertyValue.Remove(0, 1);
3265 CaptureString(&PropertyValue, FALSE);
3267 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3268 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3269 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3270 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3272 if (PropertyMatched == TRUE){
3274 PropertyMatched = FALSE;
3279 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3283 // Add the data to the General/Home/Work address variables.
3285 CaptureString(&PropertySeg2, FALSE);
3287 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3289 if (!PropertyTokens.IsEmpty()){
3291 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3297 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3299 std::map<int, int> SplitPoints;
3300 std::map<int, int> SplitLength;
3301 std::map<int, int>::iterator SLiter;
3302 wxString PropertyData;
3303 wxString PropertyName;
3304 wxString PropertyValue;
3305 wxString PropertyTokens;
3306 bool FirstToken = TRUE;
3307 int intPrevValue = 12;
3309 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3313 PropertyType PropType = PROPERTY_NONE;
3315 // Look for type before continuing.
3317 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3319 // Setup blank lines for later on.
3325 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3328 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3333 bool PropertyMatched = FALSE;
3335 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3336 intiter != SplitPoints.end(); ++intiter){
3338 SLiter = SplitLength.find(intiter->first);
3339 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3340 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3341 intPrevValue = intiter->second;
3343 // Process properties.
3345 size_t intPropertyValueLen = PropertyValue.Len();
3347 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3349 PropertyValue.Trim();
3350 PropertyValue.RemoveLast();
3354 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3356 PropertyValue.Remove(0, 1);
3360 CaptureString(&PropertyValue, FALSE);
3362 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3363 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3364 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3365 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3367 if (PropertyMatched == TRUE){
3369 PropertyMatched = FALSE;
3374 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3378 // Deal with multiple categories.
3380 int intOrigCatCount = *CategoryCount;
3381 bool FirstCategoryProcessed = TRUE;
3382 bool AfterFirstToken = FALSE;
3383 int intSplitSize = 0;
3384 int intSplitsFound = 0;
3385 int intSplitSeek = 0;
3386 int intPropertyLen = PropertySeg2.Len();
3388 SplitPoints.clear();
3389 SplitLength.clear();
3392 for (int i = 0; i <= intPropertyLen; i++){
3394 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3402 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3404 if (AfterFirstToken == TRUE){
3406 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3407 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3411 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3412 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3413 AfterFirstToken = TRUE;
3425 if (SplitPoints.size() > 0){
3427 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3428 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3432 if (SplitPoints.size() == 0){
3434 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3436 if (!PropertyTokens.IsEmpty()){
3438 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3444 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3445 intiter != SplitPoints.end(); ++intiter){
3447 SLiter = SplitLength.find(intiter->first);
3449 intPrevValue = intiter->second;
3451 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3453 // Add the data to the General/Home/Work address variables.
3455 // Trim any whitespace from the start and end.
3457 PropertyData = PropertyData.Trim(FALSE);
3458 PropertyData = PropertyData.Trim(TRUE);
3460 CaptureString(&PropertyData, FALSE);
3462 if (FirstCategoryProcessed == TRUE){
3464 FirstCategoryProcessed = FALSE;
3466 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3468 if (!PropertyTokens.IsEmpty()){
3470 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3480 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3482 if (!PropertyTokens.IsEmpty()){
3484 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3490 // Copy the properties to each of the categories (if it exists).
3492 if (!PropertyTokens.IsEmpty()){
3494 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3498 // Check if ALTID was used.
3500 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3502 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3506 // Check if PID was used.
3508 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3510 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3514 // Check if PREF was used.
3516 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3518 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3522 // Check if LANGUAGE was used.
3524 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3526 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3530 // Check if TYPE was used.
3536 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3539 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3547 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3549 size_t intPropertyLen = PropertySeg1.Len();
3550 std::map<int, int> SplitPoints;
3551 std::map<int, int> SplitLength;
3552 std::map<int, int>::iterator SLiter;
3553 wxString PropertyData;
3554 wxString PropertyName;
3555 wxString PropertyValue;
3556 wxString PropertyTokens;
3557 bool FirstToken = TRUE;
3558 int intSplitsFound = 0;
3559 int intSplitSize = 0;
3560 int intPrevValue = 7;
3562 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3566 PropertyType PropType = PROPERTY_NONE;
3568 // Look for type before continuing.
3570 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3573 bool PropertyMatched = FALSE;
3575 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3576 intiter != SplitPoints.end(); ++intiter){
3578 SLiter = SplitLength.find(intiter->first);
3579 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3580 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3581 intPrevValue = intiter->second;
3583 // Process properties.
3585 size_t intPropertyValueLen = PropertyValue.Len();
3587 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3589 PropertyValue.Trim();
3590 PropertyValue.RemoveLast();
3594 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3596 PropertyValue.Remove(0, 1);
3600 CaptureString(&PropertyValue, FALSE);
3602 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3603 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3604 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3605 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3607 if (PropertyMatched == TRUE){
3609 PropertyMatched = FALSE;
3614 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3618 intPropertyLen = PropertySeg2.Len();
3619 SplitPoints.clear();
3620 SplitLength.clear();
3625 CaptureString(&PropertySeg2, FALSE);
3627 for (int i = 0; i <= intPropertyLen; i++){
3631 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3634 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3636 if (intSplitsFound == 6){
3638 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3643 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3653 wxString wxSPhotoURI;
3654 wxString wxSPhotoMIME;
3655 wxString wxSPhotoEncoding;
3656 wxString wxSPhotoData;
3657 std::string base64enc;
3659 if (intSplitsFound == 0){
3663 std::map<int, int>::iterator striter;
3665 striter = SplitLength.find(1);
3667 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3669 while (wSTDataType.HasMoreTokens() == TRUE){
3671 wxSPhotoURI = wSTDataType.GetNextToken();
3672 wxSPhotoMIME = wSTDataType.GetNextToken();
3677 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3679 while (wSTDataInfo.HasMoreTokens() == TRUE){
3681 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3682 wxSPhotoData = wSTDataInfo.GetNextToken();
3683 base64enc = wxSPhotoData.mb_str();
3690 // Add the data to the General/Home/Work address variables.
3692 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3693 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3694 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3700 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3703 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3707 if (!PropertyTokens.IsEmpty()){
3709 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3715 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3717 size_t intPropertyLen = PropertySeg1.Len();
3718 std::map<int, int> SplitPoints;
3719 std::map<int, int> SplitLength;
3720 std::map<int, int>::iterator SLiter;
3721 wxString PropertyData;
3722 wxString PropertyName;
3723 wxString PropertyValue;
3724 wxString PropertyTokens;
3725 bool FirstToken = TRUE;
3726 int intSplitsFound = 0;
3727 int intSplitSize = 0;
3728 int intPrevValue = 6;
3730 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3734 PropertyType PropType = PROPERTY_NONE;
3736 // Look for type before continuing.
3738 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3741 bool PropertyMatched = FALSE;
3743 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3744 intiter != SplitPoints.end(); ++intiter){
3746 SLiter = SplitLength.find(intiter->first);
3747 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3748 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3749 intPrevValue = intiter->second;
3751 // Process properties.
3753 size_t intPropertyValueLen = PropertyValue.Len();
3755 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3757 PropertyValue.Trim();
3758 PropertyValue.RemoveLast();
3762 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3764 PropertyValue.Remove(0, 1);
3768 CaptureString(&PropertyValue, FALSE);
3770 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3771 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3772 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3773 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3775 if (PropertyMatched == TRUE){
3777 PropertyMatched = FALSE;
3782 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3786 intPropertyLen = PropertySeg2.Len();
3787 SplitPoints.clear();
3788 SplitLength.clear();
3793 CaptureString(&PropertySeg2, FALSE);
3795 for (int i = 0; i <= intPropertyLen; i++){
3799 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3802 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3804 if (intSplitsFound == 6){
3806 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3811 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3821 wxString wxSPhotoURI;
3822 wxString wxSPhotoMIME;
3823 wxString wxSPhotoEncoding;
3824 wxString wxSPhotoData;
3825 std::string base64enc;
3827 if (intSplitsFound == 0){
3831 std::map<int, int>::iterator striter;
3833 striter = SplitLength.find(1);
3835 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3837 while (wSTDataType.HasMoreTokens() == TRUE){
3839 wxSPhotoURI = wSTDataType.GetNextToken();
3840 wxSPhotoMIME = wSTDataType.GetNextToken();
3845 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3847 while (wSTDataInfo.HasMoreTokens() == TRUE){
3849 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3850 wxSPhotoData = wSTDataInfo.GetNextToken();
3851 base64enc = wxSPhotoData.mb_str();
3858 // Add the data to the General/Home/Work address variables.
3860 LogosList.insert(std::make_pair(*LogoCount, base64enc));
3861 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3862 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3868 LogosListType.insert(std::make_pair(*LogoCount, "home"));
3871 LogosListType.insert(std::make_pair(*LogoCount, "work"));
3875 if (!PropertyTokens.IsEmpty()){
3877 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3883 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3885 size_t intPropertyLen = PropertySeg1.Len();
3886 std::map<int, int> SplitPoints;
3887 std::map<int, int> SplitLength;
3888 std::map<int, int>::iterator SLiter;
3889 wxString PropertyData;
3890 wxString PropertyName;
3891 wxString PropertyValue;
3892 wxString PropertyTokens;
3893 bool FirstToken = TRUE;
3894 int intSplitsFound = 0;
3895 int intSplitSize = 0;
3896 int intPrevValue = 7;
3898 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3902 PropertyType PropType = PROPERTY_NONE;
3904 // Look for type before continuing.
3906 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3909 bool PropertyMatched = FALSE;
3911 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3912 intiter != SplitPoints.end(); ++intiter){
3914 SLiter = SplitLength.find(intiter->first);
3915 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3916 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3917 intPrevValue = intiter->second;
3919 // Process properties.
3921 size_t intPropertyValueLen = PropertyValue.Len();
3923 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3925 PropertyValue.Trim();
3926 PropertyValue.RemoveLast();
3930 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3932 PropertyValue.Remove(0, 1);
3936 CaptureString(&PropertyValue, FALSE);
3938 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
3939 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
3940 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
3941 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
3942 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
3944 if (PropertyMatched == TRUE){
3946 PropertyMatched = FALSE;
3951 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3955 intPropertyLen = PropertySeg2.Len();
3956 SplitPoints.clear();
3957 SplitLength.clear();
3962 CaptureString(&PropertySeg2, FALSE);
3964 for (int i = 0; i <= intPropertyLen; i++){
3968 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3971 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3973 if (intSplitsFound == 6){
3975 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3980 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3990 wxString wxSSoundURI;
3991 wxString wxSSoundMIME;
3992 wxString wxSSoundEncoding;
3993 wxString wxSSoundData;
3994 std::string base64enc;
3996 if (intSplitsFound == 0){
4000 std::map<int, int>::iterator striter;
4002 striter = SplitLength.find(1);
4004 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4006 while (wSTDataType.HasMoreTokens() == TRUE){
4008 wxSSoundURI = wSTDataType.GetNextToken();
4009 wxSSoundMIME = wSTDataType.GetNextToken();
4014 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4016 while (wSTDataInfo.HasMoreTokens() == TRUE){
4018 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4019 wxSSoundData = wSTDataInfo.GetNextToken();
4020 base64enc = wxSSoundData.mb_str();
4027 // Add the data to the General/Home/Work address variables.
4033 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4036 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4040 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4041 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4042 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4044 if (!PropertyTokens.IsEmpty()){
4046 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4052 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4054 size_t intPropertyLen = PropertySeg1.Len();
4055 std::map<int, int> SplitPoints;
4056 std::map<int, int> SplitLength;
4057 std::map<int, int>::iterator SLiter;
4058 wxString PropertyData;
4059 wxString PropertyName;
4060 wxString PropertyValue;
4061 wxString PropertyTokens;
4062 bool FirstToken = TRUE;
4063 int intSplitsFound = 0;
4064 int intSplitSize = 0;
4065 int intPrevValue = 8;
4067 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4071 PropertyType PropType = PROPERTY_NONE;
4073 // Look for type before continuing.
4075 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4078 bool PropertyMatched = FALSE;
4080 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4081 intiter != SplitPoints.end(); ++intiter){
4083 SLiter = SplitLength.find(intiter->first);
4084 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4085 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4086 intPrevValue = intiter->second;
4088 // Process properties.
4090 size_t intPropertyValueLen = PropertyValue.Len();
4092 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4094 PropertyValue.Trim();
4095 PropertyValue.RemoveLast();
4099 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4101 PropertyValue.Remove(0, 1);
4105 CaptureString(&PropertyValue, FALSE);
4107 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4108 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4109 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4110 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4112 if (PropertyMatched == TRUE){
4114 PropertyMatched = FALSE;
4119 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4123 intPropertyLen = PropertySeg2.Len();
4124 SplitPoints.clear();
4125 SplitLength.clear();
4130 CaptureString(&PropertySeg2, FALSE);
4132 // Add the data to the General/Home/Work address variables.
4138 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4141 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4145 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4147 if (!PropertyTokens.IsEmpty()){
4149 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4155 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4157 size_t intPropertyLen = PropertySeg1.Len();
4158 std::map<int, int> SplitPoints;
4159 std::map<int, int> SplitLength;
4160 std::map<int, int>::iterator SLiter;
4161 wxString PropertyData;
4162 wxString PropertyName;
4163 wxString PropertyValue;
4164 wxString PropertyTokens;
4165 bool FirstToken = TRUE;
4166 int intSplitsFound = 0;
4167 int intSplitSize = 0;
4168 int intPrevValue = 8;
4170 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4174 PropertyType PropType = PROPERTY_NONE;
4176 // Look for type before continuing.
4178 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4181 bool PropertyMatched = FALSE;
4183 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4184 intiter != SplitPoints.end(); ++intiter){
4186 SLiter = SplitLength.find(intiter->first);
4187 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4188 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4189 intPrevValue = intiter->second;
4191 // Process properties.
4193 size_t intPropertyValueLen = PropertyValue.Len();
4195 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4197 PropertyValue.Trim();
4198 PropertyValue.RemoveLast();
4202 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4204 PropertyValue.Remove(0, 1);
4208 CaptureString(&PropertyValue, FALSE);
4210 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4211 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4212 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4213 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4215 if (PropertyMatched == TRUE){
4217 PropertyMatched = FALSE;
4222 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4226 intPropertyLen = PropertySeg2.Len();
4227 SplitPoints.clear();
4228 SplitLength.clear();
4233 CaptureString(&PropertySeg2, FALSE);
4235 // Add the data to the General/Home/Work address variables.
4241 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4244 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4248 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4250 if (!PropertyTokens.IsEmpty()){
4252 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4258 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4260 size_t intPropertyLen = PropertySeg1.Len();
4261 std::map<int, int> SplitPoints;
4262 std::map<int, int> SplitLength;
4263 std::map<int, int>::iterator SLiter;
4264 wxString PropertyData;
4265 wxString PropertyName;
4266 wxString PropertyValue;
4267 wxString PropertyTokens;
4268 bool FirstToken = TRUE;
4269 int intSplitsFound = 0;
4270 int intSplitSize = 0;
4271 int intPrevValue = 7;
4273 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4277 PropertyType PropType = PROPERTY_NONE;
4279 // Look for type before continuing.
4281 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4284 bool PropertyMatched = FALSE;
4286 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4287 intiter != SplitPoints.end(); ++intiter){
4289 SLiter = SplitLength.find(intiter->first);
4290 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4291 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4292 intPrevValue = intiter->second;
4294 // Process properties.
4296 size_t intPropertyValueLen = PropertyValue.Len();
4298 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4300 PropertyValue.Trim();
4301 PropertyValue.RemoveLast();
4305 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4307 PropertyValue.Remove(0, 1);
4311 CaptureString(&PropertyValue, FALSE);
4313 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4314 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4315 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4316 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4318 if (PropertyMatched == TRUE){
4320 PropertyMatched = FALSE;
4325 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4329 intPropertyLen = PropertySeg2.Len();
4330 SplitPoints.clear();
4331 SplitLength.clear();
4336 CaptureString(&PropertySeg2, FALSE);
4338 // Add the data to the General/Home/Work address variables.
4344 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4347 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4351 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4353 if (!PropertyTokens.IsEmpty()){
4355 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4361 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4363 size_t intPropertyLen = PropertySeg1.Len();
4364 std::map<int, int> SplitPoints;
4365 std::map<int, int> SplitLength;
4366 std::map<int, int>::iterator SLiter;
4367 wxString PropertyData;
4368 wxString PropertyName;
4369 wxString PropertyValue;
4370 wxString PropertyTokens;
4371 bool FirstToken = TRUE;
4372 int intSplitsFound = 0;
4373 int intSplitSize = 0;
4374 int intPrevValue = 5;
4376 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4380 PropertyType PropType = PROPERTY_NONE;
4382 // Look for type before continuing.
4384 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4387 bool PropertyMatched = FALSE;
4389 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4390 intiter != SplitPoints.end(); ++intiter){
4392 SLiter = SplitLength.find(intiter->first);
4393 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4394 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4395 intPrevValue = intiter->second;
4397 // Process properties.
4399 size_t intPropertyValueLen = PropertyValue.Len();
4401 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4403 PropertyValue.Trim();
4404 PropertyValue.RemoveLast();
4408 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4410 PropertyValue.Remove(0, 1);
4414 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4415 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4416 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4418 if (PropertyMatched == TRUE){
4420 PropertyMatched = FALSE;
4425 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4429 intPropertyLen = PropertySeg2.Len();
4430 SplitPoints.clear();
4431 SplitLength.clear();
4436 for (int i = 0; i <= intPropertyLen; i++){
4440 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4443 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4445 if (intSplitsFound == 6){
4447 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4452 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4463 wxString wxSKeyMIME;
4464 wxString wxSKeyEncoding;
4465 wxString wxSKeyData;
4466 std::string base64enc;
4468 if (intSplitsFound == 0){
4472 std::map<int, int>::iterator striter;
4474 striter = SplitLength.find(1);
4476 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4478 while (wSTDataType.HasMoreTokens() == TRUE){
4480 wxSKeyURI = wSTDataType.GetNextToken();
4481 wxSKeyMIME = wSTDataType.GetNextToken();
4486 if (wxSKeyURI == wxT("data")){
4488 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4490 while (wSTDataInfo.HasMoreTokens() == TRUE){
4492 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4493 wxSKeyData = wSTDataInfo.GetNextToken();
4502 // Add the data to the General/Home/Work address variables.
4504 if (wxSKeyURI == wxT("data")){
4506 KeyListDataEncType.erase(*KeyCount);
4507 KeyListKeyType.erase(*KeyCount);
4508 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4509 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4511 KeyList.erase(*KeyCount);
4512 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4516 KeyList.erase(*KeyCount);
4517 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4521 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4527 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4530 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4534 if (!PropertyTokens.IsEmpty()){
4536 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4542 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4544 // Split the Vendor three ways.
4546 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4549 wxString wxSVNDPropName;
4551 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4553 wSTVendorDetails.GetNextToken();
4554 wxSVNDID = wSTVendorDetails.GetNextToken();
4555 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4560 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4562 // Add the data to the vendor variables.
4564 VendorList.erase(*VendorCount);
4565 VendorListPEN.erase(*VendorCount);
4566 VendorListElement.erase(*VendorCount);
4568 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4569 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4570 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4576 void ContactDataObject::ClearData(){
4579 NameForename.clear();
4580 NameSurname.clear();
4581 NameOtherNames.clear();
4583 NameNickname.clear();
4584 NameDisplayAs.clear();
4585 NameLanguage.clear();
4590 BirthdayAltID.clear();
4591 BirthdayCalScale.clear();
4592 BirthdayTokens.clear();
4593 Anniversary.clear();
4594 AnniversaryAltID.clear();
4595 AnniversaryCalScale.clear();
4596 AnniversaryTokens.clear();
4599 GenderDetails.clear();
4600 GenderTokens.clear();
4604 RevisionTokens.clear();
4607 SourceListAltID.clear();
4608 SourceListPID.clear();
4609 SourceListType.clear();
4610 SourceListTokens.clear();
4611 SourceListMediatype.clear();
4612 SourceListPref.clear();
4615 XMLListAltID.clear();
4617 ClientPIDList.clear();
4618 ClientPIDListTokens.clear();
4620 FullNamesList.clear();
4621 FullNamesListType.clear();
4622 FullNamesListLanguage.clear();
4623 FullNamesListAltID.clear();
4624 FullNamesListPID.clear();
4625 FullNamesListTokens.clear();
4626 FullNamesListPref.clear();
4628 GeneralNicknamesList.clear();
4629 GeneralNicknamesListType.clear();
4630 GeneralNicknamesListLanguage.clear();
4631 GeneralNicknamesListAltID.clear();
4632 GeneralNicknamesListPID.clear();
4633 GeneralNicknamesListTokens.clear();
4634 GeneralNicknamesListPref.clear();
4636 GeneralAddressList.clear();
4637 GeneralAddressListTown.clear();
4638 GeneralAddressListCounty.clear();
4639 GeneralAddressListPostCode.clear();
4640 GeneralAddressListCountry.clear();
4641 GeneralAddressListLabel.clear();
4642 GeneralAddressListLang.clear();
4643 GeneralAddressListAltID.clear();
4644 GeneralAddressListPID.clear();
4645 GeneralAddressListTokens.clear();
4646 GeneralAddressListGeo.clear();
4647 GeneralAddressListTimezone.clear();
4648 GeneralAddressListType.clear();
4649 GeneralAddressListMediatype.clear();
4650 GeneralAddressListPref.clear();
4652 GeneralEmailList.clear();
4653 GeneralEmailListAltID.clear();
4654 GeneralEmailListPID.clear();
4655 GeneralEmailListType.clear();
4656 GeneralEmailListTokens.clear();
4657 GeneralEmailListPref.clear();
4659 GeneralIMList.clear();
4660 GeneralIMListAltID.clear();
4661 GeneralIMListPID.clear();
4662 GeneralIMListType.clear();
4663 GeneralIMListTypeInfo.clear();
4664 GeneralIMListTokens.clear();
4665 GeneralIMListMediatype.clear();
4666 GeneralIMListPref.clear();
4668 GeneralTelephoneList.clear();
4669 GeneralTelephoneListAltID.clear();
4670 GeneralTelephoneListPID.clear();
4671 GeneralTelephoneListType.clear();
4672 GeneralTelephoneListTokens.clear();
4673 GeneralTelephoneListTypeInfo.clear();
4674 GeneralTelephoneListPref.clear();
4676 GeneralLanguageList.clear();
4677 GeneralLanguageListAltID.clear();
4678 GeneralLanguageListPID.clear();
4679 GeneralLanguageListType.clear();
4680 GeneralLanguageListTokens.clear();
4681 GeneralLanguageListPref.clear();
4683 GeneralTZList.clear();
4684 GeneralTZListAltID.clear();
4685 GeneralTZListPID.clear();
4686 GeneralTZListType.clear();
4687 GeneralTZListTokens.clear();
4688 GeneralTZListMediatype.clear();
4689 GeneralTZListPref.clear();
4691 GeneralGeographyList.clear();
4692 GeneralGeographyListAltID.clear();
4693 GeneralGeographyListPID.clear();
4694 GeneralGeographyListType.clear();
4695 GeneralGeographyListTokens.clear();
4696 GeneralGeographyListMediatype.clear();
4697 GeneralGeographyListPref.clear();
4699 GeneralRelatedList.clear();
4700 GeneralRelatedListRelType.clear();
4701 GeneralRelatedListLanguage.clear();
4702 GeneralRelatedListAltID.clear();
4703 GeneralRelatedListPID.clear();
4704 GeneralRelatedListType.clear();
4705 GeneralRelatedListTokens.clear();
4706 GeneralRelatedListPref.clear();
4708 GeneralWebsiteList.clear();
4709 GeneralWebsiteListAltID.clear();
4710 GeneralWebsiteListPID.clear();
4711 GeneralWebsiteListType.clear();
4712 GeneralWebsiteListTokens.clear();
4713 GeneralWebsiteListMediatype.clear();
4714 GeneralWebsiteListPref.clear();
4716 GeneralTitleList.clear();
4717 GeneralTitleListLanguage.clear();
4718 GeneralTitleListAltID.clear();
4719 GeneralTitleListPID.clear();
4720 GeneralTitleListType.clear();
4721 GeneralTitleListTokens.clear();
4722 GeneralTitleListPref.clear();
4724 GeneralRoleList.clear();
4725 GeneralRoleListLanguage.clear();
4726 GeneralRoleListAltID.clear();
4727 GeneralRoleListPID.clear();
4728 GeneralRoleListType.clear();
4729 GeneralRoleListTokens.clear();
4730 GeneralRoleListPref.clear();
4732 GeneralOrganisationsList.clear();
4733 GeneralOrganisationsListLanguage.clear();
4734 GeneralOrganisationsListAltID.clear();
4735 GeneralOrganisationsListPID.clear();
4736 GeneralOrganisationsListType.clear();
4737 GeneralOrganisationsListTokens.clear();
4738 GeneralOrganisationsListSortAs.clear();
4739 GeneralOrganisationsListPref.clear();
4741 GeneralNoteList.clear();
4742 GeneralNoteListLanguage.clear();
4743 GeneralNoteListAltID.clear();
4744 GeneralNoteListPID.clear();
4745 GeneralNoteListType.clear();
4746 GeneralNoteListTokens.clear();
4747 GeneralNoteListPref.clear();
4749 /* Items on Home Tab */
4751 HomeNicknamesList.clear();
4752 HomeNicknamesListType.clear();
4753 HomeNicknamesListLanguage.clear();
4754 HomeNicknamesListAltID.clear();
4755 HomeNicknamesListPID.clear();
4756 HomeNicknamesListTokens.clear();
4757 HomeNicknamesListPref.clear();
4759 HomeAddressList.clear();
4760 HomeAddressListTown.clear();
4761 HomeAddressListCounty.clear();
4762 HomeAddressListPostCode.clear();
4763 HomeAddressListCountry.clear();
4764 HomeAddressListLabel.clear();
4765 HomeAddressListLang.clear();
4766 HomeAddressListAltID.clear();
4767 HomeAddressListPID.clear();
4768 HomeAddressListTokens.clear();
4769 HomeAddressListGeo.clear();
4770 HomeAddressListTimezone.clear();
4771 HomeAddressListType.clear();
4772 HomeAddressListMediatype.clear();
4773 HomeAddressListPref.clear();
4775 HomeEmailList.clear();
4776 HomeEmailListAltID.clear();
4777 HomeEmailListPID.clear();
4778 HomeEmailListType.clear();
4779 HomeEmailListTokens.clear();
4780 HomeEmailListPref.clear();
4783 HomeIMListAltID.clear();
4784 HomeIMListPID.clear();
4785 HomeIMListType.clear();
4786 HomeIMListTypeInfo.clear();
4787 HomeIMListTokens.clear();
4788 HomeIMListMediatype.clear();
4789 HomeIMListPref.clear();
4791 HomeTelephoneList.clear();
4792 HomeTelephoneListAltID.clear();
4793 HomeTelephoneListPID.clear();
4794 HomeTelephoneListType.clear();
4795 HomeTelephoneListTokens.clear();
4796 HomeTelephoneListTypeInfo.clear();
4797 HomeTelephoneListPref.clear();
4799 HomeLanguageList.clear();
4800 HomeLanguageListAltID.clear();
4801 HomeLanguageListPID.clear();
4802 HomeLanguageListType.clear();
4803 HomeLanguageListTokens.clear();
4804 HomeLanguageListPref.clear();
4807 HomeTZListAltID.clear();
4808 HomeTZListPID.clear();
4809 HomeTZListType.clear();
4810 HomeTZListTokens.clear();
4811 HomeTZListMediatype.clear();
4812 HomeTZListPref.clear();
4814 HomeGeographyList.clear();
4815 HomeGeographyListAltID.clear();
4816 HomeGeographyListPID.clear();
4817 HomeGeographyListType.clear();
4818 HomeGeographyListTokens.clear();
4819 HomeGeographyListMediatype.clear();
4820 HomeGeographyListPref.clear();
4822 HomeWebsiteList.clear();
4823 HomeWebsiteListAltID.clear();
4824 HomeWebsiteListPID.clear();
4825 HomeWebsiteListType.clear();
4826 HomeWebsiteListTokens.clear();
4827 HomeWebsiteListMediatype.clear();
4828 HomeWebsiteListPref.clear();
4830 HomeTitleList.clear();
4831 HomeTitleListLanguage.clear();
4832 HomeTitleListAltID.clear();
4833 HomeTitleListPID.clear();
4834 HomeTitleListType.clear();
4835 HomeTitleListTokens.clear();
4836 HomeTitleListPref.clear();
4838 HomeRoleList.clear();
4839 HomeRoleListLanguage.clear();
4840 HomeRoleListAltID.clear();
4841 HomeRoleListPID.clear();
4842 HomeRoleListType.clear();
4843 HomeRoleListTokens.clear();
4844 HomeRoleListPref.clear();
4846 HomeOrganisationsList.clear();
4847 HomeOrganisationsListLanguage.clear();
4848 HomeOrganisationsListAltID.clear();
4849 HomeOrganisationsListPID.clear();
4850 HomeOrganisationsListType.clear();
4851 HomeOrganisationsListTokens.clear();
4852 HomeOrganisationsListSortAs.clear();
4853 HomeOrganisationsListPref.clear();
4855 HomeNoteList.clear();
4856 HomeNoteListLanguage.clear();
4857 HomeNoteListAltID.clear();
4858 HomeNoteListPID.clear();
4859 HomeNoteListType.clear();
4860 HomeNoteListTokens.clear();
4861 HomeNoteListPref.clear();
4863 /* Items on the Business tab */
4865 BusinessNicknamesList.clear();
4866 BusinessNicknamesListType.clear();
4867 BusinessNicknamesListLanguage.clear();
4868 BusinessNicknamesListAltID.clear();
4869 BusinessNicknamesListPID.clear();
4870 BusinessNicknamesListTokens.clear();
4871 BusinessNicknamesListPref.clear();
4873 BusinessAddressList.clear();
4874 BusinessAddressListTown.clear();
4875 BusinessAddressListCounty.clear();
4876 BusinessAddressListPostCode.clear();
4877 BusinessAddressListCountry.clear();
4878 BusinessAddressListLabel.clear();
4879 BusinessAddressListLang.clear();
4880 BusinessAddressListAltID.clear();
4881 BusinessAddressListPID.clear();
4882 BusinessAddressListTokens.clear();
4883 BusinessAddressListGeo.clear();
4884 BusinessAddressListTimezone.clear();
4885 BusinessAddressListType.clear();
4886 BusinessAddressListMediatype.clear();
4887 BusinessAddressListPref.clear();
4889 BusinessEmailList.clear();
4890 BusinessEmailListAltID.clear();
4891 BusinessEmailListPID.clear();
4892 BusinessEmailListType.clear();
4893 BusinessEmailListTokens.clear();
4894 BusinessEmailListPref.clear();
4896 BusinessIMList.clear();
4897 BusinessIMListAltID.clear();
4898 BusinessIMListPID.clear();
4899 BusinessIMListType.clear();
4900 BusinessIMListTokens.clear();
4901 BusinessIMListMediatype.clear();
4902 BusinessIMListPref.clear();
4904 BusinessTelephoneList.clear();
4905 BusinessTelephoneListAltID.clear();
4906 BusinessTelephoneListPID.clear();
4907 BusinessTelephoneListType.clear();
4908 BusinessTelephoneListTokens.clear();
4909 BusinessTelephoneListPref.clear();
4911 BusinessLanguageList.clear();
4912 BusinessLanguageListAltID.clear();
4913 BusinessLanguageListPID.clear();
4914 BusinessLanguageListType.clear();
4915 BusinessLanguageListTokens.clear();
4916 BusinessLanguageListPref.clear();
4918 BusinessTZList.clear();
4919 BusinessTZListAltID.clear();
4920 BusinessTZListPID.clear();
4921 BusinessTZListType.clear();
4922 BusinessTZListTokens.clear();
4923 BusinessTZListMediatype.clear();
4924 BusinessTZListPref.clear();
4926 BusinessGeographyList.clear();
4927 BusinessGeographyListAltID.clear();
4928 BusinessGeographyListPID.clear();
4929 BusinessGeographyListType.clear();
4930 BusinessGeographyListTokens.clear();
4931 BusinessGeographyListMediatype.clear();
4932 BusinessGeographyListPref.clear();
4934 BusinessWebsiteList.clear();
4935 BusinessWebsiteListAltID.clear();
4936 BusinessWebsiteListPID.clear();
4937 BusinessWebsiteListType.clear();
4938 BusinessWebsiteListTokens.clear();
4939 BusinessWebsiteListMediatype.clear();
4940 BusinessWebsiteListPref.clear();
4942 BusinessTitleList.clear();
4943 BusinessTitleListLanguage.clear();
4944 BusinessTitleListAltID.clear();
4945 BusinessTitleListPID.clear();
4946 BusinessTitleListType.clear();
4947 BusinessTitleListTokens.clear();
4948 BusinessTitleListPref.clear();
4950 BusinessRoleList.clear();
4951 BusinessRoleListLanguage.clear();
4952 BusinessRoleListAltID.clear();
4953 BusinessRoleListPID.clear();
4954 BusinessRoleListType.clear();
4955 BusinessRoleListTokens.clear();
4956 BusinessRoleListPref.clear();
4958 BusinessOrganisationsList.clear();
4959 BusinessOrganisationsListLanguage.clear();
4960 BusinessOrganisationsListAltID.clear();
4961 BusinessOrganisationsListPID.clear();
4962 BusinessOrganisationsListType.clear();
4963 BusinessOrganisationsListTokens.clear();
4964 BusinessOrganisationsListSortAs.clear();
4965 BusinessOrganisationsListPref.clear();
4967 BusinessNoteList.clear();
4968 BusinessNoteListLanguage.clear();
4969 BusinessNoteListAltID.clear();
4970 BusinessNoteListPID.clear();
4971 BusinessNoteListType.clear();
4972 BusinessNoteListTokens.clear();
4973 BusinessNoteListPref.clear();
4975 /* Items on the Categories tab */
4977 CategoriesList.clear();
4978 CategoriesListAltID.clear();
4979 CategoriesListPID.clear();
4980 CategoriesListType.clear();
4981 CategoriesListTokens.clear();
4982 CategoriesListLanguage.clear();
4983 CategoriesListPref.clear();
4985 /* Items on the Groups tab */
4988 GroupsListAltID.clear();
4989 GroupsListPID.clear();
4990 GroupsListType.clear();
4991 GroupsListMediaType.clear();
4992 GroupsListTokens.clear();
4993 GroupsListPref.clear();
4995 /* Items on the Pictures tab */
4997 PicturesList.clear();
4998 PicturesListAltID.clear();
4999 PicturesListPID.clear();
5000 PicturesListType.clear();
5001 PicturesListPicEncType.clear();
5002 PicturesListPictureType.clear();
5003 PicturesListTokens.clear();
5004 PicturesListMediatype.clear();
5005 PicturesListPref.clear();
5007 /* Items on the Logos tab */
5010 LogosListAltID.clear();
5011 LogosListPID.clear();
5012 LogosListType.clear();
5013 LogosListPicEncType.clear();
5014 LogosListPictureType.clear();
5015 LogosListTokens.clear();
5016 LogosListMediatype.clear();
5017 LogosListPref.clear();
5019 /* Items on the Sounds tab */
5022 SoundsListAltID.clear();
5023 SoundsListPID.clear();
5024 SoundsListType.clear();
5025 SoundsListAudioEncType.clear();
5026 SoundsListAudioType.clear();
5027 SoundsListTokens.clear();
5028 SoundsListMediatype.clear();
5029 SoundsListPref.clear();
5031 /* Items on the Calendaring tab */
5033 CalendarList.clear();
5034 CalendarListAltID.clear();
5035 CalendarListPID.clear();
5036 CalendarListType.clear();
5037 CalendarListTokens.clear();
5038 CalendarListMediatype.clear();
5039 CalendarListPref.clear();
5041 CalendarRequestList.clear();
5042 CalendarRequestListAltID.clear();
5043 CalendarRequestListPID.clear();
5044 CalendarRequestListType.clear();
5045 CalendarRequestListTokens.clear();
5046 CalendarRequestListMediatype.clear();
5047 CalendarRequestListPref.clear();
5049 FreeBusyList.clear();
5050 FreeBusyListAltID.clear();
5051 FreeBusyListPID.clear();
5052 FreeBusyListType.clear();
5053 FreeBusyListTokens.clear();
5054 FreeBusyListMediatype.clear();
5055 FreeBusyListPref.clear();
5057 /* Items on the Security tab */
5060 KeyListAltID.clear();
5062 KeyListKeyType.clear();
5063 KeyListDataType.clear();
5064 KeyListDataEncType.clear();
5065 KeyListType.clear();
5066 KeyListTokens.clear();
5067 KeyListPref.clear();
5069 /* Items on the Other tab */
5072 VendorListPEN.clear();
5073 VendorListElement.clear();
5076 XTokenListTokens.clear();
5080 void ProcessNameValue(wxString *PropertyData,
5081 wxString *PropertyName,
5082 wxString *PropertyValue){
5084 wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
5085 *PropertyName = PropertyElement.GetNextToken();
5086 *PropertyValue = PropertyElement.GetNextToken();
5090 void ProcessTokens(wxString *PropertyName,
5091 wxString *PropertyValue,
5092 wxString *PropertyTokens,
5095 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5097 if (*FirstToken == TRUE){
5099 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5100 *FirstToken = FALSE;
5104 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5112 void ProcessStringValue(wxString *PropertyName,
5113 wxString PropertyNameMatch,
5114 std::map<int,wxString> *MapPtr,
5115 wxString *PropertyValue,
5117 bool *PropertyMatched){
5119 if (*PropertyName == PropertyNameMatch){
5120 MapPtr->erase(*ItemCount);
5121 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5122 *PropertyMatched = TRUE;
5127 void ProcessIntegerValue(wxString *PropertyName,
5128 wxString PropertyNameMatch,
5129 std::map<int,int> *PrefPtr,
5130 wxString *PropertyValue,
5132 bool *PropertyMatched){
5134 if (*PropertyName == PropertyNameMatch){
5135 *PropertyMatched = TRUE;
5140 int PriorityNumber = 0;
5141 bool ValidNumber = TRUE;
5144 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5147 catch(std::invalid_argument &e){
5148 ValidNumber = FALSE;
5151 if (ValidNumber == TRUE){
5153 PrefPtr->erase(*ItemCount);
5154 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5160 void SplitValues(wxString *PropertyLine,
5161 std::map<int,int> *SplitPoints,
5162 std::map<int,int> *SplitLength,
5165 size_t intPropertyLen = PropertyLine->Len();
5166 int intSplitsFound = 0;
5167 int intSplitSize = 0;
5168 int intSplitSeek = 0;
5170 for (int i = intSize; i <= intPropertyLen; i++){
5174 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5175 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5177 if (intSplitsFound == 0){
5179 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5183 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5187 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5197 if (intSplitsFound == 0){
5199 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5200 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5204 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5205 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5211 void CheckType(wxString *PropertySeg1,
5212 std::map<int,int> *SplitPoints,
5213 std::map<int,int> *SplitLength,
5215 PropertyType *PropType){
5217 wxString PropertyData;
5218 wxString PropertyName;
5219 wxString PropertyValue;
5220 std::map<int,int>::iterator SLiter;
5222 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5223 intiter != SplitPoints->end(); ++intiter){
5225 SLiter = SplitLength->find(intiter->first);
5226 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5227 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
5228 *intPrevValue = intiter->second;
5230 if (PropertyName == wxT("TYPE")){
5232 if (PropertyValue == wxT("work")){
5234 *PropType = PROPERTY_WORK;
5236 } else if (PropertyValue == wxT("home")){
5238 *PropType = PROPERTY_HOME;
5242 *PropType = PROPERTY_NONE;