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 size_t intPropertyValueLen = PropertyValue.Len();
1073 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1075 PropertyValue.Trim();
1076 PropertyValue.RemoveLast();
1080 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1082 PropertyValue.Remove(0, 1);
1086 CaptureString(&PropertyValue, FALSE);
1088 if (PropertyName.IsEmpty() || PropertyName.IsEmpty()){
1094 if (FirstToken == TRUE){
1096 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1101 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1107 CaptureString(&PropertySeg2, FALSE);
1109 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
1111 if (!PropertyTokens.IsEmpty()){
1113 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
1119 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
1121 std::map<int, int> SplitPoints;
1122 std::map<int, int> SplitLength;
1124 int intPrevValue = 10;
1127 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1131 PropertyType PropType = PROPERTY_NONE;
1133 // Look for type before continuing.
1135 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1139 std::map<int, wxString> *NicknamesList = NULL;
1140 std::map<int, wxString> *NicknamesListType = NULL;
1141 std::map<int, wxString> *NicknamesListLanguage = NULL;
1142 std::map<int, wxString> *NicknamesListAltID = NULL;
1143 std::map<int, wxString> *NicknamesListPID = NULL;
1144 std::map<int, wxString> *NicknamesListTokens = NULL;
1145 std::map<int, int> *NicknamesListPref = NULL;
1149 NicknamesList = &GeneralNicknamesList;
1150 NicknamesListType = &GeneralNicknamesListType;
1151 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1152 NicknamesListAltID = &GeneralNicknamesListAltID;
1153 NicknamesListPID = &GeneralNicknamesListPID;
1154 NicknamesListTokens = &GeneralNicknamesListTokens;
1155 NicknamesListPref = &GeneralNicknamesListPref;
1158 NicknamesList = &HomeNicknamesList;
1159 NicknamesListType = &HomeNicknamesListType;
1160 NicknamesListLanguage = &HomeNicknamesListLanguage;
1161 NicknamesListAltID = &HomeNicknamesListAltID;
1162 NicknamesListPID = &HomeNicknamesListPID;
1163 NicknamesListTokens = &HomeNicknamesListTokens;
1164 NicknamesListPref = &HomeNicknamesListPref;
1167 NicknamesList = &BusinessNicknamesList;
1168 NicknamesListType = &BusinessNicknamesListType;
1169 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1170 NicknamesListAltID = &BusinessNicknamesListAltID;
1171 NicknamesListPID = &BusinessNicknamesListPID;
1172 NicknamesListTokens = &BusinessNicknamesListTokens;
1173 NicknamesListPref = &BusinessNicknamesListPref;
1177 std::map<int, int>::iterator SLiter;
1178 wxString PropertyData;
1179 wxString PropertyName;
1180 wxString PropertyValue;
1181 wxString PropertyTokens;
1182 bool FirstToken = TRUE;
1184 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1185 intiter != SplitPoints.end(); ++intiter){
1187 SLiter = SplitLength.find(intiter->first);
1189 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1191 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1192 PropertyName = PropertyElement.GetNextToken();
1193 PropertyValue = PropertyElement.GetNextToken();
1195 intPrevValue = intiter->second;
1197 CaptureString(&PropertyValue, FALSE);
1199 if (PropertyName == wxT("ALTID")){
1201 NicknamesListAltID->erase(*NicknameCount);
1202 NicknamesListAltID->insert(std::make_pair(*NicknameCount, PropertyValue));
1204 } else if (PropertyName == wxT("PID")){
1206 NicknamesListPID->erase(*NicknameCount);
1207 NicknamesListPID->insert(std::make_pair(*NicknameCount, PropertyValue));
1209 } else if (PropertyName == wxT("PREF")){
1211 ProcessIntegerValue(NicknamesListPref, &PropertyValue, NicknameCount);
1213 } else if (PropertyName == wxT("LANGUAGE")){
1215 NicknamesListLanguage->erase(*NicknameCount);
1216 NicknamesListLanguage->insert(std::make_pair(*NicknameCount, PropertyValue));
1220 // Something else we don't know about so append
1221 // to the tokens variable.
1223 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1225 if (FirstToken == TRUE){
1227 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1232 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1242 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1244 // Add the name token data.
1246 if (!PropertyTokens.IsEmpty()){
1248 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1254 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1256 std::map<int, int> SplitPoints;
1257 std::map<int, int> SplitLength;
1258 std::map<int, int>::iterator SLiter;
1259 wxString PropertyData;
1260 wxString PropertyName;
1261 wxString PropertyValue;
1262 wxString PropertyTokens;
1263 bool FirstToken = TRUE;
1264 int intPrevValue = 8;
1266 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1270 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1271 intiter != SplitPoints.end(); ++intiter){
1273 SLiter = SplitLength.find(intiter->first);
1275 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1277 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1278 PropertyName = PropertyElement.GetNextToken();
1279 PropertyValue = PropertyElement.GetNextToken();
1281 intPrevValue = intiter->second;
1283 // Process properties.
1285 size_t intPropertyValueLen = PropertyValue.Len();
1287 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1289 PropertyValue.Trim();
1290 PropertyValue.RemoveLast();
1294 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1296 PropertyValue.Remove(0, 1);
1300 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1302 if (FirstToken == TRUE){
1304 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1309 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1317 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1319 wxString GenderComponent;
1321 if (GenderData.CountTokens() >= 2){
1323 Gender = GenderData.GetNextToken();
1324 GenderDetails = GenderData.GetString();
1326 CaptureString(&GenderDetails, FALSE);
1330 Gender = GenderData.GetNextToken();
1334 if (!PropertyTokens.IsEmpty()){
1336 GenderTokens = PropertyTokens;
1342 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1344 // Process date. Preserve the remainder in the string.
1346 std::map<int, int> SplitPoints;
1347 std::map<int, int> SplitLength;
1348 std::map<int, int>::iterator SLiter;
1349 wxString PropertyData;
1350 wxString PropertyName;
1351 wxString PropertyValue;
1352 wxString PropertyTokens;
1353 bool BirthdayText = FALSE;
1354 int intPrevValue = 6;
1356 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1360 // Look for type before continuing.
1362 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1363 intiter != SplitPoints.end(); ++intiter){
1365 SLiter = SplitLength.find(intiter->first);
1367 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1369 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1370 PropertyName = PropertyElement.GetNextToken();
1371 PropertyValue = PropertyElement.GetNextToken();
1373 intPrevValue = intiter->second;
1375 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1377 CaptureString(&PropertySeg2, FALSE);
1378 Birthday = PropertySeg2;
1379 BirthdayText = TRUE;
1385 // Setup blank lines for later on.
1388 bool FirstToken = TRUE;
1390 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1391 intiter != SplitPoints.end(); ++intiter){
1393 SLiter = SplitLength.find(intiter->first);
1395 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1397 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1398 PropertyName = PropertyElement.GetNextToken();
1399 PropertyValue = PropertyElement.GetNextToken();
1401 intPrevValue = intiter->second;
1403 // Process properties.
1405 CaptureString(&PropertyValue, FALSE);
1407 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1409 PropertyValue.Trim();
1410 PropertyValue.RemoveLast();
1414 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1416 PropertyValue.Remove(0, 1);
1420 if (PropertyName == wxT("ALTID")){
1422 BirthdayAltID = PropertyValue;
1424 } else if (PropertyName == wxT("CALSCALE")){
1426 BirthdayCalScale = PropertyValue;
1428 } else if (PropertyName != wxT("VALUE")) {
1430 // Something else we don't know about so append
1431 // to the tokens variable.
1433 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1435 if (FirstToken == TRUE){
1437 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1442 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1452 // Add the data to the variables and form.
1454 if (BirthdayText == FALSE){
1456 Birthday = PropertySeg2;
1460 if (!PropertyTokens.IsEmpty()){
1462 BirthdayTokens = PropertyTokens;
1468 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1470 // Process date. Preserve the remainder in the string.
1472 std::map<int, int> SplitPoints;
1473 std::map<int, int> SplitLength;
1474 std::map<int, int>::iterator SLiter;
1475 wxString PropertyData;
1476 wxString PropertyName;
1477 wxString PropertyValue;
1478 wxString PropertyTokens;
1479 bool AnniversaryText = FALSE;
1480 int intPrevValue = 13;
1482 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1486 // Look for type before continuing.
1488 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1489 intiter != SplitPoints.end(); ++intiter){
1491 SLiter = SplitLength.find(intiter->first);
1493 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1495 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1496 PropertyName = PropertyElement.GetNextToken();
1497 PropertyValue = PropertyElement.GetNextToken();
1499 intPrevValue = intiter->second;
1501 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1503 CaptureString(&PropertySeg2, FALSE);
1504 Anniversary = PropertySeg2;
1505 AnniversaryText = TRUE;
1511 // Setup blank lines for later on.
1514 bool FirstToken = TRUE;
1516 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1517 intiter != SplitPoints.end(); ++intiter){
1519 SLiter = SplitLength.find(intiter->first);
1521 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1523 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1524 PropertyName = PropertyElement.GetNextToken();
1525 PropertyValue = PropertyElement.GetNextToken();
1527 intPrevValue = intiter->second;
1529 // Process properties.
1531 CaptureString(&PropertyValue, FALSE);
1533 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1535 PropertyValue.Trim();
1536 PropertyValue.RemoveLast();
1540 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1542 PropertyValue.Remove(0, 1);
1546 if (PropertyName == wxT("ALTID")){
1548 AnniversaryAltID = PropertyValue;
1550 } else if (PropertyName == wxT("CALSCALE")){
1552 AnniversaryCalScale = PropertyValue;
1554 } else if (PropertyName != wxT("VALUE")) {
1556 // Something else we don't know about so append
1557 // to the tokens variable.
1559 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1561 if (FirstToken == TRUE){
1563 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1568 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1578 // Add the data to the variables and form.
1580 if (AnniversaryText == FALSE){
1582 Anniversary = PropertySeg2;
1586 if (!PropertyTokens.IsEmpty()){
1588 AnniversaryTokens = PropertyTokens;
1594 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1596 std::map<int, int> SplitPoints;
1597 std::map<int, int> SplitLength;
1599 int intPrevValue = 4;
1602 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1606 PropertyType PropType = PROPERTY_NONE;
1608 // Look for type before continuing.
1610 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1614 std::map<int, wxString> *TZList = NULL;
1615 std::map<int, wxString> *TZListType = NULL;
1616 std::map<int, wxString> *TZListMediatype = NULL;
1617 std::map<int, wxString> *TZListAltID = NULL;
1618 std::map<int, wxString> *TZListPID = NULL;
1619 std::map<int, wxString> *TZListTokens = NULL;
1620 std::map<int, int> *TZListPref = NULL;
1624 TZList = &GeneralTZList;
1625 TZListType = &GeneralTZListType;
1626 TZListMediatype = &GeneralTZListMediatype;
1627 TZListAltID = &GeneralTZListAltID;
1628 TZListPID = &GeneralTZListPID;
1629 TZListTokens = &GeneralTZListTokens;
1630 TZListPref = &GeneralTZListPref;
1633 TZList = &HomeTZList;
1634 TZListType = &HomeTZListType;
1635 TZListMediatype = &HomeTZListMediatype;
1636 TZListAltID = &HomeTZListAltID;
1637 TZListPID = &HomeTZListPID;
1638 TZListTokens = &HomeTZListTokens;
1639 TZListPref = &HomeTZListPref;
1642 TZList = &BusinessTZList;
1643 TZListType = &BusinessTZListType;
1644 TZListMediatype = &BusinessTZListMediatype;
1645 TZListAltID = &BusinessTZListAltID;
1646 TZListPID = &BusinessTZListPID;
1647 TZListTokens = &BusinessTZListTokens;
1648 TZListPref = &BusinessTZListPref;
1652 std::map<int, int>::iterator SLiter;
1653 wxString PropertyData;
1654 wxString PropertyName;
1655 wxString PropertyValue;
1656 wxString PropertyTokens;
1657 bool FirstToken = TRUE;
1659 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1660 intiter != SplitPoints.end(); ++intiter){
1662 SLiter = SplitLength.find(intiter->first);
1664 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1666 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1667 PropertyName = PropertyElement.GetNextToken();
1668 PropertyValue = PropertyElement.GetNextToken();
1670 intPrevValue = intiter->second;
1672 CaptureString(&PropertyValue, FALSE);
1674 if (PropertyName == wxT("ALTID")){
1676 TZListAltID->erase(*TimeZoneCount);
1677 TZListAltID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1679 } else if (PropertyName == wxT("PID")){
1681 TZListPID->erase(*TimeZoneCount);
1682 TZListPID->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1684 } else if (PropertyName == wxT("PREF")){
1686 ProcessIntegerValue(TZListPref, &PropertyValue, TimeZoneCount);
1688 } else if (PropertyName == wxT("MEDIATYPE")){
1690 TZListMediatype->erase(*TimeZoneCount);
1691 TZListMediatype->insert(std::make_pair(*TimeZoneCount, PropertyValue));
1695 // Something else we don't know about so append
1696 // to the tokens variable.
1698 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1700 if (FirstToken == TRUE){
1702 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1707 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1717 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1719 // Add the name token data.
1721 if (!PropertyTokens.IsEmpty()){
1723 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1730 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1732 size_t intPropertyLen = PropertySeg1.Len();
1733 std::map<int, int> SplitPoints;
1734 std::map<int, int> SplitLength;
1735 std::map<int, int>::iterator SLiter;
1736 wxString PropertyData;
1737 wxString PropertyName;
1738 wxString PropertyValue;
1739 wxString PropertyTokens;
1740 wxString AddressLabel;
1741 wxString AddressLang;
1742 wxString AddressAltID;
1743 wxString AddressPID;
1744 wxString AddressTokens;
1745 wxString AddressGeo;
1746 wxString AddressTimezone;
1747 wxString AddressType;
1748 wxString AddressMediatype;
1749 wxString AddressPOBox;
1750 wxString AddressExtended;
1751 wxString AddressStreet;
1752 wxString AddressLocality;
1753 wxString AddressCity;
1754 wxString AddressRegion;
1755 wxString AddressPostalCode;
1756 wxString AddressCountry;
1757 bool FirstToken = TRUE;
1758 int intSplitsFound = 0;
1759 int intSplitSize = 0;
1760 int intPrevValue = 5;
1765 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1769 PropertyType PropType = PROPERTY_NONE;
1771 // Look for type before continuing.
1773 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1777 std::map<int, wxString> *AddressList = NULL;
1778 std::map<int, wxString> *AddressListTown = NULL;
1779 std::map<int, wxString> *AddressListCounty = NULL;
1780 std::map<int, wxString> *AddressListPostCode = NULL;
1781 std::map<int, wxString> *AddressListCountry = NULL;
1782 std::map<int, wxString> *AddressListLabel = NULL;
1783 std::map<int, wxString> *AddressListLang = NULL;
1784 std::map<int, wxString> *AddressListAltID = NULL;
1785 std::map<int, wxString> *AddressListPID = NULL;
1786 std::map<int, wxString> *AddressListTokens = NULL;
1787 std::map<int, wxString> *AddressListGeo = NULL;
1788 std::map<int, wxString> *AddressListTimezone = NULL;
1789 std::map<int, wxString> *AddressListType = NULL;
1790 std::map<int, wxString> *AddressListMediatype = NULL;
1791 std::map<int, int> *AddressListPref = NULL;
1795 AddressList = &GeneralAddressList;
1796 AddressListTown = &GeneralAddressListTown;
1797 AddressListCounty = &GeneralAddressListCounty;
1798 AddressListPostCode = &GeneralAddressListPostCode;
1799 AddressListCountry = &GeneralAddressListCountry;
1800 AddressListLabel = &GeneralAddressListLabel;
1801 AddressListLang = &GeneralAddressListLang;
1802 AddressListAltID = &GeneralAddressListAltID;
1803 AddressListPID = &GeneralAddressListPID;
1804 AddressListTokens = &GeneralAddressListTokens;
1805 AddressListGeo = &GeneralAddressListGeo;
1806 AddressListTimezone = &GeneralAddressListTimezone;
1807 AddressListType = &GeneralAddressListType;
1808 AddressListMediatype = &GeneralAddressListMediatype;
1809 AddressListPref = &GeneralAddressListPref;
1812 AddressList = &HomeAddressList;
1813 AddressListTown = &HomeAddressListTown;
1814 AddressListCounty = &HomeAddressListCounty;
1815 AddressListPostCode = &HomeAddressListPostCode;
1816 AddressListCountry = &HomeAddressListCountry;
1817 AddressListLabel = &HomeAddressListLabel;
1818 AddressListLang = &HomeAddressListLang;
1819 AddressListAltID = &HomeAddressListAltID;
1820 AddressListPID = &HomeAddressListPID;
1821 AddressListTokens = &HomeAddressListTokens;
1822 AddressListGeo = &HomeAddressListGeo;
1823 AddressListTimezone = &HomeAddressListTimezone;
1824 AddressListType = &HomeAddressListType;
1825 AddressListMediatype = &HomeAddressListMediatype;
1826 AddressListPref = &HomeAddressListPref;
1829 AddressList = &BusinessAddressList;
1830 AddressListTown = &BusinessAddressListTown;
1831 AddressListCounty = &BusinessAddressListCounty;
1832 AddressListPostCode = &BusinessAddressListPostCode;
1833 AddressListCountry = &BusinessAddressListCountry;
1834 AddressListLabel = &BusinessAddressListLabel;
1835 AddressListLang = &BusinessAddressListLang;
1836 AddressListAltID = &BusinessAddressListAltID;
1837 AddressListPID = &BusinessAddressListPID;
1838 AddressListTokens = &BusinessAddressListTokens;
1839 AddressListGeo = &BusinessAddressListGeo;
1840 AddressListTimezone = &BusinessAddressListTimezone;
1841 AddressListType = &BusinessAddressListType;
1842 AddressListMediatype = &BusinessAddressListMediatype;
1843 AddressListPref = &BusinessAddressListPref;
1849 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1850 intiter != SplitPoints.end(); ++intiter){
1852 SLiter = SplitLength.find(intiter->first);
1854 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1856 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1857 PropertyName = PropertyElement.GetNextToken();
1858 PropertyValue = PropertyElement.GetNextToken();
1860 intPrevValue = intiter->second;
1862 CaptureString(&PropertyValue, FALSE);
1864 // Process properties.
1866 if (PropertyName == wxT("LABEL")){
1868 AddressListLabel->erase(*AddressCount);
1869 AddressListLabel->insert(std::make_pair(*AddressCount, PropertyValue));
1871 } else if (PropertyName == wxT("LANGUAGE")){
1873 AddressListLang->erase(*AddressCount);
1874 AddressListLang->insert(std::make_pair(*AddressCount, PropertyValue));
1876 } else if (PropertyName == wxT("ALTID")){
1878 AddressListAltID->erase(*AddressCount);
1879 AddressListAltID->insert(std::make_pair(*AddressCount, PropertyValue));
1881 } else if (PropertyName == wxT("PID")){
1883 AddressListPID->erase(*AddressCount);
1884 AddressListPID->insert(std::make_pair(*AddressCount, PropertyValue));
1886 } else if (PropertyName == wxT("GEO")){
1888 AddressListGeo->erase(*AddressCount);
1889 AddressListGeo->insert(std::make_pair(*AddressCount, PropertyValue));
1891 } else if (PropertyName == wxT("TZ")){
1893 AddressListTimezone->erase(*AddressCount);
1894 AddressListTimezone->insert(std::make_pair(*AddressCount, PropertyValue));
1896 } else if (PropertyName == wxT("MEDIATYPE")){
1898 AddressListMediatype->erase(*AddressCount);
1899 AddressListMediatype->insert(std::make_pair(*AddressCount, PropertyValue));
1901 } else if (PropertyName == wxT("PREF")){
1903 ProcessIntegerValue(AddressListPref, &PropertyValue, AddressCount);
1907 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1909 if (FirstToken == TRUE){
1911 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1916 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1926 // Split the address.
1928 //std::map<int, int>::iterator SLiter;
1929 intPropertyLen = PropertySeg2.Len();
1930 SplitPoints.clear();
1931 SplitLength.clear();
1936 for (int i = 0; i <= intPropertyLen; i++){
1940 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1943 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1945 if (intSplitsFound == 6){
1947 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1952 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1962 // Split the data into several parts.
1964 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1965 intiter != SplitPoints.end(); ++intiter){
1967 if (intiter->first == 1){
1969 // Deal with PO Box.
1971 SLiter = SplitLength.find(1);
1973 //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
1974 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1975 intPrevValue = intiter->second;
1977 } else if (intiter->first == 2){
1979 // Deal with extended address.
1981 SLiter = SplitLength.find(2);
1983 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1984 //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1985 intPrevValue = intiter->second;
1987 } else if (intiter->first == 3){
1989 // Deal with street address.
1991 SLiter = SplitLength.find(3);
1993 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1994 //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
1995 intPrevValue = intiter->second;
1997 } else if (intiter->first == 4){
1999 // Deal with locality
2001 SLiter = SplitLength.find(4);
2003 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
2004 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2005 intPrevValue = intiter->second;
2007 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
2009 } else if (intiter->first == 5){
2011 // Deal with region.
2013 SLiter = SplitLength.find(5);
2015 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
2016 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2017 intPrevValue = intiter->second;
2019 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
2021 } else if (intiter->first == 6){
2023 // Deal with post code.
2025 SLiter = SplitLength.find(6);
2027 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
2028 //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
2029 intPrevValue = intiter->second;
2031 // Deal with country.
2033 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
2034 //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
2042 // Add the data to the General/Home/Work address variables.
2044 CaptureString(&AddressStreet, FALSE);
2045 CaptureString(&AddressLocality, FALSE);
2046 CaptureString(&AddressRegion, FALSE);
2047 CaptureString(&AddressPostalCode, FALSE);
2048 CaptureString(&AddressCountry, FALSE);
2050 if (!PropertyTokens.IsEmpty()){
2052 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
2056 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
2057 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
2058 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
2059 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
2060 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
2064 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
2067 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
2070 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
2074 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
2078 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
2080 std::map<int, int> SplitPoints;
2081 std::map<int, int> SplitLength;
2083 int intPrevValue = 7;
2086 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2090 PropertyType PropType = PROPERTY_NONE;
2092 // Look for type before continuing.
2094 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2096 std::map<int, wxString> *EmailList = NULL;
2097 std::map<int, wxString> *EmailListType = NULL;
2098 std::map<int, wxString> *EmailListAltID = NULL;
2099 std::map<int, wxString> *EmailListPID = NULL;
2100 std::map<int, wxString> *EmailListTokens = NULL;
2101 std::map<int, int> *EmailListPref = NULL;
2105 EmailList = &GeneralEmailList;
2106 EmailListType = &GeneralEmailListType;
2107 EmailListAltID = &GeneralEmailListAltID;
2108 EmailListPID = &GeneralEmailListPID;
2109 EmailListTokens = &GeneralEmailListTokens;
2110 EmailListPref = &GeneralEmailListPref;
2113 EmailList = &HomeEmailList;
2114 EmailListType = &HomeEmailListType;
2115 EmailListAltID = &HomeEmailListAltID;
2116 EmailListPID = &HomeEmailListPID;
2117 EmailListTokens = &HomeEmailListTokens;
2118 EmailListPref = &HomeEmailListPref;
2121 EmailList = &BusinessEmailList;
2122 EmailListType = &BusinessEmailListType;
2123 EmailListAltID = &BusinessEmailListAltID;
2124 EmailListPID = &BusinessEmailListPID;
2125 EmailListTokens = &BusinessEmailListTokens;
2126 EmailListPref = &BusinessEmailListPref;
2132 std::map<int,int>::iterator SLiter;
2133 wxString PropertyData;
2134 wxString PropertyName;
2135 wxString PropertyValue;
2136 wxString PropertyTokens;
2137 bool FirstToken = TRUE;
2139 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2140 intiter != SplitPoints.end(); ++intiter){
2142 SLiter = SplitLength.find(intiter->first);
2144 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2146 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2147 PropertyName = PropertyElement.GetNextToken();
2148 PropertyValue = PropertyElement.GetNextToken();
2150 intPrevValue = intiter->second;
2152 CaptureString(&PropertyValue, FALSE);
2154 // Process properties.
2156 if (PropertyName == wxT("ALTID")){
2158 EmailListAltID->erase(*EmailCount);
2159 EmailListAltID->insert(std::make_pair(*EmailCount, PropertyValue));
2161 } else if (PropertyName == wxT("PID")){
2163 EmailListPID->erase(*EmailCount);
2164 EmailListPID->insert(std::make_pair(*EmailCount, PropertyValue));
2166 } else if (PropertyName == wxT("PREF")){
2168 ProcessIntegerValue(EmailListPref, &PropertyValue, EmailCount);
2172 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2174 if (FirstToken == TRUE){
2176 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2181 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2191 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
2193 // Add the name token data.
2195 if (!PropertyTokens.IsEmpty()){
2197 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
2204 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
2206 std::map<int, int> SplitPoints;
2207 std::map<int, int> SplitLength;
2209 int intPrevValue = 6;
2212 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2216 PropertyType PropType = PROPERTY_NONE;
2218 // Look for type before continuing.
2220 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2222 std::map<int, wxString> *IMList = NULL;
2223 std::map<int, wxString> *IMListType = NULL;
2224 std::map<int, wxString> *IMListAltID = NULL;
2225 std::map<int, wxString> *IMListPID = NULL;
2226 std::map<int, wxString> *IMListTokens = NULL;
2227 std::map<int, wxString> *IMListMediatype = NULL;
2228 std::map<int, int> *IMListPref = NULL;
2232 IMList = &GeneralIMList;
2233 IMListType = &GeneralIMListType;
2234 IMListAltID = &GeneralIMListAltID;
2235 IMListPID = &GeneralIMListPID;
2236 IMListTokens = &GeneralIMListTokens;
2237 IMListMediatype = &GeneralIMListMediatype;
2238 IMListPref = &GeneralIMListPref;
2241 IMList = &HomeIMList;
2242 IMListType = &HomeIMListType;
2243 IMListAltID = &HomeIMListAltID;
2244 IMListPID = &HomeIMListPID;
2245 IMListTokens = &HomeIMListTokens;
2246 IMListMediatype = &HomeIMListMediatype;
2247 IMListPref = &HomeIMListPref;
2250 IMList = &BusinessIMList;
2251 IMListType = &BusinessIMListType;
2252 IMListAltID = &BusinessIMListAltID;
2253 IMListPID = &BusinessIMListPID;
2254 IMListTokens = &BusinessIMListTokens;
2255 IMListMediatype = &BusinessIMListMediatype;
2256 IMListPref = &BusinessIMListPref;
2262 std::map<int,int>::iterator SLiter;
2263 wxString PropertyData;
2264 wxString PropertyName;
2265 wxString PropertyValue;
2266 wxString PropertyTokens;
2267 bool FirstToken = TRUE;
2269 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2270 intiter != SplitPoints.end(); ++intiter){
2272 SLiter = SplitLength.find(intiter->first);
2274 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2276 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2277 PropertyName = PropertyElement.GetNextToken();
2278 PropertyValue = PropertyElement.GetNextToken();
2280 intPrevValue = intiter->second;
2282 CaptureString(&PropertyValue, FALSE);
2284 // Process properties.
2286 if (PropertyName == wxT("ALTID")){
2288 IMListAltID->erase(*IMCount);
2289 IMListAltID->insert(std::make_pair(*IMCount, PropertyValue));
2291 } else if (PropertyName == wxT("PID")){
2293 IMListPID->erase(*IMCount);
2294 IMListPID->insert(std::make_pair(*IMCount, PropertyValue));
2296 } else if (PropertyName == wxT("MEDIATYPE")){
2298 IMListMediatype->erase(*IMCount);
2299 IMListMediatype->insert(std::make_pair(*IMCount, PropertyValue));
2301 } else if (PropertyName == wxT("PREF")){
2303 ProcessIntegerValue(IMListPref, &PropertyValue, IMCount);
2307 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2309 if (FirstToken == TRUE){
2311 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2316 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2326 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2328 // Add the name token data.
2330 if (!PropertyTokens.IsEmpty()){
2332 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2338 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2340 std::map<int, int> SplitPoints;
2341 std::map<int, int> SplitLength;
2342 std::map<int, int>::iterator SLiter;
2346 PropertyType PropType = PROPERTY_NONE;
2348 // Look for type before continuing.
2351 wxString TelTypeDetail;
2352 wxString PropertyData;
2353 wxString PropertyName;
2354 wxString PropertyValue;
2355 wxString PropertyTokens;
2357 std::map<int,int> TypeSplitPoints;
2358 std::map<int,int> TypeSplitLength;
2359 std::map<int,int>::iterator TSLiter;
2361 int intSplitSize = 0;
2362 int intSplitsFound = 0;
2363 int intSplitPoint = 0;
2365 int intPrevValue = 5;
2367 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2371 // Look for type before continuing.
2373 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2374 intiter != SplitPoints.end(); ++intiter){
2376 SLiter = SplitLength.find(intiter->first);
2378 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2380 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2381 PropertyName = PropertyElement.GetNextToken();
2382 PropertyValue = PropertyElement.GetNextToken();
2384 intPrevValue = intiter->second;
2386 if (PropertyName == wxT("TYPE")){
2388 // Process each value in type and translate each
2391 // Strip out the quotes if they are there.
2393 size_t intPropertyValueLen = PropertyValue.Len();
2395 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2397 PropertyValue.Trim();
2398 PropertyValue.RemoveLast();
2402 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2404 PropertyValue.Remove(0, 1);
2408 TelTypeDetail = PropertyValue;
2414 for (int i = 0; i <= intPropertyValueLen; i++){
2418 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2420 if (intSplitsFound == 0){
2422 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2423 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2427 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2428 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2441 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2442 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2444 int intTypeSeek = 0;
2446 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2447 typeiter != TypeSplitPoints.end(); ++typeiter){
2449 wxString TypePropertyName;
2451 TSLiter = TypeSplitLength.find(typeiter->first);
2453 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2455 if (intTypeSeek == 0){
2460 TelTypeUI.Append(wxT(","));
2464 if (TypePropertyName == wxT("home")){
2466 PropType = PROPERTY_HOME;
2468 } else if (TypePropertyName == wxT("work")){
2470 PropType = PROPERTY_WORK;
2475 if (TypePropertyName == wxT("text")){
2477 TelTypeUI.Append(_("text"));
2480 } else if (TypePropertyName == wxT("voice")){
2482 TelTypeUI.Append(_("voice"));
2485 } else if (TypePropertyName == wxT("fax")){
2487 TelTypeUI.Append(_("fax"));
2490 } else if (TypePropertyName == wxT("cell")){
2492 TelTypeUI.Append(_("mobile"));
2495 } else if (TypePropertyName == wxT("video")){
2497 TelTypeUI.Append(_("video"));
2500 } else if (TypePropertyName == wxT("pager")){
2502 TelTypeUI.Append(_("pager"));
2505 } else if (TypePropertyName == wxT("textphone")){
2507 TelTypeUI.Append(_("textphone"));
2518 std::map<int, wxString> *TelephoneList = NULL;
2519 std::map<int, wxString> *TelephoneListType = NULL;
2520 std::map<int, wxString> *TelephoneListAltID = NULL;
2521 std::map<int, wxString> *TelephoneListPID = NULL;
2522 std::map<int, wxString> *TelephoneListTokens = NULL;
2523 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2524 std::map<int, int> *TelephoneListPref = NULL;
2528 TelephoneList = &GeneralTelephoneList;
2529 TelephoneListType = &GeneralTelephoneListType;
2530 TelephoneListAltID = &GeneralTelephoneListAltID;
2531 TelephoneListPID = &GeneralTelephoneListPID;
2532 TelephoneListTokens = &GeneralTelephoneListTokens;
2533 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2534 TelephoneListPref = &GeneralTelephoneListPref;
2537 TelephoneList = &HomeTelephoneList;
2538 TelephoneListType = &HomeTelephoneListType;
2539 TelephoneListAltID = &HomeTelephoneListAltID;
2540 TelephoneListPID = &HomeTelephoneListPID;
2541 TelephoneListTokens = &HomeTelephoneListTokens;
2542 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2543 TelephoneListPref = &HomeTelephoneListPref;
2546 TelephoneList = &BusinessTelephoneList;
2547 TelephoneListType = &BusinessTelephoneListType;
2548 TelephoneListAltID = &BusinessTelephoneListAltID;
2549 TelephoneListPID = &BusinessTelephoneListPID;
2550 TelephoneListTokens = &BusinessTelephoneListTokens;
2551 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2552 TelephoneListPref = &BusinessTelephoneListPref;
2556 // Process the properties.
2558 bool FirstToken = TRUE;
2561 SplitPoints.clear();
2562 SplitLength.clear();
2564 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2568 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2569 intiter != SplitPoints.end(); ++intiter){
2571 SLiter = SplitLength.find(intiter->first);
2573 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2575 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2576 PropertyName = PropertyElement.GetNextToken();
2577 PropertyValue = PropertyElement.GetNextToken();
2579 intPrevValue = intiter->second;
2581 CaptureString(&PropertyValue, FALSE);
2583 // Process properties.
2585 if (PropertyName == wxT("ALTID")){
2587 TelephoneListAltID->erase(*TelephoneCount);
2588 TelephoneListAltID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2590 } else if (PropertyName == wxT("PID")){
2592 TelephoneListPID->erase(*TelephoneCount);
2593 TelephoneListPID->insert(std::make_pair(*TelephoneCount, PropertyValue));
2595 } else if (PropertyName == wxT("PREF")){
2597 ProcessIntegerValue(TelephoneListPref, &PropertyValue, TelephoneCount);
2601 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2603 if (FirstToken == TRUE){
2605 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2610 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2620 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2621 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2623 // Add the name token data.
2625 if (!PropertyTokens.IsEmpty()){
2627 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2633 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2635 std::map<int, int> SplitPoints;
2636 std::map<int, int> SplitLength;
2638 int intPrevValue = 6;
2641 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2645 PropertyType PropType = PROPERTY_NONE;
2647 // Look for type before continuing.
2649 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2651 std::map<int, wxString> *LanguageList = NULL;
2652 std::map<int, wxString> *LanguageListType = NULL;
2653 std::map<int, wxString> *LanguageListAltID = NULL;
2654 std::map<int, wxString> *LanguageListPID = NULL;
2655 std::map<int, wxString> *LanguageListTokens = NULL;
2656 std::map<int, int> *LanguageListPref = NULL;
2660 LanguageList = &GeneralLanguageList;
2661 LanguageListType = &GeneralLanguageListType;
2662 LanguageListAltID = &GeneralLanguageListAltID;
2663 LanguageListPID = &GeneralLanguageListPID;
2664 LanguageListTokens = &GeneralLanguageListTokens;
2665 LanguageListPref = &GeneralLanguageListPref;
2668 LanguageList = &HomeLanguageList;
2669 LanguageListType = &HomeLanguageListType;
2670 LanguageListAltID = &HomeLanguageListAltID;
2671 LanguageListPID = &HomeLanguageListPID;
2672 LanguageListTokens = &HomeLanguageListTokens;
2673 LanguageListPref = &HomeLanguageListPref;
2676 LanguageList = &BusinessLanguageList;
2677 LanguageListType = &BusinessLanguageListType;
2678 LanguageListAltID = &BusinessLanguageListAltID;
2679 LanguageListPID = &BusinessLanguageListPID;
2680 LanguageListTokens = &BusinessLanguageListTokens;
2681 LanguageListPref = &BusinessLanguageListPref;
2687 std::map<int,int>::iterator SLiter;
2688 wxString PropertyData;
2689 wxString PropertyName;
2690 wxString PropertyValue;
2691 wxString PropertyTokens;
2692 bool FirstToken = TRUE;
2694 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2695 intiter != SplitPoints.end(); ++intiter){
2697 SLiter = SplitLength.find(intiter->first);
2699 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2701 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2702 PropertyName = PropertyElement.GetNextToken();
2703 PropertyValue = PropertyElement.GetNextToken();
2705 intPrevValue = intiter->second;
2707 CaptureString(&PropertyValue, FALSE);
2709 // Process properties.
2711 if (PropertyName == wxT("ALTID")){
2713 LanguageListAltID->erase(*LanguageCount);
2714 LanguageListAltID->insert(std::make_pair(*LanguageCount, PropertyValue));
2716 } else if (PropertyName == wxT("PID")){
2718 LanguageListPID->erase(*LanguageCount);
2719 LanguageListPID->insert(std::make_pair(*LanguageCount, PropertyValue));
2721 } else if (PropertyName == wxT("PREF")){
2723 ProcessIntegerValue(LanguageListPref, &PropertyValue, LanguageCount);
2727 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2729 if (FirstToken == TRUE){
2731 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2736 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2746 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2748 // Add the name token data.
2750 if (!PropertyTokens.IsEmpty()){
2752 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2758 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2760 std::map<int, int> SplitPoints;
2761 std::map<int, int> SplitLength;
2763 int intPrevValue = 5;
2766 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2770 PropertyType PropType = PROPERTY_NONE;
2772 // Look for type before continuing.
2774 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2776 std::map<int, wxString> *GeopositionList = NULL;
2777 std::map<int, wxString> *GeopositionListType = NULL;
2778 std::map<int, wxString> *GeopositionListAltID = NULL;
2779 std::map<int, wxString> *GeopositionListPID = NULL;
2780 std::map<int, wxString> *GeopositionListTokens = NULL;
2781 std::map<int, wxString> *GeopositionListMediatype = NULL;
2782 std::map<int, int> *GeopositionListPref = NULL;
2786 GeopositionList = &GeneralGeographyList;
2787 GeopositionListType = &GeneralGeographyListType;
2788 GeopositionListAltID = &GeneralGeographyListAltID;
2789 GeopositionListPID = &GeneralGeographyListPID;
2790 GeopositionListTokens = &GeneralGeographyListTokens;
2791 GeopositionListMediatype = &GeneralGeographyListMediatype;
2792 GeopositionListPref = &GeneralGeographyListPref;
2795 GeopositionList = &HomeGeographyList;
2796 GeopositionListType = &HomeGeographyListType;
2797 GeopositionListAltID = &HomeGeographyListAltID;
2798 GeopositionListPID = &HomeGeographyListPID;
2799 GeopositionListTokens = &HomeGeographyListTokens;
2800 GeopositionListMediatype = &HomeGeographyListMediatype;
2801 GeopositionListPref = &HomeGeographyListPref;
2804 GeopositionList = &BusinessGeographyList;
2805 GeopositionListType = &BusinessGeographyListType;
2806 GeopositionListAltID = &BusinessGeographyListAltID;
2807 GeopositionListPID = &BusinessGeographyListPID;
2808 GeopositionListTokens = &BusinessGeographyListTokens;
2809 GeopositionListMediatype = &BusinessGeographyListMediatype;
2810 GeopositionListPref = &BusinessGeographyListPref;
2816 std::map<int,int>::iterator SLiter;
2817 wxString PropertyData;
2818 wxString PropertyName;
2819 wxString PropertyValue;
2820 wxString PropertyTokens;
2821 bool FirstToken = TRUE;
2823 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2824 intiter != SplitPoints.end(); ++intiter){
2826 SLiter = SplitLength.find(intiter->first);
2828 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2830 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2831 PropertyName = PropertyElement.GetNextToken();
2832 PropertyValue = PropertyElement.GetNextToken();
2834 intPrevValue = intiter->second;
2836 CaptureString(&PropertyValue, FALSE);
2838 // Process properties.
2840 if (PropertyName == wxT("ALTID")){
2842 GeopositionListAltID->erase(*GeographicCount);
2843 GeopositionListAltID->insert(std::make_pair(*GeographicCount, PropertyValue));
2845 } else if (PropertyName == wxT("PID")){
2847 GeopositionListPID->erase(*GeographicCount);
2848 GeopositionListPID->insert(std::make_pair(*GeographicCount, PropertyValue));
2850 } else if (PropertyName == wxT("MEDIATYPE")){
2852 GeopositionListMediatype->erase(*GeographicCount);
2853 GeopositionListMediatype->insert(std::make_pair(*GeographicCount, PropertyValue));
2855 } else if (PropertyName == wxT("PREF")){
2857 ProcessIntegerValue(GeopositionListPref, &PropertyValue, GeographicCount);
2861 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2863 if (FirstToken == TRUE){
2865 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2870 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2880 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2882 // Add the name token data.
2884 if (!PropertyTokens.IsEmpty()){
2886 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2892 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2894 size_t intPropertyLen = PropertySeg1.Len();
2895 std::map<int, int> SplitPoints;
2896 std::map<int, int> SplitLength;
2897 std::map<int, int>::iterator SLiter;
2898 wxString PropertyData;
2899 wxString PropertyName;
2900 wxString PropertyValue;
2901 wxString PropertyTokens;
2902 wxString RelatedType;
2903 wxString RelatedTypeOriginal;
2904 wxString RelatedName;
2905 bool FirstToken = TRUE;
2906 int intSplitsFound = 0;
2907 int intSplitSize = 0;
2908 int intPrevValue = 9;
2912 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2916 // Look for type before continuing.
2918 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2919 intiter != SplitPoints.end(); ++intiter){
2921 SLiter = SplitLength.find(intiter->first);
2923 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2925 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2926 PropertyName = PropertyElement.GetNextToken();
2927 PropertyValue = PropertyElement.GetNextToken();
2929 intPrevValue = intiter->second;
2933 RelatedTypeOriginal = PropertyValue;
2935 if (PropertyName == wxT("TYPE")){
2937 if (PropertyValue == wxT("contact")){
2939 RelatedType = _("Contact");
2941 } else if (PropertyValue == wxT("acquaintance")){
2943 RelatedType = _("Acquaintance");
2945 } else if (PropertyValue == wxT("friend")){
2947 RelatedType = _("Friend");
2949 } else if (PropertyValue == wxT("met")){
2951 RelatedType = _("Met");
2953 } else if (PropertyValue == wxT("co-worker")){
2955 RelatedType = _("Co-worker");
2957 } else if (PropertyValue == wxT("colleague")){
2959 RelatedType = _("Colleague");
2961 } else if (PropertyValue == wxT("co-resident")){
2963 RelatedType = _("Co-resident");
2965 } else if (PropertyValue == wxT("neighbor")){
2967 RelatedType = _("Neighbour");
2969 } else if (PropertyValue == wxT("child")){
2971 RelatedType = _("Child");
2973 } else if (PropertyValue == wxT("parent")){
2975 RelatedType = _("Parent");
2977 } else if (PropertyValue == wxT("sibling")){
2979 RelatedType = _("Sibling");
2981 } else if (PropertyValue == wxT("spouse")){
2983 RelatedType = _("Spouse");
2985 } else if (PropertyValue == wxT("kin")){
2987 RelatedType = _("Kin");
2989 } else if (PropertyValue == wxT("muse")){
2991 RelatedType = _("Muse");
2993 } else if (PropertyValue == wxT("crush")){
2995 RelatedType = _("Crush");
2997 } else if (PropertyValue == wxT("date")){
2999 RelatedType = _("Date");
3001 } else if (PropertyValue == wxT("sweetheart")){
3003 RelatedType = _("Sweetheart");
3005 } else if (PropertyValue == wxT("me")){
3007 RelatedType = _("Me");
3009 } else if (PropertyValue == wxT("agent")){
3011 RelatedType = _("Agent");
3013 } else if (PropertyValue == wxT("emergency")){
3015 RelatedType = _("Emergency");
3019 RelatedType = PropertyValue;
3029 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3030 intiter != SplitPoints.end(); ++intiter){
3032 SLiter = SplitLength.find(intiter->first);
3034 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3036 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3037 PropertyName = PropertyElement.GetNextToken();
3038 PropertyValue = PropertyElement.GetNextToken();
3040 intPrevValue = intiter->second;
3042 // Process properties.
3044 size_t intPropertyValueLen = PropertyValue.Len();
3046 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3048 PropertyValue.Trim();
3049 PropertyValue.RemoveLast();
3053 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3055 PropertyValue.Remove(0, 1);
3059 CaptureString(&PropertyValue, FALSE);
3061 if (PropertyName == wxT("ALTID")){
3063 GeneralRelatedListAltID.erase(*RelatedCount);
3064 GeneralRelatedListAltID.insert(std::make_pair(*RelatedCount, PropertyValue));
3066 } else if (PropertyName == wxT("PID")){
3068 GeneralRelatedListPID.erase(*RelatedCount);
3069 GeneralRelatedListPID.insert(std::make_pair(*RelatedCount, PropertyValue));
3071 } else if (PropertyName == wxT("PREF")){
3073 int PriorityNumber = 0;
3074 bool ValidNumber = TRUE;
3077 PriorityNumber = std::stoi(PropertyValue.ToStdString());
3080 catch(std::invalid_argument &e){
3081 ValidNumber = FALSE;
3084 if (ValidNumber == TRUE){
3086 GeneralRelatedListPref.erase(*RelatedCount);
3087 GeneralRelatedListPref.insert(std::make_pair(*RelatedCount, PriorityNumber));
3091 } else if (PropertyName == wxT("LANGUAGE")){
3093 ProcessIntegerValue(&GeneralRelatedListPref, &PropertyValue, RelatedCount);
3095 } else if (PropertyName != wxT("TYPE")) {
3097 // Something else we don't know about so append
3098 // to the tokens variable.
3100 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3102 if (FirstToken == TRUE){
3104 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3109 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3119 // Add the data to the General/Home/Work address variables.
3121 GeneralRelatedList.erase(*RelatedCount);
3122 GeneralRelatedListRelType.erase(*RelatedCount);
3123 GeneralRelatedListType.erase(*RelatedCount);
3124 GeneralRelatedListTokens.erase(*RelatedCount);
3125 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
3126 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
3127 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
3128 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
3132 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
3134 std::map<int, int> SplitPoints;
3135 std::map<int, int> SplitLength;
3136 std::map<int, int>::iterator SLiter;
3137 wxString PropertyData;
3138 wxString PropertyName;
3139 wxString PropertyValue;
3140 wxString PropertyTokens;
3141 bool FirstToken = TRUE;
3142 int intPrevValue = 5;
3147 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3151 PropertyType PropType = PROPERTY_NONE;
3153 // Look for type before continuing.
3155 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3157 // Setup the pointers.
3159 std::map<int, wxString> *WebsiteList = NULL;
3160 std::map<int, wxString> *WebsiteListAltID = NULL;
3161 std::map<int, wxString> *WebsiteListPID = NULL;
3162 std::map<int, wxString> *WebsiteListType = NULL;
3163 std::map<int, wxString> *WebsiteListTokens = NULL;
3164 std::map<int, wxString> *WebsiteListMediatype = NULL;
3165 std::map<int, int> *WebsiteListPref = NULL;
3167 // Setup blank lines for later on.
3171 WebsiteList = &GeneralWebsiteList;
3172 WebsiteListType = &GeneralWebsiteListType;
3173 WebsiteListAltID = &GeneralWebsiteListAltID;
3174 WebsiteListPID = &GeneralWebsiteListPID;
3175 WebsiteListTokens = &GeneralWebsiteListTokens;
3176 WebsiteListMediatype = &GeneralWebsiteListMediatype;
3177 WebsiteListPref = &GeneralWebsiteListPref;
3180 WebsiteList = &HomeWebsiteList;
3181 WebsiteListType = &HomeWebsiteListType;
3182 WebsiteListAltID = &HomeWebsiteListAltID;
3183 WebsiteListPID = &HomeWebsiteListPID;
3184 WebsiteListTokens = &HomeWebsiteListTokens;
3185 WebsiteListMediatype = &HomeWebsiteListMediatype;
3186 WebsiteListPref = &HomeWebsiteListPref;
3189 WebsiteList = &BusinessWebsiteList;
3190 WebsiteListType = &BusinessWebsiteListType;
3191 WebsiteListAltID = &BusinessWebsiteListAltID;
3192 WebsiteListPID = &BusinessWebsiteListPID;
3193 WebsiteListTokens = &BusinessWebsiteListTokens;
3194 WebsiteListMediatype = &BusinessWebsiteListMediatype;
3195 WebsiteListPref = &BusinessWebsiteListPref;
3201 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3202 intiter != SplitPoints.end(); ++intiter){
3204 SLiter = SplitLength.find(intiter->first);
3206 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3208 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3209 PropertyName = PropertyElement.GetNextToken();
3210 PropertyValue = PropertyElement.GetNextToken();
3212 intPrevValue = intiter->second;
3214 // Process properties.
3216 size_t intPropertyValueLen = PropertyValue.Len();
3218 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3220 PropertyValue.Trim();
3221 PropertyValue.RemoveLast();
3225 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3227 PropertyValue.Remove(0, 1);
3231 CaptureString(&PropertyValue, FALSE);
3233 if (PropertyName == wxT("ALTID")){
3235 WebsiteListAltID->erase(*URLCount);
3236 WebsiteListAltID->insert(std::make_pair(*URLCount, PropertyValue));
3238 } else if (PropertyName == wxT("PID")){
3240 WebsiteListPID->erase(*URLCount);
3241 WebsiteListPID->insert(std::make_pair(*URLCount, PropertyValue));
3243 } else if (PropertyName == wxT("PREF")){
3245 ProcessIntegerValue(WebsiteListPref, &PropertyValue, URLCount);
3247 } else if (PropertyName == wxT("MEDIATYPE")){
3249 WebsiteListMediatype->erase(*URLCount);
3250 WebsiteListMediatype->insert(std::make_pair(*URLCount, PropertyValue));
3254 // Something else we don't know about so append
3255 // to the tokens variable.
3257 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3259 if (FirstToken == TRUE){
3261 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3266 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3276 // Add the data to the General/Home/Work address variables.
3278 CaptureString(&PropertySeg2, FALSE);
3280 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3282 if (!PropertyTokens.IsEmpty()){
3284 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3290 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3292 std::map<int, int> SplitPoints;
3293 std::map<int, int> SplitLength;
3294 std::map<int, int>::iterator SLiter;
3295 wxString PropertyData;
3296 wxString PropertyName;
3297 wxString PropertyValue;
3298 wxString PropertyTokens;
3299 bool FirstToken = TRUE;
3300 int intPrevValue = 7;
3305 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3309 PropertyType PropType = PROPERTY_NONE;
3311 // Look for type before continuing.
3313 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3315 // Setup the pointers.
3317 std::map<int, wxString> *TitleList = NULL;
3318 std::map<int, wxString> *TitleListAltID = NULL;
3319 std::map<int, wxString> *TitleListPID = NULL;
3320 std::map<int, wxString> *TitleListType = NULL;
3321 std::map<int, wxString> *TitleListTokens = NULL;
3322 std::map<int, wxString> *TitleListLanguage = NULL;
3323 std::map<int, int> *TitleListPref = NULL;
3325 // Setup blank lines for later on.
3329 TitleList = &GeneralTitleList;
3330 TitleListType = &GeneralTitleListType;
3331 TitleListAltID = &GeneralTitleListAltID;
3332 TitleListPID = &GeneralTitleListPID;
3333 TitleListTokens = &GeneralTitleListTokens;
3334 TitleListLanguage = &GeneralTitleListLanguage;
3335 TitleListPref = &GeneralTitleListPref;
3338 TitleList = &HomeTitleList;
3339 TitleListType = &HomeTitleListType;
3340 TitleListAltID = &HomeTitleListAltID;
3341 TitleListPID = &HomeTitleListPID;
3342 TitleListTokens = &HomeTitleListTokens;
3343 TitleListLanguage = &HomeTitleListLanguage;
3344 TitleListPref = &HomeTitleListPref;
3347 TitleList = &BusinessTitleList;
3348 TitleListType = &BusinessTitleListType;
3349 TitleListAltID = &BusinessTitleListAltID;
3350 TitleListPID = &BusinessTitleListPID;
3351 TitleListTokens = &BusinessTitleListTokens;
3352 TitleListLanguage = &BusinessTitleListLanguage;
3353 TitleListPref = &BusinessTitleListPref;
3359 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3360 intiter != SplitPoints.end(); ++intiter){
3362 SLiter = SplitLength.find(intiter->first);
3364 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3366 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3367 PropertyName = PropertyElement.GetNextToken();
3368 PropertyValue = PropertyElement.GetNextToken();
3370 intPrevValue = intiter->second;
3372 // Process properties.
3374 size_t intPropertyValueLen = PropertyValue.Len();
3376 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3378 PropertyValue.Trim();
3379 PropertyValue.RemoveLast();
3383 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3385 PropertyValue.Remove(0, 1);
3389 CaptureString(&PropertyValue, FALSE);
3391 if (PropertyName == wxT("ALTID")){
3393 TitleListAltID->erase(*TitleCount);
3394 TitleListAltID->insert(std::make_pair(*TitleCount, PropertyValue));
3396 } else if (PropertyName == wxT("PID")){
3398 TitleListPID->erase(*TitleCount);
3399 TitleListPID->insert(std::make_pair(*TitleCount, PropertyValue));
3401 } else if (PropertyName == wxT("PREF")){
3403 ProcessIntegerValue(TitleListPref, &PropertyValue, TitleCount);
3405 } else if (PropertyName == wxT("LANGUAGE")){
3407 TitleListLanguage->erase(*TitleCount);
3408 TitleListLanguage->insert(std::make_pair(*TitleCount, PropertyValue));
3412 // Something else we don't know about so append
3413 // to the tokens variable.
3415 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3417 if (FirstToken == TRUE){
3419 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3424 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3434 // Add the data to the General/Home/Work address variables.
3436 CaptureString(&PropertySeg2, FALSE);
3438 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3440 if (!PropertyTokens.IsEmpty()){
3442 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3448 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3450 std::map<int, int> SplitPoints;
3451 std::map<int, int> SplitLength;
3452 std::map<int, int>::iterator SLiter;
3453 wxString PropertyData;
3454 wxString PropertyName;
3455 wxString PropertyValue;
3456 wxString PropertyTokens;
3457 bool FirstToken = TRUE;
3458 int intPrevValue = 6;
3463 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3467 PropertyType PropType = PROPERTY_NONE;
3469 // Look for type before continuing.
3471 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3473 // Setup the pointers.
3475 std::map<int, wxString> *RoleList = NULL;
3476 std::map<int, wxString> *RoleListAltID = NULL;
3477 std::map<int, wxString> *RoleListPID = NULL;
3478 std::map<int, wxString> *RoleListType = NULL;
3479 std::map<int, wxString> *RoleListTokens = NULL;
3480 std::map<int, wxString> *RoleListLanguage = NULL;
3481 std::map<int, int> *RoleListPref = NULL;
3483 // Setup blank lines for later on.
3487 RoleList = &GeneralRoleList;
3488 RoleListType = &GeneralRoleListType;
3489 RoleListAltID = &GeneralRoleListAltID;
3490 RoleListPID = &GeneralRoleListPID;
3491 RoleListTokens = &GeneralRoleListTokens;
3492 RoleListLanguage = &GeneralRoleListLanguage;
3493 RoleListPref = &GeneralRoleListPref;
3496 RoleList = &HomeRoleList;
3497 RoleListType = &HomeRoleListType;
3498 RoleListAltID = &HomeRoleListAltID;
3499 RoleListPID = &HomeRoleListPID;
3500 RoleListTokens = &HomeRoleListTokens;
3501 RoleListLanguage = &HomeRoleListLanguage;
3502 RoleListPref = &HomeRoleListPref;
3505 RoleList = &BusinessRoleList;
3506 RoleListType = &BusinessRoleListType;
3507 RoleListAltID = &BusinessRoleListAltID;
3508 RoleListPID = &BusinessRoleListPID;
3509 RoleListTokens = &BusinessRoleListTokens;
3510 RoleListLanguage = &BusinessRoleListLanguage;
3511 RoleListPref = &BusinessRoleListPref;
3517 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3518 intiter != SplitPoints.end(); ++intiter){
3520 SLiter = SplitLength.find(intiter->first);
3522 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3524 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3525 PropertyName = PropertyElement.GetNextToken();
3526 PropertyValue = PropertyElement.GetNextToken();
3528 intPrevValue = intiter->second;
3530 // Process properties.
3532 size_t intPropertyValueLen = PropertyValue.Len();
3534 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3536 PropertyValue.Trim();
3537 PropertyValue.RemoveLast();
3541 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3543 PropertyValue.Remove(0, 1);
3547 CaptureString(&PropertyValue, FALSE);
3549 if (PropertyName == wxT("ALTID")){
3551 RoleListAltID->erase(*RoleCount);
3552 RoleListAltID->insert(std::make_pair(*RoleCount, PropertyValue));
3554 } else if (PropertyName == wxT("PID")){
3556 RoleListPID->erase(*RoleCount);
3557 RoleListPID->insert(std::make_pair(*RoleCount, PropertyValue));
3559 } else if (PropertyName == wxT("PREF")){
3561 ProcessIntegerValue(RoleListPref, &PropertyValue, RoleCount);
3563 } else if (PropertyName == wxT("LANGUAGE")){
3565 RoleListLanguage->erase(*RoleCount);
3566 RoleListLanguage->insert(std::make_pair(*RoleCount, PropertyValue));
3570 // Something else we don't know about so append
3571 // to the tokens variable.
3573 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3575 if (FirstToken == TRUE){
3577 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3582 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3592 // Add the data to the General/Home/Work address variables.
3594 CaptureString(&PropertySeg2, FALSE);
3596 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3598 if (!PropertyTokens.IsEmpty()){
3600 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3606 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3608 std::map<int, int> SplitPoints;
3609 std::map<int, int> SplitLength;
3610 std::map<int, int>::iterator SLiter;
3611 wxString PropertyData;
3612 wxString PropertyName;
3613 wxString PropertyValue;
3614 wxString PropertyTokens;
3615 bool FirstToken = TRUE;
3616 int intPrevValue = 5;
3621 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3625 PropertyType PropType = PROPERTY_NONE;
3627 // Look for type before continuing.
3629 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3631 // Setup the pointers.
3633 std::map<int, wxString> *OrganisationsList = NULL;
3634 std::map<int, wxString> *OrganisationsListAltID = NULL;
3635 std::map<int, wxString> *OrganisationsListPID = NULL;
3636 std::map<int, wxString> *OrganisationsListType = NULL;
3637 std::map<int, wxString> *OrganisationsListTokens = NULL;
3638 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3639 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3640 std::map<int, int> *OrganisationsListPref = NULL;
3642 // Setup blank lines for later on.
3646 OrganisationsList = &GeneralOrganisationsList;
3647 OrganisationsListType = &GeneralOrganisationsListType;
3648 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3649 OrganisationsListPID = &GeneralOrganisationsListPID;
3650 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3651 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3652 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3653 OrganisationsListPref = &GeneralOrganisationsListPref;
3656 OrganisationsList = &HomeOrganisationsList;
3657 OrganisationsListType = &HomeOrganisationsListType;
3658 OrganisationsListAltID = &HomeOrganisationsListAltID;
3659 OrganisationsListPID = &HomeOrganisationsListPID;
3660 OrganisationsListTokens = &HomeOrganisationsListTokens;
3661 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3662 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3663 OrganisationsListPref = &HomeOrganisationsListPref;
3666 OrganisationsList = &BusinessOrganisationsList;
3667 OrganisationsListType = &BusinessOrganisationsListType;
3668 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3669 OrganisationsListPID = &BusinessOrganisationsListPID;
3670 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3671 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3672 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3673 OrganisationsListPref = &BusinessOrganisationsListPref;
3679 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3680 intiter != SplitPoints.end(); ++intiter){
3682 SLiter = SplitLength.find(intiter->first);
3684 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3686 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3687 PropertyName = PropertyElement.GetNextToken();
3688 PropertyValue = PropertyElement.GetNextToken();
3690 intPrevValue = intiter->second;
3692 // Process properties.
3694 size_t intPropertyValueLen = PropertyValue.Len();
3696 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3698 PropertyValue.Trim();
3699 PropertyValue.RemoveLast();
3703 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3705 PropertyValue.Remove(0, 1);
3709 CaptureString(&PropertyValue, FALSE);
3711 if (PropertyName == wxT("ALTID")){
3713 OrganisationsListAltID->erase(*OrganisationCount);
3714 OrganisationsListAltID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3716 } else if (PropertyName == wxT("PID")){
3718 OrganisationsListPID->erase(*OrganisationCount);
3719 OrganisationsListPID->insert(std::make_pair(*OrganisationCount, PropertyValue));
3721 } else if (PropertyName == wxT("SORT-AS")){
3723 OrganisationsListSortAs->erase(*OrganisationCount);
3724 OrganisationsListSortAs->insert(std::make_pair(*OrganisationCount, PropertyValue));
3726 } else if (PropertyName == wxT("PREF")){
3728 ProcessIntegerValue(OrganisationsListPref, &PropertyValue, OrganisationCount);
3730 } else if (PropertyName == wxT("LANGUAGE")){
3732 OrganisationsListLanguage->erase(*OrganisationCount);
3733 OrganisationsListLanguage->insert(std::make_pair(*OrganisationCount, PropertyValue));
3737 // Something else we don't know about so append
3738 // to the tokens variable.
3740 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3742 if (FirstToken == TRUE){
3744 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3749 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3759 // Add the data to the General/Home/Work address variables.
3761 CaptureString(&PropertySeg2, FALSE);
3763 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3765 if (!PropertyTokens.IsEmpty()){
3767 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3773 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3775 std::map<int, int> SplitPoints;
3776 std::map<int, int> SplitLength;
3777 std::map<int, int>::iterator SLiter;
3778 wxString PropertyData;
3779 wxString PropertyName;
3780 wxString PropertyValue;
3781 wxString PropertyTokens;
3782 bool FirstToken = TRUE;
3783 int intPrevValue = 6;
3788 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3792 PropertyType PropType = PROPERTY_NONE;
3794 // Look for type before continuing.
3796 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3798 // Setup the pointers.
3800 std::map<int, wxString> *NoteList = NULL;
3801 std::map<int, wxString> *NoteListAltID = NULL;
3802 std::map<int, wxString> *NoteListPID = NULL;
3803 std::map<int, wxString> *NoteListType = NULL;
3804 std::map<int, wxString> *NoteListTokens = NULL;
3805 std::map<int, wxString> *NoteListLanguage = NULL;
3806 std::map<int, int> *NoteListPref = NULL;
3808 // Setup blank lines for later on.
3812 NoteList = &GeneralNoteList;
3813 NoteListType = &GeneralNoteListType;
3814 NoteListAltID = &GeneralNoteListAltID;
3815 NoteListPID = &GeneralNoteListPID;
3816 NoteListTokens = &GeneralNoteListTokens;
3817 NoteListLanguage = &GeneralNoteListLanguage;
3818 NoteListPref = &GeneralNoteListPref;
3821 NoteList = &HomeNoteList;
3822 NoteListType = &HomeNoteListType;
3823 NoteListAltID = &HomeNoteListAltID;
3824 NoteListPID = &HomeNoteListPID;
3825 NoteListTokens = &HomeNoteListTokens;
3826 NoteListLanguage = &HomeNoteListLanguage;
3827 NoteListPref = &HomeNoteListPref;
3830 NoteList = &BusinessNoteList;
3831 NoteListType = &BusinessNoteListType;
3832 NoteListAltID = &BusinessNoteListAltID;
3833 NoteListPID = &BusinessNoteListPID;
3834 NoteListTokens = &BusinessNoteListTokens;
3835 NoteListLanguage = &BusinessNoteListLanguage;
3836 NoteListPref = &BusinessNoteListPref;
3842 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3843 intiter != SplitPoints.end(); ++intiter){
3845 SLiter = SplitLength.find(intiter->first);
3847 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3849 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3850 PropertyName = PropertyElement.GetNextToken();
3851 PropertyValue = PropertyElement.GetNextToken();
3853 intPrevValue = intiter->second;
3855 // Process properties.
3857 size_t intPropertyValueLen = PropertyValue.Len();
3859 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3861 PropertyValue.Trim();
3862 PropertyValue.RemoveLast();
3866 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3868 PropertyValue.Remove(0, 1);
3872 CaptureString(&PropertyValue, FALSE);
3874 if (PropertyName == wxT("ALTID")){
3876 NoteListAltID->erase(*NoteCount);
3877 NoteListAltID->insert(std::make_pair(*NoteCount, PropertyValue));
3879 } else if (PropertyName == wxT("PID")){
3881 NoteListPID->erase(*NoteCount);
3882 NoteListPID->insert(std::make_pair(*NoteCount, PropertyValue));
3884 } else if (PropertyName == wxT("PREF")){
3886 ProcessIntegerValue(NoteListPref, &PropertyValue, NoteCount);
3888 } else if (PropertyName == wxT("LANGUAGE")){
3890 NoteListLanguage->erase(*NoteCount);
3891 NoteListLanguage->insert(std::make_pair(*NoteCount, PropertyValue));
3895 // Something else we don't know about so append
3896 // to the tokens variable.
3898 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3900 if (FirstToken == TRUE){
3902 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3907 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3917 // Add the data to the General/Home/Work address variables.
3919 CaptureString(&PropertySeg2, FALSE);
3921 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3923 if (!PropertyTokens.IsEmpty()){
3925 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3931 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3933 std::map<int, int> SplitPoints;
3934 std::map<int, int> SplitLength;
3935 std::map<int, int>::iterator SLiter;
3936 wxString PropertyData;
3937 wxString PropertyName;
3938 wxString PropertyValue;
3939 wxString PropertyTokens;
3940 bool FirstToken = TRUE;
3941 int intPrevValue = 12;
3946 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3950 PropertyType PropType = PROPERTY_NONE;
3952 // Look for type before continuing.
3954 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3956 // Setup blank lines for later on.
3962 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3965 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3971 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3972 intiter != SplitPoints.end(); ++intiter){
3974 SLiter = SplitLength.find(intiter->first);
3976 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3978 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3979 PropertyName = PropertyElement.GetNextToken();
3980 PropertyValue = PropertyElement.GetNextToken();
3982 intPrevValue = intiter->second;
3984 // Process properties.
3986 size_t intPropertyValueLen = PropertyValue.Len();
3988 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3990 PropertyValue.Trim();
3991 PropertyValue.RemoveLast();
3995 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3997 PropertyValue.Remove(0, 1);
4001 CaptureString(&PropertyValue, FALSE);
4003 if (PropertyName == wxT("ALTID")){
4005 CategoriesListAltID.erase(*CategoryCount);
4006 CategoriesListAltID.insert(std::make_pair(*CategoryCount, PropertyValue));
4008 } else if (PropertyName == wxT("PID")){
4010 CategoriesListPID.erase(*CategoryCount);
4011 CategoriesListPID.insert(std::make_pair(*CategoryCount, PropertyValue));
4013 } else if (PropertyName == wxT("PREF")){
4015 ProcessIntegerValue(&CategoriesListPref, &PropertyValue, CategoryCount);
4017 } else if (PropertyName == wxT("LANGUAGE")){
4019 CategoriesListLanguage.erase(*CategoryCount);
4020 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, PropertyValue));
4024 // Something else we don't know about so append
4025 // to the tokens variable.
4027 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4029 if (FirstToken == TRUE){
4031 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4036 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4046 // Deal with multiple categories.
4048 int intOrigCatCount = *CategoryCount;
4049 bool FirstCategoryProcessed = TRUE;
4050 bool AfterFirstToken = FALSE;
4051 int intSplitSize = 0;
4052 int intSplitsFound = 0;
4053 int intSplitSeek = 0;
4054 int intPropertyLen = PropertySeg2.Len();
4056 SplitPoints.clear();
4057 SplitLength.clear();
4060 for (int i = 0; i <= intPropertyLen; i++){
4062 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
4070 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4072 if (AfterFirstToken == TRUE){
4074 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
4075 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
4079 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
4080 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
4081 AfterFirstToken = TRUE;
4093 if (SplitPoints.size() > 0){
4095 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
4096 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
4100 if (SplitPoints.size() == 0){
4102 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
4104 if (!PropertyTokens.IsEmpty()){
4106 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4112 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4113 intiter != SplitPoints.end(); ++intiter){
4115 SLiter = SplitLength.find(intiter->first);
4117 intPrevValue = intiter->second;
4119 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
4121 // Add the data to the General/Home/Work address variables.
4123 // Trim any whitespace from the start and end.
4125 PropertyData = PropertyData.Trim(FALSE);
4126 PropertyData = PropertyData.Trim(TRUE);
4128 CaptureString(&PropertyData, FALSE);
4130 if (FirstCategoryProcessed == TRUE){
4132 FirstCategoryProcessed = FALSE;
4134 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4136 if (!PropertyTokens.IsEmpty()){
4138 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4148 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
4150 if (!PropertyTokens.IsEmpty()){
4152 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
4158 // Copy the properties to each of the categories (if it exists).
4160 if (!PropertyTokens.IsEmpty()){
4162 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
4166 // Check if ALTID was used.
4168 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
4170 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
4174 // Check if PID was used.
4176 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
4178 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
4182 // Check if PREF was used.
4184 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
4186 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
4190 // Check if LANGUAGE was used.
4192 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
4194 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
4198 // Check if TYPE was used.
4204 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
4207 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
4215 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
4217 size_t intPropertyLen = PropertySeg1.Len();
4218 std::map<int, int> SplitPoints;
4219 std::map<int, int> SplitLength;
4220 std::map<int, int>::iterator SLiter;
4221 wxString PropertyData;
4222 wxString PropertyName;
4223 wxString PropertyValue;
4224 wxString PropertyTokens;
4225 bool FirstToken = TRUE;
4226 int intSplitsFound = 0;
4227 int intSplitSize = 0;
4228 int intPrevValue = 7;
4232 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4236 PropertyType PropType = PROPERTY_NONE;
4238 // Look for type before continuing.
4240 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4244 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4245 intiter != SplitPoints.end(); ++intiter){
4247 SLiter = SplitLength.find(intiter->first);
4249 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4251 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4252 PropertyName = PropertyElement.GetNextToken();
4253 PropertyValue = PropertyElement.GetNextToken();
4255 intPrevValue = intiter->second;
4257 // Process properties.
4259 size_t intPropertyValueLen = PropertyValue.Len();
4261 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4263 PropertyValue.Trim();
4264 PropertyValue.RemoveLast();
4268 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4270 PropertyValue.Remove(0, 1);
4274 CaptureString(&PropertyValue, FALSE);
4276 if (PropertyName == wxT("ALTID")){
4278 PicturesListAltID.erase(*PhotoCount);
4279 PicturesListAltID.insert(std::make_pair(*PhotoCount, PropertyValue));
4281 } else if (PropertyName == wxT("PID")){
4283 PicturesListPID.erase(*PhotoCount);
4284 PicturesListPID.insert(std::make_pair(*PhotoCount, PropertyValue));
4286 } else if (PropertyName == wxT("PREF")){
4288 ProcessIntegerValue(&PicturesListPref, &PropertyValue, PhotoCount);
4290 } else if (PropertyName == wxT("MEDIATYPE")){
4292 PicturesListMediatype.erase(*PhotoCount);
4293 PicturesListMediatype.insert(std::make_pair(*PhotoCount, PropertyValue));
4297 // Something else we don't know about so append
4298 // to the tokens variable.
4300 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4302 if (FirstToken == TRUE){
4304 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4309 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4319 intPropertyLen = PropertySeg2.Len();
4320 SplitPoints.clear();
4321 SplitLength.clear();
4326 CaptureString(&PropertySeg2, FALSE);
4328 for (int i = 0; i <= intPropertyLen; i++){
4332 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4335 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4337 if (intSplitsFound == 6){
4339 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4344 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4354 wxString wxSPhotoURI;
4355 wxString wxSPhotoMIME;
4356 wxString wxSPhotoEncoding;
4357 wxString wxSPhotoData;
4358 std::string base64enc;
4360 if (intSplitsFound == 0){
4364 std::map<int, int>::iterator striter;
4366 striter = SplitLength.find(1);
4368 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4370 while (wSTDataType.HasMoreTokens() == TRUE){
4372 wxSPhotoURI = wSTDataType.GetNextToken();
4373 wxSPhotoMIME = wSTDataType.GetNextToken();
4378 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4380 while (wSTDataInfo.HasMoreTokens() == TRUE){
4382 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4383 wxSPhotoData = wSTDataInfo.GetNextToken();
4384 base64enc = wxSPhotoData.mb_str();
4391 // Add the data to the General/Home/Work address variables.
4393 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4394 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4395 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4401 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4404 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4408 if (!PropertyTokens.IsEmpty()){
4410 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4416 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4418 size_t intPropertyLen = PropertySeg1.Len();
4419 std::map<int, int> SplitPoints;
4420 std::map<int, int> SplitLength;
4421 std::map<int, int>::iterator SLiter;
4422 wxString PropertyData;
4423 wxString PropertyName;
4424 wxString PropertyValue;
4425 wxString PropertyTokens;
4426 bool FirstToken = TRUE;
4427 int intSplitsFound = 0;
4428 int intSplitSize = 0;
4429 int intPrevValue = 6;
4433 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4437 PropertyType PropType = PROPERTY_NONE;
4439 // Look for type before continuing.
4441 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4445 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4446 intiter != SplitPoints.end(); ++intiter){
4448 SLiter = SplitLength.find(intiter->first);
4450 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4452 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4453 PropertyName = PropertyElement.GetNextToken();
4454 PropertyValue = PropertyElement.GetNextToken();
4456 intPrevValue = intiter->second;
4458 // Process properties.
4460 size_t intPropertyValueLen = PropertyValue.Len();
4462 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4464 PropertyValue.Trim();
4465 PropertyValue.RemoveLast();
4469 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4471 PropertyValue.Remove(0, 1);
4475 CaptureString(&PropertyValue, FALSE);
4477 if (PropertyName == wxT("ALTID")){
4479 LogosListAltID.erase(*LogoCount);
4480 LogosListAltID.insert(std::make_pair(*LogoCount, PropertyValue));
4482 } else if (PropertyName == wxT("PID")){
4484 LogosListPID.erase(*LogoCount);
4485 LogosListPID.insert(std::make_pair(*LogoCount, PropertyValue));
4487 } else if (PropertyName == wxT("PREF")){
4489 ProcessIntegerValue(&LogosListPref, &PropertyValue, LogoCount);
4491 } else if (PropertyName == wxT("MEDIATYPE")){
4493 LogosListMediatype.erase(*LogoCount);
4494 LogosListMediatype.insert(std::make_pair(*LogoCount, PropertyValue));
4498 // Something else we don't know about so append
4499 // to the tokens variable.
4501 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4503 if (FirstToken == TRUE){
4505 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4510 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4520 intPropertyLen = PropertySeg2.Len();
4521 SplitPoints.clear();
4522 SplitLength.clear();
4527 CaptureString(&PropertySeg2, FALSE);
4529 for (int i = 0; i <= intPropertyLen; i++){
4533 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4536 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4538 if (intSplitsFound == 6){
4540 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4545 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4555 wxString wxSPhotoURI;
4556 wxString wxSPhotoMIME;
4557 wxString wxSPhotoEncoding;
4558 wxString wxSPhotoData;
4559 std::string base64enc;
4561 if (intSplitsFound == 0){
4565 std::map<int, int>::iterator striter;
4567 striter = SplitLength.find(1);
4569 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4571 while (wSTDataType.HasMoreTokens() == TRUE){
4573 wxSPhotoURI = wSTDataType.GetNextToken();
4574 wxSPhotoMIME = wSTDataType.GetNextToken();
4579 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4581 while (wSTDataInfo.HasMoreTokens() == TRUE){
4583 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4584 wxSPhotoData = wSTDataInfo.GetNextToken();
4585 base64enc = wxSPhotoData.mb_str();
4592 // Add the data to the General/Home/Work address variables.
4594 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4595 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4596 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4602 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4605 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4609 if (!PropertyTokens.IsEmpty()){
4611 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4617 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4619 size_t intPropertyLen = PropertySeg1.Len();
4620 std::map<int, int> SplitPoints;
4621 std::map<int, int> SplitLength;
4622 std::map<int, int>::iterator SLiter;
4623 wxString PropertyData;
4624 wxString PropertyName;
4625 wxString PropertyValue;
4626 wxString PropertyTokens;
4627 bool FirstToken = TRUE;
4628 int intSplitsFound = 0;
4629 int intSplitSize = 0;
4630 int intPrevValue = 7;
4634 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4638 PropertyType PropType = PROPERTY_NONE;
4640 // Look for type before continuing.
4642 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4646 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4647 intiter != SplitPoints.end(); ++intiter){
4649 SLiter = SplitLength.find(intiter->first);
4651 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4653 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4654 PropertyName = PropertyElement.GetNextToken();
4655 PropertyValue = PropertyElement.GetNextToken();
4657 intPrevValue = intiter->second;
4659 // Process properties.
4661 size_t intPropertyValueLen = PropertyValue.Len();
4663 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4665 PropertyValue.Trim();
4666 PropertyValue.RemoveLast();
4670 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4672 PropertyValue.Remove(0, 1);
4676 CaptureString(&PropertyValue, FALSE);
4678 if (PropertyName == wxT("ALTID")){
4680 SoundsListAltID.erase(*SoundCount);
4681 SoundsListAltID.insert(std::make_pair(*SoundCount, PropertyValue));
4683 } else if (PropertyName == wxT("PID")){
4685 SoundsListPID.erase(*SoundCount);
4686 SoundsListPID.insert(std::make_pair(*SoundCount, PropertyValue));
4688 } else if (PropertyName == wxT("PREF")){
4690 ProcessIntegerValue(&SoundsListPref, &PropertyValue, SoundCount);
4692 } else if (PropertyName == wxT("MEDIATYPE")){
4694 SoundsListMediatype.erase(*SoundCount);
4695 SoundsListMediatype.insert(std::make_pair(*SoundCount, PropertyValue));
4697 } else if (PropertyName == wxT("LANGUAGE")){
4699 SoundsListLanguage.erase(*SoundCount);
4700 SoundsListLanguage.insert(std::make_pair(*SoundCount, PropertyValue));
4704 // Something else we don't know about so append
4705 // to the tokens variable.
4707 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4709 if (FirstToken == TRUE){
4711 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4716 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4726 intPropertyLen = PropertySeg2.Len();
4727 SplitPoints.clear();
4728 SplitLength.clear();
4733 CaptureString(&PropertySeg2, FALSE);
4735 for (int i = 0; i <= intPropertyLen; i++){
4739 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4742 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4744 if (intSplitsFound == 6){
4746 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4751 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4761 wxString wxSSoundURI;
4762 wxString wxSSoundMIME;
4763 wxString wxSSoundEncoding;
4764 wxString wxSSoundData;
4765 std::string base64enc;
4767 if (intSplitsFound == 0){
4771 std::map<int, int>::iterator striter;
4773 striter = SplitLength.find(1);
4775 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4777 while (wSTDataType.HasMoreTokens() == TRUE){
4779 wxSSoundURI = wSTDataType.GetNextToken();
4780 wxSSoundMIME = wSTDataType.GetNextToken();
4785 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4787 while (wSTDataInfo.HasMoreTokens() == TRUE){
4789 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4790 wxSSoundData = wSTDataInfo.GetNextToken();
4791 base64enc = wxSSoundData.mb_str();
4798 // Add the data to the General/Home/Work address variables.
4804 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4807 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4811 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4812 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4813 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4815 if (!PropertyTokens.IsEmpty()){
4817 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4823 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4825 size_t intPropertyLen = PropertySeg1.Len();
4826 std::map<int, int> SplitPoints;
4827 std::map<int, int> SplitLength;
4828 std::map<int, int>::iterator SLiter;
4829 wxString PropertyData;
4830 wxString PropertyName;
4831 wxString PropertyValue;
4832 wxString PropertyTokens;
4833 bool FirstToken = TRUE;
4834 int intSplitsFound = 0;
4835 int intSplitSize = 0;
4836 int intPrevValue = 8;
4840 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4844 PropertyType PropType = PROPERTY_NONE;
4846 // Look for type before continuing.
4848 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4852 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4853 intiter != SplitPoints.end(); ++intiter){
4855 SLiter = SplitLength.find(intiter->first);
4857 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4859 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4860 PropertyName = PropertyElement.GetNextToken();
4861 PropertyValue = PropertyElement.GetNextToken();
4863 intPrevValue = intiter->second;
4865 // Process properties.
4867 size_t intPropertyValueLen = PropertyValue.Len();
4869 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4871 PropertyValue.Trim();
4872 PropertyValue.RemoveLast();
4876 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4878 PropertyValue.Remove(0, 1);
4882 CaptureString(&PropertyValue, FALSE);
4884 if (PropertyName == wxT("ALTID")){
4886 CalendarListAltID.erase(*CalURICount);
4887 CalendarListAltID.insert(std::make_pair(*CalURICount, PropertyValue));
4889 } else if (PropertyName == wxT("PID")){
4891 CalendarListPID.erase(*CalURICount);
4892 CalendarListPID.insert(std::make_pair(*CalURICount, PropertyValue));
4894 } else if (PropertyName == wxT("PREF")){
4896 ProcessIntegerValue(&CalendarListPref, &PropertyValue, CalURICount);
4898 } else if (PropertyName == wxT("MEDIATYPE")){
4900 CalendarListMediatype.erase(*CalURICount);
4901 CalendarListMediatype.insert(std::make_pair(*CalURICount, PropertyValue));
4905 // Something else we don't know about so append
4906 // to the tokens variable.
4908 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4910 if (FirstToken == TRUE){
4912 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4917 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4927 intPropertyLen = PropertySeg2.Len();
4928 SplitPoints.clear();
4929 SplitLength.clear();
4934 CaptureString(&PropertySeg2, FALSE);
4936 // Add the data to the General/Home/Work address variables.
4942 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4945 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4949 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4951 if (!PropertyTokens.IsEmpty()){
4953 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4959 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4961 size_t intPropertyLen = PropertySeg1.Len();
4962 std::map<int, int> SplitPoints;
4963 std::map<int, int> SplitLength;
4964 std::map<int, int>::iterator SLiter;
4965 wxString PropertyData;
4966 wxString PropertyName;
4967 wxString PropertyValue;
4968 wxString PropertyTokens;
4969 bool FirstToken = TRUE;
4970 int intSplitsFound = 0;
4971 int intSplitSize = 0;
4972 int intPrevValue = 8;
4976 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4980 PropertyType PropType = PROPERTY_NONE;
4982 // Look for type before continuing.
4984 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4988 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4989 intiter != SplitPoints.end(); ++intiter){
4991 SLiter = SplitLength.find(intiter->first);
4993 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4995 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4996 PropertyName = PropertyElement.GetNextToken();
4997 PropertyValue = PropertyElement.GetNextToken();
4999 intPrevValue = intiter->second;
5001 // Process properties.
5003 size_t intPropertyValueLen = PropertyValue.Len();
5005 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5007 PropertyValue.Trim();
5008 PropertyValue.RemoveLast();
5012 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5014 PropertyValue.Remove(0, 1);
5018 CaptureString(&PropertyValue, FALSE);
5020 if (PropertyName == wxT("ALTID")){
5022 CalendarRequestListAltID.erase(*CalAdrURICount);
5023 CalendarRequestListAltID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
5025 } else if (PropertyName == wxT("PID")){
5027 CalendarRequestListPID.erase(*CalAdrURICount);
5028 CalendarRequestListPID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
5030 } else if (PropertyName == wxT("PREF")){
5032 ProcessIntegerValue(&CalendarRequestListPref, &PropertyValue, CalAdrURICount);
5034 } else if (PropertyName == wxT("MEDIATYPE")){
5036 CalendarRequestListMediatype.erase(*CalAdrURICount);
5037 CalendarRequestListMediatype.insert(std::make_pair(*CalAdrURICount, PropertyValue));
5041 // Something else we don't know about so append
5042 // to the tokens variable.
5044 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5046 if (FirstToken == TRUE){
5048 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5053 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5063 intPropertyLen = PropertySeg2.Len();
5064 SplitPoints.clear();
5065 SplitLength.clear();
5070 CaptureString(&PropertySeg2, FALSE);
5072 // Add the data to the General/Home/Work address variables.
5078 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
5081 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
5085 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
5087 if (!PropertyTokens.IsEmpty()){
5089 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
5095 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
5097 size_t intPropertyLen = PropertySeg1.Len();
5098 std::map<int, int> SplitPoints;
5099 std::map<int, int> SplitLength;
5100 std::map<int, int>::iterator SLiter;
5101 wxString PropertyData;
5102 wxString PropertyName;
5103 wxString PropertyValue;
5104 wxString PropertyTokens;
5105 bool FirstToken = TRUE;
5106 int intSplitsFound = 0;
5107 int intSplitSize = 0;
5108 int intPrevValue = 7;
5112 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5116 PropertyType PropType = PROPERTY_NONE;
5118 // Look for type before continuing.
5120 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5124 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5125 intiter != SplitPoints.end(); ++intiter){
5127 SLiter = SplitLength.find(intiter->first);
5129 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5131 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5132 PropertyName = PropertyElement.GetNextToken();
5133 PropertyValue = PropertyElement.GetNextToken();
5135 intPrevValue = intiter->second;
5137 // Process properties.
5139 size_t intPropertyValueLen = PropertyValue.Len();
5141 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5143 PropertyValue.Trim();
5144 PropertyValue.RemoveLast();
5148 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5150 PropertyValue.Remove(0, 1);
5154 CaptureString(&PropertyValue, FALSE);
5156 if (PropertyName == wxT("ALTID")){
5158 FreeBusyListAltID.erase(*FreeBusyAddressCount);
5159 FreeBusyListAltID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5161 } else if (PropertyName == wxT("PID")){
5163 FreeBusyListPID.erase(*FreeBusyAddressCount);
5164 FreeBusyListPID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5166 } else if (PropertyName == wxT("PREF")){
5168 ProcessIntegerValue(&FreeBusyListPref, &PropertyValue, FreeBusyAddressCount);
5170 } else if (PropertyName == wxT("MEDIATYPE")){
5172 FreeBusyListMediatype.erase(*FreeBusyAddressCount);
5173 FreeBusyListMediatype.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
5177 // Something else we don't know about so append
5178 // to the tokens variable.
5180 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5182 if (FirstToken == TRUE){
5184 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5189 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5199 intPropertyLen = PropertySeg2.Len();
5200 SplitPoints.clear();
5201 SplitLength.clear();
5206 CaptureString(&PropertySeg2, FALSE);
5208 // Add the data to the General/Home/Work address variables.
5214 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
5217 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
5221 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
5223 if (!PropertyTokens.IsEmpty()){
5225 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
5231 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
5233 size_t intPropertyLen = PropertySeg1.Len();
5234 std::map<int, int> SplitPoints;
5235 std::map<int, int> SplitLength;
5236 std::map<int, int>::iterator SLiter;
5237 wxString PropertyData;
5238 wxString PropertyName;
5239 wxString PropertyValue;
5240 wxString PropertyTokens;
5241 bool FirstToken = TRUE;
5242 int intSplitsFound = 0;
5243 int intSplitSize = 0;
5244 int intPrevValue = 5;
5249 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
5253 PropertyType PropType = PROPERTY_NONE;
5255 // Look for type before continuing.
5257 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
5261 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
5262 intiter != SplitPoints.end(); ++intiter){
5264 SLiter = SplitLength.find(intiter->first);
5266 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
5268 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5269 PropertyName = PropertyElement.GetNextToken();
5270 PropertyValue = PropertyElement.GetNextToken();
5272 intPrevValue = intiter->second;
5274 // Process properties.
5276 size_t intPropertyValueLen = PropertyValue.Len();
5278 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
5280 PropertyValue.Trim();
5281 PropertyValue.RemoveLast();
5285 if (PropertyValue.Mid(0, 1) == wxT("\"")){
5287 PropertyValue.Remove(0, 1);
5291 if (PropertyName == wxT("ALTID")){
5293 KeyListAltID.erase(*KeyCount);
5294 KeyListAltID.insert(std::make_pair(*KeyCount, PropertyValue));
5296 } else if (PropertyName == wxT("PID")){
5298 KeyListPID.erase(*KeyCount);
5299 KeyListPID.insert(std::make_pair(*KeyCount, PropertyValue));
5301 } else if (PropertyName == wxT("PREF")){
5303 ProcessIntegerValue(&KeyListPref, &PropertyValue, KeyCount);
5307 // Something else we don't know about so append
5308 // to the tokens variable.
5310 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
5312 if (FirstToken == TRUE){
5314 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5319 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5329 intPropertyLen = PropertySeg2.Len();
5330 SplitPoints.clear();
5331 SplitLength.clear();
5336 for (int i = 0; i <= intPropertyLen; i++){
5340 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
5343 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
5345 if (intSplitsFound == 6){
5347 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5352 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5363 wxString wxSKeyMIME;
5364 wxString wxSKeyEncoding;
5365 wxString wxSKeyData;
5366 std::string base64enc;
5368 if (intSplitsFound == 0){
5372 std::map<int, int>::iterator striter;
5374 striter = SplitLength.find(1);
5376 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
5378 while (wSTDataType.HasMoreTokens() == TRUE){
5380 wxSKeyURI = wSTDataType.GetNextToken();
5381 wxSKeyMIME = wSTDataType.GetNextToken();
5386 if (wxSKeyURI == wxT("data")){
5388 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
5390 while (wSTDataInfo.HasMoreTokens() == TRUE){
5392 wxSKeyEncoding = wSTDataInfo.GetNextToken();
5393 wxSKeyData = wSTDataInfo.GetNextToken();
5402 // Add the data to the General/Home/Work address variables.
5404 if (wxSKeyURI == wxT("data")){
5406 KeyListDataEncType.erase(*KeyCount);
5407 KeyListKeyType.erase(*KeyCount);
5408 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
5409 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
5411 KeyList.erase(*KeyCount);
5412 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
5416 KeyList.erase(*KeyCount);
5417 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
5421 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
5427 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
5430 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
5434 if (!PropertyTokens.IsEmpty()){
5436 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
5442 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
5444 // Split the Vendor three ways.
5446 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
5449 wxString wxSVNDPropName;
5452 while (wSTVendorDetails.HasMoreTokens() == TRUE){
5454 wSTVendorDetails.GetNextToken();
5455 wxSVNDID = wSTVendorDetails.GetNextToken();
5456 wxSVNDPropName = wSTVendorDetails.GetNextToken();
5461 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
5463 // Add the data to the vendor variables.
5465 VendorList.erase(*VendorCount);
5466 VendorListPEN.erase(*VendorCount);
5467 VendorListElement.erase(*VendorCount);
5469 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
5470 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
5471 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
5477 void ProcessStringValue(wxString *PropertyName,
5478 wxString PropertyNameMatch,
5479 std::map<int,wxString> *MapPtr,
5480 wxString *PropertyValue,
5482 bool *PropertyMatched){
5484 if (*PropertyName == PropertyNameMatch){
5485 MapPtr->erase(*ItemCount);
5486 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5487 *PropertyMatched = TRUE;
5492 void ProcessIntegerValue(wxString *PropertyName,
5493 wxString PropertyNameMatch,
5494 std::map<int,int> *PrefPtr,
5495 wxString *PropertyValue,
5497 bool *PropertyMatched){
5499 if (*PropertyName == PropertyNameMatch){
5500 *PropertyMatched = TRUE;
5505 int PriorityNumber = 0;
5506 bool ValidNumber = TRUE;
5509 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5512 catch(std::invalid_argument &e){
5513 ValidNumber = FALSE;
5516 if (ValidNumber == TRUE){
5518 PrefPtr->erase(*ItemCount);
5519 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5525 void ProcessIntegerValue(std::map<int,int> *PrefPtr,
5526 wxString *PropertyValue,
5529 int PriorityNumber = 0;
5530 bool ValidNumber = TRUE;
5533 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5536 catch(std::invalid_argument &e){
5537 ValidNumber = FALSE;
5540 if (ValidNumber == TRUE){
5542 PrefPtr->erase(*ItemCount);
5543 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5549 void SplitValues(wxString *PropertyLine,
5550 std::map<int,int> *SplitPoints,
5551 std::map<int,int> *SplitLength,
5554 size_t intPropertyLen = PropertyLine->Len();
5555 int intSplitsFound = 0;
5556 int intSplitSize = 0;
5557 int intSplitSeek = 0;
5559 for (int i = intSize; i <= intPropertyLen; i++){
5563 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5564 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5566 if (intSplitsFound == 0){
5568 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5572 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5576 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5586 if (intSplitsFound == 0){
5588 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5589 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5593 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5594 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5600 void CheckType(wxString *PropertySeg1,
5601 std::map<int,int> *SplitPoints,
5602 std::map<int,int> *SplitLength,
5604 PropertyType *PropType){
5606 wxString PropertyData;
5607 wxString PropertyName;
5608 wxString PropertyValue;
5609 std::map<int,int>::iterator SLiter;
5611 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5612 intiter != SplitPoints->end(); ++intiter){
5614 SLiter = SplitLength->find(intiter->first);
5616 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5618 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5619 PropertyName = PropertyElement.GetNextToken();
5620 PropertyValue = PropertyElement.GetNextToken();
5622 *intPrevValue = intiter->second;
5624 if (PropertyName == wxT("TYPE")){
5626 if (PropertyValue == wxT("work")){
5628 *PropType = PROPERTY_WORK;
5630 } else if (PropertyValue == wxT("home")){
5632 *PropType = PROPERTY_HOME;
5636 *PropType = PROPERTY_NONE;