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 CaptureString(&PropertyValue, FALSE);
1591 // Process properties.
1593 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1594 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1595 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1596 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1597 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1598 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1599 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1600 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1602 if (PropertyMatched == TRUE){
1604 PropertyMatched = FALSE;
1609 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1613 // Split the address.
1615 //std::map<int, int>::iterator SLiter;
1616 intPropertyLen = PropertySeg2.Len();
1617 SplitPoints.clear();
1618 SplitLength.clear();
1623 for (int i = 0; i <= intPropertyLen; i++){
1627 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1630 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1632 if (intSplitsFound == 6){
1634 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1639 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1649 // Split the data into several parts.
1651 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1652 intiter != SplitPoints.end(); ++intiter){
1654 if (intiter->first == 1){
1656 // Deal with PO Box.
1658 SLiter = SplitLength.find(1);
1660 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1661 intPrevValue = intiter->second;
1663 } else if (intiter->first == 2){
1665 // Deal with extended address.
1667 SLiter = SplitLength.find(2);
1669 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1670 intPrevValue = intiter->second;
1672 } else if (intiter->first == 3){
1674 // Deal with street address.
1676 SLiter = SplitLength.find(3);
1678 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1679 intPrevValue = intiter->second;
1681 } else if (intiter->first == 4){
1683 // Deal with locality
1685 SLiter = SplitLength.find(4);
1687 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1688 intPrevValue = intiter->second;
1690 } else if (intiter->first == 5){
1692 // Deal with region.
1694 SLiter = SplitLength.find(5);
1696 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1697 intPrevValue = intiter->second;
1700 } else if (intiter->first == 6){
1702 // Deal with post code.
1704 SLiter = SplitLength.find(6);
1706 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1707 intPrevValue = intiter->second;
1709 // Deal with country.
1711 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1719 // Add the data to the General/Home/Work address variables.
1721 CaptureString(&AddressStreet, FALSE);
1722 CaptureString(&AddressLocality, FALSE);
1723 CaptureString(&AddressRegion, FALSE);
1724 CaptureString(&AddressPostalCode, FALSE);
1725 CaptureString(&AddressCountry, FALSE);
1727 if (!PropertyTokens.IsEmpty()){
1729 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1733 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1734 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1735 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1736 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1737 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1741 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1744 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1747 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1751 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1755 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1757 std::map<int, int> SplitPoints;
1758 std::map<int, int> SplitLength;
1760 int intPrevValue = 7;
1762 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1766 PropertyType PropType = PROPERTY_NONE;
1768 // Look for type before continuing.
1770 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1772 std::map<int, wxString> *EmailList = NULL;
1773 std::map<int, wxString> *EmailListType = NULL;
1774 std::map<int, wxString> *EmailListAltID = NULL;
1775 std::map<int, wxString> *EmailListPID = NULL;
1776 std::map<int, wxString> *EmailListTokens = NULL;
1777 std::map<int, int> *EmailListPref = NULL;
1781 EmailList = &GeneralEmailList;
1782 EmailListType = &GeneralEmailListType;
1783 EmailListAltID = &GeneralEmailListAltID;
1784 EmailListPID = &GeneralEmailListPID;
1785 EmailListTokens = &GeneralEmailListTokens;
1786 EmailListPref = &GeneralEmailListPref;
1789 EmailList = &HomeEmailList;
1790 EmailListType = &HomeEmailListType;
1791 EmailListAltID = &HomeEmailListAltID;
1792 EmailListPID = &HomeEmailListPID;
1793 EmailListTokens = &HomeEmailListTokens;
1794 EmailListPref = &HomeEmailListPref;
1797 EmailList = &BusinessEmailList;
1798 EmailListType = &BusinessEmailListType;
1799 EmailListAltID = &BusinessEmailListAltID;
1800 EmailListPID = &BusinessEmailListPID;
1801 EmailListTokens = &BusinessEmailListTokens;
1802 EmailListPref = &BusinessEmailListPref;
1808 std::map<int,int>::iterator SLiter;
1809 wxString PropertyData;
1810 wxString PropertyName;
1811 wxString PropertyValue;
1812 wxString PropertyTokens;
1813 bool FirstToken = TRUE;
1814 bool PropertyMatched = FALSE;
1816 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1817 intiter != SplitPoints.end(); ++intiter){
1819 SLiter = SplitLength.find(intiter->first);
1820 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1821 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1822 intPrevValue = intiter->second;
1824 CaptureString(&PropertyValue, FALSE);
1826 // Process properties.
1828 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
1829 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
1830 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
1832 if (PropertyMatched == TRUE){
1834 PropertyMatched = FALSE;
1839 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1843 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1845 // Add the name token data.
1847 if (!PropertyTokens.IsEmpty()){
1849 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1856 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1858 std::map<int, int> SplitPoints;
1859 std::map<int, int> SplitLength;
1861 int intPrevValue = 6;
1863 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1867 PropertyType PropType = PROPERTY_NONE;
1869 // Look for type before continuing.
1871 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1873 std::map<int, wxString> *IMList = NULL;
1874 std::map<int, wxString> *IMListType = NULL;
1875 std::map<int, wxString> *IMListAltID = NULL;
1876 std::map<int, wxString> *IMListPID = NULL;
1877 std::map<int, wxString> *IMListTokens = NULL;
1878 std::map<int, wxString> *IMListMediatype = NULL;
1879 std::map<int, wxString> *IMListTypeInfo = NULL;
1880 std::map<int, int> *IMListPref = NULL;
1884 IMList = &GeneralIMList;
1885 IMListType = &GeneralIMListType;
1886 IMListAltID = &GeneralIMListAltID;
1887 IMListPID = &GeneralIMListPID;
1888 IMListTokens = &GeneralIMListTokens;
1889 IMListMediatype = &GeneralIMListMediatype;
1890 IMListTypeInfo = &GeneralIMListTypeInfo;
1891 IMListPref = &GeneralIMListPref;
1894 IMList = &HomeIMList;
1895 IMListType = &HomeIMListType;
1896 IMListAltID = &HomeIMListAltID;
1897 IMListPID = &HomeIMListPID;
1898 IMListTokens = &HomeIMListTokens;
1899 IMListMediatype = &HomeIMListMediatype;
1900 IMListTypeInfo = &HomeIMListTypeInfo;
1901 IMListPref = &HomeIMListPref;
1904 IMList = &BusinessIMList;
1905 IMListType = &BusinessIMListType;
1906 IMListAltID = &BusinessIMListAltID;
1907 IMListPID = &BusinessIMListPID;
1908 IMListTokens = &BusinessIMListTokens;
1909 IMListMediatype = &BusinessIMListMediatype;
1910 IMListTypeInfo = &BusinessIMListTypeInfo;
1911 IMListPref = &BusinessIMListPref;
1917 std::map<int,int>::iterator SLiter;
1918 wxString PropertyData;
1919 wxString PropertyName;
1920 wxString PropertyValue;
1921 wxString PropertyTokens;
1922 bool FirstToken = TRUE;
1923 bool PropertyMatched = FALSE;
1925 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1926 intiter != SplitPoints.end(); ++intiter){
1928 SLiter = SplitLength.find(intiter->first);
1929 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1930 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1931 intPrevValue = intiter->second;
1933 CaptureString(&PropertyValue, FALSE);
1935 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
1936 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
1937 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
1938 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
1940 // Process properties.
1942 if (PropertyMatched == TRUE){
1944 PropertyMatched = FALSE;
1949 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1953 wxStringTokenizer IMPPSplitData(PropertySeg2, wxT(":"));
1955 if (IMPPSplitData.CountTokens() > 1){
1957 IMListTypeInfo->insert(std::make_pair(*IMCount, IMPPSplitData.GetNextToken()));
1958 IMList->insert(std::make_pair(*IMCount, IMPPSplitData.GetString()));
1962 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
1963 IMListTypeInfo->insert(std::make_pair(*IMCount, "none"));
1967 // Add the name token data.
1969 if (!PropertyTokens.IsEmpty()){
1971 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
1977 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
1979 std::map<int, int> SplitPoints;
1980 std::map<int, int> SplitLength;
1981 std::map<int, int>::iterator SLiter;
1983 PropertyType PropType = PROPERTY_NONE;
1985 // Look for type before continuing.
1988 wxString TelTypeDetail;
1989 wxString PropertyData;
1990 wxString PropertyName;
1991 wxString PropertyValue;
1992 wxString PropertyTokens;
1994 std::map<int,int> TypeSplitPoints;
1995 std::map<int,int> TypeSplitLength;
1996 std::map<int,int>::iterator TSLiter;
1998 int intSplitSize = 0;
1999 int intSplitsFound = 0;
2000 int intSplitPoint = 0;
2002 int intPrevValue = 5;
2004 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2008 // Look for type before continuing.
2010 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2011 intiter != SplitPoints.end(); ++intiter){
2013 SLiter = SplitLength.find(intiter->first);
2014 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2015 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2016 intPrevValue = intiter->second;
2018 if (PropertyName == wxT("TYPE")){
2020 // Process each value in type and translate each
2023 // Strip out the quotes if they are there.
2025 size_t intPropertyValueLen = PropertyValue.Len();
2027 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2029 PropertyValue.Trim();
2030 PropertyValue.RemoveLast();
2034 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2036 PropertyValue.Remove(0, 1);
2040 TelTypeDetail = PropertyValue;
2046 for (int i = 0; i <= intPropertyValueLen; i++){
2050 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2052 if (intSplitsFound == 0){
2054 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2055 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2059 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2060 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2073 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2074 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2076 int intTypeSeek = 0;
2078 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2079 typeiter != TypeSplitPoints.end(); ++typeiter){
2081 wxString TypePropertyName;
2083 TSLiter = TypeSplitLength.find(typeiter->first);
2085 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2087 if (intTypeSeek == 0){
2092 TelTypeUI.Append(wxT(","));
2096 if (TypePropertyName == wxT("home")){
2098 PropType = PROPERTY_HOME;
2100 } else if (TypePropertyName == wxT("work")){
2102 PropType = PROPERTY_WORK;
2107 if (TypePropertyName == wxT("text")){
2109 TelTypeUI.Append(_("text"));
2112 } else if (TypePropertyName == wxT("voice")){
2114 TelTypeUI.Append(_("voice"));
2117 } else if (TypePropertyName == wxT("fax")){
2119 TelTypeUI.Append(_("fax"));
2122 } else if (TypePropertyName == wxT("cell")){
2124 TelTypeUI.Append(_("cell"));
2127 } else if (TypePropertyName == wxT("video")){
2129 TelTypeUI.Append(_("video"));
2132 } else if (TypePropertyName == wxT("pager")){
2134 TelTypeUI.Append(_("pager"));
2137 } else if (TypePropertyName == wxT("textphone")){
2139 TelTypeUI.Append(_("textphone"));
2150 std::map<int, wxString> *TelephoneList = NULL;
2151 std::map<int, wxString> *TelephoneListType = NULL;
2152 std::map<int, wxString> *TelephoneListAltID = NULL;
2153 std::map<int, wxString> *TelephoneListPID = NULL;
2154 std::map<int, wxString> *TelephoneListTokens = NULL;
2155 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2156 std::map<int, wxString> *TelephoneListDataType = NULL;
2157 std::map<int, int> *TelephoneListPref = NULL;
2161 TelephoneList = &GeneralTelephoneList;
2162 TelephoneListType = &GeneralTelephoneListType;
2163 TelephoneListAltID = &GeneralTelephoneListAltID;
2164 TelephoneListPID = &GeneralTelephoneListPID;
2165 TelephoneListTokens = &GeneralTelephoneListTokens;
2166 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2167 TelephoneListDataType = &GeneralTelephoneListDataType;
2168 TelephoneListPref = &GeneralTelephoneListPref;
2171 TelephoneList = &HomeTelephoneList;
2172 TelephoneListType = &HomeTelephoneListType;
2173 TelephoneListAltID = &HomeTelephoneListAltID;
2174 TelephoneListPID = &HomeTelephoneListPID;
2175 TelephoneListTokens = &HomeTelephoneListTokens;
2176 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2177 TelephoneListDataType = &HomeTelephoneListDataType;
2178 TelephoneListPref = &HomeTelephoneListPref;
2181 TelephoneList = &BusinessTelephoneList;
2182 TelephoneListType = &BusinessTelephoneListType;
2183 TelephoneListAltID = &BusinessTelephoneListAltID;
2184 TelephoneListPID = &BusinessTelephoneListPID;
2185 TelephoneListTokens = &BusinessTelephoneListTokens;
2186 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2187 TelephoneListDataType = &BusinessTelephoneListDataType;
2188 TelephoneListPref = &BusinessTelephoneListPref;
2192 // Process the properties.
2194 bool FirstToken = TRUE;
2197 SplitPoints.clear();
2198 SplitLength.clear();
2200 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2204 bool PropertyMatched = FALSE;
2206 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2207 intiter != SplitPoints.end(); ++intiter){
2209 SLiter = SplitLength.find(intiter->first);
2210 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2211 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2212 intPrevValue = intiter->second;
2214 CaptureString(&PropertyValue, FALSE);
2216 // Process properties.
2218 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2219 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2220 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2222 if (PropertyMatched == TRUE){
2224 PropertyMatched = FALSE;
2229 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2233 // Check for the type information and split it down.
2235 wxStringTokenizer TelSplitData(PropertySeg2, wxT(":"));
2237 if (TelSplitData.CountTokens() > 1){
2239 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, TelSplitData.GetNextToken()));
2240 TelephoneList->insert(std::make_pair(*TelephoneCount, TelSplitData.GetString()));
2244 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2245 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, "tel"));
2249 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2251 // Add the name token data.
2253 if (!PropertyTokens.IsEmpty()){
2255 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2261 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2263 std::map<int, int> SplitPoints;
2264 std::map<int, int> SplitLength;
2266 int intPrevValue = 6;
2268 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2272 PropertyType PropType = PROPERTY_NONE;
2274 // Look for type before continuing.
2276 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2278 std::map<int, wxString> *LanguageList = NULL;
2279 std::map<int, wxString> *LanguageListType = NULL;
2280 std::map<int, wxString> *LanguageListAltID = NULL;
2281 std::map<int, wxString> *LanguageListPID = NULL;
2282 std::map<int, wxString> *LanguageListTokens = NULL;
2283 std::map<int, int> *LanguageListPref = NULL;
2287 LanguageList = &GeneralLanguageList;
2288 LanguageListType = &GeneralLanguageListType;
2289 LanguageListAltID = &GeneralLanguageListAltID;
2290 LanguageListPID = &GeneralLanguageListPID;
2291 LanguageListTokens = &GeneralLanguageListTokens;
2292 LanguageListPref = &GeneralLanguageListPref;
2295 LanguageList = &HomeLanguageList;
2296 LanguageListType = &HomeLanguageListType;
2297 LanguageListAltID = &HomeLanguageListAltID;
2298 LanguageListPID = &HomeLanguageListPID;
2299 LanguageListTokens = &HomeLanguageListTokens;
2300 LanguageListPref = &HomeLanguageListPref;
2303 LanguageList = &BusinessLanguageList;
2304 LanguageListType = &BusinessLanguageListType;
2305 LanguageListAltID = &BusinessLanguageListAltID;
2306 LanguageListPID = &BusinessLanguageListPID;
2307 LanguageListTokens = &BusinessLanguageListTokens;
2308 LanguageListPref = &BusinessLanguageListPref;
2314 std::map<int,int>::iterator SLiter;
2315 wxString PropertyData;
2316 wxString PropertyName;
2317 wxString PropertyValue;
2318 wxString PropertyTokens;
2319 bool FirstToken = TRUE;
2320 bool PropertyMatched = FALSE;
2322 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2323 intiter != SplitPoints.end(); ++intiter){
2325 SLiter = SplitLength.find(intiter->first);
2326 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2327 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2328 intPrevValue = intiter->second;
2330 CaptureString(&PropertyValue, FALSE);
2332 // Process properties.
2334 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2335 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2336 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2338 if (PropertyMatched == TRUE){
2340 PropertyMatched = FALSE;
2345 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2349 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2351 // Add the name token data.
2353 if (!PropertyTokens.IsEmpty()){
2355 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2361 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2363 std::map<int, int> SplitPoints;
2364 std::map<int, int> SplitLength;
2366 int intPrevValue = 5;
2368 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2372 PropertyType PropType = PROPERTY_NONE;
2374 // Look for type before continuing.
2376 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2378 std::map<int, wxString> *GeopositionList = NULL;
2379 std::map<int, wxString> *GeopositionListType = NULL;
2380 std::map<int, wxString> *GeopositionListAltID = NULL;
2381 std::map<int, wxString> *GeopositionListPID = NULL;
2382 std::map<int, wxString> *GeopositionListTokens = NULL;
2383 std::map<int, wxString> *GeopositionListMediatype = NULL;
2384 std::map<int, int> *GeopositionListPref = NULL;
2388 GeopositionList = &GeneralGeographyList;
2389 GeopositionListType = &GeneralGeographyListType;
2390 GeopositionListAltID = &GeneralGeographyListAltID;
2391 GeopositionListPID = &GeneralGeographyListPID;
2392 GeopositionListTokens = &GeneralGeographyListTokens;
2393 GeopositionListMediatype = &GeneralGeographyListMediatype;
2394 GeopositionListPref = &GeneralGeographyListPref;
2397 GeopositionList = &HomeGeographyList;
2398 GeopositionListType = &HomeGeographyListType;
2399 GeopositionListAltID = &HomeGeographyListAltID;
2400 GeopositionListPID = &HomeGeographyListPID;
2401 GeopositionListTokens = &HomeGeographyListTokens;
2402 GeopositionListMediatype = &HomeGeographyListMediatype;
2403 GeopositionListPref = &HomeGeographyListPref;
2406 GeopositionList = &BusinessGeographyList;
2407 GeopositionListType = &BusinessGeographyListType;
2408 GeopositionListAltID = &BusinessGeographyListAltID;
2409 GeopositionListPID = &BusinessGeographyListPID;
2410 GeopositionListTokens = &BusinessGeographyListTokens;
2411 GeopositionListMediatype = &BusinessGeographyListMediatype;
2412 GeopositionListPref = &BusinessGeographyListPref;
2418 std::map<int,int>::iterator SLiter;
2419 wxString PropertyData;
2420 wxString PropertyName;
2421 wxString PropertyValue;
2422 wxString PropertyTokens;
2423 bool FirstToken = TRUE;
2424 bool PropertyMatched = FALSE;
2426 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2427 intiter != SplitPoints.end(); ++intiter){
2429 SLiter = SplitLength.find(intiter->first);
2430 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2431 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2432 intPrevValue = intiter->second;
2434 CaptureString(&PropertyValue, FALSE);
2436 // Process properties.
2438 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2439 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2440 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2441 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2443 if (PropertyMatched == TRUE){
2445 PropertyMatched = FALSE;
2450 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2454 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2456 // Add the name token data.
2458 if (!PropertyTokens.IsEmpty()){
2460 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2466 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2468 size_t intPropertyLen = PropertySeg1.Len();
2469 std::map<int, int> SplitPoints;
2470 std::map<int, int> SplitLength;
2471 std::map<int, int>::iterator SLiter;
2472 wxString PropertyData;
2473 wxString PropertyName;
2474 wxString PropertyValue;
2475 wxString PropertyTokens;
2476 wxString RelatedType;
2477 wxString RelatedTypeOriginal;
2478 wxString RelatedName;
2479 bool FirstToken = TRUE;
2480 int intSplitsFound = 0;
2481 int intSplitSize = 0;
2482 int intPrevValue = 9;
2484 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2488 // Look for type before continuing.
2490 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2491 intiter != SplitPoints.end(); ++intiter){
2493 SLiter = SplitLength.find(intiter->first);
2494 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2495 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2496 intPrevValue = intiter->second;
2500 RelatedTypeOriginal = PropertyValue;
2502 if (PropertyName == wxT("TYPE")){
2504 if (PropertyValue == wxT("contact")){
2506 RelatedType = _("Contact");
2508 } else if (PropertyValue == wxT("acquaintance")){
2510 RelatedType = _("Acquaintance");
2512 } else if (PropertyValue == wxT("friend")){
2514 RelatedType = _("Friend");
2516 } else if (PropertyValue == wxT("met")){
2518 RelatedType = _("Met");
2520 } else if (PropertyValue == wxT("co-worker")){
2522 RelatedType = _("Co-worker");
2524 } else if (PropertyValue == wxT("colleague")){
2526 RelatedType = _("Colleague");
2528 } else if (PropertyValue == wxT("co-resident")){
2530 RelatedType = _("Co-resident");
2532 } else if (PropertyValue == wxT("neighbor")){
2534 RelatedType = _("Neighbour");
2536 } else if (PropertyValue == wxT("child")){
2538 RelatedType = _("Child");
2540 } else if (PropertyValue == wxT("parent")){
2542 RelatedType = _("Parent");
2544 } else if (PropertyValue == wxT("sibling")){
2546 RelatedType = _("Sibling");
2548 } else if (PropertyValue == wxT("spouse")){
2550 RelatedType = _("Spouse");
2552 } else if (PropertyValue == wxT("kin")){
2554 RelatedType = _("Kin");
2556 } else if (PropertyValue == wxT("muse")){
2558 RelatedType = _("Muse");
2560 } else if (PropertyValue == wxT("crush")){
2562 RelatedType = _("Crush");
2564 } else if (PropertyValue == wxT("date")){
2566 RelatedType = _("Date");
2568 } else if (PropertyValue == wxT("sweetheart")){
2570 RelatedType = _("Sweetheart");
2572 } else if (PropertyValue == wxT("me")){
2574 RelatedType = _("Me");
2576 } else if (PropertyValue == wxT("agent")){
2578 RelatedType = _("Agent");
2580 } else if (PropertyValue == wxT("emergency")){
2582 RelatedType = _("Emergency");
2586 RelatedType = PropertyValue;
2596 bool PropertyMatched = FALSE;
2598 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2599 intiter != SplitPoints.end(); ++intiter){
2601 SLiter = SplitLength.find(intiter->first);
2602 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2603 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2604 intPrevValue = intiter->second;
2606 // Process properties.
2608 size_t intPropertyValueLen = PropertyValue.Len();
2610 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2612 PropertyValue.Trim();
2613 PropertyValue.RemoveLast();
2617 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2619 PropertyValue.Remove(0, 1);
2623 CaptureString(&PropertyValue, FALSE);
2625 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2626 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2627 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2628 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2630 if (PropertyMatched == TRUE){
2632 PropertyMatched = FALSE;
2637 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2641 // Add the data to the General/Home/Work address variables.
2643 GeneralRelatedList.erase(*RelatedCount);
2644 GeneralRelatedListRelType.erase(*RelatedCount);
2645 GeneralRelatedListType.erase(*RelatedCount);
2646 GeneralRelatedListTokens.erase(*RelatedCount);
2647 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2648 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2649 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2650 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2654 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2656 std::map<int, int> SplitPoints;
2657 std::map<int, int> SplitLength;
2658 std::map<int, int>::iterator SLiter;
2659 wxString PropertyData;
2660 wxString PropertyName;
2661 wxString PropertyValue;
2662 wxString PropertyTokens;
2663 bool FirstToken = TRUE;
2664 int intPrevValue = 5;
2666 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2670 PropertyType PropType = PROPERTY_NONE;
2672 // Look for type before continuing.
2674 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2676 // Setup the pointers.
2678 std::map<int, wxString> *WebsiteList = NULL;
2679 std::map<int, wxString> *WebsiteListAltID = NULL;
2680 std::map<int, wxString> *WebsiteListPID = NULL;
2681 std::map<int, wxString> *WebsiteListType = NULL;
2682 std::map<int, wxString> *WebsiteListTokens = NULL;
2683 std::map<int, wxString> *WebsiteListMediatype = NULL;
2684 std::map<int, int> *WebsiteListPref = NULL;
2686 // Setup blank lines for later on.
2690 WebsiteList = &GeneralWebsiteList;
2691 WebsiteListType = &GeneralWebsiteListType;
2692 WebsiteListAltID = &GeneralWebsiteListAltID;
2693 WebsiteListPID = &GeneralWebsiteListPID;
2694 WebsiteListTokens = &GeneralWebsiteListTokens;
2695 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2696 WebsiteListPref = &GeneralWebsiteListPref;
2699 WebsiteList = &HomeWebsiteList;
2700 WebsiteListType = &HomeWebsiteListType;
2701 WebsiteListAltID = &HomeWebsiteListAltID;
2702 WebsiteListPID = &HomeWebsiteListPID;
2703 WebsiteListTokens = &HomeWebsiteListTokens;
2704 WebsiteListMediatype = &HomeWebsiteListMediatype;
2705 WebsiteListPref = &HomeWebsiteListPref;
2708 WebsiteList = &BusinessWebsiteList;
2709 WebsiteListType = &BusinessWebsiteListType;
2710 WebsiteListAltID = &BusinessWebsiteListAltID;
2711 WebsiteListPID = &BusinessWebsiteListPID;
2712 WebsiteListTokens = &BusinessWebsiteListTokens;
2713 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2714 WebsiteListPref = &BusinessWebsiteListPref;
2719 bool PropertyMatched = FALSE;
2721 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2722 intiter != SplitPoints.end(); ++intiter){
2724 SLiter = SplitLength.find(intiter->first);
2725 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2726 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2727 intPrevValue = intiter->second;
2729 // Process properties.
2731 size_t intPropertyValueLen = PropertyValue.Len();
2733 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2735 PropertyValue.Trim();
2736 PropertyValue.RemoveLast();
2740 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2742 PropertyValue.Remove(0, 1);
2746 CaptureString(&PropertyValue, FALSE);
2748 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2749 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2750 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2751 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2753 if (PropertyMatched == TRUE){
2755 PropertyMatched = FALSE;
2760 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2764 // Add the data to the General/Home/Work address variables.
2766 CaptureString(&PropertySeg2, FALSE);
2768 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2770 if (!PropertyTokens.IsEmpty()){
2772 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2778 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2780 std::map<int, int> SplitPoints;
2781 std::map<int, int> SplitLength;
2782 std::map<int, int>::iterator SLiter;
2783 wxString PropertyData;
2784 wxString PropertyName;
2785 wxString PropertyValue;
2786 wxString PropertyTokens;
2787 bool FirstToken = TRUE;
2788 int intPrevValue = 7;
2790 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2794 PropertyType PropType = PROPERTY_NONE;
2796 // Look for type before continuing.
2798 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2800 // Setup the pointers.
2802 std::map<int, wxString> *TitleList = NULL;
2803 std::map<int, wxString> *TitleListAltID = NULL;
2804 std::map<int, wxString> *TitleListPID = NULL;
2805 std::map<int, wxString> *TitleListType = NULL;
2806 std::map<int, wxString> *TitleListTokens = NULL;
2807 std::map<int, wxString> *TitleListLanguage = NULL;
2808 std::map<int, int> *TitleListPref = NULL;
2810 // Setup blank lines for later on.
2814 TitleList = &GeneralTitleList;
2815 TitleListType = &GeneralTitleListType;
2816 TitleListAltID = &GeneralTitleListAltID;
2817 TitleListPID = &GeneralTitleListPID;
2818 TitleListTokens = &GeneralTitleListTokens;
2819 TitleListLanguage = &GeneralTitleListLanguage;
2820 TitleListPref = &GeneralTitleListPref;
2823 TitleList = &HomeTitleList;
2824 TitleListType = &HomeTitleListType;
2825 TitleListAltID = &HomeTitleListAltID;
2826 TitleListPID = &HomeTitleListPID;
2827 TitleListTokens = &HomeTitleListTokens;
2828 TitleListLanguage = &HomeTitleListLanguage;
2829 TitleListPref = &HomeTitleListPref;
2832 TitleList = &BusinessTitleList;
2833 TitleListType = &BusinessTitleListType;
2834 TitleListAltID = &BusinessTitleListAltID;
2835 TitleListPID = &BusinessTitleListPID;
2836 TitleListTokens = &BusinessTitleListTokens;
2837 TitleListLanguage = &BusinessTitleListLanguage;
2838 TitleListPref = &BusinessTitleListPref;
2843 bool PropertyMatched = FALSE;
2845 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2846 intiter != SplitPoints.end(); ++intiter){
2848 SLiter = SplitLength.find(intiter->first);
2849 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2850 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2851 intPrevValue = intiter->second;
2853 // Process properties.
2855 size_t intPropertyValueLen = PropertyValue.Len();
2857 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2859 PropertyValue.Trim();
2860 PropertyValue.RemoveLast();
2864 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2866 PropertyValue.Remove(0, 1);
2870 CaptureString(&PropertyValue, FALSE);
2872 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2873 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2874 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2875 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2877 if (PropertyMatched == TRUE){
2879 PropertyMatched = FALSE;
2884 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2888 // Add the data to the General/Home/Work address variables.
2890 CaptureString(&PropertySeg2, FALSE);
2892 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2894 if (!PropertyTokens.IsEmpty()){
2896 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2902 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2904 std::map<int, int> SplitPoints;
2905 std::map<int, int> SplitLength;
2906 std::map<int, int>::iterator SLiter;
2907 wxString PropertyData;
2908 wxString PropertyName;
2909 wxString PropertyValue;
2910 wxString PropertyTokens;
2911 bool FirstToken = TRUE;
2912 int intPrevValue = 6;
2914 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2918 PropertyType PropType = PROPERTY_NONE;
2920 // Look for type before continuing.
2922 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2924 // Setup the pointers.
2926 std::map<int, wxString> *RoleList = NULL;
2927 std::map<int, wxString> *RoleListAltID = NULL;
2928 std::map<int, wxString> *RoleListPID = NULL;
2929 std::map<int, wxString> *RoleListType = NULL;
2930 std::map<int, wxString> *RoleListTokens = NULL;
2931 std::map<int, wxString> *RoleListLanguage = NULL;
2932 std::map<int, int> *RoleListPref = NULL;
2934 // Setup blank lines for later on.
2938 RoleList = &GeneralRoleList;
2939 RoleListType = &GeneralRoleListType;
2940 RoleListAltID = &GeneralRoleListAltID;
2941 RoleListPID = &GeneralRoleListPID;
2942 RoleListTokens = &GeneralRoleListTokens;
2943 RoleListLanguage = &GeneralRoleListLanguage;
2944 RoleListPref = &GeneralRoleListPref;
2947 RoleList = &HomeRoleList;
2948 RoleListType = &HomeRoleListType;
2949 RoleListAltID = &HomeRoleListAltID;
2950 RoleListPID = &HomeRoleListPID;
2951 RoleListTokens = &HomeRoleListTokens;
2952 RoleListLanguage = &HomeRoleListLanguage;
2953 RoleListPref = &HomeRoleListPref;
2956 RoleList = &BusinessRoleList;
2957 RoleListType = &BusinessRoleListType;
2958 RoleListAltID = &BusinessRoleListAltID;
2959 RoleListPID = &BusinessRoleListPID;
2960 RoleListTokens = &BusinessRoleListTokens;
2961 RoleListLanguage = &BusinessRoleListLanguage;
2962 RoleListPref = &BusinessRoleListPref;
2967 bool PropertyMatched = FALSE;
2969 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2970 intiter != SplitPoints.end(); ++intiter){
2972 SLiter = SplitLength.find(intiter->first);
2973 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2974 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2975 intPrevValue = intiter->second;
2977 // Process properties.
2979 size_t intPropertyValueLen = PropertyValue.Len();
2981 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2983 PropertyValue.Trim();
2984 PropertyValue.RemoveLast();
2988 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2990 PropertyValue.Remove(0, 1);
2994 CaptureString(&PropertyValue, FALSE);
2996 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
2997 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
2998 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
2999 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3001 if (PropertyMatched == TRUE){
3003 PropertyMatched = FALSE;
3008 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3012 // Add the data to the General/Home/Work address variables.
3014 CaptureString(&PropertySeg2, FALSE);
3016 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3018 if (!PropertyTokens.IsEmpty()){
3020 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3026 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3028 std::map<int, int> SplitPoints;
3029 std::map<int, int> SplitLength;
3030 std::map<int, int>::iterator SLiter;
3031 wxString PropertyData;
3032 wxString PropertyName;
3033 wxString PropertyValue;
3034 wxString PropertyTokens;
3035 bool FirstToken = TRUE;
3036 int intPrevValue = 5;
3038 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3042 PropertyType PropType = PROPERTY_NONE;
3044 // Look for type before continuing.
3046 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3048 // Setup the pointers.
3050 std::map<int, wxString> *OrganisationsList = NULL;
3051 std::map<int, wxString> *OrganisationsListAltID = NULL;
3052 std::map<int, wxString> *OrganisationsListPID = NULL;
3053 std::map<int, wxString> *OrganisationsListType = NULL;
3054 std::map<int, wxString> *OrganisationsListTokens = NULL;
3055 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3056 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3057 std::map<int, int> *OrganisationsListPref = NULL;
3059 // Setup blank lines for later on.
3063 OrganisationsList = &GeneralOrganisationsList;
3064 OrganisationsListType = &GeneralOrganisationsListType;
3065 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3066 OrganisationsListPID = &GeneralOrganisationsListPID;
3067 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3068 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3069 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3070 OrganisationsListPref = &GeneralOrganisationsListPref;
3073 OrganisationsList = &HomeOrganisationsList;
3074 OrganisationsListType = &HomeOrganisationsListType;
3075 OrganisationsListAltID = &HomeOrganisationsListAltID;
3076 OrganisationsListPID = &HomeOrganisationsListPID;
3077 OrganisationsListTokens = &HomeOrganisationsListTokens;
3078 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3079 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3080 OrganisationsListPref = &HomeOrganisationsListPref;
3083 OrganisationsList = &BusinessOrganisationsList;
3084 OrganisationsListType = &BusinessOrganisationsListType;
3085 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3086 OrganisationsListPID = &BusinessOrganisationsListPID;
3087 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3088 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3089 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3090 OrganisationsListPref = &BusinessOrganisationsListPref;
3095 bool PropertyMatched = FALSE;
3097 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3098 intiter != SplitPoints.end(); ++intiter){
3100 SLiter = SplitLength.find(intiter->first);
3101 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3102 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3103 intPrevValue = intiter->second;
3105 // Process properties.
3107 size_t intPropertyValueLen = PropertyValue.Len();
3109 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3111 PropertyValue.Trim();
3112 PropertyValue.RemoveLast();
3116 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3118 PropertyValue.Remove(0, 1);
3122 CaptureString(&PropertyValue, FALSE);
3124 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3125 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3126 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3127 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3128 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3130 if (PropertyMatched == TRUE){
3132 PropertyMatched = FALSE;
3137 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3141 // Add the data to the General/Home/Work address variables.
3143 CaptureString(&PropertySeg2, FALSE);
3145 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3147 if (!PropertyTokens.IsEmpty()){
3149 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3155 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3157 std::map<int, int> SplitPoints;
3158 std::map<int, int> SplitLength;
3159 std::map<int, int>::iterator SLiter;
3160 wxString PropertyData;
3161 wxString PropertyName;
3162 wxString PropertyValue;
3163 wxString PropertyTokens;
3164 bool FirstToken = TRUE;
3165 int intPrevValue = 6;
3167 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3171 PropertyType PropType = PROPERTY_NONE;
3173 // Look for type before continuing.
3175 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3177 // Setup the pointers.
3179 std::map<int, wxString> *NoteList = NULL;
3180 std::map<int, wxString> *NoteListAltID = NULL;
3181 std::map<int, wxString> *NoteListPID = NULL;
3182 std::map<int, wxString> *NoteListType = NULL;
3183 std::map<int, wxString> *NoteListTokens = NULL;
3184 std::map<int, wxString> *NoteListLanguage = NULL;
3185 std::map<int, int> *NoteListPref = NULL;
3187 // Setup blank lines for later on.
3191 NoteList = &GeneralNoteList;
3192 NoteListType = &GeneralNoteListType;
3193 NoteListAltID = &GeneralNoteListAltID;
3194 NoteListPID = &GeneralNoteListPID;
3195 NoteListTokens = &GeneralNoteListTokens;
3196 NoteListLanguage = &GeneralNoteListLanguage;
3197 NoteListPref = &GeneralNoteListPref;
3200 NoteList = &HomeNoteList;
3201 NoteListType = &HomeNoteListType;
3202 NoteListAltID = &HomeNoteListAltID;
3203 NoteListPID = &HomeNoteListPID;
3204 NoteListTokens = &HomeNoteListTokens;
3205 NoteListLanguage = &HomeNoteListLanguage;
3206 NoteListPref = &HomeNoteListPref;
3209 NoteList = &BusinessNoteList;
3210 NoteListType = &BusinessNoteListType;
3211 NoteListAltID = &BusinessNoteListAltID;
3212 NoteListPID = &BusinessNoteListPID;
3213 NoteListTokens = &BusinessNoteListTokens;
3214 NoteListLanguage = &BusinessNoteListLanguage;
3215 NoteListPref = &BusinessNoteListPref;
3220 bool PropertyMatched = FALSE;
3222 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3223 intiter != SplitPoints.end(); ++intiter){
3225 SLiter = SplitLength.find(intiter->first);
3226 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3227 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3228 intPrevValue = intiter->second;
3230 // Process properties.
3232 size_t intPropertyValueLen = PropertyValue.Len();
3234 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3236 PropertyValue.Trim();
3237 PropertyValue.RemoveLast();
3241 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3243 PropertyValue.Remove(0, 1);
3247 CaptureString(&PropertyValue, FALSE);
3249 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3250 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3251 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3252 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3254 if (PropertyMatched == TRUE){
3256 PropertyMatched = FALSE;
3261 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3265 // Add the data to the General/Home/Work address variables.
3267 CaptureString(&PropertySeg2, FALSE);
3269 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3271 if (!PropertyTokens.IsEmpty()){
3273 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3279 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3281 std::map<int, int> SplitPoints;
3282 std::map<int, int> SplitLength;
3283 std::map<int, int>::iterator SLiter;
3284 wxString PropertyData;
3285 wxString PropertyName;
3286 wxString PropertyValue;
3287 wxString PropertyTokens;
3288 bool FirstToken = TRUE;
3289 int intPrevValue = 12;
3291 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3295 PropertyType PropType = PROPERTY_NONE;
3297 // Look for type before continuing.
3299 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3301 // Setup blank lines for later on.
3307 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3310 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3315 bool PropertyMatched = FALSE;
3317 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3318 intiter != SplitPoints.end(); ++intiter){
3320 SLiter = SplitLength.find(intiter->first);
3321 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3322 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3323 intPrevValue = intiter->second;
3325 // Process properties.
3327 size_t intPropertyValueLen = PropertyValue.Len();
3329 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3331 PropertyValue.Trim();
3332 PropertyValue.RemoveLast();
3336 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3338 PropertyValue.Remove(0, 1);
3342 CaptureString(&PropertyValue, FALSE);
3344 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3345 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3346 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3347 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3349 if (PropertyMatched == TRUE){
3351 PropertyMatched = FALSE;
3356 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3360 // Deal with multiple categories.
3362 int intOrigCatCount = *CategoryCount;
3363 bool FirstCategoryProcessed = TRUE;
3364 bool AfterFirstToken = FALSE;
3365 int intSplitSize = 0;
3366 int intSplitsFound = 0;
3367 int intSplitSeek = 0;
3368 int intPropertyLen = PropertySeg2.Len();
3370 SplitPoints.clear();
3371 SplitLength.clear();
3374 for (int i = 0; i <= intPropertyLen; i++){
3376 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3384 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3386 if (AfterFirstToken == TRUE){
3388 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3389 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3393 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3394 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3395 AfterFirstToken = TRUE;
3407 if (SplitPoints.size() > 0){
3409 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3410 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3414 if (SplitPoints.size() == 0){
3416 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3418 if (!PropertyTokens.IsEmpty()){
3420 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3426 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3427 intiter != SplitPoints.end(); ++intiter){
3429 SLiter = SplitLength.find(intiter->first);
3431 intPrevValue = intiter->second;
3433 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3435 // Add the data to the General/Home/Work address variables.
3437 // Trim any whitespace from the start and end.
3439 PropertyData = PropertyData.Trim(FALSE);
3440 PropertyData = PropertyData.Trim(TRUE);
3442 CaptureString(&PropertyData, FALSE);
3444 if (FirstCategoryProcessed == TRUE){
3446 FirstCategoryProcessed = FALSE;
3448 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3450 if (!PropertyTokens.IsEmpty()){
3452 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3462 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3464 if (!PropertyTokens.IsEmpty()){
3466 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3472 // Copy the properties to each of the categories (if it exists).
3474 if (!PropertyTokens.IsEmpty()){
3476 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3480 // Check if ALTID was used.
3482 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3484 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3488 // Check if PID was used.
3490 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3492 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3496 // Check if PREF was used.
3498 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3500 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3504 // Check if LANGUAGE was used.
3506 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3508 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3512 // Check if TYPE was used.
3518 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3521 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3529 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3531 size_t intPropertyLen = PropertySeg1.Len();
3532 std::map<int, int> SplitPoints;
3533 std::map<int, int> SplitLength;
3534 std::map<int, int>::iterator SLiter;
3535 wxString PropertyData;
3536 wxString PropertyName;
3537 wxString PropertyValue;
3538 wxString PropertyTokens;
3539 bool FirstToken = TRUE;
3540 int intSplitsFound = 0;
3541 int intSplitSize = 0;
3542 int intPrevValue = 7;
3544 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3548 PropertyType PropType = PROPERTY_NONE;
3550 // Look for type before continuing.
3552 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3555 bool PropertyMatched = FALSE;
3557 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3558 intiter != SplitPoints.end(); ++intiter){
3560 SLiter = SplitLength.find(intiter->first);
3561 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3562 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3563 intPrevValue = intiter->second;
3565 // Process properties.
3567 size_t intPropertyValueLen = PropertyValue.Len();
3569 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3571 PropertyValue.Trim();
3572 PropertyValue.RemoveLast();
3576 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3578 PropertyValue.Remove(0, 1);
3582 CaptureString(&PropertyValue, FALSE);
3584 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3585 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3586 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3587 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3589 if (PropertyMatched == TRUE){
3591 PropertyMatched = FALSE;
3596 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3600 intPropertyLen = PropertySeg2.Len();
3601 SplitPoints.clear();
3602 SplitLength.clear();
3607 CaptureString(&PropertySeg2, FALSE);
3609 for (int i = 0; i <= intPropertyLen; i++){
3613 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3616 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3618 if (intSplitsFound == 6){
3620 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3625 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3635 wxString wxSPhotoURI;
3636 wxString wxSPhotoMIME;
3637 wxString wxSPhotoEncoding;
3638 wxString wxSPhotoData;
3639 std::string base64enc;
3641 if (intSplitsFound == 0){
3645 std::map<int, int>::iterator striter;
3647 striter = SplitLength.find(1);
3649 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3651 while (wSTDataType.HasMoreTokens() == TRUE){
3653 wxSPhotoURI = wSTDataType.GetNextToken();
3654 wxSPhotoMIME = wSTDataType.GetNextToken();
3659 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3661 while (wSTDataInfo.HasMoreTokens() == TRUE){
3663 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3664 wxSPhotoData = wSTDataInfo.GetNextToken();
3665 base64enc = wxSPhotoData.mb_str();
3672 // Add the data to the General/Home/Work address variables.
3674 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3675 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3676 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3682 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3685 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3689 if (!PropertyTokens.IsEmpty()){
3691 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3697 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3699 size_t intPropertyLen = PropertySeg1.Len();
3700 std::map<int, int> SplitPoints;
3701 std::map<int, int> SplitLength;
3702 std::map<int, int>::iterator SLiter;
3703 wxString PropertyData;
3704 wxString PropertyName;
3705 wxString PropertyValue;
3706 wxString PropertyTokens;
3707 bool FirstToken = TRUE;
3708 int intSplitsFound = 0;
3709 int intSplitSize = 0;
3710 int intPrevValue = 6;
3712 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3716 PropertyType PropType = PROPERTY_NONE;
3718 // Look for type before continuing.
3720 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3723 bool PropertyMatched = FALSE;
3725 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3726 intiter != SplitPoints.end(); ++intiter){
3728 SLiter = SplitLength.find(intiter->first);
3729 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3730 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3731 intPrevValue = intiter->second;
3733 // Process properties.
3735 size_t intPropertyValueLen = PropertyValue.Len();
3737 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3739 PropertyValue.Trim();
3740 PropertyValue.RemoveLast();
3744 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3746 PropertyValue.Remove(0, 1);
3750 CaptureString(&PropertyValue, FALSE);
3752 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3753 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3754 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3755 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3757 if (PropertyMatched == TRUE){
3759 PropertyMatched = FALSE;
3764 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3768 intPropertyLen = PropertySeg2.Len();
3769 SplitPoints.clear();
3770 SplitLength.clear();
3775 CaptureString(&PropertySeg2, FALSE);
3777 for (int i = 0; i <= intPropertyLen; i++){
3781 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3784 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3786 if (intSplitsFound == 6){
3788 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3793 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3803 wxString wxSPhotoURI;
3804 wxString wxSPhotoMIME;
3805 wxString wxSPhotoEncoding;
3806 wxString wxSPhotoData;
3807 std::string base64enc;
3809 if (intSplitsFound == 0){
3813 std::map<int, int>::iterator striter;
3815 striter = SplitLength.find(1);
3817 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3819 while (wSTDataType.HasMoreTokens() == TRUE){
3821 wxSPhotoURI = wSTDataType.GetNextToken();
3822 wxSPhotoMIME = wSTDataType.GetNextToken();
3827 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3829 while (wSTDataInfo.HasMoreTokens() == TRUE){
3831 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3832 wxSPhotoData = wSTDataInfo.GetNextToken();
3833 base64enc = wxSPhotoData.mb_str();
3840 // Add the data to the General/Home/Work address variables.
3842 LogosList.insert(std::make_pair(*LogoCount, base64enc));
3843 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3844 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3850 LogosListType.insert(std::make_pair(*LogoCount, "home"));
3853 LogosListType.insert(std::make_pair(*LogoCount, "work"));
3857 if (!PropertyTokens.IsEmpty()){
3859 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3865 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3867 size_t intPropertyLen = PropertySeg1.Len();
3868 std::map<int, int> SplitPoints;
3869 std::map<int, int> SplitLength;
3870 std::map<int, int>::iterator SLiter;
3871 wxString PropertyData;
3872 wxString PropertyName;
3873 wxString PropertyValue;
3874 wxString PropertyTokens;
3875 bool FirstToken = TRUE;
3876 int intSplitsFound = 0;
3877 int intSplitSize = 0;
3878 int intPrevValue = 7;
3880 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3884 PropertyType PropType = PROPERTY_NONE;
3886 // Look for type before continuing.
3888 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3891 bool PropertyMatched = FALSE;
3893 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3894 intiter != SplitPoints.end(); ++intiter){
3896 SLiter = SplitLength.find(intiter->first);
3897 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3898 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3899 intPrevValue = intiter->second;
3901 // Process properties.
3903 size_t intPropertyValueLen = PropertyValue.Len();
3905 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3907 PropertyValue.Trim();
3908 PropertyValue.RemoveLast();
3912 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3914 PropertyValue.Remove(0, 1);
3918 CaptureString(&PropertyValue, FALSE);
3920 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
3921 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
3922 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
3923 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
3924 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
3926 if (PropertyMatched == TRUE){
3928 PropertyMatched = FALSE;
3933 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3937 intPropertyLen = PropertySeg2.Len();
3938 SplitPoints.clear();
3939 SplitLength.clear();
3944 CaptureString(&PropertySeg2, FALSE);
3946 for (int i = 0; i <= intPropertyLen; i++){
3950 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3953 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3955 if (intSplitsFound == 6){
3957 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3962 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3972 wxString wxSSoundURI;
3973 wxString wxSSoundMIME;
3974 wxString wxSSoundEncoding;
3975 wxString wxSSoundData;
3976 std::string base64enc;
3978 if (intSplitsFound == 0){
3982 std::map<int, int>::iterator striter;
3984 striter = SplitLength.find(1);
3986 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3988 while (wSTDataType.HasMoreTokens() == TRUE){
3990 wxSSoundURI = wSTDataType.GetNextToken();
3991 wxSSoundMIME = wSTDataType.GetNextToken();
3996 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3998 while (wSTDataInfo.HasMoreTokens() == TRUE){
4000 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4001 wxSSoundData = wSTDataInfo.GetNextToken();
4002 base64enc = wxSSoundData.mb_str();
4009 // Add the data to the General/Home/Work address variables.
4015 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4018 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4022 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4023 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4024 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4026 if (!PropertyTokens.IsEmpty()){
4028 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4034 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4036 size_t intPropertyLen = PropertySeg1.Len();
4037 std::map<int, int> SplitPoints;
4038 std::map<int, int> SplitLength;
4039 std::map<int, int>::iterator SLiter;
4040 wxString PropertyData;
4041 wxString PropertyName;
4042 wxString PropertyValue;
4043 wxString PropertyTokens;
4044 bool FirstToken = TRUE;
4045 int intSplitsFound = 0;
4046 int intSplitSize = 0;
4047 int intPrevValue = 8;
4049 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4053 PropertyType PropType = PROPERTY_NONE;
4055 // Look for type before continuing.
4057 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4060 bool PropertyMatched = FALSE;
4062 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4063 intiter != SplitPoints.end(); ++intiter){
4065 SLiter = SplitLength.find(intiter->first);
4066 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4067 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4068 intPrevValue = intiter->second;
4070 // Process properties.
4072 size_t intPropertyValueLen = PropertyValue.Len();
4074 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4076 PropertyValue.Trim();
4077 PropertyValue.RemoveLast();
4081 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4083 PropertyValue.Remove(0, 1);
4087 CaptureString(&PropertyValue, FALSE);
4089 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4090 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4091 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4092 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4094 if (PropertyMatched == TRUE){
4096 PropertyMatched = FALSE;
4101 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4105 intPropertyLen = PropertySeg2.Len();
4106 SplitPoints.clear();
4107 SplitLength.clear();
4112 CaptureString(&PropertySeg2, FALSE);
4114 // Add the data to the General/Home/Work address variables.
4120 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4123 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4127 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4129 if (!PropertyTokens.IsEmpty()){
4131 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4137 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4139 size_t intPropertyLen = PropertySeg1.Len();
4140 std::map<int, int> SplitPoints;
4141 std::map<int, int> SplitLength;
4142 std::map<int, int>::iterator SLiter;
4143 wxString PropertyData;
4144 wxString PropertyName;
4145 wxString PropertyValue;
4146 wxString PropertyTokens;
4147 bool FirstToken = TRUE;
4148 int intSplitsFound = 0;
4149 int intSplitSize = 0;
4150 int intPrevValue = 8;
4152 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4156 PropertyType PropType = PROPERTY_NONE;
4158 // Look for type before continuing.
4160 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4163 bool PropertyMatched = FALSE;
4165 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4166 intiter != SplitPoints.end(); ++intiter){
4168 SLiter = SplitLength.find(intiter->first);
4169 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4170 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4171 intPrevValue = intiter->second;
4173 // Process properties.
4175 size_t intPropertyValueLen = PropertyValue.Len();
4177 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4179 PropertyValue.Trim();
4180 PropertyValue.RemoveLast();
4184 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4186 PropertyValue.Remove(0, 1);
4190 CaptureString(&PropertyValue, FALSE);
4192 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4193 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4194 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4195 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4197 if (PropertyMatched == TRUE){
4199 PropertyMatched = FALSE;
4204 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4208 intPropertyLen = PropertySeg2.Len();
4209 SplitPoints.clear();
4210 SplitLength.clear();
4215 CaptureString(&PropertySeg2, FALSE);
4217 // Add the data to the General/Home/Work address variables.
4223 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4226 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4230 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4232 if (!PropertyTokens.IsEmpty()){
4234 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4240 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4242 size_t intPropertyLen = PropertySeg1.Len();
4243 std::map<int, int> SplitPoints;
4244 std::map<int, int> SplitLength;
4245 std::map<int, int>::iterator SLiter;
4246 wxString PropertyData;
4247 wxString PropertyName;
4248 wxString PropertyValue;
4249 wxString PropertyTokens;
4250 bool FirstToken = TRUE;
4251 int intSplitsFound = 0;
4252 int intSplitSize = 0;
4253 int intPrevValue = 7;
4255 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4259 PropertyType PropType = PROPERTY_NONE;
4261 // Look for type before continuing.
4263 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4266 bool PropertyMatched = FALSE;
4268 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4269 intiter != SplitPoints.end(); ++intiter){
4271 SLiter = SplitLength.find(intiter->first);
4272 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4273 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4274 intPrevValue = intiter->second;
4276 // Process properties.
4278 size_t intPropertyValueLen = PropertyValue.Len();
4280 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4282 PropertyValue.Trim();
4283 PropertyValue.RemoveLast();
4287 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4289 PropertyValue.Remove(0, 1);
4293 CaptureString(&PropertyValue, FALSE);
4295 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4296 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4297 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4298 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4300 if (PropertyMatched == TRUE){
4302 PropertyMatched = FALSE;
4307 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4311 intPropertyLen = PropertySeg2.Len();
4312 SplitPoints.clear();
4313 SplitLength.clear();
4318 CaptureString(&PropertySeg2, FALSE);
4320 // Add the data to the General/Home/Work address variables.
4326 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4329 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4333 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4335 if (!PropertyTokens.IsEmpty()){
4337 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4343 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4345 size_t intPropertyLen = PropertySeg1.Len();
4346 std::map<int, int> SplitPoints;
4347 std::map<int, int> SplitLength;
4348 std::map<int, int>::iterator SLiter;
4349 wxString PropertyData;
4350 wxString PropertyName;
4351 wxString PropertyValue;
4352 wxString PropertyTokens;
4353 bool FirstToken = TRUE;
4354 int intSplitsFound = 0;
4355 int intSplitSize = 0;
4356 int intPrevValue = 5;
4358 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4362 PropertyType PropType = PROPERTY_NONE;
4364 // Look for type before continuing.
4366 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4369 bool PropertyMatched = FALSE;
4371 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4372 intiter != SplitPoints.end(); ++intiter){
4374 SLiter = SplitLength.find(intiter->first);
4375 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4376 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4377 intPrevValue = intiter->second;
4379 // Process properties.
4381 size_t intPropertyValueLen = PropertyValue.Len();
4383 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4385 PropertyValue.Trim();
4386 PropertyValue.RemoveLast();
4390 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4392 PropertyValue.Remove(0, 1);
4396 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4397 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4398 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4400 if (PropertyMatched == TRUE){
4402 PropertyMatched = FALSE;
4407 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4411 intPropertyLen = PropertySeg2.Len();
4412 SplitPoints.clear();
4413 SplitLength.clear();
4418 for (int i = 0; i <= intPropertyLen; i++){
4422 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4425 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4427 if (intSplitsFound == 6){
4429 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4434 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4445 wxString wxSKeyMIME;
4446 wxString wxSKeyEncoding;
4447 wxString wxSKeyData;
4448 std::string base64enc;
4450 if (intSplitsFound == 0){
4454 std::map<int, int>::iterator striter;
4456 striter = SplitLength.find(1);
4458 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4460 while (wSTDataType.HasMoreTokens() == TRUE){
4462 wxSKeyURI = wSTDataType.GetNextToken();
4463 wxSKeyMIME = wSTDataType.GetNextToken();
4468 if (wxSKeyURI == wxT("data")){
4470 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4472 while (wSTDataInfo.HasMoreTokens() == TRUE){
4474 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4475 wxSKeyData = wSTDataInfo.GetNextToken();
4484 // Add the data to the General/Home/Work address variables.
4486 if (wxSKeyURI == wxT("data")){
4488 KeyListDataEncType.erase(*KeyCount);
4489 KeyListKeyType.erase(*KeyCount);
4490 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4491 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4493 KeyList.erase(*KeyCount);
4494 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4498 KeyList.erase(*KeyCount);
4499 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4503 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4509 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4512 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4516 if (!PropertyTokens.IsEmpty()){
4518 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4524 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4526 // Split the Vendor three ways.
4528 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4531 wxString wxSVNDPropName;
4533 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4535 wSTVendorDetails.GetNextToken();
4536 wxSVNDID = wSTVendorDetails.GetNextToken();
4537 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4542 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4544 // Add the data to the vendor variables.
4546 VendorList.erase(*VendorCount);
4547 VendorListPEN.erase(*VendorCount);
4548 VendorListElement.erase(*VendorCount);
4550 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4551 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4552 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4558 void ContactDataObject::ClearData(){
4561 NameForename.clear();
4562 NameSurname.clear();
4563 NameOtherNames.clear();
4565 NameNickname.clear();
4566 NameDisplayAs.clear();
4567 NameLanguage.clear();
4572 BirthdayAltID.clear();
4573 BirthdayCalScale.clear();
4574 BirthdayTokens.clear();
4575 Anniversary.clear();
4576 AnniversaryAltID.clear();
4577 AnniversaryCalScale.clear();
4578 AnniversaryTokens.clear();
4581 GenderDetails.clear();
4582 GenderTokens.clear();
4586 RevisionTokens.clear();
4589 SourceListAltID.clear();
4590 SourceListPID.clear();
4591 SourceListType.clear();
4592 SourceListTokens.clear();
4593 SourceListMediatype.clear();
4594 SourceListPref.clear();
4597 XMLListAltID.clear();
4599 ClientPIDList.clear();
4600 ClientPIDListTokens.clear();
4602 FullNamesList.clear();
4603 FullNamesListType.clear();
4604 FullNamesListLanguage.clear();
4605 FullNamesListAltID.clear();
4606 FullNamesListPID.clear();
4607 FullNamesListTokens.clear();
4608 FullNamesListPref.clear();
4610 GeneralNicknamesList.clear();
4611 GeneralNicknamesListType.clear();
4612 GeneralNicknamesListLanguage.clear();
4613 GeneralNicknamesListAltID.clear();
4614 GeneralNicknamesListPID.clear();
4615 GeneralNicknamesListTokens.clear();
4616 GeneralNicknamesListPref.clear();
4618 GeneralAddressList.clear();
4619 GeneralAddressListTown.clear();
4620 GeneralAddressListCounty.clear();
4621 GeneralAddressListPostCode.clear();
4622 GeneralAddressListCountry.clear();
4623 GeneralAddressListLabel.clear();
4624 GeneralAddressListLang.clear();
4625 GeneralAddressListAltID.clear();
4626 GeneralAddressListPID.clear();
4627 GeneralAddressListTokens.clear();
4628 GeneralAddressListGeo.clear();
4629 GeneralAddressListTimezone.clear();
4630 GeneralAddressListType.clear();
4631 GeneralAddressListMediatype.clear();
4632 GeneralAddressListPref.clear();
4634 GeneralEmailList.clear();
4635 GeneralEmailListAltID.clear();
4636 GeneralEmailListPID.clear();
4637 GeneralEmailListType.clear();
4638 GeneralEmailListTokens.clear();
4639 GeneralEmailListPref.clear();
4641 GeneralIMList.clear();
4642 GeneralIMListAltID.clear();
4643 GeneralIMListPID.clear();
4644 GeneralIMListType.clear();
4645 GeneralIMListTypeInfo.clear();
4646 GeneralIMListTokens.clear();
4647 GeneralIMListMediatype.clear();
4648 GeneralIMListPref.clear();
4650 GeneralTelephoneList.clear();
4651 GeneralTelephoneListAltID.clear();
4652 GeneralTelephoneListPID.clear();
4653 GeneralTelephoneListType.clear();
4654 GeneralTelephoneListTokens.clear();
4655 GeneralTelephoneListTypeInfo.clear();
4656 GeneralTelephoneListPref.clear();
4658 GeneralLanguageList.clear();
4659 GeneralLanguageListAltID.clear();
4660 GeneralLanguageListPID.clear();
4661 GeneralLanguageListType.clear();
4662 GeneralLanguageListTokens.clear();
4663 GeneralLanguageListPref.clear();
4665 GeneralTZList.clear();
4666 GeneralTZListAltID.clear();
4667 GeneralTZListPID.clear();
4668 GeneralTZListType.clear();
4669 GeneralTZListTokens.clear();
4670 GeneralTZListMediatype.clear();
4671 GeneralTZListPref.clear();
4673 GeneralGeographyList.clear();
4674 GeneralGeographyListAltID.clear();
4675 GeneralGeographyListPID.clear();
4676 GeneralGeographyListType.clear();
4677 GeneralGeographyListTokens.clear();
4678 GeneralGeographyListMediatype.clear();
4679 GeneralGeographyListPref.clear();
4681 GeneralRelatedList.clear();
4682 GeneralRelatedListRelType.clear();
4683 GeneralRelatedListLanguage.clear();
4684 GeneralRelatedListAltID.clear();
4685 GeneralRelatedListPID.clear();
4686 GeneralRelatedListType.clear();
4687 GeneralRelatedListTokens.clear();
4688 GeneralRelatedListPref.clear();
4690 GeneralWebsiteList.clear();
4691 GeneralWebsiteListAltID.clear();
4692 GeneralWebsiteListPID.clear();
4693 GeneralWebsiteListType.clear();
4694 GeneralWebsiteListTokens.clear();
4695 GeneralWebsiteListMediatype.clear();
4696 GeneralWebsiteListPref.clear();
4698 GeneralTitleList.clear();
4699 GeneralTitleListLanguage.clear();
4700 GeneralTitleListAltID.clear();
4701 GeneralTitleListPID.clear();
4702 GeneralTitleListType.clear();
4703 GeneralTitleListTokens.clear();
4704 GeneralTitleListPref.clear();
4706 GeneralRoleList.clear();
4707 GeneralRoleListLanguage.clear();
4708 GeneralRoleListAltID.clear();
4709 GeneralRoleListPID.clear();
4710 GeneralRoleListType.clear();
4711 GeneralRoleListTokens.clear();
4712 GeneralRoleListPref.clear();
4714 GeneralOrganisationsList.clear();
4715 GeneralOrganisationsListLanguage.clear();
4716 GeneralOrganisationsListAltID.clear();
4717 GeneralOrganisationsListPID.clear();
4718 GeneralOrganisationsListType.clear();
4719 GeneralOrganisationsListTokens.clear();
4720 GeneralOrganisationsListSortAs.clear();
4721 GeneralOrganisationsListPref.clear();
4723 GeneralNoteList.clear();
4724 GeneralNoteListLanguage.clear();
4725 GeneralNoteListAltID.clear();
4726 GeneralNoteListPID.clear();
4727 GeneralNoteListType.clear();
4728 GeneralNoteListTokens.clear();
4729 GeneralNoteListPref.clear();
4731 /* Items on Home Tab */
4733 HomeNicknamesList.clear();
4734 HomeNicknamesListType.clear();
4735 HomeNicknamesListLanguage.clear();
4736 HomeNicknamesListAltID.clear();
4737 HomeNicknamesListPID.clear();
4738 HomeNicknamesListTokens.clear();
4739 HomeNicknamesListPref.clear();
4741 HomeAddressList.clear();
4742 HomeAddressListTown.clear();
4743 HomeAddressListCounty.clear();
4744 HomeAddressListPostCode.clear();
4745 HomeAddressListCountry.clear();
4746 HomeAddressListLabel.clear();
4747 HomeAddressListLang.clear();
4748 HomeAddressListAltID.clear();
4749 HomeAddressListPID.clear();
4750 HomeAddressListTokens.clear();
4751 HomeAddressListGeo.clear();
4752 HomeAddressListTimezone.clear();
4753 HomeAddressListType.clear();
4754 HomeAddressListMediatype.clear();
4755 HomeAddressListPref.clear();
4757 HomeEmailList.clear();
4758 HomeEmailListAltID.clear();
4759 HomeEmailListPID.clear();
4760 HomeEmailListType.clear();
4761 HomeEmailListTokens.clear();
4762 HomeEmailListPref.clear();
4765 HomeIMListAltID.clear();
4766 HomeIMListPID.clear();
4767 HomeIMListType.clear();
4768 HomeIMListTypeInfo.clear();
4769 HomeIMListTokens.clear();
4770 HomeIMListMediatype.clear();
4771 HomeIMListPref.clear();
4773 HomeTelephoneList.clear();
4774 HomeTelephoneListAltID.clear();
4775 HomeTelephoneListPID.clear();
4776 HomeTelephoneListType.clear();
4777 HomeTelephoneListTokens.clear();
4778 HomeTelephoneListTypeInfo.clear();
4779 HomeTelephoneListPref.clear();
4781 HomeLanguageList.clear();
4782 HomeLanguageListAltID.clear();
4783 HomeLanguageListPID.clear();
4784 HomeLanguageListType.clear();
4785 HomeLanguageListTokens.clear();
4786 HomeLanguageListPref.clear();
4789 HomeTZListAltID.clear();
4790 HomeTZListPID.clear();
4791 HomeTZListType.clear();
4792 HomeTZListTokens.clear();
4793 HomeTZListMediatype.clear();
4794 HomeTZListPref.clear();
4796 HomeGeographyList.clear();
4797 HomeGeographyListAltID.clear();
4798 HomeGeographyListPID.clear();
4799 HomeGeographyListType.clear();
4800 HomeGeographyListTokens.clear();
4801 HomeGeographyListMediatype.clear();
4802 HomeGeographyListPref.clear();
4804 HomeWebsiteList.clear();
4805 HomeWebsiteListAltID.clear();
4806 HomeWebsiteListPID.clear();
4807 HomeWebsiteListType.clear();
4808 HomeWebsiteListTokens.clear();
4809 HomeWebsiteListMediatype.clear();
4810 HomeWebsiteListPref.clear();
4812 HomeTitleList.clear();
4813 HomeTitleListLanguage.clear();
4814 HomeTitleListAltID.clear();
4815 HomeTitleListPID.clear();
4816 HomeTitleListType.clear();
4817 HomeTitleListTokens.clear();
4818 HomeTitleListPref.clear();
4820 HomeRoleList.clear();
4821 HomeRoleListLanguage.clear();
4822 HomeRoleListAltID.clear();
4823 HomeRoleListPID.clear();
4824 HomeRoleListType.clear();
4825 HomeRoleListTokens.clear();
4826 HomeRoleListPref.clear();
4828 HomeOrganisationsList.clear();
4829 HomeOrganisationsListLanguage.clear();
4830 HomeOrganisationsListAltID.clear();
4831 HomeOrganisationsListPID.clear();
4832 HomeOrganisationsListType.clear();
4833 HomeOrganisationsListTokens.clear();
4834 HomeOrganisationsListSortAs.clear();
4835 HomeOrganisationsListPref.clear();
4837 HomeNoteList.clear();
4838 HomeNoteListLanguage.clear();
4839 HomeNoteListAltID.clear();
4840 HomeNoteListPID.clear();
4841 HomeNoteListType.clear();
4842 HomeNoteListTokens.clear();
4843 HomeNoteListPref.clear();
4845 /* Items on the Business tab */
4847 BusinessNicknamesList.clear();
4848 BusinessNicknamesListType.clear();
4849 BusinessNicknamesListLanguage.clear();
4850 BusinessNicknamesListAltID.clear();
4851 BusinessNicknamesListPID.clear();
4852 BusinessNicknamesListTokens.clear();
4853 BusinessNicknamesListPref.clear();
4855 BusinessAddressList.clear();
4856 BusinessAddressListTown.clear();
4857 BusinessAddressListCounty.clear();
4858 BusinessAddressListPostCode.clear();
4859 BusinessAddressListCountry.clear();
4860 BusinessAddressListLabel.clear();
4861 BusinessAddressListLang.clear();
4862 BusinessAddressListAltID.clear();
4863 BusinessAddressListPID.clear();
4864 BusinessAddressListTokens.clear();
4865 BusinessAddressListGeo.clear();
4866 BusinessAddressListTimezone.clear();
4867 BusinessAddressListType.clear();
4868 BusinessAddressListMediatype.clear();
4869 BusinessAddressListPref.clear();
4871 BusinessEmailList.clear();
4872 BusinessEmailListAltID.clear();
4873 BusinessEmailListPID.clear();
4874 BusinessEmailListType.clear();
4875 BusinessEmailListTokens.clear();
4876 BusinessEmailListPref.clear();
4878 BusinessIMList.clear();
4879 BusinessIMListAltID.clear();
4880 BusinessIMListPID.clear();
4881 BusinessIMListType.clear();
4882 BusinessIMListTokens.clear();
4883 BusinessIMListMediatype.clear();
4884 BusinessIMListPref.clear();
4886 BusinessTelephoneList.clear();
4887 BusinessTelephoneListAltID.clear();
4888 BusinessTelephoneListPID.clear();
4889 BusinessTelephoneListType.clear();
4890 BusinessTelephoneListTokens.clear();
4891 BusinessTelephoneListPref.clear();
4893 BusinessLanguageList.clear();
4894 BusinessLanguageListAltID.clear();
4895 BusinessLanguageListPID.clear();
4896 BusinessLanguageListType.clear();
4897 BusinessLanguageListTokens.clear();
4898 BusinessLanguageListPref.clear();
4900 BusinessTZList.clear();
4901 BusinessTZListAltID.clear();
4902 BusinessTZListPID.clear();
4903 BusinessTZListType.clear();
4904 BusinessTZListTokens.clear();
4905 BusinessTZListMediatype.clear();
4906 BusinessTZListPref.clear();
4908 BusinessGeographyList.clear();
4909 BusinessGeographyListAltID.clear();
4910 BusinessGeographyListPID.clear();
4911 BusinessGeographyListType.clear();
4912 BusinessGeographyListTokens.clear();
4913 BusinessGeographyListMediatype.clear();
4914 BusinessGeographyListPref.clear();
4916 BusinessWebsiteList.clear();
4917 BusinessWebsiteListAltID.clear();
4918 BusinessWebsiteListPID.clear();
4919 BusinessWebsiteListType.clear();
4920 BusinessWebsiteListTokens.clear();
4921 BusinessWebsiteListMediatype.clear();
4922 BusinessWebsiteListPref.clear();
4924 BusinessTitleList.clear();
4925 BusinessTitleListLanguage.clear();
4926 BusinessTitleListAltID.clear();
4927 BusinessTitleListPID.clear();
4928 BusinessTitleListType.clear();
4929 BusinessTitleListTokens.clear();
4930 BusinessTitleListPref.clear();
4932 BusinessRoleList.clear();
4933 BusinessRoleListLanguage.clear();
4934 BusinessRoleListAltID.clear();
4935 BusinessRoleListPID.clear();
4936 BusinessRoleListType.clear();
4937 BusinessRoleListTokens.clear();
4938 BusinessRoleListPref.clear();
4940 BusinessOrganisationsList.clear();
4941 BusinessOrganisationsListLanguage.clear();
4942 BusinessOrganisationsListAltID.clear();
4943 BusinessOrganisationsListPID.clear();
4944 BusinessOrganisationsListType.clear();
4945 BusinessOrganisationsListTokens.clear();
4946 BusinessOrganisationsListSortAs.clear();
4947 BusinessOrganisationsListPref.clear();
4949 BusinessNoteList.clear();
4950 BusinessNoteListLanguage.clear();
4951 BusinessNoteListAltID.clear();
4952 BusinessNoteListPID.clear();
4953 BusinessNoteListType.clear();
4954 BusinessNoteListTokens.clear();
4955 BusinessNoteListPref.clear();
4957 /* Items on the Categories tab */
4959 CategoriesList.clear();
4960 CategoriesListAltID.clear();
4961 CategoriesListPID.clear();
4962 CategoriesListType.clear();
4963 CategoriesListTokens.clear();
4964 CategoriesListLanguage.clear();
4965 CategoriesListPref.clear();
4967 /* Items on the Groups tab */
4970 GroupsListAltID.clear();
4971 GroupsListPID.clear();
4972 GroupsListType.clear();
4973 GroupsListMediaType.clear();
4974 GroupsListTokens.clear();
4975 GroupsListPref.clear();
4977 /* Items on the Pictures tab */
4979 PicturesList.clear();
4980 PicturesListAltID.clear();
4981 PicturesListPID.clear();
4982 PicturesListType.clear();
4983 PicturesListPicEncType.clear();
4984 PicturesListPictureType.clear();
4985 PicturesListTokens.clear();
4986 PicturesListMediatype.clear();
4987 PicturesListPref.clear();
4989 /* Items on the Logos tab */
4992 LogosListAltID.clear();
4993 LogosListPID.clear();
4994 LogosListType.clear();
4995 LogosListPicEncType.clear();
4996 LogosListPictureType.clear();
4997 LogosListTokens.clear();
4998 LogosListMediatype.clear();
4999 LogosListPref.clear();
5001 /* Items on the Sounds tab */
5004 SoundsListAltID.clear();
5005 SoundsListPID.clear();
5006 SoundsListType.clear();
5007 SoundsListAudioEncType.clear();
5008 SoundsListAudioType.clear();
5009 SoundsListTokens.clear();
5010 SoundsListMediatype.clear();
5011 SoundsListPref.clear();
5013 /* Items on the Calendaring tab */
5015 CalendarList.clear();
5016 CalendarListAltID.clear();
5017 CalendarListPID.clear();
5018 CalendarListType.clear();
5019 CalendarListTokens.clear();
5020 CalendarListMediatype.clear();
5021 CalendarListPref.clear();
5023 CalendarRequestList.clear();
5024 CalendarRequestListAltID.clear();
5025 CalendarRequestListPID.clear();
5026 CalendarRequestListType.clear();
5027 CalendarRequestListTokens.clear();
5028 CalendarRequestListMediatype.clear();
5029 CalendarRequestListPref.clear();
5031 FreeBusyList.clear();
5032 FreeBusyListAltID.clear();
5033 FreeBusyListPID.clear();
5034 FreeBusyListType.clear();
5035 FreeBusyListTokens.clear();
5036 FreeBusyListMediatype.clear();
5037 FreeBusyListPref.clear();
5039 /* Items on the Security tab */
5042 KeyListAltID.clear();
5044 KeyListKeyType.clear();
5045 KeyListDataType.clear();
5046 KeyListDataEncType.clear();
5047 KeyListType.clear();
5048 KeyListTokens.clear();
5049 KeyListPref.clear();
5051 /* Items on the Other tab */
5054 VendorListPEN.clear();
5055 VendorListElement.clear();
5058 XTokenListTokens.clear();
5062 void ProcessNameValue(wxString *PropertyData,
5063 wxString *PropertyName,
5064 wxString *PropertyValue){
5066 wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
5067 *PropertyName = PropertyElement.GetNextToken();
5068 *PropertyValue = PropertyElement.GetNextToken();
5072 void ProcessTokens(wxString *PropertyName,
5073 wxString *PropertyValue,
5074 wxString *PropertyTokens,
5077 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5079 if (*FirstToken == TRUE){
5081 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5082 *FirstToken = FALSE;
5086 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5094 void ProcessStringValue(wxString *PropertyName,
5095 wxString PropertyNameMatch,
5096 std::map<int,wxString> *MapPtr,
5097 wxString *PropertyValue,
5099 bool *PropertyMatched){
5101 if (*PropertyName == PropertyNameMatch){
5102 MapPtr->erase(*ItemCount);
5103 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5104 *PropertyMatched = TRUE;
5109 void ProcessIntegerValue(wxString *PropertyName,
5110 wxString PropertyNameMatch,
5111 std::map<int,int> *PrefPtr,
5112 wxString *PropertyValue,
5114 bool *PropertyMatched){
5116 if (*PropertyName == PropertyNameMatch){
5117 *PropertyMatched = TRUE;
5122 int PriorityNumber = 0;
5123 bool ValidNumber = TRUE;
5126 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5129 catch(std::invalid_argument &e){
5130 ValidNumber = FALSE;
5133 if (ValidNumber == TRUE){
5135 PrefPtr->erase(*ItemCount);
5136 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5142 void SplitValues(wxString *PropertyLine,
5143 std::map<int,int> *SplitPoints,
5144 std::map<int,int> *SplitLength,
5147 size_t intPropertyLen = PropertyLine->Len();
5148 int intSplitsFound = 0;
5149 int intSplitSize = 0;
5150 int intSplitSeek = 0;
5152 for (int i = intSize; i <= intPropertyLen; i++){
5156 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5157 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5159 if (intSplitsFound == 0){
5161 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5165 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5169 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5179 if (intSplitsFound == 0){
5181 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5182 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5186 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5187 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5193 void CheckType(wxString *PropertySeg1,
5194 std::map<int,int> *SplitPoints,
5195 std::map<int,int> *SplitLength,
5197 PropertyType *PropType){
5199 wxString PropertyData;
5200 wxString PropertyName;
5201 wxString PropertyValue;
5202 std::map<int,int>::iterator SLiter;
5204 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5205 intiter != SplitPoints->end(); ++intiter){
5207 SLiter = SplitLength->find(intiter->first);
5208 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5209 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
5210 *intPrevValue = intiter->second;
5212 if (PropertyName == wxT("TYPE")){
5214 if (PropertyValue == wxT("work")){
5216 *PropType = PROPERTY_WORK;
5218 } else if (PropertyValue == wxT("home")){
5220 *PropType = PROPERTY_HOME;
5224 *PropType = PROPERTY_NONE;