1 // ContactDataObject.cpp - Client Data Object.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "ContactDataObject.h"
21 ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
23 if (!wxFileExists(Filename)){
25 return CONTACTLOAD_FILEMISSING;
31 if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
33 return CONTACTLOAD_FILEERROR;
37 // Check that the vCard is a valid vCard 4.0 file.
39 vCard vCard4FormatCheck;
41 vCard4FormatCheck.LoadFile(Filename);
43 if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){
45 return CONTACTLOAD_FILEINVALIDFORMAT;
49 // Check that the vCard meets the base specification.
51 if (!vCard4FormatCheck.MeetBaseSpecification()){
53 return CONTACTLOAD_FILEBASESPECFAIL;
57 wxStringTokenizer wSTContactFileLines(vCard4FormatCheck.WriteString(), wxT("\r\n"));
59 std::map<int, wxString> ContactFileLines;
61 int ContactLineSeek = 0;
63 while (wSTContactFileLines.HasMoreTokens() == TRUE){
65 wxString ContactLine = wSTContactFileLines.GetNextToken();
66 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
71 wxString wxSPropertyNextLine;
73 bool ExtraLineSeek = TRUE;
74 bool QuoteMode = FALSE;
75 bool PropertyFind = TRUE;
76 bool KindProcessed = FALSE;
77 bool NameProcessed = FALSE;
78 bool GenderProcessed = FALSE;
79 bool BirthdayProcessed = FALSE;
80 bool AnniversaryProcessed = FALSE;
81 bool UIDProcessed = FALSE;
82 bool RevisionProcessed = FALSE;
83 int ContactLineLen = 0;
84 int QuoteBreakPoint = 0;
88 int NicknameCount = 0;
89 int TimeZoneCount = 0;
93 int TelephoneCount = 0;
94 int LanguageCount = 0;
95 int GeographicCount = 0;
100 int OrganisationCount = 0;
102 int CategoryCount = 0;
106 int CalendarCount = 0;
107 int CalendarAddressCount = 0;
108 int FreeBusyAddressCount = 0;
113 int ClientPIDCount = 0;
114 wxString ContactLine;
115 wxString PropertyLine;
116 wxString PropertySeg1;
117 wxString PropertySeg2;
118 wxString PropertyNextLine;
121 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
122 iter != ContactFileLines.end(); ++iter){
124 ExtraLineSeek = TRUE;
130 PropertyLine.Clear();
131 PropertySeg1.Clear();
132 PropertySeg2.Clear();
135 ContactLine = iter->second;
137 while (ExtraLineSeek == TRUE){
139 // Check if there is extra data on the next line
140 // (indicated by space or tab at the start) and add data.
144 if (iter == ContactFileLines.end()){
151 PropertyNextLine = iter->second;
153 if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
155 PropertyNextLine.Remove(0, 1);
156 ContactLine.Append(PropertyNextLine);
161 ExtraLineSeek = FALSE;
167 ContactLineLen = ContactLine.Len();
169 // Make sure we are not in quotation mode.
170 // Make sure colon does not have \ or \\ before it.
172 for (int i = 0; i <= ContactLineLen; i++){
174 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
176 PropertyFind = FALSE;
178 } else if (PropertyFind == TRUE){
180 Property.Append(ContactLine.Mid(i, 1));
184 if (ContactLine.Mid(i, 1) == wxT("\"")){
186 if (QuoteMode == TRUE){
198 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
207 // Split that line at the point into two variables (ignore the colon).
209 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
210 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
212 if (Property == wxT("KIND") && KindProcessed == FALSE){
214 ProcessKind(PropertySeg2);
216 } else if (Property == wxT("UID") && UIDProcessed == FALSE){
218 UIDToken = PropertySeg2;
221 } else if (Property == wxT("SOURCE")){
223 ProcessSource(PropertySeg1, PropertySeg2, &SourceCount);
226 } else if (Property == wxT("XML")){
228 ProcessXML(PropertySeg1, PropertySeg2, &XMLCount);
231 } else if (Property == wxT("REV") && RevisionProcessed == FALSE){
233 ProcessRevision(PropertySeg1, PropertySeg2);
234 RevisionProcessed = TRUE;
236 } else if (Property == wxT("MEMBER")){
238 ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
241 } else if (Property == wxT("FN")){
243 ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
246 } else if (Property == wxT("N") && NameProcessed == FALSE){
248 ProcessN(PropertySeg1, PropertySeg2);
249 NameProcessed = TRUE;
251 } else if (Property == wxT("CLIENTPIDMAP")){
253 ProcessClientPIDMap(PropertySeg1, PropertySeg2, &ClientPIDCount);
256 } else if (Property == wxT("NICKNAME")){
258 ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
261 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
263 ProcessGender(PropertySeg1, PropertySeg2);
264 GenderProcessed = TRUE;
266 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
268 ProcessBirthday(PropertySeg1, PropertySeg2);
269 BirthdayProcessed = TRUE;
271 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
273 ProcessAnniversary(PropertySeg1, PropertySeg2);
274 AnniversaryProcessed = TRUE;
276 } else if (Property == wxT("TZ")){
278 ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
281 } else if (Property == wxT("ADR")){
283 ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
286 } else if (Property == wxT("EMAIL")){
288 ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);
291 } else if (Property == wxT("IMPP")){
293 ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
296 } else if (Property == wxT("TEL")){
298 ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
301 } else if (Property == wxT("LANG")){
303 // See frmContactEditor-LoadLanguage.cpp
305 ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
308 } else if (Property == wxT("GEO")){
310 // See frmContactEditor-LoadGeo.cpp
312 ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);
315 } else if (Property == wxT("RELATED")){
317 // See fromContactEditor-LoadRelated.cpp
319 ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);
322 } else if (Property == wxT("URL")){
324 // See frmContactEditor-LoadURL.cpp
326 ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
329 } else if (Property == wxT("TITLE")) {
331 // See frmContactEditor-LoadTitle.cpp
333 ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
336 } else if (Property == wxT("ROLE")) {
338 // See frmContactEditor-LoadTitle.cpp
340 ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
343 } else if (Property == wxT("ORG")) {
345 // See frmContactEditor-LoadOrg.cpp
347 ProcessOrganisation(PropertySeg1, PropertySeg2, &OrganisationCount);
350 } else if (Property == wxT("NOTE")) {
352 // See frmContactEditor-LoadNote.cpp
354 ProcessNote(PropertySeg1, PropertySeg2, &NoteCount);
357 } else if (Property == wxT("CATEGORIES")) {
359 // See frmContactEditor-LoadCategory.cpp
361 ProcessCategory(PropertySeg1, PropertySeg2, &CategoryCount);
364 } else if (Property == wxT("PHOTO")) {
366 // See frmContactEditor-LoadPhoto.cpp
368 ProcessPhoto(PropertySeg1, PropertySeg2, &PhotoCount);
371 } else if (Property == wxT("LOGO")) {
373 // See frmContactEditor-LoadPhoto.cpp
375 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
378 } else if (Property == wxT("LOGO")) {
380 // See frmContactEditor-LoadPhoto.cpp
382 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
385 } else if (Property == wxT("SOUND")) {
387 // See frmContactEditor-LoadSound.cpp
389 ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
392 } else if (Property == wxT("CALURI")){
394 // See frmContactEditor-LoadCalendar.cpp
396 ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
399 } else if (Property == wxT("CALADRURI")){
401 ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
402 CalendarAddressCount++;
404 } else if (Property == wxT("FBURL")){
406 // See frmContactEditor-LoadCalendar.cpp
408 ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
409 FreeBusyAddressCount++;
411 } else if (Property == wxT("KEY")){
413 // See frmContactEditor-LoadKey.cpp
415 ProcessKey(PropertySeg1, PropertySeg2, &KeyCount);
418 } else if (Property.Mid(0, 3) == wxT("VND")){
420 ProcessVendor(PropertySeg1, PropertySeg2, &VendorCount);
423 } else if (Property.Mid(0, 2) == wxT("X-")){
425 XTokenList.insert(std::make_pair(XTokenCount, PropertySeg2));
426 XTokenListTokens.insert(std::make_pair(XTokenCount, PropertySeg1.Mid(2)));
433 return CONTACTLOAD_OK;
437 void ContactDataObject::ProcessKind(wxString KindType){
439 if (KindType == wxT("individual")){
441 ContactKind = CONTACTKIND_INDIVIDUAL;
443 } else if (KindType == wxT("group")){
445 ContactKind = CONTACTKIND_GROUP;
447 } else if (KindType == wxT("org")){
449 ContactKind = CONTACTKIND_ORGANISATION;
451 } else if (KindType == wxT("location")){
453 ContactKind = CONTACTKIND_LOCATION;
457 ContactKind = CONTACTKIND_NONE;
462 void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString PropertySeg2){
464 size_t intPropertyLen = PropertySeg1.Len();
465 std::map<int, int> SplitPoints;
466 std::map<int, int> SplitLength;
467 std::map<int, int>::iterator SLiter;
468 wxString PropertyData;
469 wxString PropertyName;
470 wxString PropertyValue;
471 wxString PropertyTokens;
472 bool FirstToken = TRUE;
473 int intSplitsFound = 0;
474 int intSplitSize = 0;
475 int intPrevValue = 5;
479 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
483 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
484 intiter != SplitPoints.end(); ++intiter){
486 SLiter = SplitLength.find(intiter->first);
488 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
490 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
491 PropertyName = PropertyElement.GetNextToken();
492 PropertyValue = PropertyElement.GetNextToken();
494 intPrevValue = intiter->second;
496 // Process properties.
498 size_t intPropertyValueLen = PropertyValue.Len();
500 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
502 PropertyValue.Trim();
503 PropertyValue.RemoveLast();
507 if (PropertyValue.Mid(0, 1) == wxT("\"")){
509 PropertyValue.Remove(0, 1);
513 CaptureString(&PropertyValue, FALSE);
515 if (FirstToken == TRUE){
517 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
522 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
528 CaptureString(&PropertySeg2, FALSE);
530 Revision = PropertySeg2;
532 if (!PropertyTokens.IsEmpty()){
534 RevisionTokens = PropertyTokens;
541 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
543 size_t intPropertyLen = PropertySeg1.Len();
544 std::map<int, int> SplitPoints;
545 std::map<int, int> SplitLength;
546 std::map<int, int>::iterator SLiter;
547 wxString PropertyData;
548 wxString PropertyName;
549 wxString PropertyValue;
550 wxString PropertyTokens;
551 bool FirstToken = TRUE;
552 int intSplitsFound = 0;
553 int intSplitSize = 0;
554 int intPrevValue = 8;
558 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
562 PropertyType PropType = PROPERTY_NONE;
564 // Look for type before continuing.
566 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
570 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
571 intiter != SplitPoints.end(); ++intiter){
573 SLiter = SplitLength.find(intiter->first);
575 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
577 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
578 PropertyName = PropertyElement.GetNextToken();
579 PropertyValue = PropertyElement.GetNextToken();
581 intPrevValue = intiter->second;
583 // Process properties.
585 size_t intPropertyValueLen = PropertyValue.Len();
587 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
589 PropertyValue.Trim();
590 PropertyValue.RemoveLast();
594 if (PropertyValue.Mid(0, 1) == wxT("\"")){
596 PropertyValue.Remove(0, 1);
600 CaptureString(&PropertyValue, FALSE);
602 if (PropertyName == wxT("ALTID")){
604 SourceListAltID.erase(*SourceCount);
605 SourceListAltID.insert(std::make_pair(*SourceCount, PropertyValue));
607 } else if (PropertyName == wxT("PID")){
609 SourceListPID.erase(*SourceCount);
610 SourceListPID.insert(std::make_pair(*SourceCount, PropertyValue));
612 } else if (PropertyName == wxT("PREF")){
614 ProcessIntegerValue(this, &SourceListPref, &PropertyValue, SourceCount);
616 } else if (PropertyName == wxT("MEDIATYPE")){
618 SourceListMediatype.erase(*SourceCount);
619 SourceListMediatype.insert(std::make_pair(*SourceCount, PropertyValue));
623 // Something else we don't know about so append
624 // to the tokens variable.
626 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
628 if (FirstToken == TRUE){
630 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
635 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
645 intPropertyLen = PropertySeg2.Len();
652 CaptureString(&PropertySeg2, FALSE);
654 // Add the data to the General/Home/Work address variables.
660 SourceListType.insert(std::make_pair(*SourceCount, "home"));
663 SourceListType.insert(std::make_pair(*SourceCount, "work"));
667 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
669 if (!PropertyTokens.IsEmpty()){
671 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
677 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
679 std::map<int, int> SplitPoints;
680 std::map<int, int> SplitLength;
682 int intPrevValue = 5;
686 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
690 wxString PropertyName;
691 wxString PropertyValue;
692 wxString PropertyData;
693 wxString PropertyTokens;
694 std::map<int,int>::iterator SLiter;
695 bool FirstToken = TRUE;
697 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
698 intiter != SplitPoints.end(); ++intiter){
700 SLiter = SplitLength.find(intiter->first);
702 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
704 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
705 PropertyName = PropertyElement.GetNextToken();
706 PropertyValue = PropertyElement.GetNextToken();
708 intPrevValue = intiter->second;
710 CaptureString(&PropertyValue, FALSE);
712 if (PropertyName == wxT("ALTID")){
714 XMLListAltID.erase(*XMLCount);
715 XMLListAltID.insert(std::make_pair(*XMLCount, PropertyValue));
721 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
725 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
727 std::map<int, int> SplitPoints;
728 std::map<int, int> SplitLength;
730 int intPrevValue = 8;
734 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
738 wxString PropertyName;
739 wxString PropertyValue;
740 wxString PropertyData;
741 wxString PropertyTokens;
742 std::map<int,int>::iterator SLiter;
743 bool FirstToken = TRUE;
745 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
746 intiter != SplitPoints.end(); ++intiter){
748 SLiter = SplitLength.find(intiter->first);
750 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
752 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
753 PropertyName = PropertyElement.GetNextToken();
754 PropertyValue = PropertyElement.GetNextToken();
756 intPrevValue = intiter->second;
758 CaptureString(&PropertyValue, FALSE);
760 if (PropertyName == wxT("ALTID")){
762 GroupsListAltID.erase(*GroupCount);
763 GroupsListAltID.insert(std::make_pair(*GroupCount, PropertyValue));
765 } else if (PropertyName == wxT("PID")){
767 GroupsListPID.erase(*GroupCount);
768 GroupsListPID.insert(std::make_pair(*GroupCount, PropertyValue));
770 } else if (PropertyName == wxT("PREF")){
772 ProcessIntegerValue(this, &GroupsListPref, &PropertyValue, GroupCount);
774 } else if (PropertyName == wxT("MEDIATYPE")){
776 GroupsListMediaType.erase(*GroupCount);
777 GroupsListMediaType.insert(std::make_pair(*GroupCount, PropertyValue));
779 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
781 if (FirstToken == TRUE){
783 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
788 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
796 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
798 if (!PropertyTokens.IsEmpty()){
800 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
807 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
809 std::map<int, int> SplitPoints;
810 std::map<int, int> SplitLength;
812 int intPrevValue = 4;
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);
832 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
834 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
835 PropertyName = PropertyElement.GetNextToken();
836 PropertyValue = PropertyElement.GetNextToken();
838 intPrevValue = intiter->second;
840 CaptureString(&PropertyValue, FALSE);
842 if (PropertyName == wxT("TYPE")){
844 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
845 PropertyValue == wxT("work") ){
847 FullNamesListType.erase(*FNCount);
848 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
852 } else if (PropertyName == wxT("LANGUAGE")){
854 FullNamesListLanguage.erase(*FNCount);
855 FullNamesListLanguage.insert(std::make_pair(*FNCount, PropertyValue));
857 } else if (PropertyName == wxT("ALTID")){
859 FullNamesListAltID.erase(*FNCount);
860 FullNamesListAltID.insert(std::make_pair(*FNCount, PropertyValue));
862 } else if (PropertyName == wxT("PID")){
864 FullNamesListPID.erase(*FNCount);
865 FullNamesListPID.insert(std::make_pair(*FNCount, PropertyValue));
867 } else if (PropertyName == wxT("PREF")){
869 ProcessIntegerValue(this, &FullNamesListPref, &PropertyValue, FNCount);
871 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
873 if (FirstToken == TRUE){
875 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
880 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
888 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
890 if (!PropertyTokens.IsEmpty()){
892 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
898 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
900 std::map<int, int> SplitPoints;
901 std::map<int, int> SplitLength;
903 int intPrevValue = 3;
907 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
911 wxString PropertyName;
912 wxString PropertyValue;
913 wxString PropertyData;
914 wxString PropertyTokens;
915 std::map<int,int>::iterator SLiter;
916 bool FirstToken = TRUE;
918 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
919 intiter != SplitPoints.end(); ++intiter){
921 SLiter = SplitLength.find(intiter->first);
923 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
925 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
926 PropertyName = PropertyElement.GetNextToken();
927 PropertyValue = PropertyElement.GetNextToken();
929 intPrevValue = intiter->second;
931 CaptureString(&PropertyValue, FALSE);
933 if (PropertyName == wxT("ALTID")){
935 NameAltID = PropertyValue;
937 } else if (PropertyName == wxT("LANGUAGE")){
939 NameLanguage = PropertyValue;
941 } else if (PropertyName == wxT("SORT-AS")){
943 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
944 PropertyValue.Len() >= 3){
945 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
948 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
950 if (FirstToken == TRUE){
952 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
957 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
965 // Split the name data.
967 int intSplitSeek = 0;
968 int intSplitsFound = 0;
969 int intSplitSize = 0;
970 int intPropertyLen = PropertySeg2.Len();
972 std::map<int,wxString> NameValues;
975 for (int i = 0; i <= intPropertyLen; i++){
977 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
979 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
984 if (intSplitsFound == 4){
986 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
1000 // Split the data into several parts.
1002 for (std::map<int, wxString>::iterator iter = NameValues.begin();
1003 iter != NameValues.end(); ++iter){
1005 if (iter->first == 1){
1007 // Deal with family name.
1009 NameSurname = iter->second;
1011 } else if (iter->first == 2){
1013 // Deal with given names.
1015 NameForename = iter->second;
1017 } else if (iter->first == 3){
1019 // Deal with additional names.
1021 NameOtherNames = iter->second;
1023 } else if (iter->first == 4){
1025 // Deal with honorifix prefixes and suffixes.
1027 NameTitle = iter->second;
1031 if (iter == NameValues.end()){
1037 NameSuffix = iter->second;
1043 // Add the name token data.
1045 if (!PropertyTokens.IsEmpty()){
1047 NameTokens = PropertyTokens;
1053 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
1055 size_t intPropertyLen = PropertySeg1.Len();
1056 std::map<int, int> SplitPoints;
1057 std::map<int, int> SplitLength;
1058 std::map<int, int>::iterator SLiter;
1059 wxString PropertyData;
1060 wxString PropertyName;
1061 wxString PropertyValue;
1062 wxString PropertyTokens;
1063 bool FirstToken = TRUE;
1064 int intSplitsFound = 0;
1065 int intSplitSize = 0;
1066 int intPrevValue = 14;
1070 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1074 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1075 intiter != SplitPoints.end(); ++intiter){
1077 SLiter = SplitLength.find(intiter->first);
1079 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1081 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1082 PropertyName = PropertyElement.GetNextToken();
1083 PropertyValue = PropertyElement.GetNextToken();
1085 intPrevValue = intiter->second;
1087 // Process properties.
1089 size_t intPropertyValueLen = PropertyValue.Len();
1091 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1093 PropertyValue.Trim();
1094 PropertyValue.RemoveLast();
1098 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1100 PropertyValue.Remove(0, 1);
1104 CaptureString(&PropertyValue, FALSE);
1106 if (PropertyName.IsEmpty() || PropertyName.IsEmpty()){
1112 if (FirstToken == TRUE){
1114 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1119 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1125 CaptureString(&PropertySeg2, FALSE);
1127 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
1129 if (!PropertyTokens.IsEmpty()){
1131 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
1137 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
1139 std::map<int, int> SplitPoints;
1140 std::map<int, int> SplitLength;
1142 int intPrevValue = 10;
1145 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1149 PropertyType PropType = PROPERTY_NONE;
1151 // Look for type before continuing.
1153 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1157 std::map<int, wxString> *NicknamesList = NULL;
1158 std::map<int, wxString> *NicknamesListType = NULL;
1159 std::map<int, wxString> *NicknamesListLanguage = NULL;
1160 std::map<int, wxString> *NicknamesListAltID = NULL;
1161 std::map<int, wxString> *NicknamesListPID = NULL;
1162 std::map<int, wxString> *NicknamesListTokens = NULL;
1163 std::map<int, int> *NicknamesListPref = NULL;
1167 NicknamesList = &GeneralNicknamesList;
1168 NicknamesListType = &GeneralNicknamesListType;
1169 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1170 NicknamesListAltID = &GeneralNicknamesListAltID;
1171 NicknamesListPID = &GeneralNicknamesListPID;
1172 NicknamesListTokens = &GeneralNicknamesListTokens;
1173 NicknamesListPref = &GeneralNicknamesListPref;
1176 NicknamesList = &HomeNicknamesList;
1177 NicknamesListType = &HomeNicknamesListType;
1178 NicknamesListLanguage = &HomeNicknamesListLanguage;
1179 NicknamesListAltID = &HomeNicknamesListAltID;
1180 NicknamesListPID = &HomeNicknamesListPID;
1181 NicknamesListTokens = &HomeNicknamesListTokens;
1182 NicknamesListPref = &HomeNicknamesListPref;
1185 NicknamesList = &BusinessNicknamesList;
1186 NicknamesListType = &BusinessNicknamesListType;
1187 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1188 NicknamesListAltID = &BusinessNicknamesListAltID;
1189 NicknamesListPID = &BusinessNicknamesListPID;
1190 NicknamesListTokens = &BusinessNicknamesListTokens;
1191 NicknamesListPref = &BusinessNicknamesListPref;
1195 std::map<int, int>::iterator SLiter;
1196 wxString PropertyData;
1197 wxString PropertyName;
1198 wxString PropertyValue;
1199 wxString PropertyTokens;
1200 bool FirstToken = TRUE;
1202 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1203 intiter != SplitPoints.end(); ++intiter){
1205 SLiter = SplitLength.find(intiter->first);
1207 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1209 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1210 PropertyName = PropertyElement.GetNextToken();
1211 PropertyValue = PropertyElement.GetNextToken();
1213 intPrevValue = intiter->second;
1215 CaptureString(&PropertyValue, FALSE);
1217 if (PropertyName == wxT("ALTID")){
1219 NicknamesListAltID->erase(*NicknameCount);
1220 NicknamesListAltID->insert(std::make_pair(*NicknameCount, PropertyValue));
1222 } else if (PropertyName == wxT("PID")){
1224 NicknamesListPID->erase(*NicknameCount);
1225 NicknamesListPID->insert(std::make_pair(*NicknameCount, PropertyValue));
1227 } else if (PropertyName == wxT("PREF")){
1229 ProcessIntegerValue(this, NicknamesListPref, &PropertyValue, NicknameCount);
1231 } else if (PropertyName == wxT("LANGUAGE")){
1233 NicknamesListLanguage->erase(*NicknameCount);
1234 NicknamesListLanguage->insert(std::make_pair(*NicknameCount, PropertyValue));
1238 // Something else we don't know about so append
1239 // to the tokens variable.
1241 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1243 if (FirstToken == TRUE){
1245 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1250 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1260 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1262 // Add the name token data.
1264 if (!PropertyTokens.IsEmpty()){
1266 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1272 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1274 std::map<int, int> SplitPoints;
1275 std::map<int, int> SplitLength;
1276 std::map<int, int>::iterator SLiter;
1277 wxString PropertyData;
1278 wxString PropertyName;
1279 wxString PropertyValue;
1280 wxString PropertyTokens;
1281 bool FirstToken = TRUE;
1282 int intPrevValue = 8;
1284 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1288 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1289 intiter != SplitPoints.end(); ++intiter){
1291 SLiter = SplitLength.find(intiter->first);
1293 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1295 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1296 PropertyName = PropertyElement.GetNextToken();
1297 PropertyValue = PropertyElement.GetNextToken();
1299 intPrevValue = intiter->second;
1301 // Process properties.
1303 size_t intPropertyValueLen = PropertyValue.Len();
1305 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1307 PropertyValue.Trim();
1308 PropertyValue.RemoveLast();
1312 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1314 PropertyValue.Remove(0, 1);
1318 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1320 if (FirstToken == TRUE){
1322 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1327 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1335 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1337 wxString GenderComponent;
1339 if (GenderData.CountTokens() >= 2){
1341 Gender = GenderData.GetNextToken();
1342 GenderDetails = GenderData.GetString();
1344 CaptureString(&GenderDetails, FALSE);
1348 Gender = GenderData.GetNextToken();
1352 if (!PropertyTokens.IsEmpty()){
1354 GenderTokens = PropertyTokens;
1360 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1362 // Process date. Preserve the remainder in the string.
1364 std::map<int, int> SplitPoints;
1365 std::map<int, int> SplitLength;
1366 std::map<int, int>::iterator SLiter;
1367 wxString PropertyData;
1368 wxString PropertyName;
1369 wxString PropertyValue;
1370 wxString PropertyTokens;
1371 bool BirthdayText = FALSE;
1372 int intPrevValue = 6;
1374 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1378 // Look for type before continuing.
1380 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1381 intiter != SplitPoints.end(); ++intiter){
1383 SLiter = SplitLength.find(intiter->first);
1385 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1387 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1388 PropertyName = PropertyElement.GetNextToken();
1389 PropertyValue = PropertyElement.GetNextToken();
1391 intPrevValue = intiter->second;
1393 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1395 CaptureString(&PropertySeg2, FALSE);
1396 Birthday = PropertySeg2;
1397 BirthdayText = TRUE;
1403 // Setup blank lines for later on.
1406 bool FirstToken = TRUE;
1408 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1409 intiter != SplitPoints.end(); ++intiter){
1411 SLiter = SplitLength.find(intiter->first);
1413 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1415 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1416 PropertyName = PropertyElement.GetNextToken();
1417 PropertyValue = PropertyElement.GetNextToken();
1419 intPrevValue = intiter->second;
1421 // Process properties.
1423 CaptureString(&PropertyValue, FALSE);
1425 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1427 PropertyValue.Trim();
1428 PropertyValue.RemoveLast();
1432 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1434 PropertyValue.Remove(0, 1);
1438 if (PropertyName == wxT("ALTID")){
1440 BirthdayAltID = PropertyValue;
1442 } else if (PropertyName == wxT("CALSCALE")){
1444 BirthdayCalScale = PropertyValue;
1446 } else if (PropertyName != wxT("VALUE")) {
1448 // Something else we don't know about so append
1449 // to the tokens variable.
1451 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1453 if (FirstToken == TRUE){
1455 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1460 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1470 // Add the data to the variables and form.
1472 if (BirthdayText == FALSE){
1474 Birthday = PropertySeg2;
1478 if (!PropertyTokens.IsEmpty()){
1480 BirthdayTokens = PropertyTokens;
1486 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1488 // Process date. Preserve the remainder in the string.
1490 std::map<int, int> SplitPoints;
1491 std::map<int, int> SplitLength;
1492 std::map<int, int>::iterator SLiter;
1493 wxString PropertyData;
1494 wxString PropertyName;
1495 wxString PropertyValue;
1496 wxString PropertyTokens;
1497 bool AnniversaryText = FALSE;
1498 int intPrevValue = 13;
1500 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1504 // Look for type before continuing.
1506 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1507 intiter != SplitPoints.end(); ++intiter){
1509 SLiter = SplitLength.find(intiter->first);
1511 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1513 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1514 PropertyName = PropertyElement.GetNextToken();
1515 PropertyValue = PropertyElement.GetNextToken();
1517 intPrevValue = intiter->second;
1519 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1521 CaptureString(&PropertySeg2, FALSE);
1522 Anniversary = PropertySeg2;
1523 AnniversaryText = TRUE;
1529 // Setup blank lines for later on.
1532 bool FirstToken = TRUE;
1534 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1535 intiter != SplitPoints.end(); ++intiter){
1537 SLiter = SplitLength.find(intiter->first);
1539 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1541 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1542 PropertyName = PropertyElement.GetNextToken();
1543 PropertyValue = PropertyElement.GetNextToken();
1545 intPrevValue = intiter->second;
1547 // Process properties.
1549 CaptureString(&PropertyValue, FALSE);
1551 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1553 PropertyValue.Trim();
1554 PropertyValue.RemoveLast();
1558 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1560 PropertyValue.Remove(0, 1);
1564 if (PropertyName == wxT("ALTID")){
1566 AnniversaryAltID = PropertyValue;
1568 } else if (PropertyName == wxT("CALSCALE")){
1570 AnniversaryCalScale = PropertyValue;
1572 } else if (PropertyName != wxT("VALUE")) {
1574 // Something else we don't know about so append
1575 // to the tokens variable.
1577 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1579 if (FirstToken == TRUE){
1581 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1586 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1596 // Add the data to the variables and form.
1598 if (AnniversaryText == FALSE){
1600 Anniversary = PropertySeg2;
1604 if (!PropertyTokens.IsEmpty()){
1606 AnniversaryTokens = PropertyTokens;
1612 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1614 std::map<int, int> SplitPoints;
1615 std::map<int, int> SplitLength;
1617 int intPrevValue = 4;
1620 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1624 PropertyType PropType = PROPERTY_NONE;
1626 // Look for type before continuing.
1628 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1632 std::map<int, wxString> *TZList = NULL;
1633 std::map<int, wxString> *TZListType = NULL;
1634 std::map<int, wxString> *TZListMediatype = NULL;
1635 std::map<int, wxString> *TZListAltID = NULL;
1636 std::map<int, wxString> *TZListPID = NULL;
1637 std::map<int, wxString> *TZListTokens = NULL;
1638 std::map<int, int> *TZListPref = NULL;
1642 TZList = &GeneralTZList;
1643 TZListType = &GeneralTZListType;
1644 TZListMediatype = &GeneralTZListMediatype;
1645 TZListAltID = &GeneralTZListAltID;
1646 TZListPID = &GeneralTZListPID;
1647 TZListTokens = &GeneralTZListTokens;
1648 TZListPref = &GeneralTZListPref;
1651 TZList = &HomeTZList;
1652 TZListType = &HomeTZListType;
1653 TZListMediatype = &HomeTZListMediatype;
1654 TZListAltID = &HomeTZListAltID;
1655 TZListPID = &HomeTZListPID;
1656 TZListTokens = &HomeTZListTokens;
1657 TZListPref = &HomeTZListPref;
1660 TZList = &BusinessTZList;
1661 TZListType = &BusinessTZListType;
1662 TZListMediatype = &BusinessTZListMediatype;
1663 TZListAltID = &BusinessTZListAltID;
1664 TZListPID = &BusinessTZListPID;
1665 TZListTokens = &BusinessTZListTokens;
1666 TZListPref = &BusinessTZListPref;
1670 std::map<int, int>::iterator SLiter;
1671 wxString PropertyData;
1672 wxString PropertyName;
1673 wxString PropertyValue;
1674 wxString PropertyTokens;
1675 bool FirstToken = TRUE;
1677 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1678 intiter != SplitPoints.end(); ++intiter){
1680 SLiter = SplitLength.find(intiter->first);
1682 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1684 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1685 PropertyName = PropertyElement.GetNextToken();
1686 PropertyValue = PropertyElement.GetNextToken();
1688 intPrevValue = intiter->second;
1690 CaptureString(&PropertyValue, FALSE);
1692 if (PropertyName == wxT("ALTID")){
1694 TZListAltID->erase(*TimeZoneCount);
1695 TZListAltID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1697 } else if (PropertyName == wxT("PID")){
1699 TZListPID->erase(*TimeZoneCount);
1700 TZListPID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1702 } else if (PropertyName == wxT("PREF")){
1704 ProcessIntegerValue(this, TZListPref, &PropertyValue, TimeZoneCount);
1706 } else if (PropertyName == wxT("MEDIATYPE")){
1708 TZListMediatype->erase(*TimeZoneCount);
1709 TZListMediatype->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1713 // Something else we don't know about so append
1714 // to the tokens variable.
1716 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1718 if (FirstToken == TRUE){
1720 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1725 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1735 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1737 // Add the name token data.
1739 if (!PropertyTokens.IsEmpty()){
1741 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1748 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1750 size_t intPropertyLen = PropertySeg1.Len();
1751 std::map<int, int> SplitPoints;
1752 std::map<int, int> SplitLength;
1753 std::map<int, int>::iterator SLiter;
1754 wxString PropertyData;
1755 wxString PropertyName;
1756 wxString PropertyValue;
1757 wxString PropertyTokens;
1758 wxString AddressLabel;
1759 wxString AddressLang;
1760 wxString AddressAltID;
1761 wxString AddressPID;
1762 wxString AddressTokens;
1763 wxString AddressGeo;
1764 wxString AddressTimezone;
1765 wxString AddressType;
1766 wxString AddressMediatype;
1767 wxString AddressPOBox;
1768 wxString AddressExtended;
1769 wxString AddressStreet;
1770 wxString AddressLocality;
1771 wxString AddressCity;
1772 wxString AddressRegion;
1773 wxString AddressPostalCode;
1774 wxString AddressCountry;
1775 bool FirstToken = TRUE;
1776 int intSplitsFound = 0;
1777 int intSplitSize = 0;
1778 int intPrevValue = 5;
1783 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1787 PropertyType PropType = PROPERTY_NONE;
1789 // Look for type before continuing.
1791 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1795 std::map<int, wxString> *AddressList = NULL;
1796 std::map<int, wxString> *AddressListTown = NULL;
1797 std::map<int, wxString> *AddressListCounty = NULL;
1798 std::map<int, wxString> *AddressListPostCode = NULL;
1799 std::map<int, wxString> *AddressListCountry = NULL;
1800 std::map<int, wxString> *AddressListLabel = NULL;
1801 std::map<int, wxString> *AddressListLang = NULL;
1802 std::map<int, wxString> *AddressListAltID = NULL;
1803 std::map<int, wxString> *AddressListPID = NULL;
1804 std::map<int, wxString> *AddressListTokens = NULL;
1805 std::map<int, wxString> *AddressListGeo = NULL;
1806 std::map<int, wxString> *AddressListTimezone = NULL;
1807 std::map<int, wxString> *AddressListType = NULL;
1808 std::map<int, wxString> *AddressListMediatype = NULL;
1809 std::map<int, int> *AddressListPref = NULL;
1813 AddressList = &GeneralAddressList;
1814 AddressListTown = &GeneralAddressListTown;
1815 AddressListCounty = &GeneralAddressListCounty;
1816 AddressListPostCode = &GeneralAddressListPostCode;
1817 AddressListCountry = &GeneralAddressListCountry;
1818 AddressListLabel = &GeneralAddressListLabel;
1819 AddressListLang = &GeneralAddressListLang;
1820 AddressListAltID = &GeneralAddressListAltID;
1821 AddressListPID = &GeneralAddressListPID;
1822 AddressListTokens = &GeneralAddressListTokens;
1823 AddressListGeo = &GeneralAddressListGeo;
1824 AddressListTimezone = &GeneralAddressListTimezone;
1825 AddressListType = &GeneralAddressListType;
1826 AddressListMediatype = &GeneralAddressListMediatype;
1827 AddressListPref = &GeneralAddressListPref;
1830 AddressList = &HomeAddressList;
1831 AddressListTown = &HomeAddressListTown;
1832 AddressListCounty = &HomeAddressListCounty;
1833 AddressListPostCode = &HomeAddressListPostCode;
1834 AddressListCountry = &HomeAddressListCountry;
1835 AddressListLabel = &HomeAddressListLabel;
1836 AddressListLang = &HomeAddressListLang;
1837 AddressListAltID = &HomeAddressListAltID;
1838 AddressListPID = &HomeAddressListPID;
1839 AddressListTokens = &HomeAddressListTokens;
1840 AddressListGeo = &HomeAddressListGeo;
1841 AddressListTimezone = &HomeAddressListTimezone;
1842 AddressListType = &HomeAddressListType;
1843 AddressListMediatype = &HomeAddressListMediatype;
1844 AddressListPref = &HomeAddressListPref;
1847 AddressList = &BusinessAddressList;
1848 AddressListTown = &BusinessAddressListTown;
1849 AddressListCounty = &BusinessAddressListCounty;
1850 AddressListPostCode = &BusinessAddressListPostCode;
1851 AddressListCountry = &BusinessAddressListCountry;
1852 AddressListLabel = &BusinessAddressListLabel;
1853 AddressListLang = &BusinessAddressListLang;
1854 AddressListAltID = &BusinessAddressListAltID;
1855 AddressListPID = &BusinessAddressListPID;
1856 AddressListTokens = &BusinessAddressListTokens;
1857 AddressListGeo = &BusinessAddressListGeo;
1858 AddressListTimezone = &BusinessAddressListTimezone;
1859 AddressListType = &BusinessAddressListType;
1860 AddressListMediatype = &BusinessAddressListMediatype;
1861 AddressListPref = &BusinessAddressListPref;
1867 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1868 intiter != SplitPoints.end(); ++intiter){
1870 SLiter = SplitLength.find(intiter->first);
1872 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1874 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1875 PropertyName = PropertyElement.GetNextToken();
1876 PropertyValue = PropertyElement.GetNextToken();
1878 intPrevValue = intiter->second;
1880 CaptureString(&PropertyValue, FALSE);
1882 // Process properties.
1884 if (PropertyName == wxT("LABEL")){
1886 AddressListLabel->erase(*AddressCount);
1887 AddressListLabel->insert(std::make_pair(*AddressCount, PropertyValue));
1889 } else if (PropertyName == wxT("LANGUAGE")){
1891 AddressListLang->erase(*AddressCount);
1892 AddressListLang->insert(std::make_pair(*AddressCount, PropertyValue));
1894 } else if (PropertyName == wxT("ALTID")){
1896 AddressListAltID->erase(*AddressCount);
1897 AddressListAltID->insert(std::make_pair(*AddressCount, PropertyValue));
1899 } else if (PropertyName == wxT("PID")){
1901 AddressListPID->erase(*AddressCount);
1902 AddressListPID->insert(std::make_pair(*AddressCount, PropertyValue));
1904 } else if (PropertyName == wxT("GEO")){
1906 AddressListGeo->erase(*AddressCount);
1907 AddressListGeo->insert(std::make_pair(*AddressCount, PropertyValue));
1909 } else if (PropertyName == wxT("TZ")){
1911 AddressListTimezone->erase(*AddressCount);
1912 AddressListTimezone->insert(std::make_pair(*AddressCount, PropertyValue));
1914 } else if (PropertyName == wxT("MEDIATYPE")){
1916 AddressListMediatype->erase(*AddressCount);
1917 AddressListMediatype->insert(std::make_pair(*AddressCount, PropertyValue));
1919 } else if (PropertyName == wxT("PREF")){
1921 ProcessIntegerValue(this, AddressListPref, &PropertyValue, AddressCount);
1925 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1927 if (FirstToken == TRUE){
1929 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1934 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1944 // Split the address.
1946 //std::map<int, int>::iterator SLiter;
1947 intPropertyLen = PropertySeg2.Len();
1948 SplitPoints.clear();
1949 SplitLength.clear();
1954 for (int i = 0; i <= intPropertyLen; i++){
1958 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1961 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1963 if (intSplitsFound == 6){
1965 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1970 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1980 // Split the data into several parts.
1982 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1983 intiter != SplitPoints.end(); ++intiter){
1985 if (intiter->first == 1){
1987 // Deal with PO Box.
1989 SLiter = SplitLength.find(1);
1991 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
1992 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1993 intPrevValue = intiter->second;
1995 } else if (intiter->first == 2){
1997 // Deal with extended address.
1999 SLiter = SplitLength.find(2);
2001 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
2002 //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2003 intPrevValue = intiter->second;
2005 } else if (intiter->first == 3){
2007 // Deal with street address.
2009 SLiter = SplitLength.find(3);
2011 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
2012 //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2013 intPrevValue = intiter->second;
2015 } else if (intiter->first == 4){
2017 // Deal with locality
2019 SLiter = SplitLength.find(4);
2021 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
2022 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2023 intPrevValue = intiter->second;
2025 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
2027 } else if (intiter->first == 5){
2029 // Deal with region.
2031 SLiter = SplitLength.find(5);
2033 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
2034 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2035 intPrevValue = intiter->second;
2037 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
2039 } else if (intiter->first == 6){
2041 // Deal with post code.
2043 SLiter = SplitLength.find(6);
2045 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
2046 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2047 intPrevValue = intiter->second;
2049 // Deal with country.
2051 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
2052 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
2060 // Add the data to the General/Home/Work address variables.
2062 CaptureString(&AddressStreet, FALSE);
2063 CaptureString(&AddressLocality, FALSE);
2064 CaptureString(&AddressRegion, FALSE);
2065 CaptureString(&AddressPostalCode, FALSE);
2066 CaptureString(&AddressCountry, FALSE);
2068 if (!PropertyTokens.IsEmpty()){
2070 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
2074 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
2075 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
2076 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
2077 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
2078 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
2082 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
2085 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
2088 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
2092 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
2096 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
2098 std::map<int, int> SplitPoints;
2099 std::map<int, int> SplitLength;
2101 int intPrevValue = 7;
2104 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2108 PropertyType PropType = PROPERTY_NONE;
2110 // Look for type before continuing.
2112 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2114 std::map<int, wxString> *EmailList = NULL;
2115 std::map<int, wxString> *EmailListType = NULL;
2116 std::map<int, wxString> *EmailListAltID = NULL;
2117 std::map<int, wxString> *EmailListPID = NULL;
2118 std::map<int, wxString> *EmailListTokens = NULL;
2119 std::map<int, int> *EmailListPref = NULL;
2123 EmailList = &GeneralEmailList;
2124 EmailListType = &GeneralEmailListType;
2125 EmailListAltID = &GeneralEmailListAltID;
2126 EmailListPID = &GeneralEmailListPID;
2127 EmailListTokens = &GeneralEmailListTokens;
2128 EmailListPref = &GeneralEmailListPref;
2131 EmailList = &HomeEmailList;
2132 EmailListType = &HomeEmailListType;
2133 EmailListAltID = &HomeEmailListAltID;
2134 EmailListPID = &HomeEmailListPID;
2135 EmailListTokens = &HomeEmailListTokens;
2136 EmailListPref = &HomeEmailListPref;
2139 EmailList = &BusinessEmailList;
2140 EmailListType = &BusinessEmailListType;
2141 EmailListAltID = &BusinessEmailListAltID;
2142 EmailListPID = &BusinessEmailListPID;
2143 EmailListTokens = &BusinessEmailListTokens;
2144 EmailListPref = &BusinessEmailListPref;
2150 std::map<int,int>::iterator SLiter;
2151 wxString PropertyData;
2152 wxString PropertyName;
2153 wxString PropertyValue;
2154 wxString PropertyTokens;
2155 bool FirstToken = TRUE;
2157 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2158 intiter != SplitPoints.end(); ++intiter){
2160 SLiter = SplitLength.find(intiter->first);
2162 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2164 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2165 PropertyName = PropertyElement.GetNextToken();
2166 PropertyValue = PropertyElement.GetNextToken();
2168 intPrevValue = intiter->second;
2170 CaptureString(&PropertyValue, FALSE);
2172 // Process properties.
2174 if (PropertyName == wxT("ALTID")){
2176 EmailListAltID->erase(*EmailCount);
2177 EmailListAltID->insert(std::make_pair(*EmailCount, PropertyValue));
2179 } else if (PropertyName == wxT("PID")){
2181 EmailListPID->erase(*EmailCount);
2182 EmailListPID->insert(std::make_pair(*EmailCount, PropertyValue));
2184 } else if (PropertyName == wxT("PREF")){
2186 ProcessIntegerValue(this, EmailListPref, &PropertyValue, EmailCount);
2190 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2192 if (FirstToken == TRUE){
2194 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2199 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2209 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
2211 // Add the name token data.
2213 if (!PropertyTokens.IsEmpty()){
2215 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
2222 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
2224 std::map<int, int> SplitPoints;
2225 std::map<int, int> SplitLength;
2227 int intPrevValue = 6;
2230 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2234 PropertyType PropType = PROPERTY_NONE;
2236 // Look for type before continuing.
2238 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2240 std::map<int, wxString> *IMList = NULL;
2241 std::map<int, wxString> *IMListType = NULL;
2242 std::map<int, wxString> *IMListAltID = NULL;
2243 std::map<int, wxString> *IMListPID = NULL;
2244 std::map<int, wxString> *IMListTokens = NULL;
2245 std::map<int, wxString> *IMListMediatype = NULL;
2246 std::map<int, int> *IMListPref = NULL;
2250 IMList = &GeneralIMList;
2251 IMListType = &GeneralIMListType;
2252 IMListAltID = &GeneralIMListAltID;
2253 IMListPID = &GeneralIMListPID;
2254 IMListTokens = &GeneralIMListTokens;
2255 IMListMediatype = &GeneralIMListMediatype;
2256 IMListPref = &GeneralIMListPref;
2259 IMList = &HomeIMList;
2260 IMListType = &HomeIMListType;
2261 IMListAltID = &HomeIMListAltID;
2262 IMListPID = &HomeIMListPID;
2263 IMListTokens = &HomeIMListTokens;
2264 IMListMediatype = &HomeIMListMediatype;
2265 IMListPref = &HomeIMListPref;
2268 IMList = &BusinessIMList;
2269 IMListType = &BusinessIMListType;
2270 IMListAltID = &BusinessIMListAltID;
2271 IMListPID = &BusinessIMListPID;
2272 IMListTokens = &BusinessIMListTokens;
2273 IMListMediatype = &BusinessIMListMediatype;
2274 IMListPref = &BusinessIMListPref;
2280 std::map<int,int>::iterator SLiter;
2281 wxString PropertyData;
2282 wxString PropertyName;
2283 wxString PropertyValue;
2284 wxString PropertyTokens;
2285 bool FirstToken = TRUE;
2287 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2288 intiter != SplitPoints.end(); ++intiter){
2290 SLiter = SplitLength.find(intiter->first);
2292 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2294 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2295 PropertyName = PropertyElement.GetNextToken();
2296 PropertyValue = PropertyElement.GetNextToken();
2298 intPrevValue = intiter->second;
2300 CaptureString(&PropertyValue, FALSE);
2302 // Process properties.
2304 if (PropertyName == wxT("ALTID")){
2306 IMListAltID->erase(*IMCount);
2307 IMListAltID->insert(std::make_pair(*IMCount, PropertyValue));
2309 } else if (PropertyName == wxT("PID")){
2311 IMListPID->erase(*IMCount);
2312 IMListPID->insert(std::make_pair(*IMCount, PropertyValue));
2314 } else if (PropertyName == wxT("MEDIATYPE")){
2316 IMListMediatype->erase(*IMCount);
2317 IMListMediatype->insert(std::make_pair(*IMCount, PropertyValue));
2319 } else if (PropertyName == wxT("PREF")){
2321 ProcessIntegerValue(this, IMListPref, &PropertyValue, IMCount);
2325 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2327 if (FirstToken == TRUE){
2329 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2334 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2344 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2346 // Add the name token data.
2348 if (!PropertyTokens.IsEmpty()){
2350 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2356 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2358 std::map<int, int> SplitPoints;
2359 std::map<int, int> SplitLength;
2360 std::map<int, int>::iterator SLiter;
2364 PropertyType PropType = PROPERTY_NONE;
2366 // Look for type before continuing.
2369 wxString TelTypeDetail;
2370 wxString PropertyData;
2371 wxString PropertyName;
2372 wxString PropertyValue;
2373 wxString PropertyTokens;
2375 std::map<int,int> TypeSplitPoints;
2376 std::map<int,int> TypeSplitLength;
2377 std::map<int,int>::iterator TSLiter;
2379 int intSplitSize = 0;
2380 int intSplitsFound = 0;
2381 int intSplitPoint = 0;
2383 int intPrevValue = 5;
2385 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2389 // Look for type before continuing.
2391 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2392 intiter != SplitPoints.end(); ++intiter){
2394 SLiter = SplitLength.find(intiter->first);
2396 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2398 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2399 PropertyName = PropertyElement.GetNextToken();
2400 PropertyValue = PropertyElement.GetNextToken();
2402 intPrevValue = intiter->second;
2404 if (PropertyName == wxT("TYPE")){
2406 // Process each value in type and translate each
2409 // Strip out the quotes if they are there.
2411 size_t intPropertyValueLen = PropertyValue.Len();
2413 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2415 PropertyValue.Trim();
2416 PropertyValue.RemoveLast();
2420 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2422 PropertyValue.Remove(0, 1);
2426 TelTypeDetail = PropertyValue;
2432 for (int i = 0; i <= intPropertyValueLen; i++){
2436 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2438 if (intSplitsFound == 0){
2440 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2441 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2445 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2446 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2459 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2460 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2462 int intTypeSeek = 0;
2464 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2465 typeiter != TypeSplitPoints.end(); ++typeiter){
2467 wxString TypePropertyName;
2469 TSLiter = TypeSplitLength.find(typeiter->first);
2471 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2473 if (intTypeSeek == 0){
2478 TelTypeUI.Append(wxT(","));
2482 if (TypePropertyName == wxT("home")){
2484 PropType = PROPERTY_HOME;
2486 } else if (TypePropertyName == wxT("work")){
2488 PropType = PROPERTY_WORK;
2493 if (TypePropertyName == wxT("text")){
2495 TelTypeUI.Append(_("text"));
2498 } else if (TypePropertyName == wxT("voice")){
2500 TelTypeUI.Append(_("voice"));
2503 } else if (TypePropertyName == wxT("fax")){
2505 TelTypeUI.Append(_("fax"));
2508 } else if (TypePropertyName == wxT("cell")){
2510 TelTypeUI.Append(_("mobile"));
2513 } else if (TypePropertyName == wxT("video")){
2515 TelTypeUI.Append(_("video"));
2518 } else if (TypePropertyName == wxT("pager")){
2520 TelTypeUI.Append(_("pager"));
2523 } else if (TypePropertyName == wxT("textphone")){
2525 TelTypeUI.Append(_("textphone"));
2536 std::map<int, wxString> *TelephoneList = NULL;
2537 std::map<int, wxString> *TelephoneListType = NULL;
2538 std::map<int, wxString> *TelephoneListAltID = NULL;
2539 std::map<int, wxString> *TelephoneListPID = NULL;
2540 std::map<int, wxString> *TelephoneListTokens = NULL;
2541 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2542 std::map<int, int> *TelephoneListPref = NULL;
2546 TelephoneList = &GeneralTelephoneList;
2547 TelephoneListType = &GeneralTelephoneListType;
2548 TelephoneListAltID = &GeneralTelephoneListAltID;
2549 TelephoneListPID = &GeneralTelephoneListPID;
2550 TelephoneListTokens = &GeneralTelephoneListTokens;
2551 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2552 TelephoneListPref = &GeneralTelephoneListPref;
2555 TelephoneList = &HomeTelephoneList;
2556 TelephoneListType = &HomeTelephoneListType;
2557 TelephoneListAltID = &HomeTelephoneListAltID;
2558 TelephoneListPID = &HomeTelephoneListPID;
2559 TelephoneListTokens = &HomeTelephoneListTokens;
2560 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2561 TelephoneListPref = &HomeTelephoneListPref;
2564 TelephoneList = &BusinessTelephoneList;
2565 TelephoneListType = &BusinessTelephoneListType;
2566 TelephoneListAltID = &BusinessTelephoneListAltID;
2567 TelephoneListPID = &BusinessTelephoneListPID;
2568 TelephoneListTokens = &BusinessTelephoneListTokens;
2569 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2570 TelephoneListPref = &BusinessTelephoneListPref;
2574 // Process the properties.
2576 bool FirstToken = TRUE;
2579 SplitPoints.clear();
2580 SplitLength.clear();
2582 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2586 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2587 intiter != SplitPoints.end(); ++intiter){
2589 SLiter = SplitLength.find(intiter->first);
2591 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2593 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2594 PropertyName = PropertyElement.GetNextToken();
2595 PropertyValue = PropertyElement.GetNextToken();
2597 intPrevValue = intiter->second;
2599 CaptureString(&PropertyValue, FALSE);
2601 // Process properties.
2603 if (PropertyName == wxT("ALTID")){
2605 TelephoneListAltID->erase(*TelephoneCount);
2606 TelephoneListAltID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2608 } else if (PropertyName == wxT("PID")){
2610 TelephoneListPID->erase(*TelephoneCount);
2611 TelephoneListPID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2613 } else if (PropertyName == wxT("PREF")){
2615 ProcessIntegerValue(this, TelephoneListPref, &PropertyValue, TelephoneCount);
2619 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2621 if (FirstToken == TRUE){
2623 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2628 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2638 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2639 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2641 // Add the name token data.
2643 if (!PropertyTokens.IsEmpty()){
2645 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2651 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2653 std::map<int, int> SplitPoints;
2654 std::map<int, int> SplitLength;
2656 int intPrevValue = 6;
2659 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2663 PropertyType PropType = PROPERTY_NONE;
2665 // Look for type before continuing.
2667 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2669 std::map<int, wxString> *LanguageList = NULL;
2670 std::map<int, wxString> *LanguageListType = NULL;
2671 std::map<int, wxString> *LanguageListAltID = NULL;
2672 std::map<int, wxString> *LanguageListPID = NULL;
2673 std::map<int, wxString> *LanguageListTokens = NULL;
2674 std::map<int, int> *LanguageListPref = NULL;
2678 LanguageList = &GeneralLanguageList;
2679 LanguageListType = &GeneralLanguageListType;
2680 LanguageListAltID = &GeneralLanguageListAltID;
2681 LanguageListPID = &GeneralLanguageListPID;
2682 LanguageListTokens = &GeneralLanguageListTokens;
2683 LanguageListPref = &GeneralLanguageListPref;
2686 LanguageList = &HomeLanguageList;
2687 LanguageListType = &HomeLanguageListType;
2688 LanguageListAltID = &HomeLanguageListAltID;
2689 LanguageListPID = &HomeLanguageListPID;
2690 LanguageListTokens = &HomeLanguageListTokens;
2691 LanguageListPref = &HomeLanguageListPref;
2694 LanguageList = &BusinessLanguageList;
2695 LanguageListType = &BusinessLanguageListType;
2696 LanguageListAltID = &BusinessLanguageListAltID;
2697 LanguageListPID = &BusinessLanguageListPID;
2698 LanguageListTokens = &BusinessLanguageListTokens;
2699 LanguageListPref = &BusinessLanguageListPref;
2705 std::map<int,int>::iterator SLiter;
2706 wxString PropertyData;
2707 wxString PropertyName;
2708 wxString PropertyValue;
2709 wxString PropertyTokens;
2710 bool FirstToken = TRUE;
2712 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2713 intiter != SplitPoints.end(); ++intiter){
2715 SLiter = SplitLength.find(intiter->first);
2717 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2719 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2720 PropertyName = PropertyElement.GetNextToken();
2721 PropertyValue = PropertyElement.GetNextToken();
2723 intPrevValue = intiter->second;
2725 CaptureString(&PropertyValue, FALSE);
2727 // Process properties.
2729 if (PropertyName == wxT("ALTID")){
2731 LanguageListAltID->erase(*LanguageCount);
2732 LanguageListAltID->insert(std::make_pair(*LanguageCount, PropertyValue));
2734 } else if (PropertyName == wxT("PID")){
2736 LanguageListPID->erase(*LanguageCount);
2737 LanguageListPID->insert(std::make_pair(*LanguageCount, PropertyValue));
2739 } else if (PropertyName == wxT("PREF")){
2741 ProcessIntegerValue(this, LanguageListPref, &PropertyValue, LanguageCount);
2745 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2747 if (FirstToken == TRUE){
2749 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2754 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2764 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2766 // Add the name token data.
2768 if (!PropertyTokens.IsEmpty()){
2770 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2776 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2778 std::map<int, int> SplitPoints;
2779 std::map<int, int> SplitLength;
2781 int intPrevValue = 5;
2784 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2788 PropertyType PropType = PROPERTY_NONE;
2790 // Look for type before continuing.
2792 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2794 std::map<int, wxString> *GeopositionList = NULL;
2795 std::map<int, wxString> *GeopositionListType = NULL;
2796 std::map<int, wxString> *GeopositionListAltID = NULL;
2797 std::map<int, wxString> *GeopositionListPID = NULL;
2798 std::map<int, wxString> *GeopositionListTokens = NULL;
2799 std::map<int, wxString> *GeopositionListMediatype = NULL;
2800 std::map<int, int> *GeopositionListPref = NULL;
2804 GeopositionList = &GeneralGeographyList;
2805 GeopositionListType = &GeneralGeographyListType;
2806 GeopositionListAltID = &GeneralGeographyListAltID;
2807 GeopositionListPID = &GeneralGeographyListPID;
2808 GeopositionListTokens = &GeneralGeographyListTokens;
2809 GeopositionListMediatype = &GeneralGeographyListMediatype;
2810 GeopositionListPref = &GeneralGeographyListPref;
2813 GeopositionList = &HomeGeographyList;
2814 GeopositionListType = &HomeGeographyListType;
2815 GeopositionListAltID = &HomeGeographyListAltID;
2816 GeopositionListPID = &HomeGeographyListPID;
2817 GeopositionListTokens = &HomeGeographyListTokens;
2818 GeopositionListMediatype = &HomeGeographyListMediatype;
2819 GeopositionListPref = &HomeGeographyListPref;
2822 GeopositionList = &BusinessGeographyList;
2823 GeopositionListType = &BusinessGeographyListType;
2824 GeopositionListAltID = &BusinessGeographyListAltID;
2825 GeopositionListPID = &BusinessGeographyListPID;
2826 GeopositionListTokens = &BusinessGeographyListTokens;
2827 GeopositionListMediatype = &BusinessGeographyListMediatype;
2828 GeopositionListPref = &BusinessGeographyListPref;
2834 std::map<int,int>::iterator SLiter;
2835 wxString PropertyData;
2836 wxString PropertyName;
2837 wxString PropertyValue;
2838 wxString PropertyTokens;
2839 bool FirstToken = TRUE;
2841 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2842 intiter != SplitPoints.end(); ++intiter){
2844 SLiter = SplitLength.find(intiter->first);
2846 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2848 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2849 PropertyName = PropertyElement.GetNextToken();
2850 PropertyValue = PropertyElement.GetNextToken();
2852 intPrevValue = intiter->second;
2854 CaptureString(&PropertyValue, FALSE);
2856 // Process properties.
2858 if (PropertyName == wxT("ALTID")){
2860 GeopositionListAltID->erase(*GeographicCount);
2861 GeopositionListAltID->insert(std::make_pair(*GeographicCount, PropertyValue));
2863 } else if (PropertyName == wxT("PID")){
2865 GeopositionListPID->erase(*GeographicCount);
2866 GeopositionListPID->insert(std::make_pair(*GeographicCount, PropertyValue));
2868 } else if (PropertyName == wxT("MEDIATYPE")){
2870 GeopositionListMediatype->erase(*GeographicCount);
2871 GeopositionListMediatype->insert(std::make_pair(*GeographicCount, PropertyValue));
2873 } else if (PropertyName == wxT("PREF")){
2875 ProcessIntegerValue(this, GeopositionListPref, &PropertyValue, GeographicCount);
2879 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2881 if (FirstToken == TRUE){
2883 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2888 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2898 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2900 // Add the name token data.
2902 if (!PropertyTokens.IsEmpty()){
2904 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2910 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2912 size_t intPropertyLen = PropertySeg1.Len();
2913 std::map<int, int> SplitPoints;
2914 std::map<int, int> SplitLength;
2915 std::map<int, int>::iterator SLiter;
2916 wxString PropertyData;
2917 wxString PropertyName;
2918 wxString PropertyValue;
2919 wxString PropertyTokens;
2920 wxString RelatedType;
2921 wxString RelatedTypeOriginal;
2922 wxString RelatedName;
2923 bool FirstToken = TRUE;
2924 int intSplitsFound = 0;
2925 int intSplitSize = 0;
2926 int intPrevValue = 9;
2930 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2934 // Look for type before continuing.
2936 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2937 intiter != SplitPoints.end(); ++intiter){
2939 SLiter = SplitLength.find(intiter->first);
2941 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2943 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2944 PropertyName = PropertyElement.GetNextToken();
2945 PropertyValue = PropertyElement.GetNextToken();
2947 intPrevValue = intiter->second;
2951 RelatedTypeOriginal = PropertyValue;
2953 if (PropertyName == wxT("TYPE")){
2955 if (PropertyValue == wxT("contact")){
2957 RelatedType = _("Contact");
2959 } else if (PropertyValue == wxT("acquaintance")){
2961 RelatedType = _("Acquaintance");
2963 } else if (PropertyValue == wxT("friend")){
2965 RelatedType = _("Friend");
2967 } else if (PropertyValue == wxT("met")){
2969 RelatedType = _("Met");
2971 } else if (PropertyValue == wxT("co-worker")){
2973 RelatedType = _("Co-worker");
2975 } else if (PropertyValue == wxT("colleague")){
2977 RelatedType = _("Colleague");
2979 } else if (PropertyValue == wxT("co-resident")){
2981 RelatedType = _("Co-resident");
2983 } else if (PropertyValue == wxT("neighbor")){
2985 RelatedType = _("Neighbour");
2987 } else if (PropertyValue == wxT("child")){
2989 RelatedType = _("Child");
2991 } else if (PropertyValue == wxT("parent")){
2993 RelatedType = _("Parent");
2995 } else if (PropertyValue == wxT("sibling")){
2997 RelatedType = _("Sibling");
2999 } else if (PropertyValue == wxT("spouse")){
3001 RelatedType = _("Spouse");
3003 } else if (PropertyValue == wxT("kin")){
3005 RelatedType = _("Kin");
3007 } else if (PropertyValue == wxT("muse")){
3009 RelatedType = _("Muse");
3011 } else if (PropertyValue == wxT("crush")){
3013 RelatedType = _("Crush");
3015 } else if (PropertyValue == wxT("date")){
3017 RelatedType = _("Date");
3019 } else if (PropertyValue == wxT("sweetheart")){
3021 RelatedType = _("Sweetheart");
3023 } else if (PropertyValue == wxT("me")){
3025 RelatedType = _("Me");
3027 } else if (PropertyValue == wxT("agent")){
3029 RelatedType = _("Agent");
3031 } else if (PropertyValue == wxT("emergency")){
3033 RelatedType = _("Emergency");
3037 RelatedType = PropertyValue;
3047 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3048 intiter != SplitPoints.end(); ++intiter){
3050 SLiter = SplitLength.find(intiter->first);
3052 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3054 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3055 PropertyName = PropertyElement.GetNextToken();
3056 PropertyValue = PropertyElement.GetNextToken();
3058 intPrevValue = intiter->second;
3060 // Process properties.
3062 size_t intPropertyValueLen = PropertyValue.Len();
3064 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3066 PropertyValue.Trim();
3067 PropertyValue.RemoveLast();
3071 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3073 PropertyValue.Remove(0, 1);
3077 CaptureString(&PropertyValue, FALSE);
3079 if (PropertyName == wxT("ALTID")){
3081 GeneralRelatedListAltID.erase(*RelatedCount);
3082 GeneralRelatedListAltID.insert(std::make_pair(*RelatedCount, PropertyValue));
3084 } else if (PropertyName == wxT("PID")){
3086 GeneralRelatedListPID.erase(*RelatedCount);
3087 GeneralRelatedListPID.insert(std::make_pair(*RelatedCount, PropertyValue));
3089 } else if (PropertyName == wxT("PREF")){
3091 int PriorityNumber = 0;
3092 bool ValidNumber = TRUE;
3095 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3098 catch(std::invalid_argument &e){
3099 ValidNumber = FALSE;
3102 if (ValidNumber == TRUE){
3104 GeneralRelatedListPref.erase(*RelatedCount);
3105 GeneralRelatedListPref.insert(std::make_pair(*RelatedCount, PriorityNumber));
3109 } else if (PropertyName == wxT("LANGUAGE")){
3111 ProcessIntegerValue(this, &GeneralRelatedListPref, &PropertyValue, RelatedCount);
3113 } else if (PropertyName != wxT("TYPE")) {
3115 // Something else we don't know about so append
3116 // to the tokens variable.
3118 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3120 if (FirstToken == TRUE){
3122 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3127 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3137 // Add the data to the General/Home/Work address variables.
3139 GeneralRelatedList.erase(*RelatedCount);
3140 GeneralRelatedListRelType.erase(*RelatedCount);
3141 GeneralRelatedListType.erase(*RelatedCount);
3142 GeneralRelatedListTokens.erase(*RelatedCount);
3143 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
3144 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
3145 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
3146 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
3150 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
3152 std::map<int, int> SplitPoints;
3153 std::map<int, int> SplitLength;
3154 std::map<int, int>::iterator SLiter;
3155 wxString PropertyData;
3156 wxString PropertyName;
3157 wxString PropertyValue;
3158 wxString PropertyTokens;
3159 bool FirstToken = TRUE;
3160 int intPrevValue = 5;
3165 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3169 PropertyType PropType = PROPERTY_NONE;
3171 // Look for type before continuing.
3173 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3175 // Setup the pointers.
3177 std::map<int, wxString> *WebsiteList = NULL;
3178 std::map<int, wxString> *WebsiteListAltID = NULL;
3179 std::map<int, wxString> *WebsiteListPID = NULL;
3180 std::map<int, wxString> *WebsiteListType = NULL;
3181 std::map<int, wxString> *WebsiteListTokens = NULL;
3182 std::map<int, wxString> *WebsiteListMediatype = NULL;
3183 std::map<int, int> *WebsiteListPref = NULL;
3185 // Setup blank lines for later on.
3189 WebsiteList = &GeneralWebsiteList;
3190 WebsiteListType = &GeneralWebsiteListType;
3191 WebsiteListAltID = &GeneralWebsiteListAltID;
3192 WebsiteListPID = &GeneralWebsiteListPID;
3193 WebsiteListTokens = &GeneralWebsiteListTokens;
3194 WebsiteListMediatype = &GeneralWebsiteListMediatype;
3195 WebsiteListPref = &GeneralWebsiteListPref;
3198 WebsiteList = &HomeWebsiteList;
3199 WebsiteListType = &HomeWebsiteListType;
3200 WebsiteListAltID = &HomeWebsiteListAltID;
3201 WebsiteListPID = &HomeWebsiteListPID;
3202 WebsiteListTokens = &HomeWebsiteListTokens;
3203 WebsiteListMediatype = &HomeWebsiteListMediatype;
3204 WebsiteListPref = &HomeWebsiteListPref;
3207 WebsiteList = &BusinessWebsiteList;
3208 WebsiteListType = &BusinessWebsiteListType;
3209 WebsiteListAltID = &BusinessWebsiteListAltID;
3210 WebsiteListPID = &BusinessWebsiteListPID;
3211 WebsiteListTokens = &BusinessWebsiteListTokens;
3212 WebsiteListMediatype = &BusinessWebsiteListMediatype;
3213 WebsiteListPref = &BusinessWebsiteListPref;
3219 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3220 intiter != SplitPoints.end(); ++intiter){
3222 SLiter = SplitLength.find(intiter->first);
3224 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3226 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3227 PropertyName = PropertyElement.GetNextToken();
3228 PropertyValue = PropertyElement.GetNextToken();
3230 intPrevValue = intiter->second;
3232 // Process properties.
3234 size_t intPropertyValueLen = PropertyValue.Len();
3236 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3238 PropertyValue.Trim();
3239 PropertyValue.RemoveLast();
3243 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3245 PropertyValue.Remove(0, 1);
3249 CaptureString(&PropertyValue, FALSE);
3251 if (PropertyName == wxT("ALTID")){
3253 WebsiteListAltID->erase(*URLCount);
3254 WebsiteListAltID->insert(std::make_pair(*URLCount, PropertyValue));
3256 } else if (PropertyName == wxT("PID")){
3258 WebsiteListPID->erase(*URLCount);
3259 WebsiteListPID->insert(std::make_pair(*URLCount, PropertyValue));
3261 } else if (PropertyName == wxT("PREF")){
3263 ProcessIntegerValue(this, WebsiteListPref, &PropertyValue, URLCount);
3265 } else if (PropertyName == wxT("MEDIATYPE")){
3267 WebsiteListMediatype->erase(*URLCount);
3268 WebsiteListMediatype->insert(std::make_pair(*URLCount, PropertyValue));
3272 // Something else we don't know about so append
3273 // to the tokens variable.
3275 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3277 if (FirstToken == TRUE){
3279 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3284 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3294 // Add the data to the General/Home/Work address variables.
3296 CaptureString(&PropertySeg2, FALSE);
3298 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3300 if (!PropertyTokens.IsEmpty()){
3302 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3308 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3310 std::map<int, int> SplitPoints;
3311 std::map<int, int> SplitLength;
3312 std::map<int, int>::iterator SLiter;
3313 wxString PropertyData;
3314 wxString PropertyName;
3315 wxString PropertyValue;
3316 wxString PropertyTokens;
3317 bool FirstToken = TRUE;
3318 int intPrevValue = 7;
3323 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3327 PropertyType PropType = PROPERTY_NONE;
3329 // Look for type before continuing.
3331 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3333 // Setup the pointers.
3335 std::map<int, wxString> *TitleList = NULL;
3336 std::map<int, wxString> *TitleListAltID = NULL;
3337 std::map<int, wxString> *TitleListPID = NULL;
3338 std::map<int, wxString> *TitleListType = NULL;
3339 std::map<int, wxString> *TitleListTokens = NULL;
3340 std::map<int, wxString> *TitleListLanguage = NULL;
3341 std::map<int, int> *TitleListPref = NULL;
3343 // Setup blank lines for later on.
3347 TitleList = &GeneralTitleList;
3348 TitleListType = &GeneralTitleListType;
3349 TitleListAltID = &GeneralTitleListAltID;
3350 TitleListPID = &GeneralTitleListPID;
3351 TitleListTokens = &GeneralTitleListTokens;
3352 TitleListLanguage = &GeneralTitleListLanguage;
3353 TitleListPref = &GeneralTitleListPref;
3356 TitleList = &HomeTitleList;
3357 TitleListType = &HomeTitleListType;
3358 TitleListAltID = &HomeTitleListAltID;
3359 TitleListPID = &HomeTitleListPID;
3360 TitleListTokens = &HomeTitleListTokens;
3361 TitleListLanguage = &HomeTitleListLanguage;
3362 TitleListPref = &HomeTitleListPref;
3365 TitleList = &BusinessTitleList;
3366 TitleListType = &BusinessTitleListType;
3367 TitleListAltID = &BusinessTitleListAltID;
3368 TitleListPID = &BusinessTitleListPID;
3369 TitleListTokens = &BusinessTitleListTokens;
3370 TitleListLanguage = &BusinessTitleListLanguage;
3371 TitleListPref = &BusinessTitleListPref;
3377 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3378 intiter != SplitPoints.end(); ++intiter){
3380 SLiter = SplitLength.find(intiter->first);
3382 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3384 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3385 PropertyName = PropertyElement.GetNextToken();
3386 PropertyValue = PropertyElement.GetNextToken();
3388 intPrevValue = intiter->second;
3390 // Process properties.
3392 size_t intPropertyValueLen = PropertyValue.Len();
3394 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3396 PropertyValue.Trim();
3397 PropertyValue.RemoveLast();
3401 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3403 PropertyValue.Remove(0, 1);
3407 CaptureString(&PropertyValue, FALSE);
3409 if (PropertyName == wxT("ALTID")){
3411 TitleListAltID->erase(*TitleCount);
3412 TitleListAltID->insert(std::make_pair(*TitleCount, PropertyValue));
3414 } else if (PropertyName == wxT("PID")){
3416 TitleListPID->erase(*TitleCount);
3417 TitleListPID->insert(std::make_pair(*TitleCount, PropertyValue));
3419 } else if (PropertyName == wxT("PREF")){
3421 ProcessIntegerValue(this, TitleListPref, &PropertyValue, TitleCount);
3423 } else if (PropertyName == wxT("LANGUAGE")){
3425 TitleListLanguage->erase(*TitleCount);
3426 TitleListLanguage->insert(std::make_pair(*TitleCount, PropertyValue));
3430 // Something else we don't know about so append
3431 // to the tokens variable.
3433 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3435 if (FirstToken == TRUE){
3437 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3442 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3452 // Add the data to the General/Home/Work address variables.
3454 CaptureString(&PropertySeg2, FALSE);
3456 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3458 if (!PropertyTokens.IsEmpty()){
3460 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3466 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3468 std::map<int, int> SplitPoints;
3469 std::map<int, int> SplitLength;
3470 std::map<int, int>::iterator SLiter;
3471 wxString PropertyData;
3472 wxString PropertyName;
3473 wxString PropertyValue;
3474 wxString PropertyTokens;
3475 bool FirstToken = TRUE;
3476 int intPrevValue = 6;
3481 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3485 PropertyType PropType = PROPERTY_NONE;
3487 // Look for type before continuing.
3489 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3491 // Setup the pointers.
3493 std::map<int, wxString> *RoleList = NULL;
3494 std::map<int, wxString> *RoleListAltID = NULL;
3495 std::map<int, wxString> *RoleListPID = NULL;
3496 std::map<int, wxString> *RoleListType = NULL;
3497 std::map<int, wxString> *RoleListTokens = NULL;
3498 std::map<int, wxString> *RoleListLanguage = NULL;
3499 std::map<int, int> *RoleListPref = NULL;
3501 // Setup blank lines for later on.
3505 RoleList = &GeneralRoleList;
3506 RoleListType = &GeneralRoleListType;
3507 RoleListAltID = &GeneralRoleListAltID;
3508 RoleListPID = &GeneralRoleListPID;
3509 RoleListTokens = &GeneralRoleListTokens;
3510 RoleListLanguage = &GeneralRoleListLanguage;
3511 RoleListPref = &GeneralRoleListPref;
3514 RoleList = &HomeRoleList;
3515 RoleListType = &HomeRoleListType;
3516 RoleListAltID = &HomeRoleListAltID;
3517 RoleListPID = &HomeRoleListPID;
3518 RoleListTokens = &HomeRoleListTokens;
3519 RoleListLanguage = &HomeRoleListLanguage;
3520 RoleListPref = &HomeRoleListPref;
3523 RoleList = &BusinessRoleList;
3524 RoleListType = &BusinessRoleListType;
3525 RoleListAltID = &BusinessRoleListAltID;
3526 RoleListPID = &BusinessRoleListPID;
3527 RoleListTokens = &BusinessRoleListTokens;
3528 RoleListLanguage = &BusinessRoleListLanguage;
3529 RoleListPref = &BusinessRoleListPref;
3535 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3536 intiter != SplitPoints.end(); ++intiter){
3538 SLiter = SplitLength.find(intiter->first);
3540 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3542 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3543 PropertyName = PropertyElement.GetNextToken();
3544 PropertyValue = PropertyElement.GetNextToken();
3546 intPrevValue = intiter->second;
3548 // Process properties.
3550 size_t intPropertyValueLen = PropertyValue.Len();
3552 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3554 PropertyValue.Trim();
3555 PropertyValue.RemoveLast();
3559 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3561 PropertyValue.Remove(0, 1);
3565 CaptureString(&PropertyValue, FALSE);
3567 if (PropertyName == wxT("ALTID")){
3569 RoleListAltID->erase(*RoleCount);
3570 RoleListAltID->insert(std::make_pair(*RoleCount, PropertyValue));
3572 } else if (PropertyName == wxT("PID")){
3574 RoleListPID->erase(*RoleCount);
3575 RoleListPID->insert(std::make_pair(*RoleCount, PropertyValue));
3577 } else if (PropertyName == wxT("PREF")){
3579 ProcessIntegerValue(this, RoleListPref, &PropertyValue, RoleCount);
3581 } else if (PropertyName == wxT("LANGUAGE")){
3583 RoleListLanguage->erase(*RoleCount);
3584 RoleListLanguage->insert(std::make_pair(*RoleCount, PropertyValue));
3588 // Something else we don't know about so append
3589 // to the tokens variable.
3591 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3593 if (FirstToken == TRUE){
3595 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3600 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3610 // Add the data to the General/Home/Work address variables.
3612 CaptureString(&PropertySeg2, FALSE);
3614 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3616 if (!PropertyTokens.IsEmpty()){
3618 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3624 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3626 std::map<int, int> SplitPoints;
3627 std::map<int, int> SplitLength;
3628 std::map<int, int>::iterator SLiter;
3629 wxString PropertyData;
3630 wxString PropertyName;
3631 wxString PropertyValue;
3632 wxString PropertyTokens;
3633 bool FirstToken = TRUE;
3634 int intPrevValue = 5;
3639 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3643 PropertyType PropType = PROPERTY_NONE;
3645 // Look for type before continuing.
3647 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3649 // Setup the pointers.
3651 std::map<int, wxString> *OrganisationsList = NULL;
3652 std::map<int, wxString> *OrganisationsListAltID = NULL;
3653 std::map<int, wxString> *OrganisationsListPID = NULL;
3654 std::map<int, wxString> *OrganisationsListType = NULL;
3655 std::map<int, wxString> *OrganisationsListTokens = NULL;
3656 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3657 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3658 std::map<int, int> *OrganisationsListPref = NULL;
3660 // Setup blank lines for later on.
3664 OrganisationsList = &GeneralOrganisationsList;
3665 OrganisationsListType = &GeneralOrganisationsListType;
3666 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3667 OrganisationsListPID = &GeneralOrganisationsListPID;
3668 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3669 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3670 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3671 OrganisationsListPref = &GeneralOrganisationsListPref;
3674 OrganisationsList = &HomeOrganisationsList;
3675 OrganisationsListType = &HomeOrganisationsListType;
3676 OrganisationsListAltID = &HomeOrganisationsListAltID;
3677 OrganisationsListPID = &HomeOrganisationsListPID;
3678 OrganisationsListTokens = &HomeOrganisationsListTokens;
3679 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3680 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3681 OrganisationsListPref = &HomeOrganisationsListPref;
3684 OrganisationsList = &BusinessOrganisationsList;
3685 OrganisationsListType = &BusinessOrganisationsListType;
3686 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3687 OrganisationsListPID = &BusinessOrganisationsListPID;
3688 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3689 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3690 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3691 OrganisationsListPref = &BusinessOrganisationsListPref;
3697 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3698 intiter != SplitPoints.end(); ++intiter){
3700 SLiter = SplitLength.find(intiter->first);
3702 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3704 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3705 PropertyName = PropertyElement.GetNextToken();
3706 PropertyValue = PropertyElement.GetNextToken();
3708 intPrevValue = intiter->second;
3710 // Process properties.
3712 size_t intPropertyValueLen = PropertyValue.Len();
3714 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3716 PropertyValue.Trim();
3717 PropertyValue.RemoveLast();
3721 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3723 PropertyValue.Remove(0, 1);
3727 CaptureString(&PropertyValue, FALSE);
3729 if (PropertyName == wxT("ALTID")){
3731 OrganisationsListAltID->erase(*OrganisationCount);
3732 OrganisationsListAltID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3734 } else if (PropertyName == wxT("PID")){
3736 OrganisationsListPID->erase(*OrganisationCount);
3737 OrganisationsListPID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3739 } else if (PropertyName == wxT("SORT-AS")){
3741 OrganisationsListSortAs->erase(*OrganisationCount);
3742 OrganisationsListSortAs->insert(std::make_pair(*OrganisationCount, PropertyValue));
3744 } else if (PropertyName == wxT("PREF")){
3746 ProcessIntegerValue(this, OrganisationsListPref, &PropertyValue, OrganisationCount);
3748 } else if (PropertyName == wxT("LANGUAGE")){
3750 OrganisationsListLanguage->erase(*OrganisationCount);
3751 OrganisationsListLanguage->insert(std::make_pair(*OrganisationCount, PropertyValue));
3755 // Something else we don't know about so append
3756 // to the tokens variable.
3758 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3760 if (FirstToken == TRUE){
3762 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3767 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3777 // Add the data to the General/Home/Work address variables.
3779 CaptureString(&PropertySeg2, FALSE);
3781 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3783 if (!PropertyTokens.IsEmpty()){
3785 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3791 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3793 std::map<int, int> SplitPoints;
3794 std::map<int, int> SplitLength;
3795 std::map<int, int>::iterator SLiter;
3796 wxString PropertyData;
3797 wxString PropertyName;
3798 wxString PropertyValue;
3799 wxString PropertyTokens;
3800 bool FirstToken = TRUE;
3801 int intPrevValue = 6;
3806 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3810 PropertyType PropType = PROPERTY_NONE;
3812 // Look for type before continuing.
3814 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3816 // Setup the pointers.
3818 std::map<int, wxString> *NoteList = NULL;
3819 std::map<int, wxString> *NoteListAltID = NULL;
3820 std::map<int, wxString> *NoteListPID = NULL;
3821 std::map<int, wxString> *NoteListType = NULL;
3822 std::map<int, wxString> *NoteListTokens = NULL;
3823 std::map<int, wxString> *NoteListLanguage = NULL;
3824 std::map<int, int> *NoteListPref = NULL;
3826 // Setup blank lines for later on.
3830 NoteList = &GeneralNoteList;
3831 NoteListType = &GeneralNoteListType;
3832 NoteListAltID = &GeneralNoteListAltID;
3833 NoteListPID = &GeneralNoteListPID;
3834 NoteListTokens = &GeneralNoteListTokens;
3835 NoteListLanguage = &GeneralNoteListLanguage;
3836 NoteListPref = &GeneralNoteListPref;
3839 NoteList = &HomeNoteList;
3840 NoteListType = &HomeNoteListType;
3841 NoteListAltID = &HomeNoteListAltID;
3842 NoteListPID = &HomeNoteListPID;
3843 NoteListTokens = &HomeNoteListTokens;
3844 NoteListLanguage = &HomeNoteListLanguage;
3845 NoteListPref = &HomeNoteListPref;
3848 NoteList = &BusinessNoteList;
3849 NoteListType = &BusinessNoteListType;
3850 NoteListAltID = &BusinessNoteListAltID;
3851 NoteListPID = &BusinessNoteListPID;
3852 NoteListTokens = &BusinessNoteListTokens;
3853 NoteListLanguage = &BusinessNoteListLanguage;
3854 NoteListPref = &BusinessNoteListPref;
3860 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3861 intiter != SplitPoints.end(); ++intiter){
3863 SLiter = SplitLength.find(intiter->first);
3865 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3867 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3868 PropertyName = PropertyElement.GetNextToken();
3869 PropertyValue = PropertyElement.GetNextToken();
3871 intPrevValue = intiter->second;
3873 // Process properties.
3875 size_t intPropertyValueLen = PropertyValue.Len();
3877 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3879 PropertyValue.Trim();
3880 PropertyValue.RemoveLast();
3884 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3886 PropertyValue.Remove(0, 1);
3890 CaptureString(&PropertyValue, FALSE);
3892 if (PropertyName == wxT("ALTID")){
3894 NoteListAltID->erase(*NoteCount);
3895 NoteListAltID->insert(std::make_pair(*NoteCount, PropertyValue));
3897 } else if (PropertyName == wxT("PID")){
3899 NoteListPID->erase(*NoteCount);
3900 NoteListPID->insert(std::make_pair(*NoteCount, PropertyValue));
3902 } else if (PropertyName == wxT("PREF")){
3904 ProcessIntegerValue(this, NoteListPref, &PropertyValue, NoteCount);
3906 } else if (PropertyName == wxT("LANGUAGE")){
3908 NoteListLanguage->erase(*NoteCount);
3909 NoteListLanguage->insert(std::make_pair(*NoteCount, PropertyValue));
3913 // Something else we don't know about so append
3914 // to the tokens variable.
3916 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3918 if (FirstToken == TRUE){
3920 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3925 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3935 // Add the data to the General/Home/Work address variables.
3937 CaptureString(&PropertySeg2, FALSE);
3939 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3941 if (!PropertyTokens.IsEmpty()){
3943 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3949 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3951 std::map<int, int> SplitPoints;
3952 std::map<int, int> SplitLength;
3953 std::map<int, int>::iterator SLiter;
3954 wxString PropertyData;
3955 wxString PropertyName;
3956 wxString PropertyValue;
3957 wxString PropertyTokens;
3958 bool FirstToken = TRUE;
3959 int intPrevValue = 12;
3964 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3968 PropertyType PropType = PROPERTY_NONE;
3970 // Look for type before continuing.
3972 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3974 // Setup blank lines for later on.
3980 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3983 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3989 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3990 intiter != SplitPoints.end(); ++intiter){
3992 SLiter = SplitLength.find(intiter->first);
3994 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3996 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3997 PropertyName = PropertyElement.GetNextToken();
3998 PropertyValue = PropertyElement.GetNextToken();
4000 intPrevValue = intiter->second;
4002 // Process properties.
4004 size_t intPropertyValueLen = PropertyValue.Len();
4006 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4008 PropertyValue.Trim();
4009 PropertyValue.RemoveLast();
4013 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4015 PropertyValue.Remove(0, 1);
4019 CaptureString(&PropertyValue, FALSE);
4021 if (PropertyName == wxT("ALTID")){
4023 CategoriesListAltID.erase(*CategoryCount);
4024 CategoriesListAltID.insert(std::make_pair(*CategoryCount, PropertyValue));
4026 } else if (PropertyName == wxT("PID")){
4028 CategoriesListPID.erase(*CategoryCount);
4029 CategoriesListPID.insert(std::make_pair(*CategoryCount, PropertyValue));
4031 } else if (PropertyName == wxT("PREF")){
4033 ProcessIntegerValue(this, &CategoriesListPref, &PropertyValue, CategoryCount);
4035 } else if (PropertyName == wxT("LANGUAGE")){
4037 CategoriesListLanguage.erase(*CategoryCount);
4038 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, PropertyValue));
4042 // Something else we don't know about so append
4043 // to the tokens variable.
4045 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4047 if (FirstToken == TRUE){
4049 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4054 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4064 // Deal with multiple categories.
4066 int intOrigCatCount = *CategoryCount;
4067 bool FirstCategoryProcessed = TRUE;
4068 bool AfterFirstToken = FALSE;
4069 int intSplitSize = 0;
4070 int intSplitsFound = 0;
4071 int intSplitSeek = 0;
4072 int intPropertyLen = PropertySeg2.Len();
4074 SplitPoints.clear();
4075 SplitLength.clear();
4078 for (int i = 0; i <= intPropertyLen; i++){
4080 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
4088 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4090 if (AfterFirstToken == TRUE){
4092 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
4093 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
4097 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
4098 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
4099 AfterFirstToken = TRUE;
4111 if (SplitPoints.size() > 0){
4113 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
4114 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
4118 if (SplitPoints.size() == 0){
4120 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
4122 if (!PropertyTokens.IsEmpty()){
4124 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4130 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4131 intiter != SplitPoints.end(); ++intiter){
4133 SLiter = SplitLength.find(intiter->first);
4135 intPrevValue = intiter->second;
4137 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
4139 // Add the data to the General/Home/Work address variables.
4141 // Trim any whitespace from the start and end.
4143 PropertyData = PropertyData.Trim(FALSE);
4144 PropertyData = PropertyData.Trim(TRUE);
4146 CaptureString(&PropertyData, FALSE);
4148 if (FirstCategoryProcessed == TRUE){
4150 FirstCategoryProcessed = FALSE;
4152 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4154 if (!PropertyTokens.IsEmpty()){
4156 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4166 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4168 if (!PropertyTokens.IsEmpty()){
4170 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4176 // Copy the properties to each of the categories (if it exists).
4178 if (!PropertyTokens.IsEmpty()){
4180 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
4184 // Check if ALTID was used.
4186 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
4188 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
4192 // Check if PID was used.
4194 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
4196 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
4200 // Check if PREF was used.
4202 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
4204 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
4208 // Check if LANGUAGE was used.
4210 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
4212 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
4216 // Check if TYPE was used.
4222 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
4225 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
4233 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
4235 size_t intPropertyLen = PropertySeg1.Len();
4236 std::map<int, int> SplitPoints;
4237 std::map<int, int> SplitLength;
4238 std::map<int, int>::iterator SLiter;
4239 wxString PropertyData;
4240 wxString PropertyName;
4241 wxString PropertyValue;
4242 wxString PropertyTokens;
4243 bool FirstToken = TRUE;
4244 int intSplitsFound = 0;
4245 int intSplitSize = 0;
4246 int intPrevValue = 7;
4250 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4254 PropertyType PropType = PROPERTY_NONE;
4256 // Look for type before continuing.
4258 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4262 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4263 intiter != SplitPoints.end(); ++intiter){
4265 SLiter = SplitLength.find(intiter->first);
4267 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4269 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4270 PropertyName = PropertyElement.GetNextToken();
4271 PropertyValue = PropertyElement.GetNextToken();
4273 intPrevValue = intiter->second;
4275 // Process properties.
4277 size_t intPropertyValueLen = PropertyValue.Len();
4279 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4281 PropertyValue.Trim();
4282 PropertyValue.RemoveLast();
4286 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4288 PropertyValue.Remove(0, 1);
4292 CaptureString(&PropertyValue, FALSE);
4294 if (PropertyName == wxT("ALTID")){
4296 PicturesListAltID.erase(*PhotoCount);
4297 PicturesListAltID.insert(std::make_pair(*PhotoCount, PropertyValue));
4299 } else if (PropertyName == wxT("PID")){
4301 PicturesListPID.erase(*PhotoCount);
4302 PicturesListPID.insert(std::make_pair(*PhotoCount, PropertyValue));
4304 } else if (PropertyName == wxT("PREF")){
4306 ProcessIntegerValue(this, &PicturesListPref, &PropertyValue, PhotoCount);
4308 } else if (PropertyName == wxT("MEDIATYPE")){
4310 PicturesListMediatype.erase(*PhotoCount);
4311 PicturesListMediatype.insert(std::make_pair(*PhotoCount, PropertyValue));
4315 // Something else we don't know about so append
4316 // to the tokens variable.
4318 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4320 if (FirstToken == TRUE){
4322 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4327 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4337 intPropertyLen = PropertySeg2.Len();
4338 SplitPoints.clear();
4339 SplitLength.clear();
4344 CaptureString(&PropertySeg2, FALSE);
4346 for (int i = 0; i <= intPropertyLen; i++){
4350 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4353 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4355 if (intSplitsFound == 6){
4357 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4362 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4372 wxString wxSPhotoURI;
4373 wxString wxSPhotoMIME;
4374 wxString wxSPhotoEncoding;
4375 wxString wxSPhotoData;
4376 std::string base64enc;
4378 if (intSplitsFound == 0){
4382 std::map<int, int>::iterator striter;
4384 striter = SplitLength.find(1);
4386 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4388 while (wSTDataType.HasMoreTokens() == TRUE){
4390 wxSPhotoURI = wSTDataType.GetNextToken();
4391 wxSPhotoMIME = wSTDataType.GetNextToken();
4396 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4398 while (wSTDataInfo.HasMoreTokens() == TRUE){
4400 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4401 wxSPhotoData = wSTDataInfo.GetNextToken();
4402 base64enc = wxSPhotoData.mb_str();
4409 // Add the data to the General/Home/Work address variables.
4411 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4412 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4413 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4419 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4422 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4426 if (!PropertyTokens.IsEmpty()){
4428 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4434 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4436 size_t intPropertyLen = PropertySeg1.Len();
4437 std::map<int, int> SplitPoints;
4438 std::map<int, int> SplitLength;
4439 std::map<int, int>::iterator SLiter;
4440 wxString PropertyData;
4441 wxString PropertyName;
4442 wxString PropertyValue;
4443 wxString PropertyTokens;
4444 bool FirstToken = TRUE;
4445 int intSplitsFound = 0;
4446 int intSplitSize = 0;
4447 int intPrevValue = 6;
4451 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4455 PropertyType PropType = PROPERTY_NONE;
4457 // Look for type before continuing.
4459 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4463 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4464 intiter != SplitPoints.end(); ++intiter){
4466 SLiter = SplitLength.find(intiter->first);
4468 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4470 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4471 PropertyName = PropertyElement.GetNextToken();
4472 PropertyValue = PropertyElement.GetNextToken();
4474 intPrevValue = intiter->second;
4476 // Process properties.
4478 size_t intPropertyValueLen = PropertyValue.Len();
4480 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4482 PropertyValue.Trim();
4483 PropertyValue.RemoveLast();
4487 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4489 PropertyValue.Remove(0, 1);
4493 CaptureString(&PropertyValue, FALSE);
4495 if (PropertyName == wxT("ALTID")){
4497 LogosListAltID.erase(*LogoCount);
4498 LogosListAltID.insert(std::make_pair(*LogoCount, PropertyValue));
4500 } else if (PropertyName == wxT("PID")){
4502 LogosListPID.erase(*LogoCount);
4503 LogosListPID.insert(std::make_pair(*LogoCount, PropertyValue));
4505 } else if (PropertyName == wxT("PREF")){
4507 ProcessIntegerValue(this, &LogosListPref, &PropertyValue, LogoCount);
4509 } else if (PropertyName == wxT("MEDIATYPE")){
4511 LogosListMediatype.erase(*LogoCount);
4512 LogosListMediatype.insert(std::make_pair(*LogoCount, PropertyValue));
4516 // Something else we don't know about so append
4517 // to the tokens variable.
4519 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4521 if (FirstToken == TRUE){
4523 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4528 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4538 intPropertyLen = PropertySeg2.Len();
4539 SplitPoints.clear();
4540 SplitLength.clear();
4545 CaptureString(&PropertySeg2, FALSE);
4547 for (int i = 0; i <= intPropertyLen; i++){
4551 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4554 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4556 if (intSplitsFound == 6){
4558 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4563 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4573 wxString wxSPhotoURI;
4574 wxString wxSPhotoMIME;
4575 wxString wxSPhotoEncoding;
4576 wxString wxSPhotoData;
4577 std::string base64enc;
4579 if (intSplitsFound == 0){
4583 std::map<int, int>::iterator striter;
4585 striter = SplitLength.find(1);
4587 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4589 while (wSTDataType.HasMoreTokens() == TRUE){
4591 wxSPhotoURI = wSTDataType.GetNextToken();
4592 wxSPhotoMIME = wSTDataType.GetNextToken();
4597 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4599 while (wSTDataInfo.HasMoreTokens() == TRUE){
4601 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4602 wxSPhotoData = wSTDataInfo.GetNextToken();
4603 base64enc = wxSPhotoData.mb_str();
4610 // Add the data to the General/Home/Work address variables.
4612 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4613 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4614 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4620 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4623 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4627 if (!PropertyTokens.IsEmpty()){
4629 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4635 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4637 size_t intPropertyLen = PropertySeg1.Len();
4638 std::map<int, int> SplitPoints;
4639 std::map<int, int> SplitLength;
4640 std::map<int, int>::iterator SLiter;
4641 wxString PropertyData;
4642 wxString PropertyName;
4643 wxString PropertyValue;
4644 wxString PropertyTokens;
4645 bool FirstToken = TRUE;
4646 int intSplitsFound = 0;
4647 int intSplitSize = 0;
4648 int intPrevValue = 7;
4652 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4656 PropertyType PropType = PROPERTY_NONE;
4658 // Look for type before continuing.
4660 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4664 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4665 intiter != SplitPoints.end(); ++intiter){
4667 SLiter = SplitLength.find(intiter->first);
4669 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4671 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4672 PropertyName = PropertyElement.GetNextToken();
4673 PropertyValue = PropertyElement.GetNextToken();
4675 intPrevValue = intiter->second;
4677 // Process properties.
4679 size_t intPropertyValueLen = PropertyValue.Len();
4681 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4683 PropertyValue.Trim();
4684 PropertyValue.RemoveLast();
4688 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4690 PropertyValue.Remove(0, 1);
4694 CaptureString(&PropertyValue, FALSE);
4696 if (PropertyName == wxT("ALTID")){
4698 SoundsListAltID.erase(*SoundCount);
4699 SoundsListAltID.insert(std::make_pair(*SoundCount, PropertyValue));
4701 } else if (PropertyName == wxT("PID")){
4703 SoundsListPID.erase(*SoundCount);
4704 SoundsListPID.insert(std::make_pair(*SoundCount, PropertyValue));
4706 } else if (PropertyName == wxT("PREF")){
4708 ProcessIntegerValue(this, &SoundsListPref, &PropertyValue, SoundCount);
4710 } else if (PropertyName == wxT("MEDIATYPE")){
4712 SoundsListMediatype.erase(*SoundCount);
4713 SoundsListMediatype.insert(std::make_pair(*SoundCount, PropertyValue));
4715 } else if (PropertyName == wxT("LANGUAGE")){
4717 SoundsListLanguage.erase(*SoundCount);
4718 SoundsListLanguage.insert(std::make_pair(*SoundCount, PropertyValue));
4722 // Something else we don't know about so append
4723 // to the tokens variable.
4725 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4727 if (FirstToken == TRUE){
4729 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4734 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4744 intPropertyLen = PropertySeg2.Len();
4745 SplitPoints.clear();
4746 SplitLength.clear();
4751 CaptureString(&PropertySeg2, FALSE);
4753 for (int i = 0; i <= intPropertyLen; i++){
4757 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4760 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4762 if (intSplitsFound == 6){
4764 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4769 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4779 wxString wxSSoundURI;
4780 wxString wxSSoundMIME;
4781 wxString wxSSoundEncoding;
4782 wxString wxSSoundData;
4783 std::string base64enc;
4785 if (intSplitsFound == 0){
4789 std::map<int, int>::iterator striter;
4791 striter = SplitLength.find(1);
4793 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4795 while (wSTDataType.HasMoreTokens() == TRUE){
4797 wxSSoundURI = wSTDataType.GetNextToken();
4798 wxSSoundMIME = wSTDataType.GetNextToken();
4803 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4805 while (wSTDataInfo.HasMoreTokens() == TRUE){
4807 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4808 wxSSoundData = wSTDataInfo.GetNextToken();
4809 base64enc = wxSSoundData.mb_str();
4816 // Add the data to the General/Home/Work address variables.
4822 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4825 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4829 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4830 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4831 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4833 if (!PropertyTokens.IsEmpty()){
4835 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4841 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4843 size_t intPropertyLen = PropertySeg1.Len();
4844 std::map<int, int> SplitPoints;
4845 std::map<int, int> SplitLength;
4846 std::map<int, int>::iterator SLiter;
4847 wxString PropertyData;
4848 wxString PropertyName;
4849 wxString PropertyValue;
4850 wxString PropertyTokens;
4851 bool FirstToken = TRUE;
4852 int intSplitsFound = 0;
4853 int intSplitSize = 0;
4854 int intPrevValue = 8;
4858 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4862 PropertyType PropType = PROPERTY_NONE;
4864 // Look for type before continuing.
4866 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4870 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4871 intiter != SplitPoints.end(); ++intiter){
4873 SLiter = SplitLength.find(intiter->first);
4875 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4877 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4878 PropertyName = PropertyElement.GetNextToken();
4879 PropertyValue = PropertyElement.GetNextToken();
4881 intPrevValue = intiter->second;
4883 // Process properties.
4885 size_t intPropertyValueLen = PropertyValue.Len();
4887 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4889 PropertyValue.Trim();
4890 PropertyValue.RemoveLast();
4894 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4896 PropertyValue.Remove(0, 1);
4900 CaptureString(&PropertyValue, FALSE);
4902 if (PropertyName == wxT("ALTID")){
4904 CalendarListAltID.erase(*CalURICount);
4905 CalendarListAltID.insert(std::make_pair(*CalURICount, PropertyValue));
4907 } else if (PropertyName == wxT("PID")){
4909 CalendarListPID.erase(*CalURICount);
4910 CalendarListPID.insert(std::make_pair(*CalURICount, PropertyValue));
4912 } else if (PropertyName == wxT("PREF")){
4914 ProcessIntegerValue(this, &CalendarListPref, &PropertyValue, CalURICount);
4916 } else if (PropertyName == wxT("MEDIATYPE")){
4918 CalendarListMediatype.erase(*CalURICount);
4919 CalendarListMediatype.insert(std::make_pair(*CalURICount, PropertyValue));
4923 // Something else we don't know about so append
4924 // to the tokens variable.
4926 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4928 if (FirstToken == TRUE){
4930 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4935 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4945 intPropertyLen = PropertySeg2.Len();
4946 SplitPoints.clear();
4947 SplitLength.clear();
4952 CaptureString(&PropertySeg2, FALSE);
4954 // Add the data to the General/Home/Work address variables.
4960 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4963 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4967 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4969 if (!PropertyTokens.IsEmpty()){
4971 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4977 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4979 size_t intPropertyLen = PropertySeg1.Len();
4980 std::map<int, int> SplitPoints;
4981 std::map<int, int> SplitLength;
4982 std::map<int, int>::iterator SLiter;
4983 wxString PropertyData;
4984 wxString PropertyName;
4985 wxString PropertyValue;
4986 wxString PropertyTokens;
4987 bool FirstToken = TRUE;
4988 int intSplitsFound = 0;
4989 int intSplitSize = 0;
4990 int intPrevValue = 8;
4994 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4998 PropertyType PropType = PROPERTY_NONE;
5000 // Look for type before continuing.
5002 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5006 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5007 intiter != SplitPoints.end(); ++intiter){
5009 SLiter = SplitLength.find(intiter->first);
5011 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5013 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5014 PropertyName = PropertyElement.GetNextToken();
5015 PropertyValue = PropertyElement.GetNextToken();
5017 intPrevValue = intiter->second;
5019 // Process properties.
5021 size_t intPropertyValueLen = PropertyValue.Len();
5023 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5025 PropertyValue.Trim();
5026 PropertyValue.RemoveLast();
5030 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5032 PropertyValue.Remove(0, 1);
5036 CaptureString(&PropertyValue, FALSE);
5038 if (PropertyName == wxT("ALTID")){
5040 CalendarRequestListAltID.erase(*CalAdrURICount);
5041 CalendarRequestListAltID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
5043 } else if (PropertyName == wxT("PID")){
5045 CalendarRequestListPID.erase(*CalAdrURICount);
5046 CalendarRequestListPID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
5048 } else if (PropertyName == wxT("PREF")){
5050 ProcessIntegerValue(this, &CalendarRequestListPref, &PropertyValue, CalAdrURICount);
5052 } else if (PropertyName == wxT("MEDIATYPE")){
5054 CalendarRequestListMediatype.erase(*CalAdrURICount);
5055 CalendarRequestListMediatype.insert(std::make_pair(*CalAdrURICount, PropertyValue));
5059 // Something else we don't know about so append
5060 // to the tokens variable.
5062 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5064 if (FirstToken == TRUE){
5066 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5071 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5081 intPropertyLen = PropertySeg2.Len();
5082 SplitPoints.clear();
5083 SplitLength.clear();
5088 CaptureString(&PropertySeg2, FALSE);
5090 // Add the data to the General/Home/Work address variables.
5096 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
5099 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
5103 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
5105 if (!PropertyTokens.IsEmpty()){
5107 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
5113 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
5115 size_t intPropertyLen = PropertySeg1.Len();
5116 std::map<int, int> SplitPoints;
5117 std::map<int, int> SplitLength;
5118 std::map<int, int>::iterator SLiter;
5119 wxString PropertyData;
5120 wxString PropertyName;
5121 wxString PropertyValue;
5122 wxString PropertyTokens;
5123 bool FirstToken = TRUE;
5124 int intSplitsFound = 0;
5125 int intSplitSize = 0;
5126 int intPrevValue = 7;
5130 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5134 PropertyType PropType = PROPERTY_NONE;
5136 // Look for type before continuing.
5138 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5142 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5143 intiter != SplitPoints.end(); ++intiter){
5145 SLiter = SplitLength.find(intiter->first);
5147 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5149 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5150 PropertyName = PropertyElement.GetNextToken();
5151 PropertyValue = PropertyElement.GetNextToken();
5153 intPrevValue = intiter->second;
5155 // Process properties.
5157 size_t intPropertyValueLen = PropertyValue.Len();
5159 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5161 PropertyValue.Trim();
5162 PropertyValue.RemoveLast();
5166 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5168 PropertyValue.Remove(0, 1);
5172 CaptureString(&PropertyValue, FALSE);
5174 if (PropertyName == wxT("ALTID")){
5176 FreeBusyListAltID.erase(*FreeBusyAddressCount);
5177 FreeBusyListAltID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5179 } else if (PropertyName == wxT("PID")){
5181 FreeBusyListPID.erase(*FreeBusyAddressCount);
5182 FreeBusyListPID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5184 } else if (PropertyName == wxT("PREF")){
5186 ProcessIntegerValue(this, &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount);
5188 } else if (PropertyName == wxT("MEDIATYPE")){
5190 FreeBusyListMediatype.erase(*FreeBusyAddressCount);
5191 FreeBusyListMediatype.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5195 // Something else we don't know about so append
5196 // to the tokens variable.
5198 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5200 if (FirstToken == TRUE){
5202 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5207 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5217 intPropertyLen = PropertySeg2.Len();
5218 SplitPoints.clear();
5219 SplitLength.clear();
5224 CaptureString(&PropertySeg2, FALSE);
5226 // Add the data to the General/Home/Work address variables.
5232 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
5235 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
5239 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
5241 if (!PropertyTokens.IsEmpty()){
5243 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
5249 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
5251 size_t intPropertyLen = PropertySeg1.Len();
5252 std::map<int, int> SplitPoints;
5253 std::map<int, int> SplitLength;
5254 std::map<int, int>::iterator SLiter;
5255 wxString PropertyData;
5256 wxString PropertyName;
5257 wxString PropertyValue;
5258 wxString PropertyTokens;
5259 bool FirstToken = TRUE;
5260 int intSplitsFound = 0;
5261 int intSplitSize = 0;
5262 int intPrevValue = 5;
5267 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5271 PropertyType PropType = PROPERTY_NONE;
5273 // Look for type before continuing.
5275 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5279 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5280 intiter != SplitPoints.end(); ++intiter){
5282 SLiter = SplitLength.find(intiter->first);
5284 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5286 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5287 PropertyName = PropertyElement.GetNextToken();
5288 PropertyValue = PropertyElement.GetNextToken();
5290 intPrevValue = intiter->second;
5292 // Process properties.
5294 size_t intPropertyValueLen = PropertyValue.Len();
5296 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5298 PropertyValue.Trim();
5299 PropertyValue.RemoveLast();
5303 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5305 PropertyValue.Remove(0, 1);
5309 if (PropertyName == wxT("ALTID")){
5311 KeyListAltID.erase(*KeyCount);
5312 KeyListAltID.insert(std::make_pair(*KeyCount, PropertyValue));
5314 } else if (PropertyName == wxT("PID")){
5316 KeyListPID.erase(*KeyCount);
5317 KeyListPID.insert(std::make_pair(*KeyCount, PropertyValue));
5319 } else if (PropertyName == wxT("PREF")){
5321 int PriorityNumber = 0;
5322 bool ValidNumber = TRUE;
5325 PriorityNumber = std::stoi(PropertyValue.ToStdString());
5328 catch(std::invalid_argument &e){
5329 ValidNumber = FALSE;
5332 if (ValidNumber == TRUE){
5334 KeyListPref.erase(*KeyCount);
5335 KeyListPref.insert(std::make_pair(*KeyCount, PriorityNumber));
5341 // Something else we don't know about so append
5342 // to the tokens variable.
5344 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5346 if (FirstToken == TRUE){
5348 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5353 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5363 intPropertyLen = PropertySeg2.Len();
5364 SplitPoints.clear();
5365 SplitLength.clear();
5370 for (int i = 0; i <= intPropertyLen; i++){
5374 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
5377 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
5379 if (intSplitsFound == 6){
5381 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5386 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5397 wxString wxSKeyMIME;
5398 wxString wxSKeyEncoding;
5399 wxString wxSKeyData;
5400 std::string base64enc;
5402 if (intSplitsFound == 0){
5406 std::map<int, int>::iterator striter;
5408 striter = SplitLength.find(1);
5410 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
5412 while (wSTDataType.HasMoreTokens() == TRUE){
5414 wxSKeyURI = wSTDataType.GetNextToken();
5415 wxSKeyMIME = wSTDataType.GetNextToken();
5420 if (wxSKeyURI == wxT("data")){
5422 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
5424 while (wSTDataInfo.HasMoreTokens() == TRUE){
5426 wxSKeyEncoding = wSTDataInfo.GetNextToken();
5427 wxSKeyData = wSTDataInfo.GetNextToken();
5436 // Add the data to the General/Home/Work address variables.
5438 if (wxSKeyURI == wxT("data")){
5440 KeyListDataEncType.erase(*KeyCount);
5441 KeyListKeyType.erase(*KeyCount);
5442 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
5443 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
5445 KeyList.erase(*KeyCount);
5446 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
5450 KeyList.erase(*KeyCount);
5451 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
5455 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
5461 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
5464 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
5468 if (!PropertyTokens.IsEmpty()){
5470 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
5476 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
5478 // Split the Vendor three ways.
5480 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
5483 wxString wxSVNDPropName;
5486 while (wSTVendorDetails.HasMoreTokens() == TRUE){
5488 wSTVendorDetails.GetNextToken();
5489 wxSVNDID = wSTVendorDetails.GetNextToken();
5490 wxSVNDPropName = wSTVendorDetails.GetNextToken();
5495 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
5497 // Add the data to the vendor variables.
5499 VendorList.erase(*VendorCount);
5500 VendorListPEN.erase(*VendorCount);
5501 VendorListElement.erase(*VendorCount);
5503 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
5504 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
5505 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
5511 void ProcessIntegerValue(ContactDataObject *ContactData,
5512 std::map<int,int> *PrefPtr,
5513 wxString *PropertyValue,
5516 int PriorityNumber = 0;
5517 bool ValidNumber = TRUE;
5520 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5523 catch(std::invalid_argument &e){
5524 ValidNumber = FALSE;
5527 if (ValidNumber == TRUE){
5529 PrefPtr->erase(*ItemCount);
5530 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5536 void SplitValues(wxString *PropertyLine,
5537 std::map<int,int> *SplitPoints,
5538 std::map<int,int> *SplitLength,
5541 size_t intPropertyLen = PropertyLine->Len();
5542 int intSplitsFound = 0;
5543 int intSplitSize = 0;
5544 int intSplitSeek = 0;
5546 for (int i = intSize; i <= intPropertyLen; i++){
5550 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5551 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5553 if (intSplitsFound == 0){
5555 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5559 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5563 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5573 if (intSplitsFound == 0){
5575 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5576 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5580 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5581 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5587 void CheckType(wxString *PropertySeg1,
5588 std::map<int,int> *SplitPoints,
5589 std::map<int,int> *SplitLength,
5591 PropertyType *PropType){
5593 wxString PropertyData;
5594 wxString PropertyName;
5595 wxString PropertyValue;
5596 std::map<int,int>::iterator SLiter;
5598 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5599 intiter != SplitPoints->end(); ++intiter){
5601 SLiter = SplitLength->find(intiter->first);
5603 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5605 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5606 PropertyName = PropertyElement.GetNextToken();
5607 PropertyValue = PropertyElement.GetNextToken();
5609 *intPrevValue = intiter->second;
5611 if (PropertyName == wxT("TYPE")){
5613 if (PropertyValue == wxT("work")){
5615 *PropType = PROPERTY_WORK;
5617 } else if (PropertyValue == wxT("home")){
5619 *PropType = PROPERTY_HOME;
5623 *PropType = PROPERTY_NONE;