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 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
1905 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1906 intPrevValue = intiter->second;
1908 } else if (intiter->first == 2){
1910 // Deal with extended address.
1912 SLiter = SplitLength.find(2);
1914 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1915 //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1916 intPrevValue = intiter->second;
1918 } else if (intiter->first == 3){
1920 // Deal with street address.
1922 SLiter = SplitLength.find(3);
1924 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1925 //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1926 intPrevValue = intiter->second;
1928 } else if (intiter->first == 4){
1930 // Deal with locality
1932 SLiter = SplitLength.find(4);
1934 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1935 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1936 intPrevValue = intiter->second;
1938 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1940 } else if (intiter->first == 5){
1942 // Deal with region.
1944 SLiter = SplitLength.find(5);
1946 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1947 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1948 intPrevValue = intiter->second;
1950 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1952 } else if (intiter->first == 6){
1954 // Deal with post code.
1956 SLiter = SplitLength.find(6);
1958 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1959 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1960 intPrevValue = intiter->second;
1962 // Deal with country.
1964 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1965 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
1973 // Add the data to the General/Home/Work address variables.
1975 CaptureString(&AddressStreet, FALSE);
1976 CaptureString(&AddressLocality, FALSE);
1977 CaptureString(&AddressRegion, FALSE);
1978 CaptureString(&AddressPostalCode, FALSE);
1979 CaptureString(&AddressCountry, FALSE);
1981 if (!PropertyTokens.IsEmpty()){
1983 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1987 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1988 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1989 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1990 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1991 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1995 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1998 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
2001 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
2005 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
2009 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
2011 std::map<int, int> SplitPoints;
2012 std::map<int, int> SplitLength;
2014 int intPrevValue = 7;
2017 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2021 PropertyType PropType = PROPERTY_NONE;
2023 // Look for type before continuing.
2025 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2027 std::map<int, wxString> *EmailList = NULL;
2028 std::map<int, wxString> *EmailListType = NULL;
2029 std::map<int, wxString> *EmailListAltID = NULL;
2030 std::map<int, wxString> *EmailListPID = NULL;
2031 std::map<int, wxString> *EmailListTokens = NULL;
2032 std::map<int, int> *EmailListPref = NULL;
2036 EmailList = &GeneralEmailList;
2037 EmailListType = &GeneralEmailListType;
2038 EmailListAltID = &GeneralEmailListAltID;
2039 EmailListPID = &GeneralEmailListPID;
2040 EmailListTokens = &GeneralEmailListTokens;
2041 EmailListPref = &GeneralEmailListPref;
2044 EmailList = &HomeEmailList;
2045 EmailListType = &HomeEmailListType;
2046 EmailListAltID = &HomeEmailListAltID;
2047 EmailListPID = &HomeEmailListPID;
2048 EmailListTokens = &HomeEmailListTokens;
2049 EmailListPref = &HomeEmailListPref;
2052 EmailList = &BusinessEmailList;
2053 EmailListType = &BusinessEmailListType;
2054 EmailListAltID = &BusinessEmailListAltID;
2055 EmailListPID = &BusinessEmailListPID;
2056 EmailListTokens = &BusinessEmailListTokens;
2057 EmailListPref = &BusinessEmailListPref;
2063 std::map<int,int>::iterator SLiter;
2064 wxString PropertyData;
2065 wxString PropertyName;
2066 wxString PropertyValue;
2067 wxString PropertyTokens;
2068 bool FirstToken = TRUE;
2070 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2071 intiter != SplitPoints.end(); ++intiter){
2073 SLiter = SplitLength.find(intiter->first);
2075 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2077 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2078 PropertyName = PropertyElement.GetNextToken();
2079 PropertyValue = PropertyElement.GetNextToken();
2081 intPrevValue = intiter->second;
2083 CaptureString(&PropertyValue, FALSE);
2085 // Process properties.
2087 if (PropertyName == wxT("ALTID")){
2089 EmailListAltID->erase(*EmailCount);
2090 EmailListAltID->insert(std::make_pair(*EmailCount, PropertyValue));
2092 } else if (PropertyName == wxT("PID")){
2094 EmailListPID->erase(*EmailCount);
2095 EmailListPID->insert(std::make_pair(*EmailCount, PropertyValue));
2097 } else if (PropertyName == wxT("PREF")){
2099 ProcessIntegerValue(EmailListPref, &PropertyValue, EmailCount);
2103 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2105 if (FirstToken == TRUE){
2107 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2112 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2122 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
2124 // Add the name token data.
2126 if (!PropertyTokens.IsEmpty()){
2128 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
2135 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
2137 std::map<int, int> SplitPoints;
2138 std::map<int, int> SplitLength;
2140 int intPrevValue = 6;
2143 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2147 PropertyType PropType = PROPERTY_NONE;
2149 // Look for type before continuing.
2151 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2153 std::map<int, wxString> *IMList = NULL;
2154 std::map<int, wxString> *IMListType = NULL;
2155 std::map<int, wxString> *IMListAltID = NULL;
2156 std::map<int, wxString> *IMListPID = NULL;
2157 std::map<int, wxString> *IMListTokens = NULL;
2158 std::map<int, wxString> *IMListMediatype = NULL;
2159 std::map<int, int> *IMListPref = NULL;
2163 IMList = &GeneralIMList;
2164 IMListType = &GeneralIMListType;
2165 IMListAltID = &GeneralIMListAltID;
2166 IMListPID = &GeneralIMListPID;
2167 IMListTokens = &GeneralIMListTokens;
2168 IMListMediatype = &GeneralIMListMediatype;
2169 IMListPref = &GeneralIMListPref;
2172 IMList = &HomeIMList;
2173 IMListType = &HomeIMListType;
2174 IMListAltID = &HomeIMListAltID;
2175 IMListPID = &HomeIMListPID;
2176 IMListTokens = &HomeIMListTokens;
2177 IMListMediatype = &HomeIMListMediatype;
2178 IMListPref = &HomeIMListPref;
2181 IMList = &BusinessIMList;
2182 IMListType = &BusinessIMListType;
2183 IMListAltID = &BusinessIMListAltID;
2184 IMListPID = &BusinessIMListPID;
2185 IMListTokens = &BusinessIMListTokens;
2186 IMListMediatype = &BusinessIMListMediatype;
2187 IMListPref = &BusinessIMListPref;
2193 std::map<int,int>::iterator SLiter;
2194 wxString PropertyData;
2195 wxString PropertyName;
2196 wxString PropertyValue;
2197 wxString PropertyTokens;
2198 bool FirstToken = TRUE;
2200 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2201 intiter != SplitPoints.end(); ++intiter){
2203 SLiter = SplitLength.find(intiter->first);
2205 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2207 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2208 PropertyName = PropertyElement.GetNextToken();
2209 PropertyValue = PropertyElement.GetNextToken();
2211 intPrevValue = intiter->second;
2213 CaptureString(&PropertyValue, FALSE);
2215 // Process properties.
2217 if (PropertyName == wxT("ALTID")){
2219 IMListAltID->erase(*IMCount);
2220 IMListAltID->insert(std::make_pair(*IMCount, PropertyValue));
2222 } else if (PropertyName == wxT("PID")){
2224 IMListPID->erase(*IMCount);
2225 IMListPID->insert(std::make_pair(*IMCount, PropertyValue));
2227 } else if (PropertyName == wxT("MEDIATYPE")){
2229 IMListMediatype->erase(*IMCount);
2230 IMListMediatype->insert(std::make_pair(*IMCount, PropertyValue));
2232 } else if (PropertyName == wxT("PREF")){
2234 ProcessIntegerValue(IMListPref, &PropertyValue, IMCount);
2238 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2240 if (FirstToken == TRUE){
2242 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2247 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2257 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2259 // Add the name token data.
2261 if (!PropertyTokens.IsEmpty()){
2263 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2269 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2271 std::map<int, int> SplitPoints;
2272 std::map<int, int> SplitLength;
2273 std::map<int, int>::iterator SLiter;
2277 PropertyType PropType = PROPERTY_NONE;
2279 // Look for type before continuing.
2282 wxString TelTypeDetail;
2283 wxString PropertyData;
2284 wxString PropertyName;
2285 wxString PropertyValue;
2286 wxString PropertyTokens;
2288 std::map<int,int> TypeSplitPoints;
2289 std::map<int,int> TypeSplitLength;
2290 std::map<int,int>::iterator TSLiter;
2292 int intSplitSize = 0;
2293 int intSplitsFound = 0;
2294 int intSplitPoint = 0;
2296 int intPrevValue = 5;
2298 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2302 // Look for type before continuing.
2304 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2305 intiter != SplitPoints.end(); ++intiter){
2307 SLiter = SplitLength.find(intiter->first);
2309 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2311 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2312 PropertyName = PropertyElement.GetNextToken();
2313 PropertyValue = PropertyElement.GetNextToken();
2315 intPrevValue = intiter->second;
2317 if (PropertyName == wxT("TYPE")){
2319 // Process each value in type and translate each
2322 // Strip out the quotes if they are there.
2324 size_t intPropertyValueLen = PropertyValue.Len();
2326 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2328 PropertyValue.Trim();
2329 PropertyValue.RemoveLast();
2333 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2335 PropertyValue.Remove(0, 1);
2339 TelTypeDetail = PropertyValue;
2345 for (int i = 0; i <= intPropertyValueLen; i++){
2349 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2351 if (intSplitsFound == 0){
2353 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2354 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2358 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2359 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2372 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2373 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2375 int intTypeSeek = 0;
2377 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2378 typeiter != TypeSplitPoints.end(); ++typeiter){
2380 wxString TypePropertyName;
2382 TSLiter = TypeSplitLength.find(typeiter->first);
2384 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2386 if (intTypeSeek == 0){
2391 TelTypeUI.Append(wxT(","));
2395 if (TypePropertyName == wxT("home")){
2397 PropType = PROPERTY_HOME;
2399 } else if (TypePropertyName == wxT("work")){
2401 PropType = PROPERTY_WORK;
2406 if (TypePropertyName == wxT("text")){
2408 TelTypeUI.Append(_("text"));
2411 } else if (TypePropertyName == wxT("voice")){
2413 TelTypeUI.Append(_("voice"));
2416 } else if (TypePropertyName == wxT("fax")){
2418 TelTypeUI.Append(_("fax"));
2421 } else if (TypePropertyName == wxT("cell")){
2423 TelTypeUI.Append(_("mobile"));
2426 } else if (TypePropertyName == wxT("video")){
2428 TelTypeUI.Append(_("video"));
2431 } else if (TypePropertyName == wxT("pager")){
2433 TelTypeUI.Append(_("pager"));
2436 } else if (TypePropertyName == wxT("textphone")){
2438 TelTypeUI.Append(_("textphone"));
2449 std::map<int, wxString> *TelephoneList = NULL;
2450 std::map<int, wxString> *TelephoneListType = NULL;
2451 std::map<int, wxString> *TelephoneListAltID = NULL;
2452 std::map<int, wxString> *TelephoneListPID = NULL;
2453 std::map<int, wxString> *TelephoneListTokens = NULL;
2454 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2455 std::map<int, int> *TelephoneListPref = NULL;
2459 TelephoneList = &GeneralTelephoneList;
2460 TelephoneListType = &GeneralTelephoneListType;
2461 TelephoneListAltID = &GeneralTelephoneListAltID;
2462 TelephoneListPID = &GeneralTelephoneListPID;
2463 TelephoneListTokens = &GeneralTelephoneListTokens;
2464 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2465 TelephoneListPref = &GeneralTelephoneListPref;
2468 TelephoneList = &HomeTelephoneList;
2469 TelephoneListType = &HomeTelephoneListType;
2470 TelephoneListAltID = &HomeTelephoneListAltID;
2471 TelephoneListPID = &HomeTelephoneListPID;
2472 TelephoneListTokens = &HomeTelephoneListTokens;
2473 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2474 TelephoneListPref = &HomeTelephoneListPref;
2477 TelephoneList = &BusinessTelephoneList;
2478 TelephoneListType = &BusinessTelephoneListType;
2479 TelephoneListAltID = &BusinessTelephoneListAltID;
2480 TelephoneListPID = &BusinessTelephoneListPID;
2481 TelephoneListTokens = &BusinessTelephoneListTokens;
2482 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2483 TelephoneListPref = &BusinessTelephoneListPref;
2487 // Process the properties.
2489 bool FirstToken = TRUE;
2492 SplitPoints.clear();
2493 SplitLength.clear();
2495 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2499 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2500 intiter != SplitPoints.end(); ++intiter){
2502 SLiter = SplitLength.find(intiter->first);
2504 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2506 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2507 PropertyName = PropertyElement.GetNextToken();
2508 PropertyValue = PropertyElement.GetNextToken();
2510 intPrevValue = intiter->second;
2512 CaptureString(&PropertyValue, FALSE);
2514 // Process properties.
2516 if (PropertyName == wxT("ALTID")){
2518 TelephoneListAltID->erase(*TelephoneCount);
2519 TelephoneListAltID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2521 } else if (PropertyName == wxT("PID")){
2523 TelephoneListPID->erase(*TelephoneCount);
2524 TelephoneListPID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2526 } else if (PropertyName == wxT("PREF")){
2528 ProcessIntegerValue(TelephoneListPref, &PropertyValue, TelephoneCount);
2532 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2534 if (FirstToken == TRUE){
2536 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2541 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2551 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2552 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2554 // Add the name token data.
2556 if (!PropertyTokens.IsEmpty()){
2558 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2564 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2566 std::map<int, int> SplitPoints;
2567 std::map<int, int> SplitLength;
2569 int intPrevValue = 6;
2572 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2576 PropertyType PropType = PROPERTY_NONE;
2578 // Look for type before continuing.
2580 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2582 std::map<int, wxString> *LanguageList = NULL;
2583 std::map<int, wxString> *LanguageListType = NULL;
2584 std::map<int, wxString> *LanguageListAltID = NULL;
2585 std::map<int, wxString> *LanguageListPID = NULL;
2586 std::map<int, wxString> *LanguageListTokens = NULL;
2587 std::map<int, int> *LanguageListPref = NULL;
2591 LanguageList = &GeneralLanguageList;
2592 LanguageListType = &GeneralLanguageListType;
2593 LanguageListAltID = &GeneralLanguageListAltID;
2594 LanguageListPID = &GeneralLanguageListPID;
2595 LanguageListTokens = &GeneralLanguageListTokens;
2596 LanguageListPref = &GeneralLanguageListPref;
2599 LanguageList = &HomeLanguageList;
2600 LanguageListType = &HomeLanguageListType;
2601 LanguageListAltID = &HomeLanguageListAltID;
2602 LanguageListPID = &HomeLanguageListPID;
2603 LanguageListTokens = &HomeLanguageListTokens;
2604 LanguageListPref = &HomeLanguageListPref;
2607 LanguageList = &BusinessLanguageList;
2608 LanguageListType = &BusinessLanguageListType;
2609 LanguageListAltID = &BusinessLanguageListAltID;
2610 LanguageListPID = &BusinessLanguageListPID;
2611 LanguageListTokens = &BusinessLanguageListTokens;
2612 LanguageListPref = &BusinessLanguageListPref;
2618 std::map<int,int>::iterator SLiter;
2619 wxString PropertyData;
2620 wxString PropertyName;
2621 wxString PropertyValue;
2622 wxString PropertyTokens;
2623 bool FirstToken = TRUE;
2625 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2626 intiter != SplitPoints.end(); ++intiter){
2628 SLiter = SplitLength.find(intiter->first);
2630 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2632 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2633 PropertyName = PropertyElement.GetNextToken();
2634 PropertyValue = PropertyElement.GetNextToken();
2636 intPrevValue = intiter->second;
2638 CaptureString(&PropertyValue, FALSE);
2640 // Process properties.
2642 if (PropertyName == wxT("ALTID")){
2644 LanguageListAltID->erase(*LanguageCount);
2645 LanguageListAltID->insert(std::make_pair(*LanguageCount, PropertyValue));
2647 } else if (PropertyName == wxT("PID")){
2649 LanguageListPID->erase(*LanguageCount);
2650 LanguageListPID->insert(std::make_pair(*LanguageCount, PropertyValue));
2652 } else if (PropertyName == wxT("PREF")){
2654 ProcessIntegerValue(LanguageListPref, &PropertyValue, LanguageCount);
2658 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2660 if (FirstToken == TRUE){
2662 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2667 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2677 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2679 // Add the name token data.
2681 if (!PropertyTokens.IsEmpty()){
2683 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2689 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2691 std::map<int, int> SplitPoints;
2692 std::map<int, int> SplitLength;
2694 int intPrevValue = 5;
2697 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2701 PropertyType PropType = PROPERTY_NONE;
2703 // Look for type before continuing.
2705 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2707 std::map<int, wxString> *GeopositionList = NULL;
2708 std::map<int, wxString> *GeopositionListType = NULL;
2709 std::map<int, wxString> *GeopositionListAltID = NULL;
2710 std::map<int, wxString> *GeopositionListPID = NULL;
2711 std::map<int, wxString> *GeopositionListTokens = NULL;
2712 std::map<int, wxString> *GeopositionListMediatype = NULL;
2713 std::map<int, int> *GeopositionListPref = NULL;
2717 GeopositionList = &GeneralGeographyList;
2718 GeopositionListType = &GeneralGeographyListType;
2719 GeopositionListAltID = &GeneralGeographyListAltID;
2720 GeopositionListPID = &GeneralGeographyListPID;
2721 GeopositionListTokens = &GeneralGeographyListTokens;
2722 GeopositionListMediatype = &GeneralGeographyListMediatype;
2723 GeopositionListPref = &GeneralGeographyListPref;
2726 GeopositionList = &HomeGeographyList;
2727 GeopositionListType = &HomeGeographyListType;
2728 GeopositionListAltID = &HomeGeographyListAltID;
2729 GeopositionListPID = &HomeGeographyListPID;
2730 GeopositionListTokens = &HomeGeographyListTokens;
2731 GeopositionListMediatype = &HomeGeographyListMediatype;
2732 GeopositionListPref = &HomeGeographyListPref;
2735 GeopositionList = &BusinessGeographyList;
2736 GeopositionListType = &BusinessGeographyListType;
2737 GeopositionListAltID = &BusinessGeographyListAltID;
2738 GeopositionListPID = &BusinessGeographyListPID;
2739 GeopositionListTokens = &BusinessGeographyListTokens;
2740 GeopositionListMediatype = &BusinessGeographyListMediatype;
2741 GeopositionListPref = &BusinessGeographyListPref;
2747 std::map<int,int>::iterator SLiter;
2748 wxString PropertyData;
2749 wxString PropertyName;
2750 wxString PropertyValue;
2751 wxString PropertyTokens;
2752 bool FirstToken = TRUE;
2754 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2755 intiter != SplitPoints.end(); ++intiter){
2757 SLiter = SplitLength.find(intiter->first);
2759 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2761 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2762 PropertyName = PropertyElement.GetNextToken();
2763 PropertyValue = PropertyElement.GetNextToken();
2765 intPrevValue = intiter->second;
2767 CaptureString(&PropertyValue, FALSE);
2769 // Process properties.
2771 if (PropertyName == wxT("ALTID")){
2773 GeopositionListAltID->erase(*GeographicCount);
2774 GeopositionListAltID->insert(std::make_pair(*GeographicCount, PropertyValue));
2776 } else if (PropertyName == wxT("PID")){
2778 GeopositionListPID->erase(*GeographicCount);
2779 GeopositionListPID->insert(std::make_pair(*GeographicCount, PropertyValue));
2781 } else if (PropertyName == wxT("MEDIATYPE")){
2783 GeopositionListMediatype->erase(*GeographicCount);
2784 GeopositionListMediatype->insert(std::make_pair(*GeographicCount, PropertyValue));
2786 } else if (PropertyName == wxT("PREF")){
2788 ProcessIntegerValue(GeopositionListPref, &PropertyValue, GeographicCount);
2792 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2794 if (FirstToken == TRUE){
2796 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2801 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2811 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2813 // Add the name token data.
2815 if (!PropertyTokens.IsEmpty()){
2817 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2823 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2825 size_t intPropertyLen = PropertySeg1.Len();
2826 std::map<int, int> SplitPoints;
2827 std::map<int, int> SplitLength;
2828 std::map<int, int>::iterator SLiter;
2829 wxString PropertyData;
2830 wxString PropertyName;
2831 wxString PropertyValue;
2832 wxString PropertyTokens;
2833 wxString RelatedType;
2834 wxString RelatedTypeOriginal;
2835 wxString RelatedName;
2836 bool FirstToken = TRUE;
2837 int intSplitsFound = 0;
2838 int intSplitSize = 0;
2839 int intPrevValue = 9;
2843 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2847 // Look for type before continuing.
2849 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2850 intiter != SplitPoints.end(); ++intiter){
2852 SLiter = SplitLength.find(intiter->first);
2854 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2856 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2857 PropertyName = PropertyElement.GetNextToken();
2858 PropertyValue = PropertyElement.GetNextToken();
2860 intPrevValue = intiter->second;
2864 RelatedTypeOriginal = PropertyValue;
2866 if (PropertyName == wxT("TYPE")){
2868 if (PropertyValue == wxT("contact")){
2870 RelatedType = _("Contact");
2872 } else if (PropertyValue == wxT("acquaintance")){
2874 RelatedType = _("Acquaintance");
2876 } else if (PropertyValue == wxT("friend")){
2878 RelatedType = _("Friend");
2880 } else if (PropertyValue == wxT("met")){
2882 RelatedType = _("Met");
2884 } else if (PropertyValue == wxT("co-worker")){
2886 RelatedType = _("Co-worker");
2888 } else if (PropertyValue == wxT("colleague")){
2890 RelatedType = _("Colleague");
2892 } else if (PropertyValue == wxT("co-resident")){
2894 RelatedType = _("Co-resident");
2896 } else if (PropertyValue == wxT("neighbor")){
2898 RelatedType = _("Neighbour");
2900 } else if (PropertyValue == wxT("child")){
2902 RelatedType = _("Child");
2904 } else if (PropertyValue == wxT("parent")){
2906 RelatedType = _("Parent");
2908 } else if (PropertyValue == wxT("sibling")){
2910 RelatedType = _("Sibling");
2912 } else if (PropertyValue == wxT("spouse")){
2914 RelatedType = _("Spouse");
2916 } else if (PropertyValue == wxT("kin")){
2918 RelatedType = _("Kin");
2920 } else if (PropertyValue == wxT("muse")){
2922 RelatedType = _("Muse");
2924 } else if (PropertyValue == wxT("crush")){
2926 RelatedType = _("Crush");
2928 } else if (PropertyValue == wxT("date")){
2930 RelatedType = _("Date");
2932 } else if (PropertyValue == wxT("sweetheart")){
2934 RelatedType = _("Sweetheart");
2936 } else if (PropertyValue == wxT("me")){
2938 RelatedType = _("Me");
2940 } else if (PropertyValue == wxT("agent")){
2942 RelatedType = _("Agent");
2944 } else if (PropertyValue == wxT("emergency")){
2946 RelatedType = _("Emergency");
2950 RelatedType = PropertyValue;
2960 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2961 intiter != SplitPoints.end(); ++intiter){
2963 SLiter = SplitLength.find(intiter->first);
2965 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2967 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2968 PropertyName = PropertyElement.GetNextToken();
2969 PropertyValue = PropertyElement.GetNextToken();
2971 intPrevValue = intiter->second;
2973 // Process properties.
2975 size_t intPropertyValueLen = PropertyValue.Len();
2977 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2979 PropertyValue.Trim();
2980 PropertyValue.RemoveLast();
2984 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2986 PropertyValue.Remove(0, 1);
2990 CaptureString(&PropertyValue, FALSE);
2992 if (PropertyName == wxT("ALTID")){
2994 GeneralRelatedListAltID.erase(*RelatedCount);
2995 GeneralRelatedListAltID.insert(std::make_pair(*RelatedCount, PropertyValue));
2997 } else if (PropertyName == wxT("PID")){
2999 GeneralRelatedListPID.erase(*RelatedCount);
3000 GeneralRelatedListPID.insert(std::make_pair(*RelatedCount, PropertyValue));
3002 } else if (PropertyName == wxT("PREF")){
3004 int PriorityNumber = 0;
3005 bool ValidNumber = TRUE;
3008 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3011 catch(std::invalid_argument &e){
3012 ValidNumber = FALSE;
3015 if (ValidNumber == TRUE){
3017 GeneralRelatedListPref.erase(*RelatedCount);
3018 GeneralRelatedListPref.insert(std::make_pair(*RelatedCount, PriorityNumber));
3022 } else if (PropertyName == wxT("LANGUAGE")){
3024 ProcessIntegerValue(&GeneralRelatedListPref, &PropertyValue, RelatedCount);
3026 } else if (PropertyName != wxT("TYPE")) {
3028 // Something else we don't know about so append
3029 // to the tokens variable.
3031 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3033 if (FirstToken == TRUE){
3035 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3040 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3050 // Add the data to the General/Home/Work address variables.
3052 GeneralRelatedList.erase(*RelatedCount);
3053 GeneralRelatedListRelType.erase(*RelatedCount);
3054 GeneralRelatedListType.erase(*RelatedCount);
3055 GeneralRelatedListTokens.erase(*RelatedCount);
3056 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
3057 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
3058 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
3059 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
3063 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
3065 std::map<int, int> SplitPoints;
3066 std::map<int, int> SplitLength;
3067 std::map<int, int>::iterator SLiter;
3068 wxString PropertyData;
3069 wxString PropertyName;
3070 wxString PropertyValue;
3071 wxString PropertyTokens;
3072 bool FirstToken = TRUE;
3073 int intPrevValue = 5;
3078 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3082 PropertyType PropType = PROPERTY_NONE;
3084 // Look for type before continuing.
3086 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3088 // Setup the pointers.
3090 std::map<int, wxString> *WebsiteList = NULL;
3091 std::map<int, wxString> *WebsiteListAltID = NULL;
3092 std::map<int, wxString> *WebsiteListPID = NULL;
3093 std::map<int, wxString> *WebsiteListType = NULL;
3094 std::map<int, wxString> *WebsiteListTokens = NULL;
3095 std::map<int, wxString> *WebsiteListMediatype = NULL;
3096 std::map<int, int> *WebsiteListPref = NULL;
3098 // Setup blank lines for later on.
3102 WebsiteList = &GeneralWebsiteList;
3103 WebsiteListType = &GeneralWebsiteListType;
3104 WebsiteListAltID = &GeneralWebsiteListAltID;
3105 WebsiteListPID = &GeneralWebsiteListPID;
3106 WebsiteListTokens = &GeneralWebsiteListTokens;
3107 WebsiteListMediatype = &GeneralWebsiteListMediatype;
3108 WebsiteListPref = &GeneralWebsiteListPref;
3111 WebsiteList = &HomeWebsiteList;
3112 WebsiteListType = &HomeWebsiteListType;
3113 WebsiteListAltID = &HomeWebsiteListAltID;
3114 WebsiteListPID = &HomeWebsiteListPID;
3115 WebsiteListTokens = &HomeWebsiteListTokens;
3116 WebsiteListMediatype = &HomeWebsiteListMediatype;
3117 WebsiteListPref = &HomeWebsiteListPref;
3120 WebsiteList = &BusinessWebsiteList;
3121 WebsiteListType = &BusinessWebsiteListType;
3122 WebsiteListAltID = &BusinessWebsiteListAltID;
3123 WebsiteListPID = &BusinessWebsiteListPID;
3124 WebsiteListTokens = &BusinessWebsiteListTokens;
3125 WebsiteListMediatype = &BusinessWebsiteListMediatype;
3126 WebsiteListPref = &BusinessWebsiteListPref;
3132 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3133 intiter != SplitPoints.end(); ++intiter){
3135 SLiter = SplitLength.find(intiter->first);
3137 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3139 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3140 PropertyName = PropertyElement.GetNextToken();
3141 PropertyValue = PropertyElement.GetNextToken();
3143 intPrevValue = intiter->second;
3145 // Process properties.
3147 size_t intPropertyValueLen = PropertyValue.Len();
3149 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3151 PropertyValue.Trim();
3152 PropertyValue.RemoveLast();
3156 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3158 PropertyValue.Remove(0, 1);
3162 CaptureString(&PropertyValue, FALSE);
3164 if (PropertyName == wxT("ALTID")){
3166 WebsiteListAltID->erase(*URLCount);
3167 WebsiteListAltID->insert(std::make_pair(*URLCount, PropertyValue));
3169 } else if (PropertyName == wxT("PID")){
3171 WebsiteListPID->erase(*URLCount);
3172 WebsiteListPID->insert(std::make_pair(*URLCount, PropertyValue));
3174 } else if (PropertyName == wxT("PREF")){
3176 ProcessIntegerValue(WebsiteListPref, &PropertyValue, URLCount);
3178 } else if (PropertyName == wxT("MEDIATYPE")){
3180 WebsiteListMediatype->erase(*URLCount);
3181 WebsiteListMediatype->insert(std::make_pair(*URLCount, PropertyValue));
3185 // Something else we don't know about so append
3186 // to the tokens variable.
3188 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3190 if (FirstToken == TRUE){
3192 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3197 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3207 // Add the data to the General/Home/Work address variables.
3209 CaptureString(&PropertySeg2, FALSE);
3211 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3213 if (!PropertyTokens.IsEmpty()){
3215 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3221 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3223 std::map<int, int> SplitPoints;
3224 std::map<int, int> SplitLength;
3225 std::map<int, int>::iterator SLiter;
3226 wxString PropertyData;
3227 wxString PropertyName;
3228 wxString PropertyValue;
3229 wxString PropertyTokens;
3230 bool FirstToken = TRUE;
3231 int intPrevValue = 7;
3236 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3240 PropertyType PropType = PROPERTY_NONE;
3242 // Look for type before continuing.
3244 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3246 // Setup the pointers.
3248 std::map<int, wxString> *TitleList = NULL;
3249 std::map<int, wxString> *TitleListAltID = NULL;
3250 std::map<int, wxString> *TitleListPID = NULL;
3251 std::map<int, wxString> *TitleListType = NULL;
3252 std::map<int, wxString> *TitleListTokens = NULL;
3253 std::map<int, wxString> *TitleListLanguage = NULL;
3254 std::map<int, int> *TitleListPref = NULL;
3256 // Setup blank lines for later on.
3260 TitleList = &GeneralTitleList;
3261 TitleListType = &GeneralTitleListType;
3262 TitleListAltID = &GeneralTitleListAltID;
3263 TitleListPID = &GeneralTitleListPID;
3264 TitleListTokens = &GeneralTitleListTokens;
3265 TitleListLanguage = &GeneralTitleListLanguage;
3266 TitleListPref = &GeneralTitleListPref;
3269 TitleList = &HomeTitleList;
3270 TitleListType = &HomeTitleListType;
3271 TitleListAltID = &HomeTitleListAltID;
3272 TitleListPID = &HomeTitleListPID;
3273 TitleListTokens = &HomeTitleListTokens;
3274 TitleListLanguage = &HomeTitleListLanguage;
3275 TitleListPref = &HomeTitleListPref;
3278 TitleList = &BusinessTitleList;
3279 TitleListType = &BusinessTitleListType;
3280 TitleListAltID = &BusinessTitleListAltID;
3281 TitleListPID = &BusinessTitleListPID;
3282 TitleListTokens = &BusinessTitleListTokens;
3283 TitleListLanguage = &BusinessTitleListLanguage;
3284 TitleListPref = &BusinessTitleListPref;
3290 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3291 intiter != SplitPoints.end(); ++intiter){
3293 SLiter = SplitLength.find(intiter->first);
3295 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3297 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3298 PropertyName = PropertyElement.GetNextToken();
3299 PropertyValue = PropertyElement.GetNextToken();
3301 intPrevValue = intiter->second;
3303 // Process properties.
3305 size_t intPropertyValueLen = PropertyValue.Len();
3307 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3309 PropertyValue.Trim();
3310 PropertyValue.RemoveLast();
3314 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3316 PropertyValue.Remove(0, 1);
3320 CaptureString(&PropertyValue, FALSE);
3322 if (PropertyName == wxT("ALTID")){
3324 TitleListAltID->erase(*TitleCount);
3325 TitleListAltID->insert(std::make_pair(*TitleCount, PropertyValue));
3327 } else if (PropertyName == wxT("PID")){
3329 TitleListPID->erase(*TitleCount);
3330 TitleListPID->insert(std::make_pair(*TitleCount, PropertyValue));
3332 } else if (PropertyName == wxT("PREF")){
3334 ProcessIntegerValue(TitleListPref, &PropertyValue, TitleCount);
3336 } else if (PropertyName == wxT("LANGUAGE")){
3338 TitleListLanguage->erase(*TitleCount);
3339 TitleListLanguage->insert(std::make_pair(*TitleCount, PropertyValue));
3343 // Something else we don't know about so append
3344 // to the tokens variable.
3346 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3348 if (FirstToken == TRUE){
3350 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3355 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3365 // Add the data to the General/Home/Work address variables.
3367 CaptureString(&PropertySeg2, FALSE);
3369 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3371 if (!PropertyTokens.IsEmpty()){
3373 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3379 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3381 std::map<int, int> SplitPoints;
3382 std::map<int, int> SplitLength;
3383 std::map<int, int>::iterator SLiter;
3384 wxString PropertyData;
3385 wxString PropertyName;
3386 wxString PropertyValue;
3387 wxString PropertyTokens;
3388 bool FirstToken = TRUE;
3389 int intPrevValue = 6;
3394 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3398 PropertyType PropType = PROPERTY_NONE;
3400 // Look for type before continuing.
3402 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3404 // Setup the pointers.
3406 std::map<int, wxString> *RoleList = NULL;
3407 std::map<int, wxString> *RoleListAltID = NULL;
3408 std::map<int, wxString> *RoleListPID = NULL;
3409 std::map<int, wxString> *RoleListType = NULL;
3410 std::map<int, wxString> *RoleListTokens = NULL;
3411 std::map<int, wxString> *RoleListLanguage = NULL;
3412 std::map<int, int> *RoleListPref = NULL;
3414 // Setup blank lines for later on.
3418 RoleList = &GeneralRoleList;
3419 RoleListType = &GeneralRoleListType;
3420 RoleListAltID = &GeneralRoleListAltID;
3421 RoleListPID = &GeneralRoleListPID;
3422 RoleListTokens = &GeneralRoleListTokens;
3423 RoleListLanguage = &GeneralRoleListLanguage;
3424 RoleListPref = &GeneralRoleListPref;
3427 RoleList = &HomeRoleList;
3428 RoleListType = &HomeRoleListType;
3429 RoleListAltID = &HomeRoleListAltID;
3430 RoleListPID = &HomeRoleListPID;
3431 RoleListTokens = &HomeRoleListTokens;
3432 RoleListLanguage = &HomeRoleListLanguage;
3433 RoleListPref = &HomeRoleListPref;
3436 RoleList = &BusinessRoleList;
3437 RoleListType = &BusinessRoleListType;
3438 RoleListAltID = &BusinessRoleListAltID;
3439 RoleListPID = &BusinessRoleListPID;
3440 RoleListTokens = &BusinessRoleListTokens;
3441 RoleListLanguage = &BusinessRoleListLanguage;
3442 RoleListPref = &BusinessRoleListPref;
3448 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3449 intiter != SplitPoints.end(); ++intiter){
3451 SLiter = SplitLength.find(intiter->first);
3453 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3455 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3456 PropertyName = PropertyElement.GetNextToken();
3457 PropertyValue = PropertyElement.GetNextToken();
3459 intPrevValue = intiter->second;
3461 // Process properties.
3463 size_t intPropertyValueLen = PropertyValue.Len();
3465 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3467 PropertyValue.Trim();
3468 PropertyValue.RemoveLast();
3472 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3474 PropertyValue.Remove(0, 1);
3478 CaptureString(&PropertyValue, FALSE);
3480 if (PropertyName == wxT("ALTID")){
3482 RoleListAltID->erase(*RoleCount);
3483 RoleListAltID->insert(std::make_pair(*RoleCount, PropertyValue));
3485 } else if (PropertyName == wxT("PID")){
3487 RoleListPID->erase(*RoleCount);
3488 RoleListPID->insert(std::make_pair(*RoleCount, PropertyValue));
3490 } else if (PropertyName == wxT("PREF")){
3492 ProcessIntegerValue(RoleListPref, &PropertyValue, RoleCount);
3494 } else if (PropertyName == wxT("LANGUAGE")){
3496 RoleListLanguage->erase(*RoleCount);
3497 RoleListLanguage->insert(std::make_pair(*RoleCount, PropertyValue));
3501 // Something else we don't know about so append
3502 // to the tokens variable.
3504 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3506 if (FirstToken == TRUE){
3508 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3513 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3523 // Add the data to the General/Home/Work address variables.
3525 CaptureString(&PropertySeg2, FALSE);
3527 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3529 if (!PropertyTokens.IsEmpty()){
3531 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3537 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3539 std::map<int, int> SplitPoints;
3540 std::map<int, int> SplitLength;
3541 std::map<int, int>::iterator SLiter;
3542 wxString PropertyData;
3543 wxString PropertyName;
3544 wxString PropertyValue;
3545 wxString PropertyTokens;
3546 bool FirstToken = TRUE;
3547 int intPrevValue = 5;
3552 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3556 PropertyType PropType = PROPERTY_NONE;
3558 // Look for type before continuing.
3560 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3562 // Setup the pointers.
3564 std::map<int, wxString> *OrganisationsList = NULL;
3565 std::map<int, wxString> *OrganisationsListAltID = NULL;
3566 std::map<int, wxString> *OrganisationsListPID = NULL;
3567 std::map<int, wxString> *OrganisationsListType = NULL;
3568 std::map<int, wxString> *OrganisationsListTokens = NULL;
3569 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3570 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3571 std::map<int, int> *OrganisationsListPref = NULL;
3573 // Setup blank lines for later on.
3577 OrganisationsList = &GeneralOrganisationsList;
3578 OrganisationsListType = &GeneralOrganisationsListType;
3579 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3580 OrganisationsListPID = &GeneralOrganisationsListPID;
3581 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3582 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3583 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3584 OrganisationsListPref = &GeneralOrganisationsListPref;
3587 OrganisationsList = &HomeOrganisationsList;
3588 OrganisationsListType = &HomeOrganisationsListType;
3589 OrganisationsListAltID = &HomeOrganisationsListAltID;
3590 OrganisationsListPID = &HomeOrganisationsListPID;
3591 OrganisationsListTokens = &HomeOrganisationsListTokens;
3592 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3593 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3594 OrganisationsListPref = &HomeOrganisationsListPref;
3597 OrganisationsList = &BusinessOrganisationsList;
3598 OrganisationsListType = &BusinessOrganisationsListType;
3599 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3600 OrganisationsListPID = &BusinessOrganisationsListPID;
3601 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3602 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3603 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3604 OrganisationsListPref = &BusinessOrganisationsListPref;
3610 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3611 intiter != SplitPoints.end(); ++intiter){
3613 SLiter = SplitLength.find(intiter->first);
3615 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3617 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3618 PropertyName = PropertyElement.GetNextToken();
3619 PropertyValue = PropertyElement.GetNextToken();
3621 intPrevValue = intiter->second;
3623 // Process properties.
3625 size_t intPropertyValueLen = PropertyValue.Len();
3627 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3629 PropertyValue.Trim();
3630 PropertyValue.RemoveLast();
3634 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3636 PropertyValue.Remove(0, 1);
3640 CaptureString(&PropertyValue, FALSE);
3642 if (PropertyName == wxT("ALTID")){
3644 OrganisationsListAltID->erase(*OrganisationCount);
3645 OrganisationsListAltID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3647 } else if (PropertyName == wxT("PID")){
3649 OrganisationsListPID->erase(*OrganisationCount);
3650 OrganisationsListPID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3652 } else if (PropertyName == wxT("SORT-AS")){
3654 OrganisationsListSortAs->erase(*OrganisationCount);
3655 OrganisationsListSortAs->insert(std::make_pair(*OrganisationCount, PropertyValue));
3657 } else if (PropertyName == wxT("PREF")){
3659 ProcessIntegerValue(OrganisationsListPref, &PropertyValue, OrganisationCount);
3661 } else if (PropertyName == wxT("LANGUAGE")){
3663 OrganisationsListLanguage->erase(*OrganisationCount);
3664 OrganisationsListLanguage->insert(std::make_pair(*OrganisationCount, PropertyValue));
3668 // Something else we don't know about so append
3669 // to the tokens variable.
3671 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3673 if (FirstToken == TRUE){
3675 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3680 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3690 // Add the data to the General/Home/Work address variables.
3692 CaptureString(&PropertySeg2, FALSE);
3694 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3696 if (!PropertyTokens.IsEmpty()){
3698 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3704 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3706 std::map<int, int> SplitPoints;
3707 std::map<int, int> SplitLength;
3708 std::map<int, int>::iterator SLiter;
3709 wxString PropertyData;
3710 wxString PropertyName;
3711 wxString PropertyValue;
3712 wxString PropertyTokens;
3713 bool FirstToken = TRUE;
3714 int intPrevValue = 6;
3719 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3723 PropertyType PropType = PROPERTY_NONE;
3725 // Look for type before continuing.
3727 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3729 // Setup the pointers.
3731 std::map<int, wxString> *NoteList = NULL;
3732 std::map<int, wxString> *NoteListAltID = NULL;
3733 std::map<int, wxString> *NoteListPID = NULL;
3734 std::map<int, wxString> *NoteListType = NULL;
3735 std::map<int, wxString> *NoteListTokens = NULL;
3736 std::map<int, wxString> *NoteListLanguage = NULL;
3737 std::map<int, int> *NoteListPref = NULL;
3739 // Setup blank lines for later on.
3743 NoteList = &GeneralNoteList;
3744 NoteListType = &GeneralNoteListType;
3745 NoteListAltID = &GeneralNoteListAltID;
3746 NoteListPID = &GeneralNoteListPID;
3747 NoteListTokens = &GeneralNoteListTokens;
3748 NoteListLanguage = &GeneralNoteListLanguage;
3749 NoteListPref = &GeneralNoteListPref;
3752 NoteList = &HomeNoteList;
3753 NoteListType = &HomeNoteListType;
3754 NoteListAltID = &HomeNoteListAltID;
3755 NoteListPID = &HomeNoteListPID;
3756 NoteListTokens = &HomeNoteListTokens;
3757 NoteListLanguage = &HomeNoteListLanguage;
3758 NoteListPref = &HomeNoteListPref;
3761 NoteList = &BusinessNoteList;
3762 NoteListType = &BusinessNoteListType;
3763 NoteListAltID = &BusinessNoteListAltID;
3764 NoteListPID = &BusinessNoteListPID;
3765 NoteListTokens = &BusinessNoteListTokens;
3766 NoteListLanguage = &BusinessNoteListLanguage;
3767 NoteListPref = &BusinessNoteListPref;
3773 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3774 intiter != SplitPoints.end(); ++intiter){
3776 SLiter = SplitLength.find(intiter->first);
3778 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3780 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3781 PropertyName = PropertyElement.GetNextToken();
3782 PropertyValue = PropertyElement.GetNextToken();
3784 intPrevValue = intiter->second;
3786 // Process properties.
3788 size_t intPropertyValueLen = PropertyValue.Len();
3790 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3792 PropertyValue.Trim();
3793 PropertyValue.RemoveLast();
3797 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3799 PropertyValue.Remove(0, 1);
3803 CaptureString(&PropertyValue, FALSE);
3805 if (PropertyName == wxT("ALTID")){
3807 NoteListAltID->erase(*NoteCount);
3808 NoteListAltID->insert(std::make_pair(*NoteCount, PropertyValue));
3810 } else if (PropertyName == wxT("PID")){
3812 NoteListPID->erase(*NoteCount);
3813 NoteListPID->insert(std::make_pair(*NoteCount, PropertyValue));
3815 } else if (PropertyName == wxT("PREF")){
3817 ProcessIntegerValue(NoteListPref, &PropertyValue, NoteCount);
3819 } else if (PropertyName == wxT("LANGUAGE")){
3821 NoteListLanguage->erase(*NoteCount);
3822 NoteListLanguage->insert(std::make_pair(*NoteCount, PropertyValue));
3826 // Something else we don't know about so append
3827 // to the tokens variable.
3829 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3831 if (FirstToken == TRUE){
3833 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3838 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3848 // Add the data to the General/Home/Work address variables.
3850 CaptureString(&PropertySeg2, FALSE);
3852 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3854 if (!PropertyTokens.IsEmpty()){
3856 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3862 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3864 std::map<int, int> SplitPoints;
3865 std::map<int, int> SplitLength;
3866 std::map<int, int>::iterator SLiter;
3867 wxString PropertyData;
3868 wxString PropertyName;
3869 wxString PropertyValue;
3870 wxString PropertyTokens;
3871 bool FirstToken = TRUE;
3872 int intPrevValue = 12;
3877 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3881 PropertyType PropType = PROPERTY_NONE;
3883 // Look for type before continuing.
3885 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3887 // Setup blank lines for later on.
3893 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3896 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3902 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3903 intiter != SplitPoints.end(); ++intiter){
3905 SLiter = SplitLength.find(intiter->first);
3907 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3909 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3910 PropertyName = PropertyElement.GetNextToken();
3911 PropertyValue = PropertyElement.GetNextToken();
3913 intPrevValue = intiter->second;
3915 // Process properties.
3917 size_t intPropertyValueLen = PropertyValue.Len();
3919 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3921 PropertyValue.Trim();
3922 PropertyValue.RemoveLast();
3926 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3928 PropertyValue.Remove(0, 1);
3932 CaptureString(&PropertyValue, FALSE);
3934 if (PropertyName == wxT("ALTID")){
3936 CategoriesListAltID.erase(*CategoryCount);
3937 CategoriesListAltID.insert(std::make_pair(*CategoryCount, PropertyValue));
3939 } else if (PropertyName == wxT("PID")){
3941 CategoriesListPID.erase(*CategoryCount);
3942 CategoriesListPID.insert(std::make_pair(*CategoryCount, PropertyValue));
3944 } else if (PropertyName == wxT("PREF")){
3946 ProcessIntegerValue(&CategoriesListPref, &PropertyValue, CategoryCount);
3948 } else if (PropertyName == wxT("LANGUAGE")){
3950 CategoriesListLanguage.erase(*CategoryCount);
3951 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, PropertyValue));
3955 // Something else we don't know about so append
3956 // to the tokens variable.
3958 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3960 if (FirstToken == TRUE){
3962 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3967 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3977 // Deal with multiple categories.
3979 int intOrigCatCount = *CategoryCount;
3980 bool FirstCategoryProcessed = TRUE;
3981 bool AfterFirstToken = FALSE;
3982 int intSplitSize = 0;
3983 int intSplitsFound = 0;
3984 int intSplitSeek = 0;
3985 int intPropertyLen = PropertySeg2.Len();
3987 SplitPoints.clear();
3988 SplitLength.clear();
3991 for (int i = 0; i <= intPropertyLen; i++){
3993 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
4001 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4003 if (AfterFirstToken == TRUE){
4005 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
4006 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
4010 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
4011 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
4012 AfterFirstToken = TRUE;
4024 if (SplitPoints.size() > 0){
4026 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
4027 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
4031 if (SplitPoints.size() == 0){
4033 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
4035 if (!PropertyTokens.IsEmpty()){
4037 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4043 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4044 intiter != SplitPoints.end(); ++intiter){
4046 SLiter = SplitLength.find(intiter->first);
4048 intPrevValue = intiter->second;
4050 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
4052 // Add the data to the General/Home/Work address variables.
4054 // Trim any whitespace from the start and end.
4056 PropertyData = PropertyData.Trim(FALSE);
4057 PropertyData = PropertyData.Trim(TRUE);
4059 CaptureString(&PropertyData, FALSE);
4061 if (FirstCategoryProcessed == TRUE){
4063 FirstCategoryProcessed = FALSE;
4065 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4067 if (!PropertyTokens.IsEmpty()){
4069 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4079 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4081 if (!PropertyTokens.IsEmpty()){
4083 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4089 // Copy the properties to each of the categories (if it exists).
4091 if (!PropertyTokens.IsEmpty()){
4093 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
4097 // Check if ALTID was used.
4099 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
4101 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
4105 // Check if PID was used.
4107 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
4109 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
4113 // Check if PREF was used.
4115 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
4117 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
4121 // Check if LANGUAGE was used.
4123 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
4125 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
4129 // Check if TYPE was used.
4135 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
4138 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
4146 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
4148 size_t intPropertyLen = PropertySeg1.Len();
4149 std::map<int, int> SplitPoints;
4150 std::map<int, int> SplitLength;
4151 std::map<int, int>::iterator SLiter;
4152 wxString PropertyData;
4153 wxString PropertyName;
4154 wxString PropertyValue;
4155 wxString PropertyTokens;
4156 bool FirstToken = TRUE;
4157 int intSplitsFound = 0;
4158 int intSplitSize = 0;
4159 int intPrevValue = 7;
4163 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4167 PropertyType PropType = PROPERTY_NONE;
4169 // Look for type before continuing.
4171 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4175 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4176 intiter != SplitPoints.end(); ++intiter){
4178 SLiter = SplitLength.find(intiter->first);
4180 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4182 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4183 PropertyName = PropertyElement.GetNextToken();
4184 PropertyValue = PropertyElement.GetNextToken();
4186 intPrevValue = intiter->second;
4188 // Process properties.
4190 size_t intPropertyValueLen = PropertyValue.Len();
4192 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4194 PropertyValue.Trim();
4195 PropertyValue.RemoveLast();
4199 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4201 PropertyValue.Remove(0, 1);
4205 CaptureString(&PropertyValue, FALSE);
4207 if (PropertyName == wxT("ALTID")){
4209 PicturesListAltID.erase(*PhotoCount);
4210 PicturesListAltID.insert(std::make_pair(*PhotoCount, PropertyValue));
4212 } else if (PropertyName == wxT("PID")){
4214 PicturesListPID.erase(*PhotoCount);
4215 PicturesListPID.insert(std::make_pair(*PhotoCount, PropertyValue));
4217 } else if (PropertyName == wxT("PREF")){
4219 ProcessIntegerValue(&PicturesListPref, &PropertyValue, PhotoCount);
4221 } else if (PropertyName == wxT("MEDIATYPE")){
4223 PicturesListMediatype.erase(*PhotoCount);
4224 PicturesListMediatype.insert(std::make_pair(*PhotoCount, PropertyValue));
4228 // Something else we don't know about so append
4229 // to the tokens variable.
4231 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4233 if (FirstToken == TRUE){
4235 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4240 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4250 intPropertyLen = PropertySeg2.Len();
4251 SplitPoints.clear();
4252 SplitLength.clear();
4257 CaptureString(&PropertySeg2, FALSE);
4259 for (int i = 0; i <= intPropertyLen; i++){
4263 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4266 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4268 if (intSplitsFound == 6){
4270 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4275 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4285 wxString wxSPhotoURI;
4286 wxString wxSPhotoMIME;
4287 wxString wxSPhotoEncoding;
4288 wxString wxSPhotoData;
4289 std::string base64enc;
4291 if (intSplitsFound == 0){
4295 std::map<int, int>::iterator striter;
4297 striter = SplitLength.find(1);
4299 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4301 while (wSTDataType.HasMoreTokens() == TRUE){
4303 wxSPhotoURI = wSTDataType.GetNextToken();
4304 wxSPhotoMIME = wSTDataType.GetNextToken();
4309 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4311 while (wSTDataInfo.HasMoreTokens() == TRUE){
4313 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4314 wxSPhotoData = wSTDataInfo.GetNextToken();
4315 base64enc = wxSPhotoData.mb_str();
4322 // Add the data to the General/Home/Work address variables.
4324 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4325 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4326 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4332 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4335 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4339 if (!PropertyTokens.IsEmpty()){
4341 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4347 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4349 size_t intPropertyLen = PropertySeg1.Len();
4350 std::map<int, int> SplitPoints;
4351 std::map<int, int> SplitLength;
4352 std::map<int, int>::iterator SLiter;
4353 wxString PropertyData;
4354 wxString PropertyName;
4355 wxString PropertyValue;
4356 wxString PropertyTokens;
4357 bool FirstToken = TRUE;
4358 int intSplitsFound = 0;
4359 int intSplitSize = 0;
4360 int intPrevValue = 6;
4364 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4368 PropertyType PropType = PROPERTY_NONE;
4370 // Look for type before continuing.
4372 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4376 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4377 intiter != SplitPoints.end(); ++intiter){
4379 SLiter = SplitLength.find(intiter->first);
4381 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4383 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4384 PropertyName = PropertyElement.GetNextToken();
4385 PropertyValue = PropertyElement.GetNextToken();
4387 intPrevValue = intiter->second;
4389 // Process properties.
4391 size_t intPropertyValueLen = PropertyValue.Len();
4393 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4395 PropertyValue.Trim();
4396 PropertyValue.RemoveLast();
4400 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4402 PropertyValue.Remove(0, 1);
4406 CaptureString(&PropertyValue, FALSE);
4408 if (PropertyName == wxT("ALTID")){
4410 LogosListAltID.erase(*LogoCount);
4411 LogosListAltID.insert(std::make_pair(*LogoCount, PropertyValue));
4413 } else if (PropertyName == wxT("PID")){
4415 LogosListPID.erase(*LogoCount);
4416 LogosListPID.insert(std::make_pair(*LogoCount, PropertyValue));
4418 } else if (PropertyName == wxT("PREF")){
4420 ProcessIntegerValue(&LogosListPref, &PropertyValue, LogoCount);
4422 } else if (PropertyName == wxT("MEDIATYPE")){
4424 LogosListMediatype.erase(*LogoCount);
4425 LogosListMediatype.insert(std::make_pair(*LogoCount, PropertyValue));
4429 // Something else we don't know about so append
4430 // to the tokens variable.
4432 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4434 if (FirstToken == TRUE){
4436 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4441 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4451 intPropertyLen = PropertySeg2.Len();
4452 SplitPoints.clear();
4453 SplitLength.clear();
4458 CaptureString(&PropertySeg2, FALSE);
4460 for (int i = 0; i <= intPropertyLen; i++){
4464 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4467 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4469 if (intSplitsFound == 6){
4471 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4476 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4486 wxString wxSPhotoURI;
4487 wxString wxSPhotoMIME;
4488 wxString wxSPhotoEncoding;
4489 wxString wxSPhotoData;
4490 std::string base64enc;
4492 if (intSplitsFound == 0){
4496 std::map<int, int>::iterator striter;
4498 striter = SplitLength.find(1);
4500 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4502 while (wSTDataType.HasMoreTokens() == TRUE){
4504 wxSPhotoURI = wSTDataType.GetNextToken();
4505 wxSPhotoMIME = wSTDataType.GetNextToken();
4510 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4512 while (wSTDataInfo.HasMoreTokens() == TRUE){
4514 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4515 wxSPhotoData = wSTDataInfo.GetNextToken();
4516 base64enc = wxSPhotoData.mb_str();
4523 // Add the data to the General/Home/Work address variables.
4525 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4526 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4527 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4533 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4536 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4540 if (!PropertyTokens.IsEmpty()){
4542 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4548 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4550 size_t intPropertyLen = PropertySeg1.Len();
4551 std::map<int, int> SplitPoints;
4552 std::map<int, int> SplitLength;
4553 std::map<int, int>::iterator SLiter;
4554 wxString PropertyData;
4555 wxString PropertyName;
4556 wxString PropertyValue;
4557 wxString PropertyTokens;
4558 bool FirstToken = TRUE;
4559 int intSplitsFound = 0;
4560 int intSplitSize = 0;
4561 int intPrevValue = 7;
4565 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4569 PropertyType PropType = PROPERTY_NONE;
4571 // Look for type before continuing.
4573 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4577 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4578 intiter != SplitPoints.end(); ++intiter){
4580 SLiter = SplitLength.find(intiter->first);
4582 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4584 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4585 PropertyName = PropertyElement.GetNextToken();
4586 PropertyValue = PropertyElement.GetNextToken();
4588 intPrevValue = intiter->second;
4590 // Process properties.
4592 size_t intPropertyValueLen = PropertyValue.Len();
4594 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4596 PropertyValue.Trim();
4597 PropertyValue.RemoveLast();
4601 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4603 PropertyValue.Remove(0, 1);
4607 CaptureString(&PropertyValue, FALSE);
4609 if (PropertyName == wxT("ALTID")){
4611 SoundsListAltID.erase(*SoundCount);
4612 SoundsListAltID.insert(std::make_pair(*SoundCount, PropertyValue));
4614 } else if (PropertyName == wxT("PID")){
4616 SoundsListPID.erase(*SoundCount);
4617 SoundsListPID.insert(std::make_pair(*SoundCount, PropertyValue));
4619 } else if (PropertyName == wxT("PREF")){
4621 ProcessIntegerValue(&SoundsListPref, &PropertyValue, SoundCount);
4623 } else if (PropertyName == wxT("MEDIATYPE")){
4625 SoundsListMediatype.erase(*SoundCount);
4626 SoundsListMediatype.insert(std::make_pair(*SoundCount, PropertyValue));
4628 } else if (PropertyName == wxT("LANGUAGE")){
4630 SoundsListLanguage.erase(*SoundCount);
4631 SoundsListLanguage.insert(std::make_pair(*SoundCount, PropertyValue));
4635 // Something else we don't know about so append
4636 // to the tokens variable.
4638 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4640 if (FirstToken == TRUE){
4642 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4647 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4657 intPropertyLen = PropertySeg2.Len();
4658 SplitPoints.clear();
4659 SplitLength.clear();
4664 CaptureString(&PropertySeg2, FALSE);
4666 for (int i = 0; i <= intPropertyLen; i++){
4670 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4673 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4675 if (intSplitsFound == 6){
4677 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4682 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4692 wxString wxSSoundURI;
4693 wxString wxSSoundMIME;
4694 wxString wxSSoundEncoding;
4695 wxString wxSSoundData;
4696 std::string base64enc;
4698 if (intSplitsFound == 0){
4702 std::map<int, int>::iterator striter;
4704 striter = SplitLength.find(1);
4706 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4708 while (wSTDataType.HasMoreTokens() == TRUE){
4710 wxSSoundURI = wSTDataType.GetNextToken();
4711 wxSSoundMIME = wSTDataType.GetNextToken();
4716 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4718 while (wSTDataInfo.HasMoreTokens() == TRUE){
4720 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4721 wxSSoundData = wSTDataInfo.GetNextToken();
4722 base64enc = wxSSoundData.mb_str();
4729 // Add the data to the General/Home/Work address variables.
4735 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4738 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4742 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4743 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4744 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4746 if (!PropertyTokens.IsEmpty()){
4748 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4754 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4756 size_t intPropertyLen = PropertySeg1.Len();
4757 std::map<int, int> SplitPoints;
4758 std::map<int, int> SplitLength;
4759 std::map<int, int>::iterator SLiter;
4760 wxString PropertyData;
4761 wxString PropertyName;
4762 wxString PropertyValue;
4763 wxString PropertyTokens;
4764 bool FirstToken = TRUE;
4765 int intSplitsFound = 0;
4766 int intSplitSize = 0;
4767 int intPrevValue = 8;
4771 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4775 PropertyType PropType = PROPERTY_NONE;
4777 // Look for type before continuing.
4779 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4783 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4784 intiter != SplitPoints.end(); ++intiter){
4786 SLiter = SplitLength.find(intiter->first);
4788 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4790 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4791 PropertyName = PropertyElement.GetNextToken();
4792 PropertyValue = PropertyElement.GetNextToken();
4794 intPrevValue = intiter->second;
4796 // Process properties.
4798 size_t intPropertyValueLen = PropertyValue.Len();
4800 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4802 PropertyValue.Trim();
4803 PropertyValue.RemoveLast();
4807 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4809 PropertyValue.Remove(0, 1);
4813 CaptureString(&PropertyValue, FALSE);
4815 if (PropertyName == wxT("ALTID")){
4817 CalendarListAltID.erase(*CalURICount);
4818 CalendarListAltID.insert(std::make_pair(*CalURICount, PropertyValue));
4820 } else if (PropertyName == wxT("PID")){
4822 CalendarListPID.erase(*CalURICount);
4823 CalendarListPID.insert(std::make_pair(*CalURICount, PropertyValue));
4825 } else if (PropertyName == wxT("PREF")){
4827 ProcessIntegerValue(&CalendarListPref, &PropertyValue, CalURICount);
4829 } else if (PropertyName == wxT("MEDIATYPE")){
4831 CalendarListMediatype.erase(*CalURICount);
4832 CalendarListMediatype.insert(std::make_pair(*CalURICount, PropertyValue));
4836 // Something else we don't know about so append
4837 // to the tokens variable.
4839 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4841 if (FirstToken == TRUE){
4843 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4848 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4858 intPropertyLen = PropertySeg2.Len();
4859 SplitPoints.clear();
4860 SplitLength.clear();
4865 CaptureString(&PropertySeg2, FALSE);
4867 // Add the data to the General/Home/Work address variables.
4873 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4876 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4880 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4882 if (!PropertyTokens.IsEmpty()){
4884 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4890 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4892 size_t intPropertyLen = PropertySeg1.Len();
4893 std::map<int, int> SplitPoints;
4894 std::map<int, int> SplitLength;
4895 std::map<int, int>::iterator SLiter;
4896 wxString PropertyData;
4897 wxString PropertyName;
4898 wxString PropertyValue;
4899 wxString PropertyTokens;
4900 bool FirstToken = TRUE;
4901 int intSplitsFound = 0;
4902 int intSplitSize = 0;
4903 int intPrevValue = 8;
4907 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4911 PropertyType PropType = PROPERTY_NONE;
4913 // Look for type before continuing.
4915 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4919 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4920 intiter != SplitPoints.end(); ++intiter){
4922 SLiter = SplitLength.find(intiter->first);
4924 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4926 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4927 PropertyName = PropertyElement.GetNextToken();
4928 PropertyValue = PropertyElement.GetNextToken();
4930 intPrevValue = intiter->second;
4932 // Process properties.
4934 size_t intPropertyValueLen = PropertyValue.Len();
4936 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4938 PropertyValue.Trim();
4939 PropertyValue.RemoveLast();
4943 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4945 PropertyValue.Remove(0, 1);
4949 CaptureString(&PropertyValue, FALSE);
4951 if (PropertyName == wxT("ALTID")){
4953 CalendarRequestListAltID.erase(*CalAdrURICount);
4954 CalendarRequestListAltID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
4956 } else if (PropertyName == wxT("PID")){
4958 CalendarRequestListPID.erase(*CalAdrURICount);
4959 CalendarRequestListPID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
4961 } else if (PropertyName == wxT("PREF")){
4963 ProcessIntegerValue(&CalendarRequestListPref, &PropertyValue, CalAdrURICount);
4965 } else if (PropertyName == wxT("MEDIATYPE")){
4967 CalendarRequestListMediatype.erase(*CalAdrURICount);
4968 CalendarRequestListMediatype.insert(std::make_pair(*CalAdrURICount, PropertyValue));
4972 // Something else we don't know about so append
4973 // to the tokens variable.
4975 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4977 if (FirstToken == TRUE){
4979 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4984 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4994 intPropertyLen = PropertySeg2.Len();
4995 SplitPoints.clear();
4996 SplitLength.clear();
5001 CaptureString(&PropertySeg2, FALSE);
5003 // Add the data to the General/Home/Work address variables.
5009 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
5012 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
5016 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
5018 if (!PropertyTokens.IsEmpty()){
5020 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
5026 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
5028 size_t intPropertyLen = PropertySeg1.Len();
5029 std::map<int, int> SplitPoints;
5030 std::map<int, int> SplitLength;
5031 std::map<int, int>::iterator SLiter;
5032 wxString PropertyData;
5033 wxString PropertyName;
5034 wxString PropertyValue;
5035 wxString PropertyTokens;
5036 bool FirstToken = TRUE;
5037 int intSplitsFound = 0;
5038 int intSplitSize = 0;
5039 int intPrevValue = 7;
5043 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5047 PropertyType PropType = PROPERTY_NONE;
5049 // Look for type before continuing.
5051 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5055 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5056 intiter != SplitPoints.end(); ++intiter){
5058 SLiter = SplitLength.find(intiter->first);
5060 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5062 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5063 PropertyName = PropertyElement.GetNextToken();
5064 PropertyValue = PropertyElement.GetNextToken();
5066 intPrevValue = intiter->second;
5068 // Process properties.
5070 size_t intPropertyValueLen = PropertyValue.Len();
5072 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5074 PropertyValue.Trim();
5075 PropertyValue.RemoveLast();
5079 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5081 PropertyValue.Remove(0, 1);
5085 CaptureString(&PropertyValue, FALSE);
5087 if (PropertyName == wxT("ALTID")){
5089 FreeBusyListAltID.erase(*FreeBusyAddressCount);
5090 FreeBusyListAltID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5092 } else if (PropertyName == wxT("PID")){
5094 FreeBusyListPID.erase(*FreeBusyAddressCount);
5095 FreeBusyListPID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5097 } else if (PropertyName == wxT("PREF")){
5099 ProcessIntegerValue(&FreeBusyListPref, &PropertyValue, FreeBusyAddressCount);
5101 } else if (PropertyName == wxT("MEDIATYPE")){
5103 FreeBusyListMediatype.erase(*FreeBusyAddressCount);
5104 FreeBusyListMediatype.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5108 // Something else we don't know about so append
5109 // to the tokens variable.
5111 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5113 if (FirstToken == TRUE){
5115 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5120 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5130 intPropertyLen = PropertySeg2.Len();
5131 SplitPoints.clear();
5132 SplitLength.clear();
5137 CaptureString(&PropertySeg2, FALSE);
5139 // Add the data to the General/Home/Work address variables.
5145 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
5148 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
5152 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
5154 if (!PropertyTokens.IsEmpty()){
5156 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
5162 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
5164 size_t intPropertyLen = PropertySeg1.Len();
5165 std::map<int, int> SplitPoints;
5166 std::map<int, int> SplitLength;
5167 std::map<int, int>::iterator SLiter;
5168 wxString PropertyData;
5169 wxString PropertyName;
5170 wxString PropertyValue;
5171 wxString PropertyTokens;
5172 bool FirstToken = TRUE;
5173 int intSplitsFound = 0;
5174 int intSplitSize = 0;
5175 int intPrevValue = 5;
5180 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5184 PropertyType PropType = PROPERTY_NONE;
5186 // Look for type before continuing.
5188 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5192 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5193 intiter != SplitPoints.end(); ++intiter){
5195 SLiter = SplitLength.find(intiter->first);
5197 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5199 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5200 PropertyName = PropertyElement.GetNextToken();
5201 PropertyValue = PropertyElement.GetNextToken();
5203 intPrevValue = intiter->second;
5205 // Process properties.
5207 size_t intPropertyValueLen = PropertyValue.Len();
5209 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5211 PropertyValue.Trim();
5212 PropertyValue.RemoveLast();
5216 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5218 PropertyValue.Remove(0, 1);
5222 if (PropertyName == wxT("ALTID")){
5224 KeyListAltID.erase(*KeyCount);
5225 KeyListAltID.insert(std::make_pair(*KeyCount, PropertyValue));
5227 } else if (PropertyName == wxT("PID")){
5229 KeyListPID.erase(*KeyCount);
5230 KeyListPID.insert(std::make_pair(*KeyCount, PropertyValue));
5232 } else if (PropertyName == wxT("PREF")){
5234 ProcessIntegerValue(&KeyListPref, &PropertyValue, KeyCount);
5238 // Something else we don't know about so append
5239 // to the tokens variable.
5241 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5243 if (FirstToken == TRUE){
5245 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5250 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5260 intPropertyLen = PropertySeg2.Len();
5261 SplitPoints.clear();
5262 SplitLength.clear();
5267 for (int i = 0; i <= intPropertyLen; i++){
5271 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
5274 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
5276 if (intSplitsFound == 6){
5278 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5283 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5294 wxString wxSKeyMIME;
5295 wxString wxSKeyEncoding;
5296 wxString wxSKeyData;
5297 std::string base64enc;
5299 if (intSplitsFound == 0){
5303 std::map<int, int>::iterator striter;
5305 striter = SplitLength.find(1);
5307 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
5309 while (wSTDataType.HasMoreTokens() == TRUE){
5311 wxSKeyURI = wSTDataType.GetNextToken();
5312 wxSKeyMIME = wSTDataType.GetNextToken();
5317 if (wxSKeyURI == wxT("data")){
5319 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
5321 while (wSTDataInfo.HasMoreTokens() == TRUE){
5323 wxSKeyEncoding = wSTDataInfo.GetNextToken();
5324 wxSKeyData = wSTDataInfo.GetNextToken();
5333 // Add the data to the General/Home/Work address variables.
5335 if (wxSKeyURI == wxT("data")){
5337 KeyListDataEncType.erase(*KeyCount);
5338 KeyListKeyType.erase(*KeyCount);
5339 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
5340 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
5342 KeyList.erase(*KeyCount);
5343 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
5347 KeyList.erase(*KeyCount);
5348 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
5352 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
5358 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
5361 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
5365 if (!PropertyTokens.IsEmpty()){
5367 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
5373 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
5375 // Split the Vendor three ways.
5377 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
5380 wxString wxSVNDPropName;
5383 while (wSTVendorDetails.HasMoreTokens() == TRUE){
5385 wSTVendorDetails.GetNextToken();
5386 wxSVNDID = wSTVendorDetails.GetNextToken();
5387 wxSVNDPropName = wSTVendorDetails.GetNextToken();
5392 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
5394 // Add the data to the vendor variables.
5396 VendorList.erase(*VendorCount);
5397 VendorListPEN.erase(*VendorCount);
5398 VendorListElement.erase(*VendorCount);
5400 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
5401 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
5402 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
5408 void ProcessStringValue(wxString *PropertyName,
5409 wxString PropertyNameMatch,
5410 std::map<int,wxString> *MapPtr,
5411 wxString *PropertyValue,
5413 bool *PropertyMatched){
5415 if (*PropertyName == PropertyNameMatch){
5416 MapPtr->erase(*ItemCount);
5417 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5418 *PropertyMatched = TRUE;
5423 void ProcessIntegerValue(wxString *PropertyName,
5424 wxString PropertyNameMatch,
5425 std::map<int,int> *PrefPtr,
5426 wxString *PropertyValue,
5428 bool *PropertyMatched){
5430 if (*PropertyName == PropertyNameMatch){
5431 *PropertyMatched = TRUE;
5436 int PriorityNumber = 0;
5437 bool ValidNumber = TRUE;
5440 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5443 catch(std::invalid_argument &e){
5444 ValidNumber = FALSE;
5447 if (ValidNumber == TRUE){
5449 PrefPtr->erase(*ItemCount);
5450 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5456 void ProcessIntegerValue(std::map<int,int> *PrefPtr,
5457 wxString *PropertyValue,
5460 int PriorityNumber = 0;
5461 bool ValidNumber = TRUE;
5464 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5467 catch(std::invalid_argument &e){
5468 ValidNumber = FALSE;
5471 if (ValidNumber == TRUE){
5473 PrefPtr->erase(*ItemCount);
5474 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5480 void SplitValues(wxString *PropertyLine,
5481 std::map<int,int> *SplitPoints,
5482 std::map<int,int> *SplitLength,
5485 size_t intPropertyLen = PropertyLine->Len();
5486 int intSplitsFound = 0;
5487 int intSplitSize = 0;
5488 int intSplitSeek = 0;
5490 for (int i = intSize; i <= intPropertyLen; i++){
5494 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5495 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5497 if (intSplitsFound == 0){
5499 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5503 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5507 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5517 if (intSplitsFound == 0){
5519 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5520 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5524 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5525 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5531 void CheckType(wxString *PropertySeg1,
5532 std::map<int,int> *SplitPoints,
5533 std::map<int,int> *SplitLength,
5535 PropertyType *PropType){
5537 wxString PropertyData;
5538 wxString PropertyName;
5539 wxString PropertyValue;
5540 std::map<int,int>::iterator SLiter;
5542 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5543 intiter != SplitPoints->end(); ++intiter){
5545 SLiter = SplitLength->find(intiter->first);
5547 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5549 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5550 PropertyName = PropertyElement.GetNextToken();
5551 PropertyValue = PropertyElement.GetNextToken();
5553 *intPrevValue = intiter->second;
5555 if (PropertyName == wxT("TYPE")){
5557 if (PropertyValue == wxT("work")){
5559 *PropType = PROPERTY_WORK;
5561 } else if (PropertyValue == wxT("home")){
5563 *PropType = PROPERTY_HOME;
5567 *PropType = PROPERTY_NONE;