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 // Load the ContactDataObject using the Filename given.
25 if (!wxFileExists(Filename)){
27 return CONTACTLOAD_FILEMISSING;
33 if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
35 return CONTACTLOAD_FILEERROR;
39 // Check that the vCard is a valid vCard 4.0 file.
41 vCard vCard4FormatCheck;
43 vCard4FormatCheck.LoadFile(Filename);
45 if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){
47 return CONTACTLOAD_FILEINVALIDFORMAT;
51 // Check that the vCard meets the base specification.
53 if (!vCard4FormatCheck.MeetBaseSpecification()){
55 return CONTACTLOAD_FILEBASESPECFAIL;
59 wxStringTokenizer wSTContactFileLines(vCard4FormatCheck.WriteString(), wxT("\r\n"));
61 std::map<int, wxString> ContactFileLines;
63 int ContactLineSeek = 0;
65 while (wSTContactFileLines.HasMoreTokens() == TRUE){
67 wxString ContactLine = wSTContactFileLines.GetNextToken();
68 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
73 wxString wxSPropertyNextLine;
75 bool ExtraLineSeek = TRUE;
76 bool QuoteMode = FALSE;
77 bool PropertyFind = TRUE;
78 bool KindProcessed = FALSE;
79 bool NameProcessed = FALSE;
80 bool GenderProcessed = FALSE;
81 bool BirthdayProcessed = FALSE;
82 bool AnniversaryProcessed = FALSE;
83 bool UIDProcessed = FALSE;
84 bool RevisionProcessed = FALSE;
85 int ContactLineLen = 0;
86 int QuoteBreakPoint = 0;
90 int NicknameCount = 0;
91 int TimeZoneCount = 0;
95 int TelephoneCount = 0;
96 int LanguageCount = 0;
97 int GeographicCount = 0;
102 int OrganisationCount = 0;
104 int CategoryCount = 0;
108 int CalendarCount = 0;
109 int CalendarAddressCount = 0;
110 int FreeBusyAddressCount = 0;
115 int ClientPIDCount = 0;
116 wxString ContactLine;
117 wxString PropertyLine;
118 wxString PropertySeg1;
119 wxString PropertySeg2;
120 wxString PropertyNextLine;
123 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
124 iter != ContactFileLines.end(); ++iter){
126 ExtraLineSeek = TRUE;
132 PropertyLine.Clear();
133 PropertySeg1.Clear();
134 PropertySeg2.Clear();
137 ContactLine = iter->second;
139 while (ExtraLineSeek == TRUE){
141 // Check if there is extra data on the next line
142 // (indicated by space or tab at the start) and add data.
146 if (iter == ContactFileLines.end()){
153 PropertyNextLine = iter->second;
155 if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
157 PropertyNextLine.Remove(0, 1);
158 ContactLine.Append(PropertyNextLine);
163 ExtraLineSeek = FALSE;
169 ContactLineLen = ContactLine.Len();
171 // Make sure we are not in quotation mode.
172 // Make sure colon does not have \ or \\ before it.
174 for (int i = 0; i <= ContactLineLen; i++){
176 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
178 PropertyFind = FALSE;
180 } else if (PropertyFind == TRUE){
182 Property.Append(ContactLine.Mid(i, 1));
186 if (ContactLine.Mid(i, 1) == wxT("\"")){
188 if (QuoteMode == TRUE){
200 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
209 // Split that line at the point into two variables (ignore the colon).
211 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
212 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
214 if (Property == wxT("KIND") && KindProcessed == FALSE){
216 ProcessKind(PropertySeg2);
218 } else if (Property == wxT("UID") && UIDProcessed == FALSE){
220 UIDToken = PropertySeg2;
223 } else if (Property == wxT("SOURCE")){
225 ProcessSource(PropertySeg1, PropertySeg2, &SourceCount);
228 } else if (Property == wxT("XML")){
230 ProcessXML(PropertySeg1, PropertySeg2, &XMLCount);
233 } else if (Property == wxT("REV") && RevisionProcessed == FALSE){
235 ProcessRevision(PropertySeg1, PropertySeg2);
236 RevisionProcessed = TRUE;
238 } else if (Property == wxT("MEMBER")){
240 ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
243 } else if (Property == wxT("FN")){
245 ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
248 } else if (Property == wxT("N") && NameProcessed == FALSE){
250 ProcessN(PropertySeg1, PropertySeg2);
251 NameProcessed = TRUE;
253 } else if (Property == wxT("CLIENTPIDMAP")){
255 ProcessClientPIDMap(PropertySeg1, PropertySeg2, &ClientPIDCount);
258 } else if (Property == wxT("NICKNAME")){
260 ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
263 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
265 ProcessGender(PropertySeg1, PropertySeg2);
266 GenderProcessed = TRUE;
268 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
270 ProcessBirthday(PropertySeg1, PropertySeg2);
271 BirthdayProcessed = TRUE;
273 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
275 ProcessAnniversary(PropertySeg1, PropertySeg2);
276 AnniversaryProcessed = TRUE;
278 } else if (Property == wxT("TZ")){
280 ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
283 } else if (Property == wxT("ADR")){
285 ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
288 } else if (Property == wxT("EMAIL")){
290 ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);
293 } else if (Property == wxT("IMPP")){
295 ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
298 } else if (Property == wxT("TEL")){
300 ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
303 } else if (Property == wxT("LANG")){
305 // See frmContactEditor-LoadLanguage.cpp
307 ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
310 } else if (Property == wxT("GEO")){
312 // See frmContactEditor-LoadGeo.cpp
314 ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);
317 } else if (Property == wxT("RELATED")){
319 // See fromContactEditor-LoadRelated.cpp
321 ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);
324 } else if (Property == wxT("URL")){
326 // See frmContactEditor-LoadURL.cpp
328 ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
331 } else if (Property == wxT("TITLE")) {
333 // See frmContactEditor-LoadTitle.cpp
335 ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
338 } else if (Property == wxT("ROLE")) {
340 // See frmContactEditor-LoadTitle.cpp
342 ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
345 } else if (Property == wxT("ORG")) {
347 // See frmContactEditor-LoadOrg.cpp
349 ProcessOrganisation(PropertySeg1, PropertySeg2, &OrganisationCount);
352 } else if (Property == wxT("NOTE")) {
354 // See frmContactEditor-LoadNote.cpp
356 ProcessNote(PropertySeg1, PropertySeg2, &NoteCount);
359 } else if (Property == wxT("CATEGORIES")) {
361 // See frmContactEditor-LoadCategory.cpp
363 ProcessCategory(PropertySeg1, PropertySeg2, &CategoryCount);
366 } else if (Property == wxT("PHOTO")) {
368 // See frmContactEditor-LoadPhoto.cpp
370 ProcessPhoto(PropertySeg1, PropertySeg2, &PhotoCount);
373 } else if (Property == wxT("LOGO")) {
375 // See frmContactEditor-LoadPhoto.cpp
377 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
380 } else if (Property == wxT("SOUND")) {
382 // See frmContactEditor-LoadSound.cpp
384 ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
387 } else if (Property == wxT("CALURI")){
389 // See frmContactEditor-LoadCalendar.cpp
391 ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
394 } else if (Property == wxT("CALADRURI")){
396 ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
397 CalendarAddressCount++;
399 } else if (Property == wxT("FBURL")){
401 // See frmContactEditor-LoadCalendar.cpp
403 ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
404 FreeBusyAddressCount++;
406 } else if (Property == wxT("KEY")){
408 // See frmContactEditor-LoadKey.cpp
410 ProcessKey(PropertySeg1, PropertySeg2, &KeyCount);
413 } else if (Property.Mid(0, 3) == wxT("VND")){
415 ProcessVendor(PropertySeg1, PropertySeg2, &VendorCount);
418 } else if (Property.Mid(0, 2) == wxT("X-")){
420 XTokenList.insert(std::make_pair(XTokenCount, PropertySeg2));
421 XTokenListTokens.insert(std::make_pair(XTokenCount, PropertySeg1.Mid(2)));
428 return CONTACTLOAD_OK;
432 void ContactDataObject::ProcessKind(wxString KindType){
434 // Process the type of contact.
436 if (KindType == wxT("individual")){
438 ContactKind = CONTACTKIND_INDIVIDUAL;
440 } else if (KindType == wxT("group")){
442 ContactKind = CONTACTKIND_GROUP;
444 } else if (KindType == wxT("org")){
446 ContactKind = CONTACTKIND_ORGANISATION;
448 } else if (KindType == wxT("location")){
450 ContactKind = CONTACTKIND_LOCATION;
454 ContactKind = CONTACTKIND_NONE;
459 void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString PropertySeg2){
461 // Process the revision date.
463 size_t intPropertyLen = PropertySeg1.Len();
464 std::map<int, int> SplitPoints;
465 std::map<int, int> SplitLength;
466 std::map<int, int>::iterator SLiter;
467 wxString PropertyData;
468 wxString PropertyName;
469 wxString PropertyValue;
470 wxString PropertyTokens;
471 bool FirstToken = TRUE;
472 int intSplitsFound = 0;
473 int intSplitSize = 0;
474 int intPrevValue = 5;
476 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
480 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
481 intiter != SplitPoints.end(); ++intiter){
483 SLiter = SplitLength.find(intiter->first);
484 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
485 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
486 intPrevValue = intiter->second;
488 // Process properties.
490 size_t intPropertyValueLen = PropertyValue.Len();
492 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
494 PropertyValue.Trim();
495 PropertyValue.RemoveLast();
499 if (PropertyValue.Mid(0, 1) == wxT("\"")){
501 PropertyValue.Remove(0, 1);
505 CaptureString(&PropertyValue, FALSE);
507 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
511 CaptureString(&PropertySeg2, FALSE);
513 Revision = PropertySeg2;
515 if (!PropertyTokens.IsEmpty()){
517 RevisionTokens = PropertyTokens;
524 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
526 // Process the source address.
528 size_t intPropertyLen = PropertySeg1.Len();
529 std::map<int, int> SplitPoints;
530 std::map<int, int> SplitLength;
531 std::map<int, int>::iterator SLiter;
532 wxString PropertyData;
533 wxString PropertyName;
534 wxString PropertyValue;
535 wxString PropertyTokens;
536 bool FirstToken = TRUE;
537 bool PropertyMatched = FALSE;
538 int intSplitsFound = 0;
539 int intSplitSize = 0;
540 int intPrevValue = 8;
542 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
546 PropertyType PropType = PROPERTY_NONE;
548 // Look for type before continuing.
550 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
554 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
555 intiter != SplitPoints.end(); ++intiter){
557 SLiter = SplitLength.find(intiter->first);
559 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
561 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
563 intPrevValue = intiter->second;
565 // Process properties.
567 size_t intPropertyValueLen = PropertyValue.Len();
569 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
571 PropertyValue.Trim();
572 PropertyValue.RemoveLast();
576 if (PropertyValue.Mid(0, 1) == wxT("\"")){
578 PropertyValue.Remove(0, 1);
582 CaptureString(&PropertyValue, FALSE);
584 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
585 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
586 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
587 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
589 if (PropertyMatched == TRUE){
591 PropertyMatched = FALSE;
596 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
600 intPropertyLen = PropertySeg2.Len();
607 CaptureString(&PropertySeg2, FALSE);
609 // Add the data to the General/Home/Work address variables.
615 SourceListType.insert(std::make_pair(*SourceCount, "home"));
618 SourceListType.insert(std::make_pair(*SourceCount, "work"));
622 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
624 if (!PropertyTokens.IsEmpty()){
626 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
632 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
634 // Process the XML data.
636 std::map<int, int> SplitPoints;
637 std::map<int, int> SplitLength;
639 int intPrevValue = 5;
641 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
645 wxString PropertyName;
646 wxString PropertyValue;
647 wxString PropertyData;
648 wxString PropertyTokens;
649 std::map<int,int>::iterator SLiter;
650 bool FirstToken = TRUE;
651 bool PropertyMatched = FALSE;
653 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
654 intiter != SplitPoints.end(); ++intiter){
656 SLiter = SplitLength.find(intiter->first);
657 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
658 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
659 intPrevValue = intiter->second;
661 CaptureString(&PropertyValue, FALSE);
663 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
665 if (PropertyMatched == TRUE){
667 PropertyMatched = FALSE;
674 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
678 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
680 // Process the membership data.
682 std::map<int, int> SplitPoints;
683 std::map<int, int> SplitLength;
685 int intPrevValue = 8;
687 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
691 wxString PropertyName;
692 wxString PropertyValue;
693 wxString PropertyData;
694 wxString PropertyTokens;
695 std::map<int,int>::iterator SLiter;
696 bool FirstToken = TRUE;
697 bool PropertyMatched = FALSE;
699 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
700 intiter != SplitPoints.end(); ++intiter){
702 SLiter = SplitLength.find(intiter->first);
703 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
704 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
705 intPrevValue = intiter->second;
707 CaptureString(&PropertyValue, FALSE);
709 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
710 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
711 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
712 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
714 if (PropertyMatched == TRUE){
716 PropertyMatched = FALSE;
721 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
725 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
727 if (!PropertyTokens.IsEmpty()){
729 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
736 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
738 // Process the full name.
740 std::map<int, int> SplitPoints;
741 std::map<int, int> SplitLength;
743 int intPrevValue = 4;
745 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
749 wxString PropertyName;
750 wxString PropertyValue;
751 wxString PropertyData;
752 wxString PropertyTokens;
753 std::map<int,int>::iterator SLiter;
754 bool FirstToken = TRUE;
755 bool PropertyMatched = FALSE;
757 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
758 intiter != SplitPoints.end(); ++intiter){
760 SLiter = SplitLength.find(intiter->first);
761 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
762 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
763 intPrevValue = intiter->second;
765 CaptureString(&PropertyValue, FALSE);
767 if (PropertyName == wxT("TYPE")){
769 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
770 PropertyValue == wxT("work") ){
772 FullNamesListType.erase(*FNCount);
773 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
777 PropertyMatched = TRUE;
781 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
782 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
783 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
784 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
786 if (PropertyMatched == TRUE){
788 PropertyMatched = FALSE;
793 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
797 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
799 if (!PropertyTokens.IsEmpty()){
801 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
807 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
811 std::map<int, int> SplitPoints;
812 std::map<int, int> SplitLength;
814 int intPrevValue = 3;
816 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
820 wxString PropertyName;
821 wxString PropertyValue;
822 wxString PropertyData;
823 wxString PropertyTokens;
824 std::map<int,int>::iterator SLiter;
825 bool FirstToken = TRUE;
827 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
828 intiter != SplitPoints.end(); ++intiter){
830 SLiter = SplitLength.find(intiter->first);
831 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
832 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
833 intPrevValue = intiter->second;
835 CaptureString(&PropertyValue, FALSE);
837 if (PropertyName == wxT("ALTID")){
839 NameAltID = PropertyValue;
841 } else if (PropertyName == wxT("LANGUAGE")){
843 NameLanguage = PropertyValue;
845 } else if (PropertyName == wxT("SORT-AS")){
847 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
848 PropertyValue.Len() >= 3){
849 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
852 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
854 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
860 // Split the name data.
862 int intSplitSeek = 0;
863 int intSplitsFound = 0;
864 int intSplitSize = 0;
865 int intPropertyLen = PropertySeg2.Len();
867 std::map<int,wxString> NameValues;
870 for (int i = 0; i <= intPropertyLen; i++){
872 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
874 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
879 if (intSplitsFound == 4){
881 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
895 // Split the data into several parts.
897 for (std::map<int, wxString>::iterator iter = NameValues.begin();
898 iter != NameValues.end(); ++iter){
900 if (iter->first == 1){
902 // Deal with family name.
904 NameSurname = iter->second;
906 } else if (iter->first == 2){
908 // Deal with given names.
910 NameForename = iter->second;
912 } else if (iter->first == 3){
914 // Deal with additional names.
916 NameOtherNames = iter->second;
918 } else if (iter->first == 4){
920 // Deal with honorifix prefixes and suffixes.
922 NameTitle = iter->second;
926 if (iter == NameValues.end()){
932 NameSuffix = iter->second;
938 // Add the name token data.
940 if (!PropertyTokens.IsEmpty()){
942 NameTokens = PropertyTokens;
948 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
950 // Process the Client PID Map.
952 size_t intPropertyLen = PropertySeg1.Len();
953 std::map<int, int> SplitPoints;
954 std::map<int, int> SplitLength;
955 std::map<int, int>::iterator SLiter;
956 wxString PropertyData;
957 wxString PropertyName;
958 wxString PropertyValue;
959 wxString PropertyTokens;
960 bool FirstToken = TRUE;
961 int intSplitsFound = 0;
962 int intSplitSize = 0;
963 int intPrevValue = 14;
965 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
969 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
970 intiter != SplitPoints.end(); ++intiter){
972 SLiter = SplitLength.find(intiter->first);
973 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
974 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
975 intPrevValue = intiter->second;
977 // Process properties.
979 CaptureString(&PropertyValue, FALSE);
981 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
985 CaptureString(&PropertySeg2, FALSE);
987 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
989 if (!PropertyTokens.IsEmpty()){
991 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
997 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
999 // Process the Nickname.
1001 std::map<int, int> SplitPoints;
1002 std::map<int, int> SplitLength;
1004 int intPrevValue = 10;
1006 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1010 PropertyType PropType = PROPERTY_NONE;
1012 // Look for type before continuing.
1014 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1018 std::map<int, wxString> *NicknamesList = NULL;
1019 std::map<int, wxString> *NicknamesListType = NULL;
1020 std::map<int, wxString> *NicknamesListLanguage = NULL;
1021 std::map<int, wxString> *NicknamesListAltID = NULL;
1022 std::map<int, wxString> *NicknamesListPID = NULL;
1023 std::map<int, wxString> *NicknamesListTokens = NULL;
1024 std::map<int, int> *NicknamesListPref = NULL;
1028 NicknamesList = &GeneralNicknamesList;
1029 NicknamesListType = &GeneralNicknamesListType;
1030 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1031 NicknamesListAltID = &GeneralNicknamesListAltID;
1032 NicknamesListPID = &GeneralNicknamesListPID;
1033 NicknamesListTokens = &GeneralNicknamesListTokens;
1034 NicknamesListPref = &GeneralNicknamesListPref;
1037 NicknamesList = &HomeNicknamesList;
1038 NicknamesListType = &HomeNicknamesListType;
1039 NicknamesListLanguage = &HomeNicknamesListLanguage;
1040 NicknamesListAltID = &HomeNicknamesListAltID;
1041 NicknamesListPID = &HomeNicknamesListPID;
1042 NicknamesListTokens = &HomeNicknamesListTokens;
1043 NicknamesListPref = &HomeNicknamesListPref;
1046 NicknamesList = &BusinessNicknamesList;
1047 NicknamesListType = &BusinessNicknamesListType;
1048 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1049 NicknamesListAltID = &BusinessNicknamesListAltID;
1050 NicknamesListPID = &BusinessNicknamesListPID;
1051 NicknamesListTokens = &BusinessNicknamesListTokens;
1052 NicknamesListPref = &BusinessNicknamesListPref;
1056 std::map<int, int>::iterator SLiter;
1057 wxString PropertyData;
1058 wxString PropertyName;
1059 wxString PropertyValue;
1060 wxString PropertyTokens;
1061 bool FirstToken = TRUE;
1062 bool PropertyMatched = FALSE;
1064 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1065 intiter != SplitPoints.end(); ++intiter){
1067 SLiter = SplitLength.find(intiter->first);
1068 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1069 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1070 intPrevValue = intiter->second;
1072 CaptureString(&PropertyValue, FALSE);
1074 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1075 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1076 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1077 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1079 if (PropertyMatched == TRUE){
1081 PropertyMatched = FALSE;
1086 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1090 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1092 // Add the name token data.
1094 if (!PropertyTokens.IsEmpty()){
1096 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1102 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1104 // Process the gender.
1106 std::map<int, int> SplitPoints;
1107 std::map<int, int> SplitLength;
1108 std::map<int, int>::iterator SLiter;
1109 wxString PropertyData;
1110 wxString PropertyName;
1111 wxString PropertyValue;
1112 wxString PropertyTokens;
1113 bool FirstToken = TRUE;
1114 int intPrevValue = 8;
1116 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1120 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1121 intiter != SplitPoints.end(); ++intiter){
1123 SLiter = SplitLength.find(intiter->first);
1124 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1125 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1126 intPrevValue = intiter->second;
1128 // Process properties.
1130 size_t intPropertyValueLen = PropertyValue.Len();
1132 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1134 PropertyValue.Trim();
1135 PropertyValue.RemoveLast();
1139 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1141 PropertyValue.Remove(0, 1);
1145 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1149 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1151 wxString GenderComponent;
1153 if (GenderData.CountTokens() >= 2){
1155 Gender = GenderData.GetNextToken();
1156 GenderDetails = GenderData.GetString();
1158 CaptureString(&GenderDetails, FALSE);
1162 Gender = GenderData.GetNextToken();
1166 if (!PropertyTokens.IsEmpty()){
1168 GenderTokens = PropertyTokens;
1174 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1176 // Process birthday date.
1178 std::map<int, int> SplitPoints;
1179 std::map<int, int> SplitLength;
1180 std::map<int, int>::iterator SLiter;
1181 wxString PropertyData;
1182 wxString PropertyName;
1183 wxString PropertyValue;
1184 wxString PropertyTokens;
1185 int intPrevValue = 6;
1187 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1191 // Look for type before continuing.
1193 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1194 intiter != SplitPoints.end(); ++intiter){
1196 SLiter = SplitLength.find(intiter->first);
1197 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1198 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1199 intPrevValue = intiter->second;
1201 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1203 CaptureString(&PropertySeg2, FALSE);
1204 Birthday = PropertySeg2;
1205 BirthdayText = TRUE;
1211 // Setup blank lines for later on.
1214 bool FirstToken = TRUE;
1216 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1217 intiter != SplitPoints.end(); ++intiter){
1219 SLiter = SplitLength.find(intiter->first);
1220 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1221 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1222 intPrevValue = intiter->second;
1224 // Process properties.
1226 CaptureString(&PropertyValue, FALSE);
1228 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1230 PropertyValue.Trim();
1231 PropertyValue.RemoveLast();
1235 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1237 PropertyValue.Remove(0, 1);
1241 if (PropertyName == wxT("ALTID")){
1243 BirthdayAltID = PropertyValue;
1245 } else if (PropertyName == wxT("CALSCALE")){
1247 BirthdayCalScale = PropertyValue;
1249 } else if (PropertyName != wxT("VALUE")) {
1251 // Something else we don't know about so append
1252 // to the tokens variable.
1254 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1260 // Add the data to the variables and form.
1262 if (BirthdayText == FALSE){
1264 Birthday = PropertySeg2;
1268 if (!PropertyTokens.IsEmpty()){
1270 BirthdayTokens = PropertyTokens;
1276 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1278 // Process the anniversary.
1280 std::map<int, int> SplitPoints;
1281 std::map<int, int> SplitLength;
1282 std::map<int, int>::iterator SLiter;
1283 wxString PropertyData;
1284 wxString PropertyName;
1285 wxString PropertyValue;
1286 wxString PropertyTokens;
1287 int intPrevValue = 13;
1289 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1293 // Look for type before continuing.
1295 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1296 intiter != SplitPoints.end(); ++intiter){
1298 SLiter = SplitLength.find(intiter->first);
1299 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1300 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1301 intPrevValue = intiter->second;
1303 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1305 CaptureString(&PropertySeg2, FALSE);
1306 Anniversary = PropertySeg2;
1307 AnniversaryText = TRUE;
1313 // Setup blank lines for later on.
1316 bool FirstToken = TRUE;
1318 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1319 intiter != SplitPoints.end(); ++intiter){
1321 SLiter = SplitLength.find(intiter->first);
1322 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1323 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1324 intPrevValue = intiter->second;
1326 // Process properties.
1328 CaptureString(&PropertyValue, FALSE);
1330 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1332 PropertyValue.Trim();
1333 PropertyValue.RemoveLast();
1337 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1339 PropertyValue.Remove(0, 1);
1343 if (PropertyName == wxT("ALTID")){
1345 AnniversaryAltID = PropertyValue;
1347 } else if (PropertyName == wxT("CALSCALE")){
1349 AnniversaryCalScale = PropertyValue;
1351 } else if (PropertyName != wxT("VALUE")) {
1353 // Something else we don't know about so append
1354 // to the tokens variable.
1356 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1362 // Add the data to the variables and form.
1364 if (AnniversaryText == FALSE){
1366 Anniversary = PropertySeg2;
1370 if (!PropertyTokens.IsEmpty()){
1372 AnniversaryTokens = PropertyTokens;
1378 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1380 // Process the timezone.
1382 std::map<int, int> SplitPoints;
1383 std::map<int, int> SplitLength;
1385 int intPrevValue = 4;
1387 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1391 PropertyType PropType = PROPERTY_NONE;
1393 // Look for type before continuing.
1395 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1399 std::map<int, wxString> *TZList = NULL;
1400 std::map<int, wxString> *TZListType = NULL;
1401 std::map<int, wxString> *TZListMediatype = NULL;
1402 std::map<int, wxString> *TZListAltID = NULL;
1403 std::map<int, wxString> *TZListPID = NULL;
1404 std::map<int, wxString> *TZListTokens = NULL;
1405 std::map<int, int> *TZListPref = NULL;
1409 TZList = &GeneralTZList;
1410 TZListType = &GeneralTZListType;
1411 TZListMediatype = &GeneralTZListMediatype;
1412 TZListAltID = &GeneralTZListAltID;
1413 TZListPID = &GeneralTZListPID;
1414 TZListTokens = &GeneralTZListTokens;
1415 TZListPref = &GeneralTZListPref;
1418 TZList = &HomeTZList;
1419 TZListType = &HomeTZListType;
1420 TZListMediatype = &HomeTZListMediatype;
1421 TZListAltID = &HomeTZListAltID;
1422 TZListPID = &HomeTZListPID;
1423 TZListTokens = &HomeTZListTokens;
1424 TZListPref = &HomeTZListPref;
1427 TZList = &BusinessTZList;
1428 TZListType = &BusinessTZListType;
1429 TZListMediatype = &BusinessTZListMediatype;
1430 TZListAltID = &BusinessTZListAltID;
1431 TZListPID = &BusinessTZListPID;
1432 TZListTokens = &BusinessTZListTokens;
1433 TZListPref = &BusinessTZListPref;
1437 std::map<int, int>::iterator SLiter;
1438 wxString PropertyData;
1439 wxString PropertyName;
1440 wxString PropertyValue;
1441 wxString PropertyTokens;
1442 bool FirstToken = TRUE;
1443 bool PropertyMatched = FALSE;
1445 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1446 intiter != SplitPoints.end(); ++intiter){
1448 SLiter = SplitLength.find(intiter->first);
1449 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1450 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1451 intPrevValue = intiter->second;
1453 CaptureString(&PropertyValue, FALSE);
1455 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1456 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1457 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1458 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1460 if (PropertyMatched == TRUE){
1462 PropertyMatched = FALSE;
1467 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1469 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1475 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1477 // Add the name token data.
1479 if (!PropertyTokens.IsEmpty()){
1481 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1488 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1490 // Process the address.
1492 size_t intPropertyLen = PropertySeg1.Len();
1493 std::map<int, int> SplitPoints;
1494 std::map<int, int> SplitLength;
1495 std::map<int, int>::iterator SLiter;
1496 wxString PropertyData;
1497 wxString PropertyName;
1498 wxString PropertyValue;
1499 wxString PropertyTokens;
1500 wxString AddressLabel;
1501 wxString AddressLang;
1502 wxString AddressAltID;
1503 wxString AddressPID;
1504 wxString AddressTokens;
1505 wxString AddressGeo;
1506 wxString AddressTimezone;
1507 wxString AddressType;
1508 wxString AddressMediatype;
1509 wxString AddressPOBox;
1510 wxString AddressExtended;
1511 wxString AddressStreet;
1512 wxString AddressLocality;
1513 wxString AddressCity;
1514 wxString AddressRegion;
1515 wxString AddressPostalCode;
1516 wxString AddressCountry;
1517 bool FirstToken = TRUE;
1518 int intSplitsFound = 0;
1519 int intSplitSize = 0;
1520 int intPrevValue = 5;
1521 bool PropertyMatched = FALSE;
1523 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1527 PropertyType PropType = PROPERTY_NONE;
1529 // Look for type before continuing.
1531 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1535 std::map<int, wxString> *AddressList = NULL;
1536 std::map<int, wxString> *AddressListTown = NULL;
1537 std::map<int, wxString> *AddressListCounty = NULL;
1538 std::map<int, wxString> *AddressListPostCode = NULL;
1539 std::map<int, wxString> *AddressListCountry = NULL;
1540 std::map<int, wxString> *AddressListLabel = NULL;
1541 std::map<int, wxString> *AddressListLang = NULL;
1542 std::map<int, wxString> *AddressListAltID = NULL;
1543 std::map<int, wxString> *AddressListPID = NULL;
1544 std::map<int, wxString> *AddressListTokens = NULL;
1545 std::map<int, wxString> *AddressListGeo = NULL;
1546 std::map<int, wxString> *AddressListTimezone = NULL;
1547 std::map<int, wxString> *AddressListType = NULL;
1548 std::map<int, wxString> *AddressListMediatype = NULL;
1549 std::map<int, int> *AddressListPref = NULL;
1553 AddressList = &GeneralAddressList;
1554 AddressListTown = &GeneralAddressListTown;
1555 AddressListCounty = &GeneralAddressListCounty;
1556 AddressListPostCode = &GeneralAddressListPostCode;
1557 AddressListCountry = &GeneralAddressListCountry;
1558 AddressListLabel = &GeneralAddressListLabel;
1559 AddressListLang = &GeneralAddressListLang;
1560 AddressListAltID = &GeneralAddressListAltID;
1561 AddressListPID = &GeneralAddressListPID;
1562 AddressListTokens = &GeneralAddressListTokens;
1563 AddressListGeo = &GeneralAddressListGeo;
1564 AddressListTimezone = &GeneralAddressListTimezone;
1565 AddressListType = &GeneralAddressListType;
1566 AddressListMediatype = &GeneralAddressListMediatype;
1567 AddressListPref = &GeneralAddressListPref;
1570 AddressList = &HomeAddressList;
1571 AddressListTown = &HomeAddressListTown;
1572 AddressListCounty = &HomeAddressListCounty;
1573 AddressListPostCode = &HomeAddressListPostCode;
1574 AddressListCountry = &HomeAddressListCountry;
1575 AddressListLabel = &HomeAddressListLabel;
1576 AddressListLang = &HomeAddressListLang;
1577 AddressListAltID = &HomeAddressListAltID;
1578 AddressListPID = &HomeAddressListPID;
1579 AddressListTokens = &HomeAddressListTokens;
1580 AddressListGeo = &HomeAddressListGeo;
1581 AddressListTimezone = &HomeAddressListTimezone;
1582 AddressListType = &HomeAddressListType;
1583 AddressListMediatype = &HomeAddressListMediatype;
1584 AddressListPref = &HomeAddressListPref;
1587 AddressList = &BusinessAddressList;
1588 AddressListTown = &BusinessAddressListTown;
1589 AddressListCounty = &BusinessAddressListCounty;
1590 AddressListPostCode = &BusinessAddressListPostCode;
1591 AddressListCountry = &BusinessAddressListCountry;
1592 AddressListLabel = &BusinessAddressListLabel;
1593 AddressListLang = &BusinessAddressListLang;
1594 AddressListAltID = &BusinessAddressListAltID;
1595 AddressListPID = &BusinessAddressListPID;
1596 AddressListTokens = &BusinessAddressListTokens;
1597 AddressListGeo = &BusinessAddressListGeo;
1598 AddressListTimezone = &BusinessAddressListTimezone;
1599 AddressListType = &BusinessAddressListType;
1600 AddressListMediatype = &BusinessAddressListMediatype;
1601 AddressListPref = &BusinessAddressListPref;
1607 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1608 intiter != SplitPoints.end(); ++intiter){
1610 SLiter = SplitLength.find(intiter->first);
1611 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1612 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1613 intPrevValue = intiter->second;
1615 if (PropertyName == "GEO"){
1617 CaptureString(&PropertyValue, TRUE);
1621 CaptureString(&PropertyValue, FALSE);
1625 // Process properties.
1627 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1628 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1629 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1630 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1631 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1632 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1633 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1634 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1636 if (PropertyMatched == TRUE){
1638 PropertyMatched = FALSE;
1643 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1647 // Split the address.
1649 //std::map<int, int>::iterator SLiter;
1650 intPropertyLen = PropertySeg2.Len();
1651 SplitPoints.clear();
1652 SplitLength.clear();
1657 for (int i = 0; i <= intPropertyLen; i++){
1661 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1664 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1666 if (intSplitsFound == 6){
1668 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1673 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1683 // Split the data into several parts.
1685 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1686 intiter != SplitPoints.end(); ++intiter){
1688 if (intiter->first == 1){
1690 // Deal with PO Box.
1692 SLiter = SplitLength.find(1);
1694 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1695 intPrevValue = intiter->second;
1697 } else if (intiter->first == 2){
1699 // Deal with extended address.
1701 SLiter = SplitLength.find(2);
1703 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1704 intPrevValue = intiter->second;
1706 } else if (intiter->first == 3){
1708 // Deal with street address.
1710 SLiter = SplitLength.find(3);
1712 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1713 intPrevValue = intiter->second;
1715 } else if (intiter->first == 4){
1717 // Deal with locality
1719 SLiter = SplitLength.find(4);
1721 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1722 intPrevValue = intiter->second;
1724 } else if (intiter->first == 5){
1726 // Deal with region.
1728 SLiter = SplitLength.find(5);
1730 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1731 intPrevValue = intiter->second;
1734 } else if (intiter->first == 6){
1736 // Deal with post code.
1738 SLiter = SplitLength.find(6);
1740 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1741 intPrevValue = intiter->second;
1743 // Deal with country.
1745 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1753 // Add the data to the General/Home/Work address variables.
1755 CaptureString(&AddressStreet, FALSE);
1756 CaptureString(&AddressLocality, FALSE);
1757 CaptureString(&AddressRegion, FALSE);
1758 CaptureString(&AddressPostalCode, FALSE);
1759 CaptureString(&AddressCountry, FALSE);
1761 if (!PropertyTokens.IsEmpty()){
1763 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1767 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1768 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1769 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1770 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1771 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1775 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1778 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1781 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1785 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1789 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1791 // Process the email address.
1793 std::map<int, int> SplitPoints;
1794 std::map<int, int> SplitLength;
1796 int intPrevValue = 7;
1798 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1802 PropertyType PropType = PROPERTY_NONE;
1804 // Look for type before continuing.
1806 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1808 std::map<int, wxString> *EmailList = NULL;
1809 std::map<int, wxString> *EmailListType = NULL;
1810 std::map<int, wxString> *EmailListAltID = NULL;
1811 std::map<int, wxString> *EmailListPID = NULL;
1812 std::map<int, wxString> *EmailListTokens = NULL;
1813 std::map<int, int> *EmailListPref = NULL;
1817 EmailList = &GeneralEmailList;
1818 EmailListType = &GeneralEmailListType;
1819 EmailListAltID = &GeneralEmailListAltID;
1820 EmailListPID = &GeneralEmailListPID;
1821 EmailListTokens = &GeneralEmailListTokens;
1822 EmailListPref = &GeneralEmailListPref;
1825 EmailList = &HomeEmailList;
1826 EmailListType = &HomeEmailListType;
1827 EmailListAltID = &HomeEmailListAltID;
1828 EmailListPID = &HomeEmailListPID;
1829 EmailListTokens = &HomeEmailListTokens;
1830 EmailListPref = &HomeEmailListPref;
1833 EmailList = &BusinessEmailList;
1834 EmailListType = &BusinessEmailListType;
1835 EmailListAltID = &BusinessEmailListAltID;
1836 EmailListPID = &BusinessEmailListPID;
1837 EmailListTokens = &BusinessEmailListTokens;
1838 EmailListPref = &BusinessEmailListPref;
1844 std::map<int,int>::iterator SLiter;
1845 wxString PropertyData;
1846 wxString PropertyName;
1847 wxString PropertyValue;
1848 wxString PropertyTokens;
1849 bool FirstToken = TRUE;
1850 bool PropertyMatched = FALSE;
1852 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1853 intiter != SplitPoints.end(); ++intiter){
1855 SLiter = SplitLength.find(intiter->first);
1856 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1857 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1858 intPrevValue = intiter->second;
1860 CaptureString(&PropertyValue, FALSE);
1862 // Process properties.
1864 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
1865 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
1866 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
1868 if (PropertyMatched == TRUE){
1870 PropertyMatched = FALSE;
1875 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1879 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1881 // Add the name token data.
1883 if (!PropertyTokens.IsEmpty()){
1885 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1892 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1896 std::map<int, int> SplitPoints;
1897 std::map<int, int> SplitLength;
1899 int intPrevValue = 6;
1901 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1905 PropertyType PropType = PROPERTY_NONE;
1907 // Look for type before continuing.
1909 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1911 std::map<int, wxString> *IMList = NULL;
1912 std::map<int, wxString> *IMListType = NULL;
1913 std::map<int, wxString> *IMListAltID = NULL;
1914 std::map<int, wxString> *IMListPID = NULL;
1915 std::map<int, wxString> *IMListTokens = NULL;
1916 std::map<int, wxString> *IMListMediatype = NULL;
1917 std::map<int, wxString> *IMListTypeInfo = NULL;
1918 std::map<int, int> *IMListPref = NULL;
1922 IMList = &GeneralIMList;
1923 IMListType = &GeneralIMListType;
1924 IMListAltID = &GeneralIMListAltID;
1925 IMListPID = &GeneralIMListPID;
1926 IMListTokens = &GeneralIMListTokens;
1927 IMListMediatype = &GeneralIMListMediatype;
1928 IMListTypeInfo = &GeneralIMListTypeInfo;
1929 IMListPref = &GeneralIMListPref;
1932 IMList = &HomeIMList;
1933 IMListType = &HomeIMListType;
1934 IMListAltID = &HomeIMListAltID;
1935 IMListPID = &HomeIMListPID;
1936 IMListTokens = &HomeIMListTokens;
1937 IMListMediatype = &HomeIMListMediatype;
1938 IMListTypeInfo = &HomeIMListTypeInfo;
1939 IMListPref = &HomeIMListPref;
1942 IMList = &BusinessIMList;
1943 IMListType = &BusinessIMListType;
1944 IMListAltID = &BusinessIMListAltID;
1945 IMListPID = &BusinessIMListPID;
1946 IMListTokens = &BusinessIMListTokens;
1947 IMListMediatype = &BusinessIMListMediatype;
1948 IMListTypeInfo = &BusinessIMListTypeInfo;
1949 IMListPref = &BusinessIMListPref;
1955 std::map<int,int>::iterator SLiter;
1956 wxString PropertyData;
1957 wxString PropertyName;
1958 wxString PropertyValue;
1959 wxString PropertyTokens;
1960 bool FirstToken = TRUE;
1961 bool PropertyMatched = FALSE;
1963 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1964 intiter != SplitPoints.end(); ++intiter){
1966 SLiter = SplitLength.find(intiter->first);
1967 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1968 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1969 intPrevValue = intiter->second;
1971 CaptureString(&PropertyValue, FALSE);
1973 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
1974 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
1975 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
1976 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
1978 // Process properties.
1980 if (PropertyMatched == TRUE){
1982 PropertyMatched = FALSE;
1987 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1991 wxStringTokenizer IMPPSplitData(PropertySeg2, wxT(":"));
1993 if (IMPPSplitData.CountTokens() > 1){
1995 IMListTypeInfo->insert(std::make_pair(*IMCount, IMPPSplitData.GetNextToken()));
1996 IMList->insert(std::make_pair(*IMCount, IMPPSplitData.GetString()));
2000 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2001 IMListTypeInfo->insert(std::make_pair(*IMCount, "none"));
2005 // Add the name token data.
2007 if (!PropertyTokens.IsEmpty()){
2009 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2015 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2017 // Process the telephone.
2019 std::map<int, int> SplitPoints;
2020 std::map<int, int> SplitLength;
2021 std::map<int, int>::iterator SLiter;
2023 PropertyType PropType = PROPERTY_NONE;
2025 // Look for type before continuing.
2028 wxString TelTypeDetail;
2029 wxString PropertyData;
2030 wxString PropertyName;
2031 wxString PropertyValue;
2032 wxString PropertyTokens;
2034 std::map<int,int> TypeSplitPoints;
2035 std::map<int,int> TypeSplitLength;
2036 std::map<int,int>::iterator TSLiter;
2038 int intSplitSize = 0;
2039 int intSplitsFound = 0;
2040 int intSplitPoint = 0;
2042 int intPrevValue = 5;
2044 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2048 // Look for type before continuing.
2050 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2051 intiter != SplitPoints.end(); ++intiter){
2053 SLiter = SplitLength.find(intiter->first);
2054 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2055 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2056 intPrevValue = intiter->second;
2058 if (PropertyName == wxT("TYPE")){
2060 // Process each value in type and translate each
2063 // Strip out the quotes if they are there.
2065 size_t intPropertyValueLen = PropertyValue.Len();
2067 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2069 PropertyValue.Trim();
2070 PropertyValue.RemoveLast();
2074 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2076 PropertyValue.Remove(0, 1);
2080 TelTypeDetail = PropertyValue;
2086 for (int i = 0; i <= intPropertyValueLen; i++){
2090 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2092 if (intSplitsFound == 0){
2094 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2095 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2099 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2100 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2113 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2114 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2116 int intTypeSeek = 0;
2117 bool TypeFound = FALSE;
2119 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2120 typeiter != TypeSplitPoints.end(); ++typeiter){
2122 wxString TypePropertyName;
2124 TSLiter = TypeSplitLength.find(typeiter->first);
2126 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2128 if (intTypeSeek == 0){
2133 TelTypeUI.Append(wxT(","));
2137 if (TypePropertyName == wxT("home") && TypeFound == FALSE){
2139 PropType = PROPERTY_HOME;
2140 TelTypeUI.Append("home");
2144 } else if (TypePropertyName == wxT("work") && TypeFound == FALSE){
2146 PropType = PROPERTY_WORK;
2147 TelTypeUI.Append("work");
2153 if (TypePropertyName == wxT("text")){
2155 TelTypeUI.Append(_("text"));
2158 } else if (TypePropertyName == wxT("voice")){
2160 TelTypeUI.Append(_("voice"));
2163 } else if (TypePropertyName == wxT("fax")){
2165 TelTypeUI.Append(_("fax"));
2168 } else if (TypePropertyName == wxT("cell")){
2170 TelTypeUI.Append(_("cell"));
2173 } else if (TypePropertyName == wxT("video")){
2175 TelTypeUI.Append(_("video"));
2178 } else if (TypePropertyName == wxT("pager")){
2180 TelTypeUI.Append(_("pager"));
2183 } else if (TypePropertyName == wxT("textphone")){
2185 TelTypeUI.Append(_("textphone"));
2196 std::map<int, wxString> *TelephoneList = NULL;
2197 std::map<int, wxString> *TelephoneListType = NULL;
2198 std::map<int, wxString> *TelephoneListAltID = NULL;
2199 std::map<int, wxString> *TelephoneListPID = NULL;
2200 std::map<int, wxString> *TelephoneListTokens = NULL;
2201 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2202 std::map<int, wxString> *TelephoneListDataType = NULL;
2203 std::map<int, int> *TelephoneListPref = NULL;
2207 TelephoneList = &GeneralTelephoneList;
2208 TelephoneListType = &GeneralTelephoneListType;
2209 TelephoneListAltID = &GeneralTelephoneListAltID;
2210 TelephoneListPID = &GeneralTelephoneListPID;
2211 TelephoneListTokens = &GeneralTelephoneListTokens;
2212 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2213 TelephoneListDataType = &GeneralTelephoneListDataType;
2214 TelephoneListPref = &GeneralTelephoneListPref;
2217 TelephoneList = &HomeTelephoneList;
2218 TelephoneListType = &HomeTelephoneListType;
2219 TelephoneListAltID = &HomeTelephoneListAltID;
2220 TelephoneListPID = &HomeTelephoneListPID;
2221 TelephoneListTokens = &HomeTelephoneListTokens;
2222 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2223 TelephoneListDataType = &HomeTelephoneListDataType;
2224 TelephoneListPref = &HomeTelephoneListPref;
2227 TelephoneList = &BusinessTelephoneList;
2228 TelephoneListType = &BusinessTelephoneListType;
2229 TelephoneListAltID = &BusinessTelephoneListAltID;
2230 TelephoneListPID = &BusinessTelephoneListPID;
2231 TelephoneListTokens = &BusinessTelephoneListTokens;
2232 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2233 TelephoneListDataType = &BusinessTelephoneListDataType;
2234 TelephoneListPref = &BusinessTelephoneListPref;
2238 // Process the properties.
2240 bool FirstToken = TRUE;
2243 SplitPoints.clear();
2244 SplitLength.clear();
2246 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2250 bool PropertyMatched = FALSE;
2252 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2253 intiter != SplitPoints.end(); ++intiter){
2255 SLiter = SplitLength.find(intiter->first);
2256 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2257 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2258 intPrevValue = intiter->second;
2260 CaptureString(&PropertyValue, FALSE);
2262 // Process properties.
2264 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2265 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2266 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2268 if (PropertyMatched == TRUE){
2270 PropertyMatched = FALSE;
2275 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2279 // Check for the type information and split it down.
2281 wxStringTokenizer TelSplitData(PropertySeg2, wxT(":"));
2283 if (TelSplitData.CountTokens() > 1){
2285 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, TelSplitData.GetNextToken()));
2286 TelephoneList->insert(std::make_pair(*TelephoneCount, TelSplitData.GetString()));
2290 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2291 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, "tel"));
2295 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2297 // Add the name token data.
2299 if (!PropertyTokens.IsEmpty()){
2301 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2307 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2309 // Process the language.
2311 std::map<int, int> SplitPoints;
2312 std::map<int, int> SplitLength;
2314 int intPrevValue = 6;
2316 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2320 PropertyType PropType = PROPERTY_NONE;
2322 // Look for type before continuing.
2324 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2326 std::map<int, wxString> *LanguageList = NULL;
2327 std::map<int, wxString> *LanguageListType = NULL;
2328 std::map<int, wxString> *LanguageListAltID = NULL;
2329 std::map<int, wxString> *LanguageListPID = NULL;
2330 std::map<int, wxString> *LanguageListTokens = NULL;
2331 std::map<int, int> *LanguageListPref = NULL;
2335 LanguageList = &GeneralLanguageList;
2336 LanguageListType = &GeneralLanguageListType;
2337 LanguageListAltID = &GeneralLanguageListAltID;
2338 LanguageListPID = &GeneralLanguageListPID;
2339 LanguageListTokens = &GeneralLanguageListTokens;
2340 LanguageListPref = &GeneralLanguageListPref;
2343 LanguageList = &HomeLanguageList;
2344 LanguageListType = &HomeLanguageListType;
2345 LanguageListAltID = &HomeLanguageListAltID;
2346 LanguageListPID = &HomeLanguageListPID;
2347 LanguageListTokens = &HomeLanguageListTokens;
2348 LanguageListPref = &HomeLanguageListPref;
2351 LanguageList = &BusinessLanguageList;
2352 LanguageListType = &BusinessLanguageListType;
2353 LanguageListAltID = &BusinessLanguageListAltID;
2354 LanguageListPID = &BusinessLanguageListPID;
2355 LanguageListTokens = &BusinessLanguageListTokens;
2356 LanguageListPref = &BusinessLanguageListPref;
2362 std::map<int,int>::iterator SLiter;
2363 wxString PropertyData;
2364 wxString PropertyName;
2365 wxString PropertyValue;
2366 wxString PropertyTokens;
2367 bool FirstToken = TRUE;
2368 bool PropertyMatched = FALSE;
2370 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2371 intiter != SplitPoints.end(); ++intiter){
2373 SLiter = SplitLength.find(intiter->first);
2374 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2375 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2376 intPrevValue = intiter->second;
2378 CaptureString(&PropertyValue, FALSE);
2380 // Process properties.
2382 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2383 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2384 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2386 if (PropertyMatched == TRUE){
2388 PropertyMatched = FALSE;
2393 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2397 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2399 // Add the name token data.
2401 if (!PropertyTokens.IsEmpty()){
2403 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2409 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2411 // Process the geographic location.
2413 std::map<int, int> SplitPoints;
2414 std::map<int, int> SplitLength;
2416 int intPrevValue = 5;
2418 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2422 PropertyType PropType = PROPERTY_NONE;
2424 // Look for type before continuing.
2426 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2428 std::map<int, wxString> *GeopositionList = NULL;
2429 std::map<int, wxString> *GeopositionListType = NULL;
2430 std::map<int, wxString> *GeopositionListAltID = NULL;
2431 std::map<int, wxString> *GeopositionListPID = NULL;
2432 std::map<int, wxString> *GeopositionListTokens = NULL;
2433 std::map<int, wxString> *GeopositionListMediatype = NULL;
2434 std::map<int, wxString> *GeopositionListDataType = NULL;
2435 std::map<int, int> *GeopositionListPref = NULL;
2439 GeopositionList = &GeneralGeographyList;
2440 GeopositionListType = &GeneralGeographyListType;
2441 GeopositionListAltID = &GeneralGeographyListAltID;
2442 GeopositionListPID = &GeneralGeographyListPID;
2443 GeopositionListTokens = &GeneralGeographyListTokens;
2444 GeopositionListMediatype = &GeneralGeographyListMediatype;
2445 GeopositionListDataType = &GeneralGeographyListDataType;
2446 GeopositionListPref = &GeneralGeographyListPref;
2449 GeopositionList = &HomeGeographyList;
2450 GeopositionListType = &HomeGeographyListType;
2451 GeopositionListAltID = &HomeGeographyListAltID;
2452 GeopositionListPID = &HomeGeographyListPID;
2453 GeopositionListTokens = &HomeGeographyListTokens;
2454 GeopositionListMediatype = &HomeGeographyListMediatype;
2455 GeopositionListDataType = &HomeGeographyListDataType;
2456 GeopositionListPref = &HomeGeographyListPref;
2459 GeopositionList = &BusinessGeographyList;
2460 GeopositionListType = &BusinessGeographyListType;
2461 GeopositionListAltID = &BusinessGeographyListAltID;
2462 GeopositionListPID = &BusinessGeographyListPID;
2463 GeopositionListTokens = &BusinessGeographyListTokens;
2464 GeopositionListMediatype = &BusinessGeographyListMediatype;
2465 GeopositionListDataType = &BusinessGeographyListDataType;
2466 GeopositionListPref = &BusinessGeographyListPref;
2472 std::map<int,int>::iterator SLiter;
2473 wxString PropertyData;
2474 wxString PropertyName;
2475 wxString PropertyValue;
2476 wxString PropertyTokens;
2477 bool FirstToken = TRUE;
2478 bool PropertyMatched = FALSE;
2480 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2481 intiter != SplitPoints.end(); ++intiter){
2483 SLiter = SplitLength.find(intiter->first);
2484 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2485 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2486 intPrevValue = intiter->second;
2488 CaptureString(&PropertyValue, FALSE);
2490 // Process properties.
2492 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2493 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2494 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2495 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2497 if (PropertyMatched == TRUE){
2499 PropertyMatched = FALSE;
2504 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2508 wxStringTokenizer GeoSplitData(PropertySeg2, wxT(":"));
2510 if (GeoSplitData.CountTokens() > 1){
2512 GeopositionListDataType->insert(std::make_pair(*GeographicCount, GeoSplitData.GetNextToken()));
2513 GeopositionList->insert(std::make_pair(*GeographicCount, GeoSplitData.GetString()));
2517 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2518 GeopositionListDataType->insert(std::make_pair(*GeographicCount, "tel"));
2522 // Add the name token data.
2524 if (!PropertyTokens.IsEmpty()){
2526 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2532 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2534 // Process the relation.
2536 size_t intPropertyLen = PropertySeg1.Len();
2537 std::map<int, int> SplitPoints;
2538 std::map<int, int> SplitLength;
2539 std::map<int, int>::iterator SLiter;
2540 wxString PropertyData;
2541 wxString PropertyName;
2542 wxString PropertyValue;
2543 wxString PropertyTokens;
2544 wxString RelatedType;
2545 wxString RelatedTypeOriginal;
2546 wxString RelatedName;
2547 bool FirstToken = TRUE;
2548 int intSplitsFound = 0;
2549 int intSplitSize = 0;
2550 int intPrevValue = 9;
2552 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2556 // Look for type before continuing.
2558 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2559 intiter != SplitPoints.end(); ++intiter){
2561 SLiter = SplitLength.find(intiter->first);
2562 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2563 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2564 intPrevValue = intiter->second;
2568 RelatedTypeOriginal = PropertyValue;
2570 if (PropertyName == wxT("TYPE")){
2572 if (PropertyValue == wxT("contact")){
2574 RelatedType = _("Contact");
2576 } else if (PropertyValue == wxT("acquaintance")){
2578 RelatedType = _("Acquaintance");
2580 } else if (PropertyValue == wxT("friend")){
2582 RelatedType = _("Friend");
2584 } else if (PropertyValue == wxT("met")){
2586 RelatedType = _("Met");
2588 } else if (PropertyValue == wxT("co-worker")){
2590 RelatedType = _("Co-worker");
2592 } else if (PropertyValue == wxT("colleague")){
2594 RelatedType = _("Colleague");
2596 } else if (PropertyValue == wxT("co-resident")){
2598 RelatedType = _("Co-resident");
2600 } else if (PropertyValue == wxT("neighbor")){
2602 RelatedType = _("Neighbour");
2604 } else if (PropertyValue == wxT("child")){
2606 RelatedType = _("Child");
2608 } else if (PropertyValue == wxT("parent")){
2610 RelatedType = _("Parent");
2612 } else if (PropertyValue == wxT("sibling")){
2614 RelatedType = _("Sibling");
2616 } else if (PropertyValue == wxT("spouse")){
2618 RelatedType = _("Spouse");
2620 } else if (PropertyValue == wxT("kin")){
2622 RelatedType = _("Kin");
2624 } else if (PropertyValue == wxT("muse")){
2626 RelatedType = _("Muse");
2628 } else if (PropertyValue == wxT("crush")){
2630 RelatedType = _("Crush");
2632 } else if (PropertyValue == wxT("date")){
2634 RelatedType = _("Date");
2636 } else if (PropertyValue == wxT("sweetheart")){
2638 RelatedType = _("Sweetheart");
2640 } else if (PropertyValue == wxT("me")){
2642 RelatedType = _("Me");
2644 } else if (PropertyValue == wxT("agent")){
2646 RelatedType = _("Agent");
2648 } else if (PropertyValue == wxT("emergency")){
2650 RelatedType = _("Emergency");
2654 RelatedType = PropertyValue;
2664 bool PropertyMatched = FALSE;
2666 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2667 intiter != SplitPoints.end(); ++intiter){
2669 SLiter = SplitLength.find(intiter->first);
2670 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2671 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2672 intPrevValue = intiter->second;
2674 // Process properties.
2676 size_t intPropertyValueLen = PropertyValue.Len();
2678 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2680 PropertyValue.Trim();
2681 PropertyValue.RemoveLast();
2685 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2687 PropertyValue.Remove(0, 1);
2691 CaptureString(&PropertyValue, FALSE);
2693 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2694 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2695 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2696 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2698 if (PropertyMatched == TRUE){
2700 PropertyMatched = FALSE;
2705 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2709 // Add the data to the General/Home/Work address variables.
2711 GeneralRelatedList.erase(*RelatedCount);
2712 GeneralRelatedListRelType.erase(*RelatedCount);
2713 GeneralRelatedListType.erase(*RelatedCount);
2714 GeneralRelatedListTokens.erase(*RelatedCount);
2715 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2716 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2717 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2718 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2722 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2726 std::map<int, int> SplitPoints;
2727 std::map<int, int> SplitLength;
2728 std::map<int, int>::iterator SLiter;
2729 wxString PropertyData;
2730 wxString PropertyName;
2731 wxString PropertyValue;
2732 wxString PropertyTokens;
2733 bool FirstToken = TRUE;
2734 int intPrevValue = 5;
2736 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2740 PropertyType PropType = PROPERTY_NONE;
2742 // Look for type before continuing.
2744 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2746 // Setup the pointers.
2748 std::map<int, wxString> *WebsiteList = NULL;
2749 std::map<int, wxString> *WebsiteListAltID = NULL;
2750 std::map<int, wxString> *WebsiteListPID = NULL;
2751 std::map<int, wxString> *WebsiteListType = NULL;
2752 std::map<int, wxString> *WebsiteListTokens = NULL;
2753 std::map<int, wxString> *WebsiteListMediatype = NULL;
2754 std::map<int, int> *WebsiteListPref = NULL;
2756 // Setup blank lines for later on.
2760 WebsiteList = &GeneralWebsiteList;
2761 WebsiteListType = &GeneralWebsiteListType;
2762 WebsiteListAltID = &GeneralWebsiteListAltID;
2763 WebsiteListPID = &GeneralWebsiteListPID;
2764 WebsiteListTokens = &GeneralWebsiteListTokens;
2765 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2766 WebsiteListPref = &GeneralWebsiteListPref;
2769 WebsiteList = &HomeWebsiteList;
2770 WebsiteListType = &HomeWebsiteListType;
2771 WebsiteListAltID = &HomeWebsiteListAltID;
2772 WebsiteListPID = &HomeWebsiteListPID;
2773 WebsiteListTokens = &HomeWebsiteListTokens;
2774 WebsiteListMediatype = &HomeWebsiteListMediatype;
2775 WebsiteListPref = &HomeWebsiteListPref;
2778 WebsiteList = &BusinessWebsiteList;
2779 WebsiteListType = &BusinessWebsiteListType;
2780 WebsiteListAltID = &BusinessWebsiteListAltID;
2781 WebsiteListPID = &BusinessWebsiteListPID;
2782 WebsiteListTokens = &BusinessWebsiteListTokens;
2783 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2784 WebsiteListPref = &BusinessWebsiteListPref;
2789 bool PropertyMatched = FALSE;
2791 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2792 intiter != SplitPoints.end(); ++intiter){
2794 SLiter = SplitLength.find(intiter->first);
2795 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2796 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2797 intPrevValue = intiter->second;
2799 // Process properties.
2801 size_t intPropertyValueLen = PropertyValue.Len();
2803 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2805 PropertyValue.Trim();
2806 PropertyValue.RemoveLast();
2810 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2812 PropertyValue.Remove(0, 1);
2816 CaptureString(&PropertyValue, FALSE);
2818 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2819 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2820 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2821 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2823 if (PropertyMatched == TRUE){
2825 PropertyMatched = FALSE;
2830 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2834 // Add the data to the General/Home/Work address variables.
2836 CaptureString(&PropertySeg2, FALSE);
2838 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2840 if (!PropertyTokens.IsEmpty()){
2842 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2848 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2850 // Process the title.
2852 std::map<int, int> SplitPoints;
2853 std::map<int, int> SplitLength;
2854 std::map<int, int>::iterator SLiter;
2855 wxString PropertyData;
2856 wxString PropertyName;
2857 wxString PropertyValue;
2858 wxString PropertyTokens;
2859 bool FirstToken = TRUE;
2860 int intPrevValue = 7;
2862 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2866 PropertyType PropType = PROPERTY_NONE;
2868 // Look for type before continuing.
2870 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2872 // Setup the pointers.
2874 std::map<int, wxString> *TitleList = NULL;
2875 std::map<int, wxString> *TitleListAltID = NULL;
2876 std::map<int, wxString> *TitleListPID = NULL;
2877 std::map<int, wxString> *TitleListType = NULL;
2878 std::map<int, wxString> *TitleListTokens = NULL;
2879 std::map<int, wxString> *TitleListLanguage = NULL;
2880 std::map<int, int> *TitleListPref = NULL;
2882 // Setup blank lines for later on.
2886 TitleList = &GeneralTitleList;
2887 TitleListType = &GeneralTitleListType;
2888 TitleListAltID = &GeneralTitleListAltID;
2889 TitleListPID = &GeneralTitleListPID;
2890 TitleListTokens = &GeneralTitleListTokens;
2891 TitleListLanguage = &GeneralTitleListLanguage;
2892 TitleListPref = &GeneralTitleListPref;
2895 TitleList = &HomeTitleList;
2896 TitleListType = &HomeTitleListType;
2897 TitleListAltID = &HomeTitleListAltID;
2898 TitleListPID = &HomeTitleListPID;
2899 TitleListTokens = &HomeTitleListTokens;
2900 TitleListLanguage = &HomeTitleListLanguage;
2901 TitleListPref = &HomeTitleListPref;
2904 TitleList = &BusinessTitleList;
2905 TitleListType = &BusinessTitleListType;
2906 TitleListAltID = &BusinessTitleListAltID;
2907 TitleListPID = &BusinessTitleListPID;
2908 TitleListTokens = &BusinessTitleListTokens;
2909 TitleListLanguage = &BusinessTitleListLanguage;
2910 TitleListPref = &BusinessTitleListPref;
2915 bool PropertyMatched = FALSE;
2917 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2918 intiter != SplitPoints.end(); ++intiter){
2920 SLiter = SplitLength.find(intiter->first);
2921 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2922 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2923 intPrevValue = intiter->second;
2925 // Process properties.
2927 size_t intPropertyValueLen = PropertyValue.Len();
2929 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2931 PropertyValue.Trim();
2932 PropertyValue.RemoveLast();
2936 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2938 PropertyValue.Remove(0, 1);
2942 CaptureString(&PropertyValue, FALSE);
2944 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2945 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2946 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2947 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2949 if (PropertyMatched == TRUE){
2951 PropertyMatched = FALSE;
2956 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2960 // Add the data to the General/Home/Work address variables.
2962 CaptureString(&PropertySeg2, FALSE);
2964 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2966 if (!PropertyTokens.IsEmpty()){
2968 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2974 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2976 // Process the role.
2978 std::map<int, int> SplitPoints;
2979 std::map<int, int> SplitLength;
2980 std::map<int, int>::iterator SLiter;
2981 wxString PropertyData;
2982 wxString PropertyName;
2983 wxString PropertyValue;
2984 wxString PropertyTokens;
2985 bool FirstToken = TRUE;
2986 int intPrevValue = 6;
2988 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2992 PropertyType PropType = PROPERTY_NONE;
2994 // Look for type before continuing.
2996 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2998 // Setup the pointers.
3000 std::map<int, wxString> *RoleList = NULL;
3001 std::map<int, wxString> *RoleListAltID = NULL;
3002 std::map<int, wxString> *RoleListPID = NULL;
3003 std::map<int, wxString> *RoleListType = NULL;
3004 std::map<int, wxString> *RoleListTokens = NULL;
3005 std::map<int, wxString> *RoleListLanguage = NULL;
3006 std::map<int, int> *RoleListPref = NULL;
3008 // Setup blank lines for later on.
3012 RoleList = &GeneralRoleList;
3013 RoleListType = &GeneralRoleListType;
3014 RoleListAltID = &GeneralRoleListAltID;
3015 RoleListPID = &GeneralRoleListPID;
3016 RoleListTokens = &GeneralRoleListTokens;
3017 RoleListLanguage = &GeneralRoleListLanguage;
3018 RoleListPref = &GeneralRoleListPref;
3021 RoleList = &HomeRoleList;
3022 RoleListType = &HomeRoleListType;
3023 RoleListAltID = &HomeRoleListAltID;
3024 RoleListPID = &HomeRoleListPID;
3025 RoleListTokens = &HomeRoleListTokens;
3026 RoleListLanguage = &HomeRoleListLanguage;
3027 RoleListPref = &HomeRoleListPref;
3030 RoleList = &BusinessRoleList;
3031 RoleListType = &BusinessRoleListType;
3032 RoleListAltID = &BusinessRoleListAltID;
3033 RoleListPID = &BusinessRoleListPID;
3034 RoleListTokens = &BusinessRoleListTokens;
3035 RoleListLanguage = &BusinessRoleListLanguage;
3036 RoleListPref = &BusinessRoleListPref;
3041 bool PropertyMatched = FALSE;
3043 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3044 intiter != SplitPoints.end(); ++intiter){
3046 SLiter = SplitLength.find(intiter->first);
3047 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3048 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3049 intPrevValue = intiter->second;
3051 // Process properties.
3053 size_t intPropertyValueLen = PropertyValue.Len();
3055 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3057 PropertyValue.Trim();
3058 PropertyValue.RemoveLast();
3062 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3064 PropertyValue.Remove(0, 1);
3068 CaptureString(&PropertyValue, FALSE);
3070 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3071 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3072 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3073 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3075 if (PropertyMatched == TRUE){
3077 PropertyMatched = FALSE;
3082 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3086 // Add the data to the General/Home/Work address variables.
3088 CaptureString(&PropertySeg2, FALSE);
3090 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3092 if (!PropertyTokens.IsEmpty()){
3094 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3100 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3102 // Process the organisation.
3104 std::map<int, int> SplitPoints;
3105 std::map<int, int> SplitLength;
3106 std::map<int, int>::iterator SLiter;
3107 wxString PropertyData;
3108 wxString PropertyName;
3109 wxString PropertyValue;
3110 wxString PropertyTokens;
3111 bool FirstToken = TRUE;
3112 int intPrevValue = 5;
3114 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3118 PropertyType PropType = PROPERTY_NONE;
3120 // Look for type before continuing.
3122 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3124 // Setup the pointers.
3126 std::map<int, wxString> *OrganisationsList = NULL;
3127 std::map<int, wxString> *OrganisationsListAltID = NULL;
3128 std::map<int, wxString> *OrganisationsListPID = NULL;
3129 std::map<int, wxString> *OrganisationsListType = NULL;
3130 std::map<int, wxString> *OrganisationsListTokens = NULL;
3131 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3132 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3133 std::map<int, int> *OrganisationsListPref = NULL;
3135 // Setup blank lines for later on.
3139 OrganisationsList = &GeneralOrganisationsList;
3140 OrganisationsListType = &GeneralOrganisationsListType;
3141 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3142 OrganisationsListPID = &GeneralOrganisationsListPID;
3143 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3144 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3145 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3146 OrganisationsListPref = &GeneralOrganisationsListPref;
3149 OrganisationsList = &HomeOrganisationsList;
3150 OrganisationsListType = &HomeOrganisationsListType;
3151 OrganisationsListAltID = &HomeOrganisationsListAltID;
3152 OrganisationsListPID = &HomeOrganisationsListPID;
3153 OrganisationsListTokens = &HomeOrganisationsListTokens;
3154 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3155 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3156 OrganisationsListPref = &HomeOrganisationsListPref;
3159 OrganisationsList = &BusinessOrganisationsList;
3160 OrganisationsListType = &BusinessOrganisationsListType;
3161 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3162 OrganisationsListPID = &BusinessOrganisationsListPID;
3163 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3164 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3165 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3166 OrganisationsListPref = &BusinessOrganisationsListPref;
3171 bool PropertyMatched = FALSE;
3173 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3174 intiter != SplitPoints.end(); ++intiter){
3176 SLiter = SplitLength.find(intiter->first);
3177 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3178 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3179 intPrevValue = intiter->second;
3181 // Process properties.
3183 size_t intPropertyValueLen = PropertyValue.Len();
3185 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3187 PropertyValue.Trim();
3188 PropertyValue.RemoveLast();
3192 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3194 PropertyValue.Remove(0, 1);
3198 CaptureString(&PropertyValue, FALSE);
3200 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3201 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3202 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3203 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3204 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3206 if (PropertyMatched == TRUE){
3208 PropertyMatched = FALSE;
3213 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3217 // Add the data to the General/Home/Work address variables.
3219 CaptureString(&PropertySeg2, FALSE);
3221 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3223 if (!PropertyTokens.IsEmpty()){
3225 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3231 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3233 // Process the note.
3235 std::map<int, int> SplitPoints;
3236 std::map<int, int> SplitLength;
3237 std::map<int, int>::iterator SLiter;
3238 wxString PropertyData;
3239 wxString PropertyName;
3240 wxString PropertyValue;
3241 wxString PropertyTokens;
3242 bool FirstToken = TRUE;
3243 int intPrevValue = 6;
3245 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3249 PropertyType PropType = PROPERTY_NONE;
3251 // Look for type before continuing.
3253 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3255 // Setup the pointers.
3257 std::map<int, wxString> *NoteList = NULL;
3258 std::map<int, wxString> *NoteListAltID = NULL;
3259 std::map<int, wxString> *NoteListPID = NULL;
3260 std::map<int, wxString> *NoteListType = NULL;
3261 std::map<int, wxString> *NoteListTokens = NULL;
3262 std::map<int, wxString> *NoteListLanguage = NULL;
3263 std::map<int, int> *NoteListPref = NULL;
3265 // Setup blank lines for later on.
3269 NoteList = &GeneralNoteList;
3270 NoteListType = &GeneralNoteListType;
3271 NoteListAltID = &GeneralNoteListAltID;
3272 NoteListPID = &GeneralNoteListPID;
3273 NoteListTokens = &GeneralNoteListTokens;
3274 NoteListLanguage = &GeneralNoteListLanguage;
3275 NoteListPref = &GeneralNoteListPref;
3278 NoteList = &HomeNoteList;
3279 NoteListType = &HomeNoteListType;
3280 NoteListAltID = &HomeNoteListAltID;
3281 NoteListPID = &HomeNoteListPID;
3282 NoteListTokens = &HomeNoteListTokens;
3283 NoteListLanguage = &HomeNoteListLanguage;
3284 NoteListPref = &HomeNoteListPref;
3287 NoteList = &BusinessNoteList;
3288 NoteListType = &BusinessNoteListType;
3289 NoteListAltID = &BusinessNoteListAltID;
3290 NoteListPID = &BusinessNoteListPID;
3291 NoteListTokens = &BusinessNoteListTokens;
3292 NoteListLanguage = &BusinessNoteListLanguage;
3293 NoteListPref = &BusinessNoteListPref;
3298 bool PropertyMatched = FALSE;
3300 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3301 intiter != SplitPoints.end(); ++intiter){
3303 SLiter = SplitLength.find(intiter->first);
3304 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3305 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3306 intPrevValue = intiter->second;
3308 // Process properties.
3310 size_t intPropertyValueLen = PropertyValue.Len();
3312 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3314 PropertyValue.Trim();
3315 PropertyValue.RemoveLast();
3319 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3321 PropertyValue.Remove(0, 1);
3325 CaptureString(&PropertyValue, FALSE);
3327 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3328 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3329 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3330 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3332 if (PropertyMatched == TRUE){
3334 PropertyMatched = FALSE;
3339 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3343 // Add the data to the General/Home/Work address variables.
3345 CaptureString(&PropertySeg2, FALSE);
3347 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3349 if (!PropertyTokens.IsEmpty()){
3351 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3357 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3359 // Process the category.
3361 std::map<int, int> SplitPoints;
3362 std::map<int, int> SplitLength;
3363 std::map<int, int>::iterator SLiter;
3364 wxString PropertyData;
3365 wxString PropertyName;
3366 wxString PropertyValue;
3367 wxString PropertyTokens;
3368 bool FirstToken = TRUE;
3369 int intPrevValue = 12;
3371 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3375 PropertyType PropType = PROPERTY_NONE;
3377 // Look for type before continuing.
3379 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3381 // Setup blank lines for later on.
3387 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3390 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3395 bool PropertyMatched = FALSE;
3397 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3398 intiter != SplitPoints.end(); ++intiter){
3400 SLiter = SplitLength.find(intiter->first);
3401 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3402 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3403 intPrevValue = intiter->second;
3405 // Process properties.
3407 size_t intPropertyValueLen = PropertyValue.Len();
3409 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3411 PropertyValue.Trim();
3412 PropertyValue.RemoveLast();
3416 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3418 PropertyValue.Remove(0, 1);
3422 CaptureString(&PropertyValue, FALSE);
3424 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3425 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3426 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3427 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3429 if (PropertyMatched == TRUE){
3431 PropertyMatched = FALSE;
3436 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3440 // Deal with multiple categories.
3442 int intOrigCatCount = *CategoryCount;
3443 bool FirstCategoryProcessed = TRUE;
3444 bool AfterFirstToken = FALSE;
3445 int intSplitSize = 0;
3446 int intSplitsFound = 0;
3447 int intSplitSeek = 0;
3448 int intPropertyLen = PropertySeg2.Len();
3450 SplitPoints.clear();
3451 SplitLength.clear();
3454 for (int i = 0; i <= intPropertyLen; i++){
3456 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3464 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3466 if (AfterFirstToken == TRUE){
3468 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3469 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3473 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3474 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3475 AfterFirstToken = TRUE;
3487 if (SplitPoints.size() > 0){
3489 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3490 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3494 if (SplitPoints.size() == 0){
3496 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3498 if (!PropertyTokens.IsEmpty()){
3500 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3506 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3507 intiter != SplitPoints.end(); ++intiter){
3509 SLiter = SplitLength.find(intiter->first);
3511 intPrevValue = intiter->second;
3513 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3515 // Add the data to the General/Home/Work address variables.
3517 // Trim any whitespace from the start and end.
3519 PropertyData = PropertyData.Trim(FALSE);
3520 PropertyData = PropertyData.Trim(TRUE);
3522 CaptureString(&PropertyData, FALSE);
3524 if (FirstCategoryProcessed == TRUE){
3526 FirstCategoryProcessed = FALSE;
3528 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3530 if (!PropertyTokens.IsEmpty()){
3532 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3542 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3544 if (!PropertyTokens.IsEmpty()){
3546 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3552 // Copy the properties to each of the categories (if it exists).
3554 if (!PropertyTokens.IsEmpty()){
3556 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3560 // Check if ALTID was used.
3562 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3564 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3568 // Check if PID was used.
3570 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3572 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3576 // Check if PREF was used.
3578 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3580 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3584 // Check if LANGUAGE was used.
3586 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3588 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3592 // Check if TYPE was used.
3598 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3601 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3609 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3611 // Process the photo.
3613 size_t intPropertyLen = PropertySeg1.Len();
3614 std::map<int, int> SplitPoints;
3615 std::map<int, int> SplitLength;
3616 std::map<int, int>::iterator SLiter;
3617 wxString PropertyData;
3618 wxString PropertyName;
3619 wxString PropertyValue;
3620 wxString PropertyTokens;
3621 bool FirstToken = TRUE;
3622 int intSplitsFound = 0;
3623 int intSplitSize = 0;
3624 int intPrevValue = 7;
3626 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3630 PropertyType PropType = PROPERTY_NONE;
3632 // Look for type before continuing.
3634 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3637 bool PropertyMatched = FALSE;
3639 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3640 intiter != SplitPoints.end(); ++intiter){
3642 SLiter = SplitLength.find(intiter->first);
3643 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3644 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3645 intPrevValue = intiter->second;
3647 // Process properties.
3649 size_t intPropertyValueLen = PropertyValue.Len();
3651 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3653 PropertyValue.Trim();
3654 PropertyValue.RemoveLast();
3658 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3660 PropertyValue.Remove(0, 1);
3664 CaptureString(&PropertyValue, FALSE);
3666 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3667 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3668 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3669 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3671 if (PropertyMatched == TRUE){
3673 PropertyMatched = FALSE;
3678 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3682 intPropertyLen = PropertySeg2.Len();
3683 SplitPoints.clear();
3684 SplitLength.clear();
3689 CaptureString(&PropertySeg2, FALSE);
3691 for (int i = 0; i <= intPropertyLen; i++){
3695 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3698 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3700 if (intSplitsFound == 6){
3702 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3707 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3717 wxString wxSPhotoURI;
3718 wxString wxSPhotoMIME;
3719 wxString wxSPhotoEncoding;
3720 wxString wxSPhotoData;
3721 std::string base64enc;
3723 if (intSplitsFound == 0){
3727 std::map<int, int>::iterator striter;
3729 striter = SplitLength.find(1);
3731 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3733 while (wSTDataType.HasMoreTokens() == TRUE){
3735 wxSPhotoURI = wSTDataType.GetNextToken();
3736 wxSPhotoMIME = wSTDataType.GetNextToken();
3741 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3743 while (wSTDataInfo.HasMoreTokens() == TRUE){
3745 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3746 wxSPhotoData = wSTDataInfo.GetNextToken();
3747 base64enc = wxSPhotoData.mb_str();
3754 // Add the data to the General/Home/Work address variables.
3756 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3757 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3758 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3764 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3767 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3771 if (!PropertyTokens.IsEmpty()){
3773 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3779 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3781 // Process the logo.
3783 size_t intPropertyLen = PropertySeg1.Len();
3784 std::map<int, int> SplitPoints;
3785 std::map<int, int> SplitLength;
3786 std::map<int, int>::iterator SLiter;
3787 wxString PropertyData;
3788 wxString PropertyName;
3789 wxString PropertyValue;
3790 wxString PropertyTokens;
3791 bool FirstToken = TRUE;
3792 int intSplitsFound = 0;
3793 int intSplitSize = 0;
3794 int intPrevValue = 6;
3796 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3800 PropertyType PropType = PROPERTY_NONE;
3802 // Look for type before continuing.
3804 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3807 bool PropertyMatched = FALSE;
3809 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3810 intiter != SplitPoints.end(); ++intiter){
3812 SLiter = SplitLength.find(intiter->first);
3813 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3814 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3815 intPrevValue = intiter->second;
3817 // Process properties.
3819 size_t intPropertyValueLen = PropertyValue.Len();
3821 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3823 PropertyValue.Trim();
3824 PropertyValue.RemoveLast();
3828 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3830 PropertyValue.Remove(0, 1);
3834 CaptureString(&PropertyValue, FALSE);
3836 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3837 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3838 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3839 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3841 if (PropertyMatched == TRUE){
3843 PropertyMatched = FALSE;
3848 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3852 intPropertyLen = PropertySeg2.Len();
3853 SplitPoints.clear();
3854 SplitLength.clear();
3859 CaptureString(&PropertySeg2, FALSE);
3861 for (int i = 0; i <= intPropertyLen; i++){
3865 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3868 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3870 if (intSplitsFound == 6){
3872 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3877 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3887 wxString wxSPhotoURI;
3888 wxString wxSPhotoMIME;
3889 wxString wxSPhotoEncoding;
3890 wxString wxSPhotoData;
3891 std::string base64enc;
3893 if (intSplitsFound == 0){
3897 std::map<int, int>::iterator striter;
3899 striter = SplitLength.find(1);
3901 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3903 while (wSTDataType.HasMoreTokens() == TRUE){
3905 wxSPhotoURI = wSTDataType.GetNextToken();
3906 wxSPhotoMIME = wSTDataType.GetNextToken();
3911 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3913 while (wSTDataInfo.HasMoreTokens() == TRUE){
3915 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3916 wxSPhotoData = wSTDataInfo.GetNextToken();
3917 base64enc = wxSPhotoData.mb_str();
3924 // Add the data to the General/Home/Work address variables.
3926 LogosList.insert(std::make_pair(*LogoCount, base64enc));
3927 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3928 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3934 LogosListType.insert(std::make_pair(*LogoCount, "home"));
3937 LogosListType.insert(std::make_pair(*LogoCount, "work"));
3941 if (!PropertyTokens.IsEmpty()){
3943 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3949 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3951 // Process the sound.
3953 size_t intPropertyLen = PropertySeg1.Len();
3954 std::map<int, int> SplitPoints;
3955 std::map<int, int> SplitLength;
3956 std::map<int, int>::iterator SLiter;
3957 wxString PropertyData;
3958 wxString PropertyName;
3959 wxString PropertyValue;
3960 wxString PropertyTokens;
3961 bool FirstToken = TRUE;
3962 int intSplitsFound = 0;
3963 int intSplitSize = 0;
3964 int intPrevValue = 7;
3966 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3970 PropertyType PropType = PROPERTY_NONE;
3972 // Look for type before continuing.
3974 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3977 bool PropertyMatched = FALSE;
3979 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3980 intiter != SplitPoints.end(); ++intiter){
3982 SLiter = SplitLength.find(intiter->first);
3983 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3984 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3985 intPrevValue = intiter->second;
3987 // Process properties.
3989 size_t intPropertyValueLen = PropertyValue.Len();
3991 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3993 PropertyValue.Trim();
3994 PropertyValue.RemoveLast();
3998 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4000 PropertyValue.Remove(0, 1);
4004 CaptureString(&PropertyValue, FALSE);
4006 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
4007 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
4008 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
4009 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
4010 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
4012 if (PropertyMatched == TRUE){
4014 PropertyMatched = FALSE;
4019 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4023 intPropertyLen = PropertySeg2.Len();
4024 SplitPoints.clear();
4025 SplitLength.clear();
4030 CaptureString(&PropertySeg2, FALSE);
4032 for (int i = 0; i <= intPropertyLen; i++){
4036 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4039 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4041 if (intSplitsFound == 6){
4043 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4048 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4058 wxString wxSSoundURI;
4059 wxString wxSSoundMIME;
4060 wxString wxSSoundEncoding;
4061 wxString wxSSoundData;
4062 std::string base64enc;
4064 if (intSplitsFound == 0){
4068 std::map<int, int>::iterator striter;
4070 striter = SplitLength.find(1);
4072 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4074 while (wSTDataType.HasMoreTokens() == TRUE){
4076 wxSSoundURI = wSTDataType.GetNextToken();
4077 wxSSoundMIME = wSTDataType.GetNextToken();
4082 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4084 while (wSTDataInfo.HasMoreTokens() == TRUE){
4086 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4087 wxSSoundData = wSTDataInfo.GetNextToken();
4088 base64enc = wxSSoundData.mb_str();
4095 // Add the data to the General/Home/Work address variables.
4101 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4104 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4108 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4109 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4110 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4112 if (!PropertyTokens.IsEmpty()){
4114 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4120 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4122 // Process the calendar URI.
4124 size_t intPropertyLen = PropertySeg1.Len();
4125 std::map<int, int> SplitPoints;
4126 std::map<int, int> SplitLength;
4127 std::map<int, int>::iterator SLiter;
4128 wxString PropertyData;
4129 wxString PropertyName;
4130 wxString PropertyValue;
4131 wxString PropertyTokens;
4132 bool FirstToken = TRUE;
4133 int intSplitsFound = 0;
4134 int intSplitSize = 0;
4135 int intPrevValue = 8;
4137 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4141 PropertyType PropType = PROPERTY_NONE;
4143 // Look for type before continuing.
4145 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4148 bool PropertyMatched = FALSE;
4150 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4151 intiter != SplitPoints.end(); ++intiter){
4153 SLiter = SplitLength.find(intiter->first);
4154 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4155 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4156 intPrevValue = intiter->second;
4158 // Process properties.
4160 size_t intPropertyValueLen = PropertyValue.Len();
4162 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4164 PropertyValue.Trim();
4165 PropertyValue.RemoveLast();
4169 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4171 PropertyValue.Remove(0, 1);
4175 CaptureString(&PropertyValue, FALSE);
4177 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4178 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4179 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4180 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4182 if (PropertyMatched == TRUE){
4184 PropertyMatched = FALSE;
4189 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4193 intPropertyLen = PropertySeg2.Len();
4194 SplitPoints.clear();
4195 SplitLength.clear();
4200 CaptureString(&PropertySeg2, FALSE);
4202 // Add the data to the General/Home/Work address variables.
4208 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4211 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4215 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4217 if (!PropertyTokens.IsEmpty()){
4219 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4225 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4227 // Process the calendar address URI.
4229 size_t intPropertyLen = PropertySeg1.Len();
4230 std::map<int, int> SplitPoints;
4231 std::map<int, int> SplitLength;
4232 std::map<int, int>::iterator SLiter;
4233 wxString PropertyData;
4234 wxString PropertyName;
4235 wxString PropertyValue;
4236 wxString PropertyTokens;
4237 bool FirstToken = TRUE;
4238 int intSplitsFound = 0;
4239 int intSplitSize = 0;
4240 int intPrevValue = 8;
4242 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4246 PropertyType PropType = PROPERTY_NONE;
4248 // Look for type before continuing.
4250 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4253 bool PropertyMatched = FALSE;
4255 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4256 intiter != SplitPoints.end(); ++intiter){
4258 SLiter = SplitLength.find(intiter->first);
4259 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4260 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4261 intPrevValue = intiter->second;
4263 // Process properties.
4265 size_t intPropertyValueLen = PropertyValue.Len();
4267 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4269 PropertyValue.Trim();
4270 PropertyValue.RemoveLast();
4274 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4276 PropertyValue.Remove(0, 1);
4280 CaptureString(&PropertyValue, FALSE);
4282 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4283 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4284 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4285 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4287 if (PropertyMatched == TRUE){
4289 PropertyMatched = FALSE;
4294 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4298 intPropertyLen = PropertySeg2.Len();
4299 SplitPoints.clear();
4300 SplitLength.clear();
4305 CaptureString(&PropertySeg2, FALSE);
4307 // Add the data to the General/Home/Work address variables.
4313 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4316 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4320 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4322 if (!PropertyTokens.IsEmpty()){
4324 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4330 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4332 // Process the calendar free busy URL.
4334 size_t intPropertyLen = PropertySeg1.Len();
4335 std::map<int, int> SplitPoints;
4336 std::map<int, int> SplitLength;
4337 std::map<int, int>::iterator SLiter;
4338 wxString PropertyData;
4339 wxString PropertyName;
4340 wxString PropertyValue;
4341 wxString PropertyTokens;
4342 bool FirstToken = TRUE;
4343 int intSplitsFound = 0;
4344 int intSplitSize = 0;
4345 int intPrevValue = 7;
4347 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4351 PropertyType PropType = PROPERTY_NONE;
4353 // Look for type before continuing.
4355 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4358 bool PropertyMatched = FALSE;
4360 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4361 intiter != SplitPoints.end(); ++intiter){
4363 SLiter = SplitLength.find(intiter->first);
4364 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4365 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4366 intPrevValue = intiter->second;
4368 // Process properties.
4370 size_t intPropertyValueLen = PropertyValue.Len();
4372 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4374 PropertyValue.Trim();
4375 PropertyValue.RemoveLast();
4379 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4381 PropertyValue.Remove(0, 1);
4385 CaptureString(&PropertyValue, FALSE);
4387 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4388 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4389 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4390 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4392 if (PropertyMatched == TRUE){
4394 PropertyMatched = FALSE;
4399 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4403 intPropertyLen = PropertySeg2.Len();
4404 SplitPoints.clear();
4405 SplitLength.clear();
4410 CaptureString(&PropertySeg2, FALSE);
4412 // Add the data to the General/Home/Work address variables.
4418 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4421 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4425 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4427 if (!PropertyTokens.IsEmpty()){
4429 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4435 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4439 size_t intPropertyLen = PropertySeg1.Len();
4440 std::map<int, int> SplitPoints;
4441 std::map<int, int> SplitLength;
4442 std::map<int, int>::iterator SLiter;
4443 wxString PropertyData;
4444 wxString PropertyName;
4445 wxString PropertyValue;
4446 wxString PropertyTokens;
4447 bool FirstToken = TRUE;
4448 int intSplitsFound = 0;
4449 int intSplitSize = 0;
4450 int intPrevValue = 5;
4452 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4456 PropertyType PropType = PROPERTY_NONE;
4458 // Look for type before continuing.
4460 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4463 bool PropertyMatched = FALSE;
4465 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4466 intiter != SplitPoints.end(); ++intiter){
4468 SLiter = SplitLength.find(intiter->first);
4469 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4470 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4471 intPrevValue = intiter->second;
4473 // Process properties.
4475 size_t intPropertyValueLen = PropertyValue.Len();
4477 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4479 PropertyValue.Trim();
4480 PropertyValue.RemoveLast();
4484 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4486 PropertyValue.Remove(0, 1);
4490 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4491 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4492 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4494 if (PropertyMatched == TRUE){
4496 PropertyMatched = FALSE;
4501 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4505 intPropertyLen = PropertySeg2.Len();
4506 SplitPoints.clear();
4507 SplitLength.clear();
4512 for (int i = 0; i <= intPropertyLen; i++){
4516 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4519 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4521 if (intSplitsFound == 6){
4523 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4528 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4539 wxString wxSKeyMIME;
4540 wxString wxSKeyEncoding;
4541 wxString wxSKeyData;
4542 std::string base64enc;
4544 if (intSplitsFound == 0){
4548 std::map<int, int>::iterator striter;
4550 striter = SplitLength.find(1);
4552 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4554 while (wSTDataType.HasMoreTokens() == TRUE){
4556 wxSKeyURI = wSTDataType.GetNextToken();
4557 wxSKeyMIME = wSTDataType.GetNextToken();
4562 if (wxSKeyURI == wxT("data")){
4564 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4566 while (wSTDataInfo.HasMoreTokens() == TRUE){
4568 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4569 wxSKeyData = wSTDataInfo.GetNextToken();
4578 // Add the data to the General/Home/Work address variables.
4580 if (wxSKeyURI == wxT("data")){
4582 KeyListDataEncType.erase(*KeyCount);
4583 KeyListKeyType.erase(*KeyCount);
4584 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4585 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4587 KeyList.erase(*KeyCount);
4588 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4592 KeyList.erase(*KeyCount);
4593 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4597 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4603 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4606 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4610 if (!PropertyTokens.IsEmpty()){
4612 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4618 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4620 // Process the vendor information.
4622 // Split the Vendor three ways.
4624 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4627 wxString wxSVNDPropName;
4629 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4631 wSTVendorDetails.GetNextToken();
4632 wxSVNDID = wSTVendorDetails.GetNextToken();
4633 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4638 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4640 // Add the data to the vendor variables.
4642 VendorList.erase(*VendorCount);
4643 VendorListPEN.erase(*VendorCount);
4644 VendorListElement.erase(*VendorCount);
4646 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4647 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4648 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4654 void ContactDataObject::ClearData(){
4656 // Clear the contact information.
4659 NameForename.clear();
4660 NameSurname.clear();
4661 NameOtherNames.clear();
4663 NameNickname.clear();
4664 NameDisplayAs.clear();
4665 NameLanguage.clear();
4670 BirthdayAltID.clear();
4671 BirthdayCalScale.clear();
4672 BirthdayTokens.clear();
4673 Anniversary.clear();
4674 AnniversaryAltID.clear();
4675 AnniversaryCalScale.clear();
4676 AnniversaryTokens.clear();
4679 GenderDetails.clear();
4680 GenderTokens.clear();
4684 RevisionTokens.clear();
4687 SourceListAltID.clear();
4688 SourceListPID.clear();
4689 SourceListType.clear();
4690 SourceListTokens.clear();
4691 SourceListMediatype.clear();
4692 SourceListPref.clear();
4695 XMLListAltID.clear();
4697 ClientPIDList.clear();
4698 ClientPIDListTokens.clear();
4700 FullNamesList.clear();
4701 FullNamesListType.clear();
4702 FullNamesListLanguage.clear();
4703 FullNamesListAltID.clear();
4704 FullNamesListPID.clear();
4705 FullNamesListTokens.clear();
4706 FullNamesListPref.clear();
4708 GeneralNicknamesList.clear();
4709 GeneralNicknamesListType.clear();
4710 GeneralNicknamesListLanguage.clear();
4711 GeneralNicknamesListAltID.clear();
4712 GeneralNicknamesListPID.clear();
4713 GeneralNicknamesListTokens.clear();
4714 GeneralNicknamesListPref.clear();
4716 GeneralAddressList.clear();
4717 GeneralAddressListTown.clear();
4718 GeneralAddressListCounty.clear();
4719 GeneralAddressListPostCode.clear();
4720 GeneralAddressListCountry.clear();
4721 GeneralAddressListLabel.clear();
4722 GeneralAddressListLang.clear();
4723 GeneralAddressListAltID.clear();
4724 GeneralAddressListPID.clear();
4725 GeneralAddressListTokens.clear();
4726 GeneralAddressListGeo.clear();
4727 GeneralAddressListTimezone.clear();
4728 GeneralAddressListType.clear();
4729 GeneralAddressListMediatype.clear();
4730 GeneralAddressListPref.clear();
4732 GeneralEmailList.clear();
4733 GeneralEmailListAltID.clear();
4734 GeneralEmailListPID.clear();
4735 GeneralEmailListType.clear();
4736 GeneralEmailListTokens.clear();
4737 GeneralEmailListPref.clear();
4739 GeneralIMList.clear();
4740 GeneralIMListAltID.clear();
4741 GeneralIMListPID.clear();
4742 GeneralIMListType.clear();
4743 GeneralIMListTypeInfo.clear();
4744 GeneralIMListTokens.clear();
4745 GeneralIMListMediatype.clear();
4746 GeneralIMListPref.clear();
4748 GeneralTelephoneList.clear();
4749 GeneralTelephoneListAltID.clear();
4750 GeneralTelephoneListPID.clear();
4751 GeneralTelephoneListType.clear();
4752 GeneralTelephoneListTokens.clear();
4753 GeneralTelephoneListTypeInfo.clear();
4754 GeneralTelephoneListPref.clear();
4756 GeneralLanguageList.clear();
4757 GeneralLanguageListAltID.clear();
4758 GeneralLanguageListPID.clear();
4759 GeneralLanguageListType.clear();
4760 GeneralLanguageListTokens.clear();
4761 GeneralLanguageListPref.clear();
4763 GeneralTZList.clear();
4764 GeneralTZListAltID.clear();
4765 GeneralTZListPID.clear();
4766 GeneralTZListType.clear();
4767 GeneralTZListTokens.clear();
4768 GeneralTZListMediatype.clear();
4769 GeneralTZListPref.clear();
4771 GeneralGeographyList.clear();
4772 GeneralGeographyListAltID.clear();
4773 GeneralGeographyListPID.clear();
4774 GeneralGeographyListType.clear();
4775 GeneralGeographyListTokens.clear();
4776 GeneralGeographyListMediatype.clear();
4777 GeneralGeographyListPref.clear();
4779 GeneralRelatedList.clear();
4780 GeneralRelatedListRelType.clear();
4781 GeneralRelatedListLanguage.clear();
4782 GeneralRelatedListAltID.clear();
4783 GeneralRelatedListPID.clear();
4784 GeneralRelatedListType.clear();
4785 GeneralRelatedListTokens.clear();
4786 GeneralRelatedListPref.clear();
4788 GeneralWebsiteList.clear();
4789 GeneralWebsiteListAltID.clear();
4790 GeneralWebsiteListPID.clear();
4791 GeneralWebsiteListType.clear();
4792 GeneralWebsiteListTokens.clear();
4793 GeneralWebsiteListMediatype.clear();
4794 GeneralWebsiteListPref.clear();
4796 GeneralTitleList.clear();
4797 GeneralTitleListLanguage.clear();
4798 GeneralTitleListAltID.clear();
4799 GeneralTitleListPID.clear();
4800 GeneralTitleListType.clear();
4801 GeneralTitleListTokens.clear();
4802 GeneralTitleListPref.clear();
4804 GeneralRoleList.clear();
4805 GeneralRoleListLanguage.clear();
4806 GeneralRoleListAltID.clear();
4807 GeneralRoleListPID.clear();
4808 GeneralRoleListType.clear();
4809 GeneralRoleListTokens.clear();
4810 GeneralRoleListPref.clear();
4812 GeneralOrganisationsList.clear();
4813 GeneralOrganisationsListLanguage.clear();
4814 GeneralOrganisationsListAltID.clear();
4815 GeneralOrganisationsListPID.clear();
4816 GeneralOrganisationsListType.clear();
4817 GeneralOrganisationsListTokens.clear();
4818 GeneralOrganisationsListSortAs.clear();
4819 GeneralOrganisationsListPref.clear();
4821 GeneralNoteList.clear();
4822 GeneralNoteListLanguage.clear();
4823 GeneralNoteListAltID.clear();
4824 GeneralNoteListPID.clear();
4825 GeneralNoteListType.clear();
4826 GeneralNoteListTokens.clear();
4827 GeneralNoteListPref.clear();
4829 /* Items on Home Tab */
4831 HomeNicknamesList.clear();
4832 HomeNicknamesListType.clear();
4833 HomeNicknamesListLanguage.clear();
4834 HomeNicknamesListAltID.clear();
4835 HomeNicknamesListPID.clear();
4836 HomeNicknamesListTokens.clear();
4837 HomeNicknamesListPref.clear();
4839 HomeAddressList.clear();
4840 HomeAddressListTown.clear();
4841 HomeAddressListCounty.clear();
4842 HomeAddressListPostCode.clear();
4843 HomeAddressListCountry.clear();
4844 HomeAddressListLabel.clear();
4845 HomeAddressListLang.clear();
4846 HomeAddressListAltID.clear();
4847 HomeAddressListPID.clear();
4848 HomeAddressListTokens.clear();
4849 HomeAddressListGeo.clear();
4850 HomeAddressListTimezone.clear();
4851 HomeAddressListType.clear();
4852 HomeAddressListMediatype.clear();
4853 HomeAddressListPref.clear();
4855 HomeEmailList.clear();
4856 HomeEmailListAltID.clear();
4857 HomeEmailListPID.clear();
4858 HomeEmailListType.clear();
4859 HomeEmailListTokens.clear();
4860 HomeEmailListPref.clear();
4863 HomeIMListAltID.clear();
4864 HomeIMListPID.clear();
4865 HomeIMListType.clear();
4866 HomeIMListTypeInfo.clear();
4867 HomeIMListTokens.clear();
4868 HomeIMListMediatype.clear();
4869 HomeIMListPref.clear();
4871 HomeTelephoneList.clear();
4872 HomeTelephoneListAltID.clear();
4873 HomeTelephoneListPID.clear();
4874 HomeTelephoneListType.clear();
4875 HomeTelephoneListTokens.clear();
4876 HomeTelephoneListTypeInfo.clear();
4877 HomeTelephoneListPref.clear();
4879 HomeLanguageList.clear();
4880 HomeLanguageListAltID.clear();
4881 HomeLanguageListPID.clear();
4882 HomeLanguageListType.clear();
4883 HomeLanguageListTokens.clear();
4884 HomeLanguageListPref.clear();
4887 HomeTZListAltID.clear();
4888 HomeTZListPID.clear();
4889 HomeTZListType.clear();
4890 HomeTZListTokens.clear();
4891 HomeTZListMediatype.clear();
4892 HomeTZListPref.clear();
4894 HomeGeographyList.clear();
4895 HomeGeographyListAltID.clear();
4896 HomeGeographyListPID.clear();
4897 HomeGeographyListType.clear();
4898 HomeGeographyListTokens.clear();
4899 HomeGeographyListMediatype.clear();
4900 HomeGeographyListPref.clear();
4902 HomeWebsiteList.clear();
4903 HomeWebsiteListAltID.clear();
4904 HomeWebsiteListPID.clear();
4905 HomeWebsiteListType.clear();
4906 HomeWebsiteListTokens.clear();
4907 HomeWebsiteListMediatype.clear();
4908 HomeWebsiteListPref.clear();
4910 HomeTitleList.clear();
4911 HomeTitleListLanguage.clear();
4912 HomeTitleListAltID.clear();
4913 HomeTitleListPID.clear();
4914 HomeTitleListType.clear();
4915 HomeTitleListTokens.clear();
4916 HomeTitleListPref.clear();
4918 HomeRoleList.clear();
4919 HomeRoleListLanguage.clear();
4920 HomeRoleListAltID.clear();
4921 HomeRoleListPID.clear();
4922 HomeRoleListType.clear();
4923 HomeRoleListTokens.clear();
4924 HomeRoleListPref.clear();
4926 HomeOrganisationsList.clear();
4927 HomeOrganisationsListLanguage.clear();
4928 HomeOrganisationsListAltID.clear();
4929 HomeOrganisationsListPID.clear();
4930 HomeOrganisationsListType.clear();
4931 HomeOrganisationsListTokens.clear();
4932 HomeOrganisationsListSortAs.clear();
4933 HomeOrganisationsListPref.clear();
4935 HomeNoteList.clear();
4936 HomeNoteListLanguage.clear();
4937 HomeNoteListAltID.clear();
4938 HomeNoteListPID.clear();
4939 HomeNoteListType.clear();
4940 HomeNoteListTokens.clear();
4941 HomeNoteListPref.clear();
4943 /* Items on the Business tab */
4945 BusinessNicknamesList.clear();
4946 BusinessNicknamesListType.clear();
4947 BusinessNicknamesListLanguage.clear();
4948 BusinessNicknamesListAltID.clear();
4949 BusinessNicknamesListPID.clear();
4950 BusinessNicknamesListTokens.clear();
4951 BusinessNicknamesListPref.clear();
4953 BusinessAddressList.clear();
4954 BusinessAddressListTown.clear();
4955 BusinessAddressListCounty.clear();
4956 BusinessAddressListPostCode.clear();
4957 BusinessAddressListCountry.clear();
4958 BusinessAddressListLabel.clear();
4959 BusinessAddressListLang.clear();
4960 BusinessAddressListAltID.clear();
4961 BusinessAddressListPID.clear();
4962 BusinessAddressListTokens.clear();
4963 BusinessAddressListGeo.clear();
4964 BusinessAddressListTimezone.clear();
4965 BusinessAddressListType.clear();
4966 BusinessAddressListMediatype.clear();
4967 BusinessAddressListPref.clear();
4969 BusinessEmailList.clear();
4970 BusinessEmailListAltID.clear();
4971 BusinessEmailListPID.clear();
4972 BusinessEmailListType.clear();
4973 BusinessEmailListTokens.clear();
4974 BusinessEmailListPref.clear();
4976 BusinessIMList.clear();
4977 BusinessIMListAltID.clear();
4978 BusinessIMListPID.clear();
4979 BusinessIMListType.clear();
4980 BusinessIMListTokens.clear();
4981 BusinessIMListMediatype.clear();
4982 BusinessIMListPref.clear();
4984 BusinessTelephoneList.clear();
4985 BusinessTelephoneListAltID.clear();
4986 BusinessTelephoneListPID.clear();
4987 BusinessTelephoneListType.clear();
4988 BusinessTelephoneListTokens.clear();
4989 BusinessTelephoneListPref.clear();
4991 BusinessLanguageList.clear();
4992 BusinessLanguageListAltID.clear();
4993 BusinessLanguageListPID.clear();
4994 BusinessLanguageListType.clear();
4995 BusinessLanguageListTokens.clear();
4996 BusinessLanguageListPref.clear();
4998 BusinessTZList.clear();
4999 BusinessTZListAltID.clear();
5000 BusinessTZListPID.clear();
5001 BusinessTZListType.clear();
5002 BusinessTZListTokens.clear();
5003 BusinessTZListMediatype.clear();
5004 BusinessTZListPref.clear();
5006 BusinessGeographyList.clear();
5007 BusinessGeographyListAltID.clear();
5008 BusinessGeographyListPID.clear();
5009 BusinessGeographyListType.clear();
5010 BusinessGeographyListTokens.clear();
5011 BusinessGeographyListMediatype.clear();
5012 BusinessGeographyListPref.clear();
5014 BusinessWebsiteList.clear();
5015 BusinessWebsiteListAltID.clear();
5016 BusinessWebsiteListPID.clear();
5017 BusinessWebsiteListType.clear();
5018 BusinessWebsiteListTokens.clear();
5019 BusinessWebsiteListMediatype.clear();
5020 BusinessWebsiteListPref.clear();
5022 BusinessTitleList.clear();
5023 BusinessTitleListLanguage.clear();
5024 BusinessTitleListAltID.clear();
5025 BusinessTitleListPID.clear();
5026 BusinessTitleListType.clear();
5027 BusinessTitleListTokens.clear();
5028 BusinessTitleListPref.clear();
5030 BusinessRoleList.clear();
5031 BusinessRoleListLanguage.clear();
5032 BusinessRoleListAltID.clear();
5033 BusinessRoleListPID.clear();
5034 BusinessRoleListType.clear();
5035 BusinessRoleListTokens.clear();
5036 BusinessRoleListPref.clear();
5038 BusinessOrganisationsList.clear();
5039 BusinessOrganisationsListLanguage.clear();
5040 BusinessOrganisationsListAltID.clear();
5041 BusinessOrganisationsListPID.clear();
5042 BusinessOrganisationsListType.clear();
5043 BusinessOrganisationsListTokens.clear();
5044 BusinessOrganisationsListSortAs.clear();
5045 BusinessOrganisationsListPref.clear();
5047 BusinessNoteList.clear();
5048 BusinessNoteListLanguage.clear();
5049 BusinessNoteListAltID.clear();
5050 BusinessNoteListPID.clear();
5051 BusinessNoteListType.clear();
5052 BusinessNoteListTokens.clear();
5053 BusinessNoteListPref.clear();
5055 /* Items on the Categories tab */
5057 CategoriesList.clear();
5058 CategoriesListAltID.clear();
5059 CategoriesListPID.clear();
5060 CategoriesListType.clear();
5061 CategoriesListTokens.clear();
5062 CategoriesListLanguage.clear();
5063 CategoriesListPref.clear();
5065 /* Items on the Groups tab */
5068 GroupsListAltID.clear();
5069 GroupsListPID.clear();
5070 GroupsListType.clear();
5071 GroupsListMediaType.clear();
5072 GroupsListTokens.clear();
5073 GroupsListPref.clear();
5075 /* Items on the Pictures tab */
5077 PicturesList.clear();
5078 PicturesListAltID.clear();
5079 PicturesListPID.clear();
5080 PicturesListType.clear();
5081 PicturesListPicEncType.clear();
5082 PicturesListPictureType.clear();
5083 PicturesListTokens.clear();
5084 PicturesListMediatype.clear();
5085 PicturesListPref.clear();
5087 /* Items on the Logos tab */
5090 LogosListAltID.clear();
5091 LogosListPID.clear();
5092 LogosListType.clear();
5093 LogosListPicEncType.clear();
5094 LogosListPictureType.clear();
5095 LogosListTokens.clear();
5096 LogosListMediatype.clear();
5097 LogosListPref.clear();
5099 /* Items on the Sounds tab */
5102 SoundsListAltID.clear();
5103 SoundsListPID.clear();
5104 SoundsListType.clear();
5105 SoundsListAudioEncType.clear();
5106 SoundsListAudioType.clear();
5107 SoundsListTokens.clear();
5108 SoundsListMediatype.clear();
5109 SoundsListPref.clear();
5111 /* Items on the Calendaring tab */
5113 CalendarList.clear();
5114 CalendarListAltID.clear();
5115 CalendarListPID.clear();
5116 CalendarListType.clear();
5117 CalendarListTokens.clear();
5118 CalendarListMediatype.clear();
5119 CalendarListPref.clear();
5121 CalendarRequestList.clear();
5122 CalendarRequestListAltID.clear();
5123 CalendarRequestListPID.clear();
5124 CalendarRequestListType.clear();
5125 CalendarRequestListTokens.clear();
5126 CalendarRequestListMediatype.clear();
5127 CalendarRequestListPref.clear();
5129 FreeBusyList.clear();
5130 FreeBusyListAltID.clear();
5131 FreeBusyListPID.clear();
5132 FreeBusyListType.clear();
5133 FreeBusyListTokens.clear();
5134 FreeBusyListMediatype.clear();
5135 FreeBusyListPref.clear();
5137 /* Items on the Security tab */
5140 KeyListAltID.clear();
5142 KeyListKeyType.clear();
5143 KeyListDataType.clear();
5144 KeyListDataEncType.clear();
5145 KeyListType.clear();
5146 KeyListTokens.clear();
5147 KeyListPref.clear();
5149 /* Items on the Other tab */
5152 VendorListPEN.clear();
5153 VendorListElement.clear();
5156 XTokenListTokens.clear();
5160 void ProcessNameValue(wxString *PropertyData,
5161 wxString *PropertyName,
5162 wxString *PropertyValue){
5164 // Proces the name and value information.
5166 wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
5167 *PropertyName = PropertyElement.GetNextToken();
5168 *PropertyValue = PropertyElement.GetNextToken();
5172 void ProcessTokens(wxString *PropertyName,
5173 wxString *PropertyValue,
5174 wxString *PropertyTokens,
5177 // Process the tokens.
5179 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5181 if (*FirstToken == TRUE){
5183 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5184 *FirstToken = FALSE;
5188 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5196 void ProcessStringValue(wxString *PropertyName,
5197 wxString PropertyNameMatch,
5198 std::map<int,wxString> *MapPtr,
5199 wxString *PropertyValue,
5201 bool *PropertyMatched){
5203 // Process the string value.
5205 if (*PropertyName == PropertyNameMatch){
5206 MapPtr->erase(*ItemCount);
5207 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5208 *PropertyMatched = TRUE;
5213 void ProcessIntegerValue(wxString *PropertyName,
5214 wxString PropertyNameMatch,
5215 std::map<int,int> *PrefPtr,
5216 wxString *PropertyValue,
5218 bool *PropertyMatched){
5220 // Process the integer value.
5222 if (*PropertyName == PropertyNameMatch){
5223 *PropertyMatched = TRUE;
5228 int PriorityNumber = 0;
5229 bool ValidNumber = TRUE;
5232 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5235 catch(std::invalid_argument &e){
5236 ValidNumber = FALSE;
5239 if (ValidNumber == TRUE){
5241 PrefPtr->erase(*ItemCount);
5242 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5248 void SplitValues(wxString *PropertyLine,
5249 std::map<int,int> *SplitPoints,
5250 std::map<int,int> *SplitLength,
5253 // Split values from a string supplied by PropertyLine.
5255 size_t intPropertyLen = PropertyLine->Len();
5256 int intSplitsFound = 0;
5257 int intSplitSize = 0;
5258 int intSplitSeek = 0;
5260 for (int i = intSize; i <= intPropertyLen; i++){
5264 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5265 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5267 if (intSplitsFound == 0){
5269 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5273 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5277 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5287 if (intSplitsFound == 0){
5289 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5290 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5294 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5295 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5301 void CheckType(wxString *PropertySeg1,
5302 std::map<int,int> *SplitPoints,
5303 std::map<int,int> *SplitLength,
5305 PropertyType *PropType){
5307 // Check the information type.
5309 wxString PropertyData;
5310 wxString PropertyName;
5311 wxString PropertyValue;
5312 std::map<int,int>::iterator SLiter;
5314 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5315 intiter != SplitPoints->end(); ++intiter){
5317 SLiter = SplitLength->find(intiter->first);
5318 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5319 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
5320 *intPrevValue = intiter->second;
5322 if (PropertyName == wxT("TYPE")){
5324 if (PropertyValue == wxT("work")){
5326 *PropType = PROPERTY_WORK;
5328 } else if (PropertyValue == wxT("home")){
5330 *PropType = PROPERTY_HOME;
5334 *PropType = PROPERTY_NONE;