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 bool PropertyMatched = FALSE;
553 int intSplitsFound = 0;
554 int intSplitSize = 0;
555 int intPrevValue = 8;
559 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
563 PropertyType PropType = PROPERTY_NONE;
565 // Look for type before continuing.
567 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
571 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
572 intiter != SplitPoints.end(); ++intiter){
574 SLiter = SplitLength.find(intiter->first);
576 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
578 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
579 PropertyName = PropertyElement.GetNextToken();
580 PropertyValue = PropertyElement.GetNextToken();
582 intPrevValue = intiter->second;
584 // Process properties.
586 size_t intPropertyValueLen = PropertyValue.Len();
588 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
590 PropertyValue.Trim();
591 PropertyValue.RemoveLast();
595 if (PropertyValue.Mid(0, 1) == wxT("\"")){
597 PropertyValue.Remove(0, 1);
601 CaptureString(&PropertyValue, FALSE);
603 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
604 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
605 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
606 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
608 if (PropertyMatched == TRUE){
610 PropertyMatched = FALSE;
615 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
617 if (FirstToken == TRUE){
619 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
624 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
632 intPropertyLen = PropertySeg2.Len();
639 CaptureString(&PropertySeg2, FALSE);
641 // Add the data to the General/Home/Work address variables.
647 SourceListType.insert(std::make_pair(*SourceCount, "home"));
650 SourceListType.insert(std::make_pair(*SourceCount, "work"));
654 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
656 if (!PropertyTokens.IsEmpty()){
658 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
664 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
666 std::map<int, int> SplitPoints;
667 std::map<int, int> SplitLength;
669 int intPrevValue = 5;
673 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
677 wxString PropertyName;
678 wxString PropertyValue;
679 wxString PropertyData;
680 wxString PropertyTokens;
681 std::map<int,int>::iterator SLiter;
682 bool FirstToken = TRUE;
683 bool PropertyMatched = FALSE;
685 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
686 intiter != SplitPoints.end(); ++intiter){
688 SLiter = SplitLength.find(intiter->first);
690 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
692 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
693 PropertyName = PropertyElement.GetNextToken();
694 PropertyValue = PropertyElement.GetNextToken();
696 intPrevValue = intiter->second;
698 CaptureString(&PropertyValue, FALSE);
700 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
702 if (PropertyMatched == TRUE){
704 PropertyMatched = FALSE;
711 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
715 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
717 std::map<int, int> SplitPoints;
718 std::map<int, int> SplitLength;
720 int intPrevValue = 8;
724 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
728 wxString PropertyName;
729 wxString PropertyValue;
730 wxString PropertyData;
731 wxString PropertyTokens;
732 std::map<int,int>::iterator SLiter;
733 bool FirstToken = TRUE;
734 bool PropertyMatched = FALSE;
736 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
737 intiter != SplitPoints.end(); ++intiter){
739 SLiter = SplitLength.find(intiter->first);
741 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
743 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
744 PropertyName = PropertyElement.GetNextToken();
745 PropertyValue = PropertyElement.GetNextToken();
747 intPrevValue = intiter->second;
749 CaptureString(&PropertyValue, FALSE);
751 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
752 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
753 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
754 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
756 if (PropertyMatched == TRUE){
758 PropertyMatched = FALSE;
763 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
765 if (FirstToken == TRUE){
767 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
772 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
780 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
782 if (!PropertyTokens.IsEmpty()){
784 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
791 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
793 std::map<int, int> SplitPoints;
794 std::map<int, int> SplitLength;
796 int intPrevValue = 4;
800 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
804 wxString PropertyName;
805 wxString PropertyValue;
806 wxString PropertyData;
807 wxString PropertyTokens;
808 std::map<int,int>::iterator SLiter;
809 bool FirstToken = TRUE;
810 bool PropertyMatched = FALSE;
812 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
813 intiter != SplitPoints.end(); ++intiter){
815 SLiter = SplitLength.find(intiter->first);
817 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
819 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
820 PropertyName = PropertyElement.GetNextToken();
821 PropertyValue = PropertyElement.GetNextToken();
823 intPrevValue = intiter->second;
825 CaptureString(&PropertyValue, FALSE);
827 if (PropertyName == wxT("TYPE")){
829 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
830 PropertyValue == wxT("work") ){
832 FullNamesListType.erase(*FNCount);
833 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
837 PropertyMatched = TRUE;
841 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
842 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
843 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
844 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
846 if (PropertyMatched == TRUE){
848 PropertyMatched = FALSE;
853 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
855 if (FirstToken == TRUE){
857 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
862 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
870 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
872 if (!PropertyTokens.IsEmpty()){
874 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
880 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
882 std::map<int, int> SplitPoints;
883 std::map<int, int> SplitLength;
885 int intPrevValue = 3;
889 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
893 wxString PropertyName;
894 wxString PropertyValue;
895 wxString PropertyData;
896 wxString PropertyTokens;
897 std::map<int,int>::iterator SLiter;
898 bool FirstToken = TRUE;
900 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
901 intiter != SplitPoints.end(); ++intiter){
903 SLiter = SplitLength.find(intiter->first);
905 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
907 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
908 PropertyName = PropertyElement.GetNextToken();
909 PropertyValue = PropertyElement.GetNextToken();
911 intPrevValue = intiter->second;
913 CaptureString(&PropertyValue, FALSE);
915 if (PropertyName == wxT("ALTID")){
917 NameAltID = PropertyValue;
919 } else if (PropertyName == wxT("LANGUAGE")){
921 NameLanguage = PropertyValue;
923 } else if (PropertyName == wxT("SORT-AS")){
925 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
926 PropertyValue.Len() >= 3){
927 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
930 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
932 if (FirstToken == TRUE){
934 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
939 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
947 // Split the name data.
949 int intSplitSeek = 0;
950 int intSplitsFound = 0;
951 int intSplitSize = 0;
952 int intPropertyLen = PropertySeg2.Len();
954 std::map<int,wxString> NameValues;
957 for (int i = 0; i <= intPropertyLen; i++){
959 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
961 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
966 if (intSplitsFound == 4){
968 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
982 // Split the data into several parts.
984 for (std::map<int, wxString>::iterator iter = NameValues.begin();
985 iter != NameValues.end(); ++iter){
987 if (iter->first == 1){
989 // Deal with family name.
991 NameSurname = iter->second;
993 } else if (iter->first == 2){
995 // Deal with given names.
997 NameForename = iter->second;
999 } else if (iter->first == 3){
1001 // Deal with additional names.
1003 NameOtherNames = iter->second;
1005 } else if (iter->first == 4){
1007 // Deal with honorifix prefixes and suffixes.
1009 NameTitle = iter->second;
1013 if (iter == NameValues.end()){
1019 NameSuffix = iter->second;
1025 // Add the name token data.
1027 if (!PropertyTokens.IsEmpty()){
1029 NameTokens = PropertyTokens;
1035 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
1037 size_t intPropertyLen = PropertySeg1.Len();
1038 std::map<int, int> SplitPoints;
1039 std::map<int, int> SplitLength;
1040 std::map<int, int>::iterator SLiter;
1041 wxString PropertyData;
1042 wxString PropertyName;
1043 wxString PropertyValue;
1044 wxString PropertyTokens;
1045 bool FirstToken = TRUE;
1046 int intSplitsFound = 0;
1047 int intSplitSize = 0;
1048 int intPrevValue = 14;
1052 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1056 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1057 intiter != SplitPoints.end(); ++intiter){
1059 SLiter = SplitLength.find(intiter->first);
1061 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1063 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1064 PropertyName = PropertyElement.GetNextToken();
1065 PropertyValue = PropertyElement.GetNextToken();
1067 intPrevValue = intiter->second;
1069 // Process properties.
1071 CaptureString(&PropertyValue, FALSE);
1073 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1075 if (FirstToken == TRUE){
1077 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1082 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1090 CaptureString(&PropertySeg2, FALSE);
1092 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
1094 if (!PropertyTokens.IsEmpty()){
1096 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
1102 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
1104 std::map<int, int> SplitPoints;
1105 std::map<int, int> SplitLength;
1107 int intPrevValue = 10;
1110 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1114 PropertyType PropType = PROPERTY_NONE;
1116 // Look for type before continuing.
1118 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1122 std::map<int, wxString> *NicknamesList = NULL;
1123 std::map<int, wxString> *NicknamesListType = NULL;
1124 std::map<int, wxString> *NicknamesListLanguage = NULL;
1125 std::map<int, wxString> *NicknamesListAltID = NULL;
1126 std::map<int, wxString> *NicknamesListPID = NULL;
1127 std::map<int, wxString> *NicknamesListTokens = NULL;
1128 std::map<int, int> *NicknamesListPref = NULL;
1132 NicknamesList = &GeneralNicknamesList;
1133 NicknamesListType = &GeneralNicknamesListType;
1134 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1135 NicknamesListAltID = &GeneralNicknamesListAltID;
1136 NicknamesListPID = &GeneralNicknamesListPID;
1137 NicknamesListTokens = &GeneralNicknamesListTokens;
1138 NicknamesListPref = &GeneralNicknamesListPref;
1141 NicknamesList = &HomeNicknamesList;
1142 NicknamesListType = &HomeNicknamesListType;
1143 NicknamesListLanguage = &HomeNicknamesListLanguage;
1144 NicknamesListAltID = &HomeNicknamesListAltID;
1145 NicknamesListPID = &HomeNicknamesListPID;
1146 NicknamesListTokens = &HomeNicknamesListTokens;
1147 NicknamesListPref = &HomeNicknamesListPref;
1150 NicknamesList = &BusinessNicknamesList;
1151 NicknamesListType = &BusinessNicknamesListType;
1152 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1153 NicknamesListAltID = &BusinessNicknamesListAltID;
1154 NicknamesListPID = &BusinessNicknamesListPID;
1155 NicknamesListTokens = &BusinessNicknamesListTokens;
1156 NicknamesListPref = &BusinessNicknamesListPref;
1160 std::map<int, int>::iterator SLiter;
1161 wxString PropertyData;
1162 wxString PropertyName;
1163 wxString PropertyValue;
1164 wxString PropertyTokens;
1165 bool FirstToken = TRUE;
1166 bool PropertyMatched = FALSE;
1168 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1169 intiter != SplitPoints.end(); ++intiter){
1171 SLiter = SplitLength.find(intiter->first);
1173 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1175 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1176 PropertyName = PropertyElement.GetNextToken();
1177 PropertyValue = PropertyElement.GetNextToken();
1179 intPrevValue = intiter->second;
1181 CaptureString(&PropertyValue, FALSE);
1183 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1184 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1185 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1186 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1188 if (PropertyMatched == TRUE){
1190 PropertyMatched = FALSE;
1195 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1197 if (FirstToken == TRUE){
1199 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1204 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1212 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1214 // Add the name token data.
1216 if (!PropertyTokens.IsEmpty()){
1218 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1224 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1226 std::map<int, int> SplitPoints;
1227 std::map<int, int> SplitLength;
1228 std::map<int, int>::iterator SLiter;
1229 wxString PropertyData;
1230 wxString PropertyName;
1231 wxString PropertyValue;
1232 wxString PropertyTokens;
1233 bool FirstToken = TRUE;
1234 int intPrevValue = 8;
1236 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1240 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1241 intiter != SplitPoints.end(); ++intiter){
1243 SLiter = SplitLength.find(intiter->first);
1245 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1247 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1248 PropertyName = PropertyElement.GetNextToken();
1249 PropertyValue = PropertyElement.GetNextToken();
1251 intPrevValue = intiter->second;
1253 // Process properties.
1255 size_t intPropertyValueLen = PropertyValue.Len();
1257 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1259 PropertyValue.Trim();
1260 PropertyValue.RemoveLast();
1264 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1266 PropertyValue.Remove(0, 1);
1270 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1272 if (FirstToken == TRUE){
1274 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1279 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1287 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1289 wxString GenderComponent;
1291 if (GenderData.CountTokens() >= 2){
1293 Gender = GenderData.GetNextToken();
1294 GenderDetails = GenderData.GetString();
1296 CaptureString(&GenderDetails, FALSE);
1300 Gender = GenderData.GetNextToken();
1304 if (!PropertyTokens.IsEmpty()){
1306 GenderTokens = PropertyTokens;
1312 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1314 // Process date. Preserve the remainder in the string.
1316 std::map<int, int> SplitPoints;
1317 std::map<int, int> SplitLength;
1318 std::map<int, int>::iterator SLiter;
1319 wxString PropertyData;
1320 wxString PropertyName;
1321 wxString PropertyValue;
1322 wxString PropertyTokens;
1323 bool BirthdayText = FALSE;
1324 int intPrevValue = 6;
1326 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1330 // Look for type before continuing.
1332 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1333 intiter != SplitPoints.end(); ++intiter){
1335 SLiter = SplitLength.find(intiter->first);
1337 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1339 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1340 PropertyName = PropertyElement.GetNextToken();
1341 PropertyValue = PropertyElement.GetNextToken();
1343 intPrevValue = intiter->second;
1345 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1347 CaptureString(&PropertySeg2, FALSE);
1348 Birthday = PropertySeg2;
1349 BirthdayText = TRUE;
1355 // Setup blank lines for later on.
1358 bool FirstToken = TRUE;
1360 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1361 intiter != SplitPoints.end(); ++intiter){
1363 SLiter = SplitLength.find(intiter->first);
1365 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1367 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1368 PropertyName = PropertyElement.GetNextToken();
1369 PropertyValue = PropertyElement.GetNextToken();
1371 intPrevValue = intiter->second;
1373 // Process properties.
1375 CaptureString(&PropertyValue, FALSE);
1377 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1379 PropertyValue.Trim();
1380 PropertyValue.RemoveLast();
1384 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1386 PropertyValue.Remove(0, 1);
1390 if (PropertyName == wxT("ALTID")){
1392 BirthdayAltID = PropertyValue;
1394 } else if (PropertyName == wxT("CALSCALE")){
1396 BirthdayCalScale = PropertyValue;
1398 } else if (PropertyName != wxT("VALUE")) {
1400 // Something else we don't know about so append
1401 // to the tokens variable.
1403 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1405 if (FirstToken == TRUE){
1407 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1412 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1422 // Add the data to the variables and form.
1424 if (BirthdayText == FALSE){
1426 Birthday = PropertySeg2;
1430 if (!PropertyTokens.IsEmpty()){
1432 BirthdayTokens = PropertyTokens;
1438 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1440 // Process date. Preserve the remainder in the string.
1442 std::map<int, int> SplitPoints;
1443 std::map<int, int> SplitLength;
1444 std::map<int, int>::iterator SLiter;
1445 wxString PropertyData;
1446 wxString PropertyName;
1447 wxString PropertyValue;
1448 wxString PropertyTokens;
1449 bool AnniversaryText = FALSE;
1450 int intPrevValue = 13;
1452 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1456 // Look for type before continuing.
1458 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1459 intiter != SplitPoints.end(); ++intiter){
1461 SLiter = SplitLength.find(intiter->first);
1463 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1465 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1466 PropertyName = PropertyElement.GetNextToken();
1467 PropertyValue = PropertyElement.GetNextToken();
1469 intPrevValue = intiter->second;
1471 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1473 CaptureString(&PropertySeg2, FALSE);
1474 Anniversary = PropertySeg2;
1475 AnniversaryText = TRUE;
1481 // Setup blank lines for later on.
1484 bool FirstToken = TRUE;
1486 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1487 intiter != SplitPoints.end(); ++intiter){
1489 SLiter = SplitLength.find(intiter->first);
1491 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1493 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1494 PropertyName = PropertyElement.GetNextToken();
1495 PropertyValue = PropertyElement.GetNextToken();
1497 intPrevValue = intiter->second;
1499 // Process properties.
1501 CaptureString(&PropertyValue, FALSE);
1503 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1505 PropertyValue.Trim();
1506 PropertyValue.RemoveLast();
1510 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1512 PropertyValue.Remove(0, 1);
1516 if (PropertyName == wxT("ALTID")){
1518 AnniversaryAltID = PropertyValue;
1520 } else if (PropertyName == wxT("CALSCALE")){
1522 AnniversaryCalScale = PropertyValue;
1524 } else if (PropertyName != wxT("VALUE")) {
1526 // Something else we don't know about so append
1527 // to the tokens variable.
1529 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1531 if (FirstToken == TRUE){
1533 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1538 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1548 // Add the data to the variables and form.
1550 if (AnniversaryText == FALSE){
1552 Anniversary = PropertySeg2;
1556 if (!PropertyTokens.IsEmpty()){
1558 AnniversaryTokens = PropertyTokens;
1564 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1566 std::map<int, int> SplitPoints;
1567 std::map<int, int> SplitLength;
1569 int intPrevValue = 4;
1572 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1576 PropertyType PropType = PROPERTY_NONE;
1578 // Look for type before continuing.
1580 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1584 std::map<int, wxString> *TZList = NULL;
1585 std::map<int, wxString> *TZListType = NULL;
1586 std::map<int, wxString> *TZListMediatype = NULL;
1587 std::map<int, wxString> *TZListAltID = NULL;
1588 std::map<int, wxString> *TZListPID = NULL;
1589 std::map<int, wxString> *TZListTokens = NULL;
1590 std::map<int, int> *TZListPref = NULL;
1594 TZList = &GeneralTZList;
1595 TZListType = &GeneralTZListType;
1596 TZListMediatype = &GeneralTZListMediatype;
1597 TZListAltID = &GeneralTZListAltID;
1598 TZListPID = &GeneralTZListPID;
1599 TZListTokens = &GeneralTZListTokens;
1600 TZListPref = &GeneralTZListPref;
1603 TZList = &HomeTZList;
1604 TZListType = &HomeTZListType;
1605 TZListMediatype = &HomeTZListMediatype;
1606 TZListAltID = &HomeTZListAltID;
1607 TZListPID = &HomeTZListPID;
1608 TZListTokens = &HomeTZListTokens;
1609 TZListPref = &HomeTZListPref;
1612 TZList = &BusinessTZList;
1613 TZListType = &BusinessTZListType;
1614 TZListMediatype = &BusinessTZListMediatype;
1615 TZListAltID = &BusinessTZListAltID;
1616 TZListPID = &BusinessTZListPID;
1617 TZListTokens = &BusinessTZListTokens;
1618 TZListPref = &BusinessTZListPref;
1622 std::map<int, int>::iterator SLiter;
1623 wxString PropertyData;
1624 wxString PropertyName;
1625 wxString PropertyValue;
1626 wxString PropertyTokens;
1627 bool FirstToken = TRUE;
1628 bool PropertyMatched = FALSE;
1630 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1631 intiter != SplitPoints.end(); ++intiter){
1633 SLiter = SplitLength.find(intiter->first);
1635 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1637 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1638 PropertyName = PropertyElement.GetNextToken();
1639 PropertyValue = PropertyElement.GetNextToken();
1641 intPrevValue = intiter->second;
1643 CaptureString(&PropertyValue, FALSE);
1645 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1646 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1647 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1648 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1650 if (PropertyMatched == TRUE){
1652 PropertyMatched = FALSE;
1657 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1659 if (FirstToken == TRUE){
1661 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1666 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1674 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1676 // Add the name token data.
1678 if (!PropertyTokens.IsEmpty()){
1680 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1687 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1689 size_t intPropertyLen = PropertySeg1.Len();
1690 std::map<int, int> SplitPoints;
1691 std::map<int, int> SplitLength;
1692 std::map<int, int>::iterator SLiter;
1693 wxString PropertyData;
1694 wxString PropertyName;
1695 wxString PropertyValue;
1696 wxString PropertyTokens;
1697 wxString AddressLabel;
1698 wxString AddressLang;
1699 wxString AddressAltID;
1700 wxString AddressPID;
1701 wxString AddressTokens;
1702 wxString AddressGeo;
1703 wxString AddressTimezone;
1704 wxString AddressType;
1705 wxString AddressMediatype;
1706 wxString AddressPOBox;
1707 wxString AddressExtended;
1708 wxString AddressStreet;
1709 wxString AddressLocality;
1710 wxString AddressCity;
1711 wxString AddressRegion;
1712 wxString AddressPostalCode;
1713 wxString AddressCountry;
1714 bool FirstToken = TRUE;
1715 int intSplitsFound = 0;
1716 int intSplitSize = 0;
1717 int intPrevValue = 5;
1721 bool PropertyMatched = FALSE;
1723 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1727 PropertyType PropType = PROPERTY_NONE;
1729 // Look for type before continuing.
1731 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1735 std::map<int, wxString> *AddressList = NULL;
1736 std::map<int, wxString> *AddressListTown = NULL;
1737 std::map<int, wxString> *AddressListCounty = NULL;
1738 std::map<int, wxString> *AddressListPostCode = NULL;
1739 std::map<int, wxString> *AddressListCountry = NULL;
1740 std::map<int, wxString> *AddressListLabel = NULL;
1741 std::map<int, wxString> *AddressListLang = NULL;
1742 std::map<int, wxString> *AddressListAltID = NULL;
1743 std::map<int, wxString> *AddressListPID = NULL;
1744 std::map<int, wxString> *AddressListTokens = NULL;
1745 std::map<int, wxString> *AddressListGeo = NULL;
1746 std::map<int, wxString> *AddressListTimezone = NULL;
1747 std::map<int, wxString> *AddressListType = NULL;
1748 std::map<int, wxString> *AddressListMediatype = NULL;
1749 std::map<int, int> *AddressListPref = NULL;
1753 AddressList = &GeneralAddressList;
1754 AddressListTown = &GeneralAddressListTown;
1755 AddressListCounty = &GeneralAddressListCounty;
1756 AddressListPostCode = &GeneralAddressListPostCode;
1757 AddressListCountry = &GeneralAddressListCountry;
1758 AddressListLabel = &GeneralAddressListLabel;
1759 AddressListLang = &GeneralAddressListLang;
1760 AddressListAltID = &GeneralAddressListAltID;
1761 AddressListPID = &GeneralAddressListPID;
1762 AddressListTokens = &GeneralAddressListTokens;
1763 AddressListGeo = &GeneralAddressListGeo;
1764 AddressListTimezone = &GeneralAddressListTimezone;
1765 AddressListType = &GeneralAddressListType;
1766 AddressListMediatype = &GeneralAddressListMediatype;
1767 AddressListPref = &GeneralAddressListPref;
1770 AddressList = &HomeAddressList;
1771 AddressListTown = &HomeAddressListTown;
1772 AddressListCounty = &HomeAddressListCounty;
1773 AddressListPostCode = &HomeAddressListPostCode;
1774 AddressListCountry = &HomeAddressListCountry;
1775 AddressListLabel = &HomeAddressListLabel;
1776 AddressListLang = &HomeAddressListLang;
1777 AddressListAltID = &HomeAddressListAltID;
1778 AddressListPID = &HomeAddressListPID;
1779 AddressListTokens = &HomeAddressListTokens;
1780 AddressListGeo = &HomeAddressListGeo;
1781 AddressListTimezone = &HomeAddressListTimezone;
1782 AddressListType = &HomeAddressListType;
1783 AddressListMediatype = &HomeAddressListMediatype;
1784 AddressListPref = &HomeAddressListPref;
1787 AddressList = &BusinessAddressList;
1788 AddressListTown = &BusinessAddressListTown;
1789 AddressListCounty = &BusinessAddressListCounty;
1790 AddressListPostCode = &BusinessAddressListPostCode;
1791 AddressListCountry = &BusinessAddressListCountry;
1792 AddressListLabel = &BusinessAddressListLabel;
1793 AddressListLang = &BusinessAddressListLang;
1794 AddressListAltID = &BusinessAddressListAltID;
1795 AddressListPID = &BusinessAddressListPID;
1796 AddressListTokens = &BusinessAddressListTokens;
1797 AddressListGeo = &BusinessAddressListGeo;
1798 AddressListTimezone = &BusinessAddressListTimezone;
1799 AddressListType = &BusinessAddressListType;
1800 AddressListMediatype = &BusinessAddressListMediatype;
1801 AddressListPref = &BusinessAddressListPref;
1807 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1808 intiter != SplitPoints.end(); ++intiter){
1810 SLiter = SplitLength.find(intiter->first);
1812 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1814 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1815 PropertyName = PropertyElement.GetNextToken();
1816 PropertyValue = PropertyElement.GetNextToken();
1818 intPrevValue = intiter->second;
1820 CaptureString(&PropertyValue, FALSE);
1822 // Process properties.
1824 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1825 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1826 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1827 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1828 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1829 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1830 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1831 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1833 if (PropertyMatched == TRUE){
1835 PropertyMatched = FALSE;
1840 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1842 if (FirstToken == TRUE){
1844 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1849 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1857 // Split the address.
1859 //std::map<int, int>::iterator SLiter;
1860 intPropertyLen = PropertySeg2.Len();
1861 SplitPoints.clear();
1862 SplitLength.clear();
1867 for (int i = 0; i <= intPropertyLen; i++){
1871 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1874 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1876 if (intSplitsFound == 6){
1878 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1883 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1893 // Split the data into several parts.
1895 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1896 intiter != SplitPoints.end(); ++intiter){
1898 if (intiter->first == 1){
1900 // Deal with PO Box.
1902 SLiter = SplitLength.find(1);
1904 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1905 intPrevValue = intiter->second;
1907 } else if (intiter->first == 2){
1909 // Deal with extended address.
1911 SLiter = SplitLength.find(2);
1913 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1914 intPrevValue = intiter->second;
1916 } else if (intiter->first == 3){
1918 // Deal with street address.
1920 SLiter = SplitLength.find(3);
1922 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1923 intPrevValue = intiter->second;
1925 } else if (intiter->first == 4){
1927 // Deal with locality
1929 SLiter = SplitLength.find(4);
1931 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1932 intPrevValue = intiter->second;
1934 } else if (intiter->first == 5){
1936 // Deal with region.
1938 SLiter = SplitLength.find(5);
1940 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1941 intPrevValue = intiter->second;
1944 } else if (intiter->first == 6){
1946 // Deal with post code.
1948 SLiter = SplitLength.find(6);
1950 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1951 intPrevValue = intiter->second;
1953 // Deal with country.
1955 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1963 // Add the data to the General/Home/Work address variables.
1965 CaptureString(&AddressStreet, FALSE);
1966 CaptureString(&AddressLocality, FALSE);
1967 CaptureString(&AddressRegion, FALSE);
1968 CaptureString(&AddressPostalCode, FALSE);
1969 CaptureString(&AddressCountry, FALSE);
1971 if (!PropertyTokens.IsEmpty()){
1973 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1977 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1978 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1979 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1980 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1981 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1985 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1988 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1991 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1995 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1999 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
2001 std::map<int, int> SplitPoints;
2002 std::map<int, int> SplitLength;
2004 int intPrevValue = 7;
2007 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2011 PropertyType PropType = PROPERTY_NONE;
2013 // Look for type before continuing.
2015 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2017 std::map<int, wxString> *EmailList = NULL;
2018 std::map<int, wxString> *EmailListType = NULL;
2019 std::map<int, wxString> *EmailListAltID = NULL;
2020 std::map<int, wxString> *EmailListPID = NULL;
2021 std::map<int, wxString> *EmailListTokens = NULL;
2022 std::map<int, int> *EmailListPref = NULL;
2026 EmailList = &GeneralEmailList;
2027 EmailListType = &GeneralEmailListType;
2028 EmailListAltID = &GeneralEmailListAltID;
2029 EmailListPID = &GeneralEmailListPID;
2030 EmailListTokens = &GeneralEmailListTokens;
2031 EmailListPref = &GeneralEmailListPref;
2034 EmailList = &HomeEmailList;
2035 EmailListType = &HomeEmailListType;
2036 EmailListAltID = &HomeEmailListAltID;
2037 EmailListPID = &HomeEmailListPID;
2038 EmailListTokens = &HomeEmailListTokens;
2039 EmailListPref = &HomeEmailListPref;
2042 EmailList = &BusinessEmailList;
2043 EmailListType = &BusinessEmailListType;
2044 EmailListAltID = &BusinessEmailListAltID;
2045 EmailListPID = &BusinessEmailListPID;
2046 EmailListTokens = &BusinessEmailListTokens;
2047 EmailListPref = &BusinessEmailListPref;
2053 std::map<int,int>::iterator SLiter;
2054 wxString PropertyData;
2055 wxString PropertyName;
2056 wxString PropertyValue;
2057 wxString PropertyTokens;
2058 bool FirstToken = TRUE;
2060 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2061 intiter != SplitPoints.end(); ++intiter){
2063 SLiter = SplitLength.find(intiter->first);
2065 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2067 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2068 PropertyName = PropertyElement.GetNextToken();
2069 PropertyValue = PropertyElement.GetNextToken();
2071 intPrevValue = intiter->second;
2073 CaptureString(&PropertyValue, FALSE);
2075 // Process properties.
2077 if (PropertyName == wxT("ALTID")){
2079 EmailListAltID->erase(*EmailCount);
2080 EmailListAltID->insert(std::make_pair(*EmailCount, PropertyValue));
2082 } else if (PropertyName == wxT("PID")){
2084 EmailListPID->erase(*EmailCount);
2085 EmailListPID->insert(std::make_pair(*EmailCount, PropertyValue));
2087 } else if (PropertyName == wxT("PREF")){
2089 ProcessIntegerValue(EmailListPref, &PropertyValue, EmailCount);
2093 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2095 if (FirstToken == TRUE){
2097 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2102 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2112 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
2114 // Add the name token data.
2116 if (!PropertyTokens.IsEmpty()){
2118 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
2125 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
2127 std::map<int, int> SplitPoints;
2128 std::map<int, int> SplitLength;
2130 int intPrevValue = 6;
2133 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2137 PropertyType PropType = PROPERTY_NONE;
2139 // Look for type before continuing.
2141 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2143 std::map<int, wxString> *IMList = NULL;
2144 std::map<int, wxString> *IMListType = NULL;
2145 std::map<int, wxString> *IMListAltID = NULL;
2146 std::map<int, wxString> *IMListPID = NULL;
2147 std::map<int, wxString> *IMListTokens = NULL;
2148 std::map<int, wxString> *IMListMediatype = NULL;
2149 std::map<int, int> *IMListPref = NULL;
2153 IMList = &GeneralIMList;
2154 IMListType = &GeneralIMListType;
2155 IMListAltID = &GeneralIMListAltID;
2156 IMListPID = &GeneralIMListPID;
2157 IMListTokens = &GeneralIMListTokens;
2158 IMListMediatype = &GeneralIMListMediatype;
2159 IMListPref = &GeneralIMListPref;
2162 IMList = &HomeIMList;
2163 IMListType = &HomeIMListType;
2164 IMListAltID = &HomeIMListAltID;
2165 IMListPID = &HomeIMListPID;
2166 IMListTokens = &HomeIMListTokens;
2167 IMListMediatype = &HomeIMListMediatype;
2168 IMListPref = &HomeIMListPref;
2171 IMList = &BusinessIMList;
2172 IMListType = &BusinessIMListType;
2173 IMListAltID = &BusinessIMListAltID;
2174 IMListPID = &BusinessIMListPID;
2175 IMListTokens = &BusinessIMListTokens;
2176 IMListMediatype = &BusinessIMListMediatype;
2177 IMListPref = &BusinessIMListPref;
2183 std::map<int,int>::iterator SLiter;
2184 wxString PropertyData;
2185 wxString PropertyName;
2186 wxString PropertyValue;
2187 wxString PropertyTokens;
2188 bool FirstToken = TRUE;
2190 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2191 intiter != SplitPoints.end(); ++intiter){
2193 SLiter = SplitLength.find(intiter->first);
2195 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2197 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2198 PropertyName = PropertyElement.GetNextToken();
2199 PropertyValue = PropertyElement.GetNextToken();
2201 intPrevValue = intiter->second;
2203 CaptureString(&PropertyValue, FALSE);
2205 // Process properties.
2207 if (PropertyName == wxT("ALTID")){
2209 IMListAltID->erase(*IMCount);
2210 IMListAltID->insert(std::make_pair(*IMCount, PropertyValue));
2212 } else if (PropertyName == wxT("PID")){
2214 IMListPID->erase(*IMCount);
2215 IMListPID->insert(std::make_pair(*IMCount, PropertyValue));
2217 } else if (PropertyName == wxT("MEDIATYPE")){
2219 IMListMediatype->erase(*IMCount);
2220 IMListMediatype->insert(std::make_pair(*IMCount, PropertyValue));
2222 } else if (PropertyName == wxT("PREF")){
2224 ProcessIntegerValue(IMListPref, &PropertyValue, IMCount);
2228 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2230 if (FirstToken == TRUE){
2232 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2237 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2247 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2249 // Add the name token data.
2251 if (!PropertyTokens.IsEmpty()){
2253 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2259 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2261 std::map<int, int> SplitPoints;
2262 std::map<int, int> SplitLength;
2263 std::map<int, int>::iterator SLiter;
2267 PropertyType PropType = PROPERTY_NONE;
2269 // Look for type before continuing.
2272 wxString TelTypeDetail;
2273 wxString PropertyData;
2274 wxString PropertyName;
2275 wxString PropertyValue;
2276 wxString PropertyTokens;
2278 std::map<int,int> TypeSplitPoints;
2279 std::map<int,int> TypeSplitLength;
2280 std::map<int,int>::iterator TSLiter;
2282 int intSplitSize = 0;
2283 int intSplitsFound = 0;
2284 int intSplitPoint = 0;
2286 int intPrevValue = 5;
2288 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2292 // Look for type before continuing.
2294 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2295 intiter != SplitPoints.end(); ++intiter){
2297 SLiter = SplitLength.find(intiter->first);
2299 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2301 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2302 PropertyName = PropertyElement.GetNextToken();
2303 PropertyValue = PropertyElement.GetNextToken();
2305 intPrevValue = intiter->second;
2307 if (PropertyName == wxT("TYPE")){
2309 // Process each value in type and translate each
2312 // Strip out the quotes if they are there.
2314 size_t intPropertyValueLen = PropertyValue.Len();
2316 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2318 PropertyValue.Trim();
2319 PropertyValue.RemoveLast();
2323 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2325 PropertyValue.Remove(0, 1);
2329 TelTypeDetail = PropertyValue;
2335 for (int i = 0; i <= intPropertyValueLen; i++){
2339 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2341 if (intSplitsFound == 0){
2343 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2344 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2348 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2349 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2362 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2363 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2365 int intTypeSeek = 0;
2367 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2368 typeiter != TypeSplitPoints.end(); ++typeiter){
2370 wxString TypePropertyName;
2372 TSLiter = TypeSplitLength.find(typeiter->first);
2374 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2376 if (intTypeSeek == 0){
2381 TelTypeUI.Append(wxT(","));
2385 if (TypePropertyName == wxT("home")){
2387 PropType = PROPERTY_HOME;
2389 } else if (TypePropertyName == wxT("work")){
2391 PropType = PROPERTY_WORK;
2396 if (TypePropertyName == wxT("text")){
2398 TelTypeUI.Append(_("text"));
2401 } else if (TypePropertyName == wxT("voice")){
2403 TelTypeUI.Append(_("voice"));
2406 } else if (TypePropertyName == wxT("fax")){
2408 TelTypeUI.Append(_("fax"));
2411 } else if (TypePropertyName == wxT("cell")){
2413 TelTypeUI.Append(_("mobile"));
2416 } else if (TypePropertyName == wxT("video")){
2418 TelTypeUI.Append(_("video"));
2421 } else if (TypePropertyName == wxT("pager")){
2423 TelTypeUI.Append(_("pager"));
2426 } else if (TypePropertyName == wxT("textphone")){
2428 TelTypeUI.Append(_("textphone"));
2439 std::map<int, wxString> *TelephoneList = NULL;
2440 std::map<int, wxString> *TelephoneListType = NULL;
2441 std::map<int, wxString> *TelephoneListAltID = NULL;
2442 std::map<int, wxString> *TelephoneListPID = NULL;
2443 std::map<int, wxString> *TelephoneListTokens = NULL;
2444 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2445 std::map<int, int> *TelephoneListPref = NULL;
2449 TelephoneList = &GeneralTelephoneList;
2450 TelephoneListType = &GeneralTelephoneListType;
2451 TelephoneListAltID = &GeneralTelephoneListAltID;
2452 TelephoneListPID = &GeneralTelephoneListPID;
2453 TelephoneListTokens = &GeneralTelephoneListTokens;
2454 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2455 TelephoneListPref = &GeneralTelephoneListPref;
2458 TelephoneList = &HomeTelephoneList;
2459 TelephoneListType = &HomeTelephoneListType;
2460 TelephoneListAltID = &HomeTelephoneListAltID;
2461 TelephoneListPID = &HomeTelephoneListPID;
2462 TelephoneListTokens = &HomeTelephoneListTokens;
2463 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2464 TelephoneListPref = &HomeTelephoneListPref;
2467 TelephoneList = &BusinessTelephoneList;
2468 TelephoneListType = &BusinessTelephoneListType;
2469 TelephoneListAltID = &BusinessTelephoneListAltID;
2470 TelephoneListPID = &BusinessTelephoneListPID;
2471 TelephoneListTokens = &BusinessTelephoneListTokens;
2472 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2473 TelephoneListPref = &BusinessTelephoneListPref;
2477 // Process the properties.
2479 bool FirstToken = TRUE;
2482 SplitPoints.clear();
2483 SplitLength.clear();
2485 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2489 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2490 intiter != SplitPoints.end(); ++intiter){
2492 SLiter = SplitLength.find(intiter->first);
2494 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2496 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2497 PropertyName = PropertyElement.GetNextToken();
2498 PropertyValue = PropertyElement.GetNextToken();
2500 intPrevValue = intiter->second;
2502 CaptureString(&PropertyValue, FALSE);
2504 // Process properties.
2506 if (PropertyName == wxT("ALTID")){
2508 TelephoneListAltID->erase(*TelephoneCount);
2509 TelephoneListAltID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2511 } else if (PropertyName == wxT("PID")){
2513 TelephoneListPID->erase(*TelephoneCount);
2514 TelephoneListPID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2516 } else if (PropertyName == wxT("PREF")){
2518 ProcessIntegerValue(TelephoneListPref, &PropertyValue, TelephoneCount);
2522 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2524 if (FirstToken == TRUE){
2526 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2531 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2541 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2542 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2544 // Add the name token data.
2546 if (!PropertyTokens.IsEmpty()){
2548 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2554 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2556 std::map<int, int> SplitPoints;
2557 std::map<int, int> SplitLength;
2559 int intPrevValue = 6;
2562 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2566 PropertyType PropType = PROPERTY_NONE;
2568 // Look for type before continuing.
2570 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2572 std::map<int, wxString> *LanguageList = NULL;
2573 std::map<int, wxString> *LanguageListType = NULL;
2574 std::map<int, wxString> *LanguageListAltID = NULL;
2575 std::map<int, wxString> *LanguageListPID = NULL;
2576 std::map<int, wxString> *LanguageListTokens = NULL;
2577 std::map<int, int> *LanguageListPref = NULL;
2581 LanguageList = &GeneralLanguageList;
2582 LanguageListType = &GeneralLanguageListType;
2583 LanguageListAltID = &GeneralLanguageListAltID;
2584 LanguageListPID = &GeneralLanguageListPID;
2585 LanguageListTokens = &GeneralLanguageListTokens;
2586 LanguageListPref = &GeneralLanguageListPref;
2589 LanguageList = &HomeLanguageList;
2590 LanguageListType = &HomeLanguageListType;
2591 LanguageListAltID = &HomeLanguageListAltID;
2592 LanguageListPID = &HomeLanguageListPID;
2593 LanguageListTokens = &HomeLanguageListTokens;
2594 LanguageListPref = &HomeLanguageListPref;
2597 LanguageList = &BusinessLanguageList;
2598 LanguageListType = &BusinessLanguageListType;
2599 LanguageListAltID = &BusinessLanguageListAltID;
2600 LanguageListPID = &BusinessLanguageListPID;
2601 LanguageListTokens = &BusinessLanguageListTokens;
2602 LanguageListPref = &BusinessLanguageListPref;
2608 std::map<int,int>::iterator SLiter;
2609 wxString PropertyData;
2610 wxString PropertyName;
2611 wxString PropertyValue;
2612 wxString PropertyTokens;
2613 bool FirstToken = TRUE;
2615 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2616 intiter != SplitPoints.end(); ++intiter){
2618 SLiter = SplitLength.find(intiter->first);
2620 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2622 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2623 PropertyName = PropertyElement.GetNextToken();
2624 PropertyValue = PropertyElement.GetNextToken();
2626 intPrevValue = intiter->second;
2628 CaptureString(&PropertyValue, FALSE);
2630 // Process properties.
2632 if (PropertyName == wxT("ALTID")){
2634 LanguageListAltID->erase(*LanguageCount);
2635 LanguageListAltID->insert(std::make_pair(*LanguageCount, PropertyValue));
2637 } else if (PropertyName == wxT("PID")){
2639 LanguageListPID->erase(*LanguageCount);
2640 LanguageListPID->insert(std::make_pair(*LanguageCount, PropertyValue));
2642 } else if (PropertyName == wxT("PREF")){
2644 ProcessIntegerValue(LanguageListPref, &PropertyValue, LanguageCount);
2648 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2650 if (FirstToken == TRUE){
2652 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2657 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2667 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2669 // Add the name token data.
2671 if (!PropertyTokens.IsEmpty()){
2673 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2679 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2681 std::map<int, int> SplitPoints;
2682 std::map<int, int> SplitLength;
2684 int intPrevValue = 5;
2687 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2691 PropertyType PropType = PROPERTY_NONE;
2693 // Look for type before continuing.
2695 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2697 std::map<int, wxString> *GeopositionList = NULL;
2698 std::map<int, wxString> *GeopositionListType = NULL;
2699 std::map<int, wxString> *GeopositionListAltID = NULL;
2700 std::map<int, wxString> *GeopositionListPID = NULL;
2701 std::map<int, wxString> *GeopositionListTokens = NULL;
2702 std::map<int, wxString> *GeopositionListMediatype = NULL;
2703 std::map<int, int> *GeopositionListPref = NULL;
2707 GeopositionList = &GeneralGeographyList;
2708 GeopositionListType = &GeneralGeographyListType;
2709 GeopositionListAltID = &GeneralGeographyListAltID;
2710 GeopositionListPID = &GeneralGeographyListPID;
2711 GeopositionListTokens = &GeneralGeographyListTokens;
2712 GeopositionListMediatype = &GeneralGeographyListMediatype;
2713 GeopositionListPref = &GeneralGeographyListPref;
2716 GeopositionList = &HomeGeographyList;
2717 GeopositionListType = &HomeGeographyListType;
2718 GeopositionListAltID = &HomeGeographyListAltID;
2719 GeopositionListPID = &HomeGeographyListPID;
2720 GeopositionListTokens = &HomeGeographyListTokens;
2721 GeopositionListMediatype = &HomeGeographyListMediatype;
2722 GeopositionListPref = &HomeGeographyListPref;
2725 GeopositionList = &BusinessGeographyList;
2726 GeopositionListType = &BusinessGeographyListType;
2727 GeopositionListAltID = &BusinessGeographyListAltID;
2728 GeopositionListPID = &BusinessGeographyListPID;
2729 GeopositionListTokens = &BusinessGeographyListTokens;
2730 GeopositionListMediatype = &BusinessGeographyListMediatype;
2731 GeopositionListPref = &BusinessGeographyListPref;
2737 std::map<int,int>::iterator SLiter;
2738 wxString PropertyData;
2739 wxString PropertyName;
2740 wxString PropertyValue;
2741 wxString PropertyTokens;
2742 bool FirstToken = TRUE;
2744 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2745 intiter != SplitPoints.end(); ++intiter){
2747 SLiter = SplitLength.find(intiter->first);
2749 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2751 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2752 PropertyName = PropertyElement.GetNextToken();
2753 PropertyValue = PropertyElement.GetNextToken();
2755 intPrevValue = intiter->second;
2757 CaptureString(&PropertyValue, FALSE);
2759 // Process properties.
2761 if (PropertyName == wxT("ALTID")){
2763 GeopositionListAltID->erase(*GeographicCount);
2764 GeopositionListAltID->insert(std::make_pair(*GeographicCount, PropertyValue));
2766 } else if (PropertyName == wxT("PID")){
2768 GeopositionListPID->erase(*GeographicCount);
2769 GeopositionListPID->insert(std::make_pair(*GeographicCount, PropertyValue));
2771 } else if (PropertyName == wxT("MEDIATYPE")){
2773 GeopositionListMediatype->erase(*GeographicCount);
2774 GeopositionListMediatype->insert(std::make_pair(*GeographicCount, PropertyValue));
2776 } else if (PropertyName == wxT("PREF")){
2778 ProcessIntegerValue(GeopositionListPref, &PropertyValue, GeographicCount);
2782 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2784 if (FirstToken == TRUE){
2786 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2791 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2801 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2803 // Add the name token data.
2805 if (!PropertyTokens.IsEmpty()){
2807 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2813 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2815 size_t intPropertyLen = PropertySeg1.Len();
2816 std::map<int, int> SplitPoints;
2817 std::map<int, int> SplitLength;
2818 std::map<int, int>::iterator SLiter;
2819 wxString PropertyData;
2820 wxString PropertyName;
2821 wxString PropertyValue;
2822 wxString PropertyTokens;
2823 wxString RelatedType;
2824 wxString RelatedTypeOriginal;
2825 wxString RelatedName;
2826 bool FirstToken = TRUE;
2827 int intSplitsFound = 0;
2828 int intSplitSize = 0;
2829 int intPrevValue = 9;
2833 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2837 // Look for type before continuing.
2839 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2840 intiter != SplitPoints.end(); ++intiter){
2842 SLiter = SplitLength.find(intiter->first);
2844 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2846 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2847 PropertyName = PropertyElement.GetNextToken();
2848 PropertyValue = PropertyElement.GetNextToken();
2850 intPrevValue = intiter->second;
2854 RelatedTypeOriginal = PropertyValue;
2856 if (PropertyName == wxT("TYPE")){
2858 if (PropertyValue == wxT("contact")){
2860 RelatedType = _("Contact");
2862 } else if (PropertyValue == wxT("acquaintance")){
2864 RelatedType = _("Acquaintance");
2866 } else if (PropertyValue == wxT("friend")){
2868 RelatedType = _("Friend");
2870 } else if (PropertyValue == wxT("met")){
2872 RelatedType = _("Met");
2874 } else if (PropertyValue == wxT("co-worker")){
2876 RelatedType = _("Co-worker");
2878 } else if (PropertyValue == wxT("colleague")){
2880 RelatedType = _("Colleague");
2882 } else if (PropertyValue == wxT("co-resident")){
2884 RelatedType = _("Co-resident");
2886 } else if (PropertyValue == wxT("neighbor")){
2888 RelatedType = _("Neighbour");
2890 } else if (PropertyValue == wxT("child")){
2892 RelatedType = _("Child");
2894 } else if (PropertyValue == wxT("parent")){
2896 RelatedType = _("Parent");
2898 } else if (PropertyValue == wxT("sibling")){
2900 RelatedType = _("Sibling");
2902 } else if (PropertyValue == wxT("spouse")){
2904 RelatedType = _("Spouse");
2906 } else if (PropertyValue == wxT("kin")){
2908 RelatedType = _("Kin");
2910 } else if (PropertyValue == wxT("muse")){
2912 RelatedType = _("Muse");
2914 } else if (PropertyValue == wxT("crush")){
2916 RelatedType = _("Crush");
2918 } else if (PropertyValue == wxT("date")){
2920 RelatedType = _("Date");
2922 } else if (PropertyValue == wxT("sweetheart")){
2924 RelatedType = _("Sweetheart");
2926 } else if (PropertyValue == wxT("me")){
2928 RelatedType = _("Me");
2930 } else if (PropertyValue == wxT("agent")){
2932 RelatedType = _("Agent");
2934 } else if (PropertyValue == wxT("emergency")){
2936 RelatedType = _("Emergency");
2940 RelatedType = PropertyValue;
2950 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2951 intiter != SplitPoints.end(); ++intiter){
2953 SLiter = SplitLength.find(intiter->first);
2955 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2957 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2958 PropertyName = PropertyElement.GetNextToken();
2959 PropertyValue = PropertyElement.GetNextToken();
2961 intPrevValue = intiter->second;
2963 // Process properties.
2965 size_t intPropertyValueLen = PropertyValue.Len();
2967 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2969 PropertyValue.Trim();
2970 PropertyValue.RemoveLast();
2974 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2976 PropertyValue.Remove(0, 1);
2980 CaptureString(&PropertyValue, FALSE);
2982 if (PropertyName == wxT("ALTID")){
2984 GeneralRelatedListAltID.erase(*RelatedCount);
2985 GeneralRelatedListAltID.insert(std::make_pair(*RelatedCount, PropertyValue));
2987 } else if (PropertyName == wxT("PID")){
2989 GeneralRelatedListPID.erase(*RelatedCount);
2990 GeneralRelatedListPID.insert(std::make_pair(*RelatedCount, PropertyValue));
2992 } else if (PropertyName == wxT("PREF")){
2994 int PriorityNumber = 0;
2995 bool ValidNumber = TRUE;
2998 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3001 catch(std::invalid_argument &e){
3002 ValidNumber = FALSE;
3005 if (ValidNumber == TRUE){
3007 GeneralRelatedListPref.erase(*RelatedCount);
3008 GeneralRelatedListPref.insert(std::make_pair(*RelatedCount, PriorityNumber));
3012 } else if (PropertyName == wxT("LANGUAGE")){
3014 ProcessIntegerValue(&GeneralRelatedListPref, &PropertyValue, RelatedCount);
3016 } else if (PropertyName != wxT("TYPE")) {
3018 // Something else we don't know about so append
3019 // to the tokens variable.
3021 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3023 if (FirstToken == TRUE){
3025 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3030 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3040 // Add the data to the General/Home/Work address variables.
3042 GeneralRelatedList.erase(*RelatedCount);
3043 GeneralRelatedListRelType.erase(*RelatedCount);
3044 GeneralRelatedListType.erase(*RelatedCount);
3045 GeneralRelatedListTokens.erase(*RelatedCount);
3046 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
3047 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
3048 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
3049 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
3053 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
3055 std::map<int, int> SplitPoints;
3056 std::map<int, int> SplitLength;
3057 std::map<int, int>::iterator SLiter;
3058 wxString PropertyData;
3059 wxString PropertyName;
3060 wxString PropertyValue;
3061 wxString PropertyTokens;
3062 bool FirstToken = TRUE;
3063 int intPrevValue = 5;
3068 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3072 PropertyType PropType = PROPERTY_NONE;
3074 // Look for type before continuing.
3076 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3078 // Setup the pointers.
3080 std::map<int, wxString> *WebsiteList = NULL;
3081 std::map<int, wxString> *WebsiteListAltID = NULL;
3082 std::map<int, wxString> *WebsiteListPID = NULL;
3083 std::map<int, wxString> *WebsiteListType = NULL;
3084 std::map<int, wxString> *WebsiteListTokens = NULL;
3085 std::map<int, wxString> *WebsiteListMediatype = NULL;
3086 std::map<int, int> *WebsiteListPref = NULL;
3088 // Setup blank lines for later on.
3092 WebsiteList = &GeneralWebsiteList;
3093 WebsiteListType = &GeneralWebsiteListType;
3094 WebsiteListAltID = &GeneralWebsiteListAltID;
3095 WebsiteListPID = &GeneralWebsiteListPID;
3096 WebsiteListTokens = &GeneralWebsiteListTokens;
3097 WebsiteListMediatype = &GeneralWebsiteListMediatype;
3098 WebsiteListPref = &GeneralWebsiteListPref;
3101 WebsiteList = &HomeWebsiteList;
3102 WebsiteListType = &HomeWebsiteListType;
3103 WebsiteListAltID = &HomeWebsiteListAltID;
3104 WebsiteListPID = &HomeWebsiteListPID;
3105 WebsiteListTokens = &HomeWebsiteListTokens;
3106 WebsiteListMediatype = &HomeWebsiteListMediatype;
3107 WebsiteListPref = &HomeWebsiteListPref;
3110 WebsiteList = &BusinessWebsiteList;
3111 WebsiteListType = &BusinessWebsiteListType;
3112 WebsiteListAltID = &BusinessWebsiteListAltID;
3113 WebsiteListPID = &BusinessWebsiteListPID;
3114 WebsiteListTokens = &BusinessWebsiteListTokens;
3115 WebsiteListMediatype = &BusinessWebsiteListMediatype;
3116 WebsiteListPref = &BusinessWebsiteListPref;
3122 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3123 intiter != SplitPoints.end(); ++intiter){
3125 SLiter = SplitLength.find(intiter->first);
3127 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3129 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3130 PropertyName = PropertyElement.GetNextToken();
3131 PropertyValue = PropertyElement.GetNextToken();
3133 intPrevValue = intiter->second;
3135 // Process properties.
3137 size_t intPropertyValueLen = PropertyValue.Len();
3139 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3141 PropertyValue.Trim();
3142 PropertyValue.RemoveLast();
3146 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3148 PropertyValue.Remove(0, 1);
3152 CaptureString(&PropertyValue, FALSE);
3154 if (PropertyName == wxT("ALTID")){
3156 WebsiteListAltID->erase(*URLCount);
3157 WebsiteListAltID->insert(std::make_pair(*URLCount, PropertyValue));
3159 } else if (PropertyName == wxT("PID")){
3161 WebsiteListPID->erase(*URLCount);
3162 WebsiteListPID->insert(std::make_pair(*URLCount, PropertyValue));
3164 } else if (PropertyName == wxT("PREF")){
3166 ProcessIntegerValue(WebsiteListPref, &PropertyValue, URLCount);
3168 } else if (PropertyName == wxT("MEDIATYPE")){
3170 WebsiteListMediatype->erase(*URLCount);
3171 WebsiteListMediatype->insert(std::make_pair(*URLCount, PropertyValue));
3175 // Something else we don't know about so append
3176 // to the tokens variable.
3178 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3180 if (FirstToken == TRUE){
3182 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3187 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3197 // Add the data to the General/Home/Work address variables.
3199 CaptureString(&PropertySeg2, FALSE);
3201 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3203 if (!PropertyTokens.IsEmpty()){
3205 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3211 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3213 std::map<int, int> SplitPoints;
3214 std::map<int, int> SplitLength;
3215 std::map<int, int>::iterator SLiter;
3216 wxString PropertyData;
3217 wxString PropertyName;
3218 wxString PropertyValue;
3219 wxString PropertyTokens;
3220 bool FirstToken = TRUE;
3221 int intPrevValue = 7;
3226 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3230 PropertyType PropType = PROPERTY_NONE;
3232 // Look for type before continuing.
3234 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3236 // Setup the pointers.
3238 std::map<int, wxString> *TitleList = NULL;
3239 std::map<int, wxString> *TitleListAltID = NULL;
3240 std::map<int, wxString> *TitleListPID = NULL;
3241 std::map<int, wxString> *TitleListType = NULL;
3242 std::map<int, wxString> *TitleListTokens = NULL;
3243 std::map<int, wxString> *TitleListLanguage = NULL;
3244 std::map<int, int> *TitleListPref = NULL;
3246 // Setup blank lines for later on.
3250 TitleList = &GeneralTitleList;
3251 TitleListType = &GeneralTitleListType;
3252 TitleListAltID = &GeneralTitleListAltID;
3253 TitleListPID = &GeneralTitleListPID;
3254 TitleListTokens = &GeneralTitleListTokens;
3255 TitleListLanguage = &GeneralTitleListLanguage;
3256 TitleListPref = &GeneralTitleListPref;
3259 TitleList = &HomeTitleList;
3260 TitleListType = &HomeTitleListType;
3261 TitleListAltID = &HomeTitleListAltID;
3262 TitleListPID = &HomeTitleListPID;
3263 TitleListTokens = &HomeTitleListTokens;
3264 TitleListLanguage = &HomeTitleListLanguage;
3265 TitleListPref = &HomeTitleListPref;
3268 TitleList = &BusinessTitleList;
3269 TitleListType = &BusinessTitleListType;
3270 TitleListAltID = &BusinessTitleListAltID;
3271 TitleListPID = &BusinessTitleListPID;
3272 TitleListTokens = &BusinessTitleListTokens;
3273 TitleListLanguage = &BusinessTitleListLanguage;
3274 TitleListPref = &BusinessTitleListPref;
3280 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3281 intiter != SplitPoints.end(); ++intiter){
3283 SLiter = SplitLength.find(intiter->first);
3285 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3287 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3288 PropertyName = PropertyElement.GetNextToken();
3289 PropertyValue = PropertyElement.GetNextToken();
3291 intPrevValue = intiter->second;
3293 // Process properties.
3295 size_t intPropertyValueLen = PropertyValue.Len();
3297 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3299 PropertyValue.Trim();
3300 PropertyValue.RemoveLast();
3304 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3306 PropertyValue.Remove(0, 1);
3310 CaptureString(&PropertyValue, FALSE);
3312 if (PropertyName == wxT("ALTID")){
3314 TitleListAltID->erase(*TitleCount);
3315 TitleListAltID->insert(std::make_pair(*TitleCount, PropertyValue));
3317 } else if (PropertyName == wxT("PID")){
3319 TitleListPID->erase(*TitleCount);
3320 TitleListPID->insert(std::make_pair(*TitleCount, PropertyValue));
3322 } else if (PropertyName == wxT("PREF")){
3324 ProcessIntegerValue(TitleListPref, &PropertyValue, TitleCount);
3326 } else if (PropertyName == wxT("LANGUAGE")){
3328 TitleListLanguage->erase(*TitleCount);
3329 TitleListLanguage->insert(std::make_pair(*TitleCount, PropertyValue));
3333 // Something else we don't know about so append
3334 // to the tokens variable.
3336 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3338 if (FirstToken == TRUE){
3340 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3345 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3355 // Add the data to the General/Home/Work address variables.
3357 CaptureString(&PropertySeg2, FALSE);
3359 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3361 if (!PropertyTokens.IsEmpty()){
3363 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3369 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3371 std::map<int, int> SplitPoints;
3372 std::map<int, int> SplitLength;
3373 std::map<int, int>::iterator SLiter;
3374 wxString PropertyData;
3375 wxString PropertyName;
3376 wxString PropertyValue;
3377 wxString PropertyTokens;
3378 bool FirstToken = TRUE;
3379 int intPrevValue = 6;
3384 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3388 PropertyType PropType = PROPERTY_NONE;
3390 // Look for type before continuing.
3392 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3394 // Setup the pointers.
3396 std::map<int, wxString> *RoleList = NULL;
3397 std::map<int, wxString> *RoleListAltID = NULL;
3398 std::map<int, wxString> *RoleListPID = NULL;
3399 std::map<int, wxString> *RoleListType = NULL;
3400 std::map<int, wxString> *RoleListTokens = NULL;
3401 std::map<int, wxString> *RoleListLanguage = NULL;
3402 std::map<int, int> *RoleListPref = NULL;
3404 // Setup blank lines for later on.
3408 RoleList = &GeneralRoleList;
3409 RoleListType = &GeneralRoleListType;
3410 RoleListAltID = &GeneralRoleListAltID;
3411 RoleListPID = &GeneralRoleListPID;
3412 RoleListTokens = &GeneralRoleListTokens;
3413 RoleListLanguage = &GeneralRoleListLanguage;
3414 RoleListPref = &GeneralRoleListPref;
3417 RoleList = &HomeRoleList;
3418 RoleListType = &HomeRoleListType;
3419 RoleListAltID = &HomeRoleListAltID;
3420 RoleListPID = &HomeRoleListPID;
3421 RoleListTokens = &HomeRoleListTokens;
3422 RoleListLanguage = &HomeRoleListLanguage;
3423 RoleListPref = &HomeRoleListPref;
3426 RoleList = &BusinessRoleList;
3427 RoleListType = &BusinessRoleListType;
3428 RoleListAltID = &BusinessRoleListAltID;
3429 RoleListPID = &BusinessRoleListPID;
3430 RoleListTokens = &BusinessRoleListTokens;
3431 RoleListLanguage = &BusinessRoleListLanguage;
3432 RoleListPref = &BusinessRoleListPref;
3438 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3439 intiter != SplitPoints.end(); ++intiter){
3441 SLiter = SplitLength.find(intiter->first);
3443 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3445 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3446 PropertyName = PropertyElement.GetNextToken();
3447 PropertyValue = PropertyElement.GetNextToken();
3449 intPrevValue = intiter->second;
3451 // Process properties.
3453 size_t intPropertyValueLen = PropertyValue.Len();
3455 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3457 PropertyValue.Trim();
3458 PropertyValue.RemoveLast();
3462 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3464 PropertyValue.Remove(0, 1);
3468 CaptureString(&PropertyValue, FALSE);
3470 if (PropertyName == wxT("ALTID")){
3472 RoleListAltID->erase(*RoleCount);
3473 RoleListAltID->insert(std::make_pair(*RoleCount, PropertyValue));
3475 } else if (PropertyName == wxT("PID")){
3477 RoleListPID->erase(*RoleCount);
3478 RoleListPID->insert(std::make_pair(*RoleCount, PropertyValue));
3480 } else if (PropertyName == wxT("PREF")){
3482 ProcessIntegerValue(RoleListPref, &PropertyValue, RoleCount);
3484 } else if (PropertyName == wxT("LANGUAGE")){
3486 RoleListLanguage->erase(*RoleCount);
3487 RoleListLanguage->insert(std::make_pair(*RoleCount, PropertyValue));
3491 // Something else we don't know about so append
3492 // to the tokens variable.
3494 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3496 if (FirstToken == TRUE){
3498 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3503 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3513 // Add the data to the General/Home/Work address variables.
3515 CaptureString(&PropertySeg2, FALSE);
3517 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3519 if (!PropertyTokens.IsEmpty()){
3521 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3527 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3529 std::map<int, int> SplitPoints;
3530 std::map<int, int> SplitLength;
3531 std::map<int, int>::iterator SLiter;
3532 wxString PropertyData;
3533 wxString PropertyName;
3534 wxString PropertyValue;
3535 wxString PropertyTokens;
3536 bool FirstToken = TRUE;
3537 int intPrevValue = 5;
3542 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3546 PropertyType PropType = PROPERTY_NONE;
3548 // Look for type before continuing.
3550 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3552 // Setup the pointers.
3554 std::map<int, wxString> *OrganisationsList = NULL;
3555 std::map<int, wxString> *OrganisationsListAltID = NULL;
3556 std::map<int, wxString> *OrganisationsListPID = NULL;
3557 std::map<int, wxString> *OrganisationsListType = NULL;
3558 std::map<int, wxString> *OrganisationsListTokens = NULL;
3559 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3560 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3561 std::map<int, int> *OrganisationsListPref = NULL;
3563 // Setup blank lines for later on.
3567 OrganisationsList = &GeneralOrganisationsList;
3568 OrganisationsListType = &GeneralOrganisationsListType;
3569 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3570 OrganisationsListPID = &GeneralOrganisationsListPID;
3571 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3572 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3573 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3574 OrganisationsListPref = &GeneralOrganisationsListPref;
3577 OrganisationsList = &HomeOrganisationsList;
3578 OrganisationsListType = &HomeOrganisationsListType;
3579 OrganisationsListAltID = &HomeOrganisationsListAltID;
3580 OrganisationsListPID = &HomeOrganisationsListPID;
3581 OrganisationsListTokens = &HomeOrganisationsListTokens;
3582 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3583 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3584 OrganisationsListPref = &HomeOrganisationsListPref;
3587 OrganisationsList = &BusinessOrganisationsList;
3588 OrganisationsListType = &BusinessOrganisationsListType;
3589 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3590 OrganisationsListPID = &BusinessOrganisationsListPID;
3591 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3592 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3593 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3594 OrganisationsListPref = &BusinessOrganisationsListPref;
3600 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3601 intiter != SplitPoints.end(); ++intiter){
3603 SLiter = SplitLength.find(intiter->first);
3605 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3607 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3608 PropertyName = PropertyElement.GetNextToken();
3609 PropertyValue = PropertyElement.GetNextToken();
3611 intPrevValue = intiter->second;
3613 // Process properties.
3615 size_t intPropertyValueLen = PropertyValue.Len();
3617 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3619 PropertyValue.Trim();
3620 PropertyValue.RemoveLast();
3624 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3626 PropertyValue.Remove(0, 1);
3630 CaptureString(&PropertyValue, FALSE);
3632 if (PropertyName == wxT("ALTID")){
3634 OrganisationsListAltID->erase(*OrganisationCount);
3635 OrganisationsListAltID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3637 } else if (PropertyName == wxT("PID")){
3639 OrganisationsListPID->erase(*OrganisationCount);
3640 OrganisationsListPID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3642 } else if (PropertyName == wxT("SORT-AS")){
3644 OrganisationsListSortAs->erase(*OrganisationCount);
3645 OrganisationsListSortAs->insert(std::make_pair(*OrganisationCount, PropertyValue));
3647 } else if (PropertyName == wxT("PREF")){
3649 ProcessIntegerValue(OrganisationsListPref, &PropertyValue, OrganisationCount);
3651 } else if (PropertyName == wxT("LANGUAGE")){
3653 OrganisationsListLanguage->erase(*OrganisationCount);
3654 OrganisationsListLanguage->insert(std::make_pair(*OrganisationCount, PropertyValue));
3658 // Something else we don't know about so append
3659 // to the tokens variable.
3661 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3663 if (FirstToken == TRUE){
3665 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3670 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3680 // Add the data to the General/Home/Work address variables.
3682 CaptureString(&PropertySeg2, FALSE);
3684 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3686 if (!PropertyTokens.IsEmpty()){
3688 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3694 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3696 std::map<int, int> SplitPoints;
3697 std::map<int, int> SplitLength;
3698 std::map<int, int>::iterator SLiter;
3699 wxString PropertyData;
3700 wxString PropertyName;
3701 wxString PropertyValue;
3702 wxString PropertyTokens;
3703 bool FirstToken = TRUE;
3704 int intPrevValue = 6;
3709 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3713 PropertyType PropType = PROPERTY_NONE;
3715 // Look for type before continuing.
3717 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3719 // Setup the pointers.
3721 std::map<int, wxString> *NoteList = NULL;
3722 std::map<int, wxString> *NoteListAltID = NULL;
3723 std::map<int, wxString> *NoteListPID = NULL;
3724 std::map<int, wxString> *NoteListType = NULL;
3725 std::map<int, wxString> *NoteListTokens = NULL;
3726 std::map<int, wxString> *NoteListLanguage = NULL;
3727 std::map<int, int> *NoteListPref = NULL;
3729 // Setup blank lines for later on.
3733 NoteList = &GeneralNoteList;
3734 NoteListType = &GeneralNoteListType;
3735 NoteListAltID = &GeneralNoteListAltID;
3736 NoteListPID = &GeneralNoteListPID;
3737 NoteListTokens = &GeneralNoteListTokens;
3738 NoteListLanguage = &GeneralNoteListLanguage;
3739 NoteListPref = &GeneralNoteListPref;
3742 NoteList = &HomeNoteList;
3743 NoteListType = &HomeNoteListType;
3744 NoteListAltID = &HomeNoteListAltID;
3745 NoteListPID = &HomeNoteListPID;
3746 NoteListTokens = &HomeNoteListTokens;
3747 NoteListLanguage = &HomeNoteListLanguage;
3748 NoteListPref = &HomeNoteListPref;
3751 NoteList = &BusinessNoteList;
3752 NoteListType = &BusinessNoteListType;
3753 NoteListAltID = &BusinessNoteListAltID;
3754 NoteListPID = &BusinessNoteListPID;
3755 NoteListTokens = &BusinessNoteListTokens;
3756 NoteListLanguage = &BusinessNoteListLanguage;
3757 NoteListPref = &BusinessNoteListPref;
3763 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3764 intiter != SplitPoints.end(); ++intiter){
3766 SLiter = SplitLength.find(intiter->first);
3768 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3770 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3771 PropertyName = PropertyElement.GetNextToken();
3772 PropertyValue = PropertyElement.GetNextToken();
3774 intPrevValue = intiter->second;
3776 // Process properties.
3778 size_t intPropertyValueLen = PropertyValue.Len();
3780 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3782 PropertyValue.Trim();
3783 PropertyValue.RemoveLast();
3787 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3789 PropertyValue.Remove(0, 1);
3793 CaptureString(&PropertyValue, FALSE);
3795 if (PropertyName == wxT("ALTID")){
3797 NoteListAltID->erase(*NoteCount);
3798 NoteListAltID->insert(std::make_pair(*NoteCount, PropertyValue));
3800 } else if (PropertyName == wxT("PID")){
3802 NoteListPID->erase(*NoteCount);
3803 NoteListPID->insert(std::make_pair(*NoteCount, PropertyValue));
3805 } else if (PropertyName == wxT("PREF")){
3807 ProcessIntegerValue(NoteListPref, &PropertyValue, NoteCount);
3809 } else if (PropertyName == wxT("LANGUAGE")){
3811 NoteListLanguage->erase(*NoteCount);
3812 NoteListLanguage->insert(std::make_pair(*NoteCount, PropertyValue));
3816 // Something else we don't know about so append
3817 // to the tokens variable.
3819 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3821 if (FirstToken == TRUE){
3823 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3828 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3838 // Add the data to the General/Home/Work address variables.
3840 CaptureString(&PropertySeg2, FALSE);
3842 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3844 if (!PropertyTokens.IsEmpty()){
3846 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3852 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3854 std::map<int, int> SplitPoints;
3855 std::map<int, int> SplitLength;
3856 std::map<int, int>::iterator SLiter;
3857 wxString PropertyData;
3858 wxString PropertyName;
3859 wxString PropertyValue;
3860 wxString PropertyTokens;
3861 bool FirstToken = TRUE;
3862 int intPrevValue = 12;
3867 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3871 PropertyType PropType = PROPERTY_NONE;
3873 // Look for type before continuing.
3875 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3877 // Setup blank lines for later on.
3883 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3886 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3892 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3893 intiter != SplitPoints.end(); ++intiter){
3895 SLiter = SplitLength.find(intiter->first);
3897 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3899 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3900 PropertyName = PropertyElement.GetNextToken();
3901 PropertyValue = PropertyElement.GetNextToken();
3903 intPrevValue = intiter->second;
3905 // Process properties.
3907 size_t intPropertyValueLen = PropertyValue.Len();
3909 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3911 PropertyValue.Trim();
3912 PropertyValue.RemoveLast();
3916 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3918 PropertyValue.Remove(0, 1);
3922 CaptureString(&PropertyValue, FALSE);
3924 if (PropertyName == wxT("ALTID")){
3926 CategoriesListAltID.erase(*CategoryCount);
3927 CategoriesListAltID.insert(std::make_pair(*CategoryCount, PropertyValue));
3929 } else if (PropertyName == wxT("PID")){
3931 CategoriesListPID.erase(*CategoryCount);
3932 CategoriesListPID.insert(std::make_pair(*CategoryCount, PropertyValue));
3934 } else if (PropertyName == wxT("PREF")){
3936 ProcessIntegerValue(&CategoriesListPref, &PropertyValue, CategoryCount);
3938 } else if (PropertyName == wxT("LANGUAGE")){
3940 CategoriesListLanguage.erase(*CategoryCount);
3941 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, PropertyValue));
3945 // Something else we don't know about so append
3946 // to the tokens variable.
3948 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3950 if (FirstToken == TRUE){
3952 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3957 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3967 // Deal with multiple categories.
3969 int intOrigCatCount = *CategoryCount;
3970 bool FirstCategoryProcessed = TRUE;
3971 bool AfterFirstToken = FALSE;
3972 int intSplitSize = 0;
3973 int intSplitsFound = 0;
3974 int intSplitSeek = 0;
3975 int intPropertyLen = PropertySeg2.Len();
3977 SplitPoints.clear();
3978 SplitLength.clear();
3981 for (int i = 0; i <= intPropertyLen; i++){
3983 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3991 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3993 if (AfterFirstToken == TRUE){
3995 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3996 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
4000 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
4001 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
4002 AfterFirstToken = TRUE;
4014 if (SplitPoints.size() > 0){
4016 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
4017 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
4021 if (SplitPoints.size() == 0){
4023 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
4025 if (!PropertyTokens.IsEmpty()){
4027 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4033 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4034 intiter != SplitPoints.end(); ++intiter){
4036 SLiter = SplitLength.find(intiter->first);
4038 intPrevValue = intiter->second;
4040 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
4042 // Add the data to the General/Home/Work address variables.
4044 // Trim any whitespace from the start and end.
4046 PropertyData = PropertyData.Trim(FALSE);
4047 PropertyData = PropertyData.Trim(TRUE);
4049 CaptureString(&PropertyData, FALSE);
4051 if (FirstCategoryProcessed == TRUE){
4053 FirstCategoryProcessed = FALSE;
4055 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4057 if (!PropertyTokens.IsEmpty()){
4059 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4069 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4071 if (!PropertyTokens.IsEmpty()){
4073 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4079 // Copy the properties to each of the categories (if it exists).
4081 if (!PropertyTokens.IsEmpty()){
4083 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
4087 // Check if ALTID was used.
4089 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
4091 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
4095 // Check if PID was used.
4097 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
4099 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
4103 // Check if PREF was used.
4105 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
4107 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
4111 // Check if LANGUAGE was used.
4113 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
4115 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
4119 // Check if TYPE was used.
4125 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
4128 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
4136 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
4138 size_t intPropertyLen = PropertySeg1.Len();
4139 std::map<int, int> SplitPoints;
4140 std::map<int, int> SplitLength;
4141 std::map<int, int>::iterator SLiter;
4142 wxString PropertyData;
4143 wxString PropertyName;
4144 wxString PropertyValue;
4145 wxString PropertyTokens;
4146 bool FirstToken = TRUE;
4147 int intSplitsFound = 0;
4148 int intSplitSize = 0;
4149 int intPrevValue = 7;
4153 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4157 PropertyType PropType = PROPERTY_NONE;
4159 // Look for type before continuing.
4161 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4165 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4166 intiter != SplitPoints.end(); ++intiter){
4168 SLiter = SplitLength.find(intiter->first);
4170 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4172 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4173 PropertyName = PropertyElement.GetNextToken();
4174 PropertyValue = PropertyElement.GetNextToken();
4176 intPrevValue = intiter->second;
4178 // Process properties.
4180 size_t intPropertyValueLen = PropertyValue.Len();
4182 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4184 PropertyValue.Trim();
4185 PropertyValue.RemoveLast();
4189 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4191 PropertyValue.Remove(0, 1);
4195 CaptureString(&PropertyValue, FALSE);
4197 if (PropertyName == wxT("ALTID")){
4199 PicturesListAltID.erase(*PhotoCount);
4200 PicturesListAltID.insert(std::make_pair(*PhotoCount, PropertyValue));
4202 } else if (PropertyName == wxT("PID")){
4204 PicturesListPID.erase(*PhotoCount);
4205 PicturesListPID.insert(std::make_pair(*PhotoCount, PropertyValue));
4207 } else if (PropertyName == wxT("PREF")){
4209 ProcessIntegerValue(&PicturesListPref, &PropertyValue, PhotoCount);
4211 } else if (PropertyName == wxT("MEDIATYPE")){
4213 PicturesListMediatype.erase(*PhotoCount);
4214 PicturesListMediatype.insert(std::make_pair(*PhotoCount, PropertyValue));
4218 // Something else we don't know about so append
4219 // to the tokens variable.
4221 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4223 if (FirstToken == TRUE){
4225 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4230 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4240 intPropertyLen = PropertySeg2.Len();
4241 SplitPoints.clear();
4242 SplitLength.clear();
4247 CaptureString(&PropertySeg2, FALSE);
4249 for (int i = 0; i <= intPropertyLen; i++){
4253 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4256 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4258 if (intSplitsFound == 6){
4260 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4265 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4275 wxString wxSPhotoURI;
4276 wxString wxSPhotoMIME;
4277 wxString wxSPhotoEncoding;
4278 wxString wxSPhotoData;
4279 std::string base64enc;
4281 if (intSplitsFound == 0){
4285 std::map<int, int>::iterator striter;
4287 striter = SplitLength.find(1);
4289 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4291 while (wSTDataType.HasMoreTokens() == TRUE){
4293 wxSPhotoURI = wSTDataType.GetNextToken();
4294 wxSPhotoMIME = wSTDataType.GetNextToken();
4299 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4301 while (wSTDataInfo.HasMoreTokens() == TRUE){
4303 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4304 wxSPhotoData = wSTDataInfo.GetNextToken();
4305 base64enc = wxSPhotoData.mb_str();
4312 // Add the data to the General/Home/Work address variables.
4314 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4315 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4316 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4322 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4325 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4329 if (!PropertyTokens.IsEmpty()){
4331 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4337 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4339 size_t intPropertyLen = PropertySeg1.Len();
4340 std::map<int, int> SplitPoints;
4341 std::map<int, int> SplitLength;
4342 std::map<int, int>::iterator SLiter;
4343 wxString PropertyData;
4344 wxString PropertyName;
4345 wxString PropertyValue;
4346 wxString PropertyTokens;
4347 bool FirstToken = TRUE;
4348 int intSplitsFound = 0;
4349 int intSplitSize = 0;
4350 int intPrevValue = 6;
4354 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4358 PropertyType PropType = PROPERTY_NONE;
4360 // Look for type before continuing.
4362 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4366 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4367 intiter != SplitPoints.end(); ++intiter){
4369 SLiter = SplitLength.find(intiter->first);
4371 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4373 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4374 PropertyName = PropertyElement.GetNextToken();
4375 PropertyValue = PropertyElement.GetNextToken();
4377 intPrevValue = intiter->second;
4379 // Process properties.
4381 size_t intPropertyValueLen = PropertyValue.Len();
4383 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4385 PropertyValue.Trim();
4386 PropertyValue.RemoveLast();
4390 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4392 PropertyValue.Remove(0, 1);
4396 CaptureString(&PropertyValue, FALSE);
4398 if (PropertyName == wxT("ALTID")){
4400 LogosListAltID.erase(*LogoCount);
4401 LogosListAltID.insert(std::make_pair(*LogoCount, PropertyValue));
4403 } else if (PropertyName == wxT("PID")){
4405 LogosListPID.erase(*LogoCount);
4406 LogosListPID.insert(std::make_pair(*LogoCount, PropertyValue));
4408 } else if (PropertyName == wxT("PREF")){
4410 ProcessIntegerValue(&LogosListPref, &PropertyValue, LogoCount);
4412 } else if (PropertyName == wxT("MEDIATYPE")){
4414 LogosListMediatype.erase(*LogoCount);
4415 LogosListMediatype.insert(std::make_pair(*LogoCount, PropertyValue));
4419 // Something else we don't know about so append
4420 // to the tokens variable.
4422 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4424 if (FirstToken == TRUE){
4426 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4431 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4441 intPropertyLen = PropertySeg2.Len();
4442 SplitPoints.clear();
4443 SplitLength.clear();
4448 CaptureString(&PropertySeg2, FALSE);
4450 for (int i = 0; i <= intPropertyLen; i++){
4454 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4457 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4459 if (intSplitsFound == 6){
4461 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4466 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4476 wxString wxSPhotoURI;
4477 wxString wxSPhotoMIME;
4478 wxString wxSPhotoEncoding;
4479 wxString wxSPhotoData;
4480 std::string base64enc;
4482 if (intSplitsFound == 0){
4486 std::map<int, int>::iterator striter;
4488 striter = SplitLength.find(1);
4490 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4492 while (wSTDataType.HasMoreTokens() == TRUE){
4494 wxSPhotoURI = wSTDataType.GetNextToken();
4495 wxSPhotoMIME = wSTDataType.GetNextToken();
4500 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4502 while (wSTDataInfo.HasMoreTokens() == TRUE){
4504 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4505 wxSPhotoData = wSTDataInfo.GetNextToken();
4506 base64enc = wxSPhotoData.mb_str();
4513 // Add the data to the General/Home/Work address variables.
4515 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4516 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4517 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4523 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4526 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4530 if (!PropertyTokens.IsEmpty()){
4532 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4538 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4540 size_t intPropertyLen = PropertySeg1.Len();
4541 std::map<int, int> SplitPoints;
4542 std::map<int, int> SplitLength;
4543 std::map<int, int>::iterator SLiter;
4544 wxString PropertyData;
4545 wxString PropertyName;
4546 wxString PropertyValue;
4547 wxString PropertyTokens;
4548 bool FirstToken = TRUE;
4549 int intSplitsFound = 0;
4550 int intSplitSize = 0;
4551 int intPrevValue = 7;
4555 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4559 PropertyType PropType = PROPERTY_NONE;
4561 // Look for type before continuing.
4563 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4567 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4568 intiter != SplitPoints.end(); ++intiter){
4570 SLiter = SplitLength.find(intiter->first);
4572 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4574 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4575 PropertyName = PropertyElement.GetNextToken();
4576 PropertyValue = PropertyElement.GetNextToken();
4578 intPrevValue = intiter->second;
4580 // Process properties.
4582 size_t intPropertyValueLen = PropertyValue.Len();
4584 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4586 PropertyValue.Trim();
4587 PropertyValue.RemoveLast();
4591 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4593 PropertyValue.Remove(0, 1);
4597 CaptureString(&PropertyValue, FALSE);
4599 if (PropertyName == wxT("ALTID")){
4601 SoundsListAltID.erase(*SoundCount);
4602 SoundsListAltID.insert(std::make_pair(*SoundCount, PropertyValue));
4604 } else if (PropertyName == wxT("PID")){
4606 SoundsListPID.erase(*SoundCount);
4607 SoundsListPID.insert(std::make_pair(*SoundCount, PropertyValue));
4609 } else if (PropertyName == wxT("PREF")){
4611 ProcessIntegerValue(&SoundsListPref, &PropertyValue, SoundCount);
4613 } else if (PropertyName == wxT("MEDIATYPE")){
4615 SoundsListMediatype.erase(*SoundCount);
4616 SoundsListMediatype.insert(std::make_pair(*SoundCount, PropertyValue));
4618 } else if (PropertyName == wxT("LANGUAGE")){
4620 SoundsListLanguage.erase(*SoundCount);
4621 SoundsListLanguage.insert(std::make_pair(*SoundCount, PropertyValue));
4625 // Something else we don't know about so append
4626 // to the tokens variable.
4628 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4630 if (FirstToken == TRUE){
4632 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4637 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4647 intPropertyLen = PropertySeg2.Len();
4648 SplitPoints.clear();
4649 SplitLength.clear();
4654 CaptureString(&PropertySeg2, FALSE);
4656 for (int i = 0; i <= intPropertyLen; i++){
4660 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4663 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4665 if (intSplitsFound == 6){
4667 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4672 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4682 wxString wxSSoundURI;
4683 wxString wxSSoundMIME;
4684 wxString wxSSoundEncoding;
4685 wxString wxSSoundData;
4686 std::string base64enc;
4688 if (intSplitsFound == 0){
4692 std::map<int, int>::iterator striter;
4694 striter = SplitLength.find(1);
4696 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4698 while (wSTDataType.HasMoreTokens() == TRUE){
4700 wxSSoundURI = wSTDataType.GetNextToken();
4701 wxSSoundMIME = wSTDataType.GetNextToken();
4706 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4708 while (wSTDataInfo.HasMoreTokens() == TRUE){
4710 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4711 wxSSoundData = wSTDataInfo.GetNextToken();
4712 base64enc = wxSSoundData.mb_str();
4719 // Add the data to the General/Home/Work address variables.
4725 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4728 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4732 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4733 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4734 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4736 if (!PropertyTokens.IsEmpty()){
4738 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4744 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4746 size_t intPropertyLen = PropertySeg1.Len();
4747 std::map<int, int> SplitPoints;
4748 std::map<int, int> SplitLength;
4749 std::map<int, int>::iterator SLiter;
4750 wxString PropertyData;
4751 wxString PropertyName;
4752 wxString PropertyValue;
4753 wxString PropertyTokens;
4754 bool FirstToken = TRUE;
4755 int intSplitsFound = 0;
4756 int intSplitSize = 0;
4757 int intPrevValue = 8;
4761 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4765 PropertyType PropType = PROPERTY_NONE;
4767 // Look for type before continuing.
4769 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4773 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4774 intiter != SplitPoints.end(); ++intiter){
4776 SLiter = SplitLength.find(intiter->first);
4778 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4780 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4781 PropertyName = PropertyElement.GetNextToken();
4782 PropertyValue = PropertyElement.GetNextToken();
4784 intPrevValue = intiter->second;
4786 // Process properties.
4788 size_t intPropertyValueLen = PropertyValue.Len();
4790 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4792 PropertyValue.Trim();
4793 PropertyValue.RemoveLast();
4797 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4799 PropertyValue.Remove(0, 1);
4803 CaptureString(&PropertyValue, FALSE);
4805 if (PropertyName == wxT("ALTID")){
4807 CalendarListAltID.erase(*CalURICount);
4808 CalendarListAltID.insert(std::make_pair(*CalURICount, PropertyValue));
4810 } else if (PropertyName == wxT("PID")){
4812 CalendarListPID.erase(*CalURICount);
4813 CalendarListPID.insert(std::make_pair(*CalURICount, PropertyValue));
4815 } else if (PropertyName == wxT("PREF")){
4817 ProcessIntegerValue(&CalendarListPref, &PropertyValue, CalURICount);
4819 } else if (PropertyName == wxT("MEDIATYPE")){
4821 CalendarListMediatype.erase(*CalURICount);
4822 CalendarListMediatype.insert(std::make_pair(*CalURICount, PropertyValue));
4826 // Something else we don't know about so append
4827 // to the tokens variable.
4829 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4831 if (FirstToken == TRUE){
4833 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4838 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4848 intPropertyLen = PropertySeg2.Len();
4849 SplitPoints.clear();
4850 SplitLength.clear();
4855 CaptureString(&PropertySeg2, FALSE);
4857 // Add the data to the General/Home/Work address variables.
4863 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4866 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4870 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4872 if (!PropertyTokens.IsEmpty()){
4874 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4880 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4882 size_t intPropertyLen = PropertySeg1.Len();
4883 std::map<int, int> SplitPoints;
4884 std::map<int, int> SplitLength;
4885 std::map<int, int>::iterator SLiter;
4886 wxString PropertyData;
4887 wxString PropertyName;
4888 wxString PropertyValue;
4889 wxString PropertyTokens;
4890 bool FirstToken = TRUE;
4891 int intSplitsFound = 0;
4892 int intSplitSize = 0;
4893 int intPrevValue = 8;
4897 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4901 PropertyType PropType = PROPERTY_NONE;
4903 // Look for type before continuing.
4905 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4909 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4910 intiter != SplitPoints.end(); ++intiter){
4912 SLiter = SplitLength.find(intiter->first);
4914 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4916 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4917 PropertyName = PropertyElement.GetNextToken();
4918 PropertyValue = PropertyElement.GetNextToken();
4920 intPrevValue = intiter->second;
4922 // Process properties.
4924 size_t intPropertyValueLen = PropertyValue.Len();
4926 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4928 PropertyValue.Trim();
4929 PropertyValue.RemoveLast();
4933 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4935 PropertyValue.Remove(0, 1);
4939 CaptureString(&PropertyValue, FALSE);
4941 if (PropertyName == wxT("ALTID")){
4943 CalendarRequestListAltID.erase(*CalAdrURICount);
4944 CalendarRequestListAltID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
4946 } else if (PropertyName == wxT("PID")){
4948 CalendarRequestListPID.erase(*CalAdrURICount);
4949 CalendarRequestListPID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
4951 } else if (PropertyName == wxT("PREF")){
4953 ProcessIntegerValue(&CalendarRequestListPref, &PropertyValue, CalAdrURICount);
4955 } else if (PropertyName == wxT("MEDIATYPE")){
4957 CalendarRequestListMediatype.erase(*CalAdrURICount);
4958 CalendarRequestListMediatype.insert(std::make_pair(*CalAdrURICount, PropertyValue));
4962 // Something else we don't know about so append
4963 // to the tokens variable.
4965 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4967 if (FirstToken == TRUE){
4969 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4974 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4984 intPropertyLen = PropertySeg2.Len();
4985 SplitPoints.clear();
4986 SplitLength.clear();
4991 CaptureString(&PropertySeg2, FALSE);
4993 // Add the data to the General/Home/Work address variables.
4999 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
5002 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
5006 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
5008 if (!PropertyTokens.IsEmpty()){
5010 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
5016 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
5018 size_t intPropertyLen = PropertySeg1.Len();
5019 std::map<int, int> SplitPoints;
5020 std::map<int, int> SplitLength;
5021 std::map<int, int>::iterator SLiter;
5022 wxString PropertyData;
5023 wxString PropertyName;
5024 wxString PropertyValue;
5025 wxString PropertyTokens;
5026 bool FirstToken = TRUE;
5027 int intSplitsFound = 0;
5028 int intSplitSize = 0;
5029 int intPrevValue = 7;
5033 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5037 PropertyType PropType = PROPERTY_NONE;
5039 // Look for type before continuing.
5041 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5045 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5046 intiter != SplitPoints.end(); ++intiter){
5048 SLiter = SplitLength.find(intiter->first);
5050 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5052 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5053 PropertyName = PropertyElement.GetNextToken();
5054 PropertyValue = PropertyElement.GetNextToken();
5056 intPrevValue = intiter->second;
5058 // Process properties.
5060 size_t intPropertyValueLen = PropertyValue.Len();
5062 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5064 PropertyValue.Trim();
5065 PropertyValue.RemoveLast();
5069 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5071 PropertyValue.Remove(0, 1);
5075 CaptureString(&PropertyValue, FALSE);
5077 if (PropertyName == wxT("ALTID")){
5079 FreeBusyListAltID.erase(*FreeBusyAddressCount);
5080 FreeBusyListAltID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5082 } else if (PropertyName == wxT("PID")){
5084 FreeBusyListPID.erase(*FreeBusyAddressCount);
5085 FreeBusyListPID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5087 } else if (PropertyName == wxT("PREF")){
5089 ProcessIntegerValue(&FreeBusyListPref, &PropertyValue, FreeBusyAddressCount);
5091 } else if (PropertyName == wxT("MEDIATYPE")){
5093 FreeBusyListMediatype.erase(*FreeBusyAddressCount);
5094 FreeBusyListMediatype.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5098 // Something else we don't know about so append
5099 // to the tokens variable.
5101 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5103 if (FirstToken == TRUE){
5105 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5110 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5120 intPropertyLen = PropertySeg2.Len();
5121 SplitPoints.clear();
5122 SplitLength.clear();
5127 CaptureString(&PropertySeg2, FALSE);
5129 // Add the data to the General/Home/Work address variables.
5135 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
5138 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
5142 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
5144 if (!PropertyTokens.IsEmpty()){
5146 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
5152 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
5154 size_t intPropertyLen = PropertySeg1.Len();
5155 std::map<int, int> SplitPoints;
5156 std::map<int, int> SplitLength;
5157 std::map<int, int>::iterator SLiter;
5158 wxString PropertyData;
5159 wxString PropertyName;
5160 wxString PropertyValue;
5161 wxString PropertyTokens;
5162 bool FirstToken = TRUE;
5163 int intSplitsFound = 0;
5164 int intSplitSize = 0;
5165 int intPrevValue = 5;
5170 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5174 PropertyType PropType = PROPERTY_NONE;
5176 // Look for type before continuing.
5178 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5182 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5183 intiter != SplitPoints.end(); ++intiter){
5185 SLiter = SplitLength.find(intiter->first);
5187 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5189 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5190 PropertyName = PropertyElement.GetNextToken();
5191 PropertyValue = PropertyElement.GetNextToken();
5193 intPrevValue = intiter->second;
5195 // Process properties.
5197 size_t intPropertyValueLen = PropertyValue.Len();
5199 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5201 PropertyValue.Trim();
5202 PropertyValue.RemoveLast();
5206 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5208 PropertyValue.Remove(0, 1);
5212 if (PropertyName == wxT("ALTID")){
5214 KeyListAltID.erase(*KeyCount);
5215 KeyListAltID.insert(std::make_pair(*KeyCount, PropertyValue));
5217 } else if (PropertyName == wxT("PID")){
5219 KeyListPID.erase(*KeyCount);
5220 KeyListPID.insert(std::make_pair(*KeyCount, PropertyValue));
5222 } else if (PropertyName == wxT("PREF")){
5224 ProcessIntegerValue(&KeyListPref, &PropertyValue, KeyCount);
5228 // Something else we don't know about so append
5229 // to the tokens variable.
5231 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5233 if (FirstToken == TRUE){
5235 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5240 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5250 intPropertyLen = PropertySeg2.Len();
5251 SplitPoints.clear();
5252 SplitLength.clear();
5257 for (int i = 0; i <= intPropertyLen; i++){
5261 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
5264 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
5266 if (intSplitsFound == 6){
5268 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5273 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5284 wxString wxSKeyMIME;
5285 wxString wxSKeyEncoding;
5286 wxString wxSKeyData;
5287 std::string base64enc;
5289 if (intSplitsFound == 0){
5293 std::map<int, int>::iterator striter;
5295 striter = SplitLength.find(1);
5297 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
5299 while (wSTDataType.HasMoreTokens() == TRUE){
5301 wxSKeyURI = wSTDataType.GetNextToken();
5302 wxSKeyMIME = wSTDataType.GetNextToken();
5307 if (wxSKeyURI == wxT("data")){
5309 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
5311 while (wSTDataInfo.HasMoreTokens() == TRUE){
5313 wxSKeyEncoding = wSTDataInfo.GetNextToken();
5314 wxSKeyData = wSTDataInfo.GetNextToken();
5323 // Add the data to the General/Home/Work address variables.
5325 if (wxSKeyURI == wxT("data")){
5327 KeyListDataEncType.erase(*KeyCount);
5328 KeyListKeyType.erase(*KeyCount);
5329 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
5330 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
5332 KeyList.erase(*KeyCount);
5333 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
5337 KeyList.erase(*KeyCount);
5338 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
5342 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
5348 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
5351 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
5355 if (!PropertyTokens.IsEmpty()){
5357 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
5363 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
5365 // Split the Vendor three ways.
5367 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
5370 wxString wxSVNDPropName;
5373 while (wSTVendorDetails.HasMoreTokens() == TRUE){
5375 wSTVendorDetails.GetNextToken();
5376 wxSVNDID = wSTVendorDetails.GetNextToken();
5377 wxSVNDPropName = wSTVendorDetails.GetNextToken();
5382 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
5384 // Add the data to the vendor variables.
5386 VendorList.erase(*VendorCount);
5387 VendorListPEN.erase(*VendorCount);
5388 VendorListElement.erase(*VendorCount);
5390 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
5391 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
5392 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
5398 void ProcessStringValue(wxString *PropertyName,
5399 wxString PropertyNameMatch,
5400 std::map<int,wxString> *MapPtr,
5401 wxString *PropertyValue,
5403 bool *PropertyMatched){
5405 if (*PropertyName == PropertyNameMatch){
5406 MapPtr->erase(*ItemCount);
5407 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5408 *PropertyMatched = TRUE;
5413 void ProcessIntegerValue(wxString *PropertyName,
5414 wxString PropertyNameMatch,
5415 std::map<int,int> *PrefPtr,
5416 wxString *PropertyValue,
5418 bool *PropertyMatched){
5420 if (*PropertyName == PropertyNameMatch){
5421 *PropertyMatched = TRUE;
5426 int PriorityNumber = 0;
5427 bool ValidNumber = TRUE;
5430 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5433 catch(std::invalid_argument &e){
5434 ValidNumber = FALSE;
5437 if (ValidNumber == TRUE){
5439 PrefPtr->erase(*ItemCount);
5440 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5446 void ProcessIntegerValue(std::map<int,int> *PrefPtr,
5447 wxString *PropertyValue,
5450 int PriorityNumber = 0;
5451 bool ValidNumber = TRUE;
5454 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5457 catch(std::invalid_argument &e){
5458 ValidNumber = FALSE;
5461 if (ValidNumber == TRUE){
5463 PrefPtr->erase(*ItemCount);
5464 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5470 void SplitValues(wxString *PropertyLine,
5471 std::map<int,int> *SplitPoints,
5472 std::map<int,int> *SplitLength,
5475 size_t intPropertyLen = PropertyLine->Len();
5476 int intSplitsFound = 0;
5477 int intSplitSize = 0;
5478 int intSplitSeek = 0;
5480 for (int i = intSize; i <= intPropertyLen; i++){
5484 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5485 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5487 if (intSplitsFound == 0){
5489 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5493 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5497 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5507 if (intSplitsFound == 0){
5509 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5510 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5514 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5515 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5521 void CheckType(wxString *PropertySeg1,
5522 std::map<int,int> *SplitPoints,
5523 std::map<int,int> *SplitLength,
5525 PropertyType *PropType){
5527 wxString PropertyData;
5528 wxString PropertyName;
5529 wxString PropertyValue;
5530 std::map<int,int>::iterator SLiter;
5532 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5533 intiter != SplitPoints->end(); ++intiter){
5535 SLiter = SplitLength->find(intiter->first);
5537 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5539 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5540 PropertyName = PropertyElement.GetNextToken();
5541 PropertyValue = PropertyElement.GetNextToken();
5543 *intPrevValue = intiter->second;
5545 if (PropertyName == wxT("TYPE")){
5547 if (PropertyValue == wxT("work")){
5549 *PropType = PROPERTY_WORK;
5551 } else if (PropertyValue == wxT("home")){
5553 *PropType = PROPERTY_HOME;
5557 *PropType = PROPERTY_NONE;