1 // ContactDataObject.cpp - Client Data Object.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "ContactDataObject.h"
21 ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
23 if (!wxFileExists(Filename)){
25 return CONTACTLOAD_FILEMISSING;
31 if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
33 return CONTACTLOAD_FILEERROR;
37 // Check that the vCard is a valid vCard 4.0 file.
39 vCard vCard4FormatCheck;
41 vCard4FormatCheck.LoadFile(Filename);
43 if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){
45 return CONTACTLOAD_FILEINVALIDFORMAT;
49 // Check that the vCard meets the base specification.
51 if (!vCard4FormatCheck.MeetBaseSpecification()){
53 return CONTACTLOAD_FILEBASESPECFAIL;
57 wxStringTokenizer wSTContactFileLines(vCard4FormatCheck.WriteString(), wxT("\r\n"));
59 std::map<int, wxString> ContactFileLines;
61 int ContactLineSeek = 0;
63 while (wSTContactFileLines.HasMoreTokens() == TRUE){
65 wxString ContactLine = wSTContactFileLines.GetNextToken();
66 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
71 wxString wxSPropertyNextLine;
73 bool ExtraLineSeek = TRUE;
74 bool QuoteMode = FALSE;
75 bool PropertyFind = TRUE;
76 bool KindProcessed = FALSE;
77 bool NameProcessed = FALSE;
78 bool GenderProcessed = FALSE;
79 bool BirthdayProcessed = FALSE;
80 bool AnniversaryProcessed = FALSE;
81 bool UIDProcessed = FALSE;
82 bool RevisionProcessed = FALSE;
83 int ContactLineLen = 0;
84 int QuoteBreakPoint = 0;
88 int NicknameCount = 0;
89 int TimeZoneCount = 0;
93 int TelephoneCount = 0;
94 int LanguageCount = 0;
95 int GeographicCount = 0;
100 int OrganisationCount = 0;
102 int CategoryCount = 0;
106 int CalendarCount = 0;
107 int CalendarAddressCount = 0;
108 int FreeBusyAddressCount = 0;
113 int ClientPIDCount = 0;
114 wxString ContactLine;
115 wxString PropertyLine;
116 wxString PropertySeg1;
117 wxString PropertySeg2;
118 wxString PropertyNextLine;
121 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
122 iter != ContactFileLines.end(); ++iter){
124 ExtraLineSeek = TRUE;
130 PropertyLine.Clear();
131 PropertySeg1.Clear();
132 PropertySeg2.Clear();
135 ContactLine = iter->second;
137 while (ExtraLineSeek == TRUE){
139 // Check if there is extra data on the next line
140 // (indicated by space or tab at the start) and add data.
144 if (iter == ContactFileLines.end()){
151 PropertyNextLine = iter->second;
153 if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
155 PropertyNextLine.Remove(0, 1);
156 ContactLine.Append(PropertyNextLine);
161 ExtraLineSeek = FALSE;
167 ContactLineLen = ContactLine.Len();
169 // Make sure we are not in quotation mode.
170 // Make sure colon does not have \ or \\ before it.
172 for (int i = 0; i <= ContactLineLen; i++){
174 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
176 PropertyFind = FALSE;
178 } else if (PropertyFind == TRUE){
180 Property.Append(ContactLine.Mid(i, 1));
184 if (ContactLine.Mid(i, 1) == wxT("\"")){
186 if (QuoteMode == TRUE){
198 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
207 // Split that line at the point into two variables (ignore the colon).
209 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
210 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
212 if (Property == wxT("KIND") && KindProcessed == FALSE){
214 ProcessKind(PropertySeg2);
216 } else if (Property == wxT("UID") && UIDProcessed == FALSE){
218 UIDToken = PropertySeg2;
221 } else if (Property == wxT("SOURCE")){
223 ProcessSource(PropertySeg1, PropertySeg2, &SourceCount);
226 } else if (Property == wxT("XML")){
228 ProcessXML(PropertySeg1, PropertySeg2, &XMLCount);
231 } else if (Property == wxT("REV") && RevisionProcessed == FALSE){
233 ProcessRevision(PropertySeg1, PropertySeg2);
234 RevisionProcessed = TRUE;
236 } else if (Property == wxT("MEMBER")){
238 ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
241 } else if (Property == wxT("FN")){
243 ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
246 } else if (Property == wxT("N") && NameProcessed == FALSE){
248 ProcessN(PropertySeg1, PropertySeg2);
249 NameProcessed = TRUE;
251 } else if (Property == wxT("CLIENTPIDMAP")){
253 ProcessClientPIDMap(PropertySeg1, PropertySeg2, &ClientPIDCount);
256 } else if (Property == wxT("NICKNAME")){
258 ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
261 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
263 ProcessGender(PropertySeg1, PropertySeg2);
264 GenderProcessed = TRUE;
266 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
268 ProcessBirthday(PropertySeg1, PropertySeg2);
269 BirthdayProcessed = TRUE;
271 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
273 ProcessAnniversary(PropertySeg1, PropertySeg2);
274 AnniversaryProcessed = TRUE;
276 } else if (Property == wxT("TZ")){
278 ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
281 } else if (Property == wxT("ADR")){
283 ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
286 } else if (Property == wxT("EMAIL")){
288 ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);
291 } else if (Property == wxT("IMPP")){
293 ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
296 } else if (Property == wxT("TEL")){
298 ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
301 } else if (Property == wxT("LANG")){
303 // See frmContactEditor-LoadLanguage.cpp
305 ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
308 } else if (Property == wxT("GEO")){
310 // See frmContactEditor-LoadGeo.cpp
312 ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);
315 } else if (Property == wxT("RELATED")){
317 // See fromContactEditor-LoadRelated.cpp
319 ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);
322 } else if (Property == wxT("URL")){
324 // See frmContactEditor-LoadURL.cpp
326 ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
329 } else if (Property == wxT("TITLE")) {
331 // See frmContactEditor-LoadTitle.cpp
333 ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
336 } else if (Property == wxT("ROLE")) {
338 // See frmContactEditor-LoadTitle.cpp
340 ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
343 } else if (Property == wxT("ORG")) {
345 // See frmContactEditor-LoadOrg.cpp
347 ProcessOrganisation(PropertySeg1, PropertySeg2, &OrganisationCount);
350 } else if (Property == wxT("NOTE")) {
352 // See frmContactEditor-LoadNote.cpp
354 ProcessNote(PropertySeg1, PropertySeg2, &NoteCount);
357 } else if (Property == wxT("CATEGORIES")) {
359 // See frmContactEditor-LoadCategory.cpp
361 ProcessCategory(PropertySeg1, PropertySeg2, &CategoryCount);
364 } else if (Property == wxT("PHOTO")) {
366 // See frmContactEditor-LoadPhoto.cpp
368 ProcessPhoto(PropertySeg1, PropertySeg2, &PhotoCount);
371 } else if (Property == wxT("LOGO")) {
373 // See frmContactEditor-LoadPhoto.cpp
375 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
378 } else if (Property == wxT("LOGO")) {
380 // See frmContactEditor-LoadPhoto.cpp
382 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
385 } else if (Property == wxT("SOUND")) {
387 // See frmContactEditor-LoadSound.cpp
389 ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
392 } else if (Property == wxT("CALURI")){
394 // See frmContactEditor-LoadCalendar.cpp
396 ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
399 } else if (Property == wxT("CALADRURI")){
401 ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
402 CalendarAddressCount++;
404 } else if (Property == wxT("FBURL")){
406 // See frmContactEditor-LoadCalendar.cpp
408 ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
409 FreeBusyAddressCount++;
411 } else if (Property == wxT("KEY")){
413 // See frmContactEditor-LoadKey.cpp
415 ProcessKey(PropertySeg1, PropertySeg2, &KeyCount);
418 } else if (Property.Mid(0, 3) == wxT("VND")){
420 ProcessVendor(PropertySeg1, PropertySeg2, &VendorCount);
423 } else if (Property.Mid(0, 2) == wxT("X-")){
425 XTokenList.insert(std::make_pair(XTokenCount, PropertySeg2));
426 XTokenListTokens.insert(std::make_pair(XTokenCount, PropertySeg1.Mid(2)));
433 return CONTACTLOAD_OK;
437 void ContactDataObject::ProcessKind(wxString KindType){
439 if (KindType == wxT("individual")){
441 ContactKind = CONTACTKIND_INDIVIDUAL;
443 } else if (KindType == wxT("group")){
445 ContactKind = CONTACTKIND_GROUP;
447 } else if (KindType == wxT("org")){
449 ContactKind = CONTACTKIND_ORGANISATION;
451 } else if (KindType == wxT("location")){
453 ContactKind = CONTACTKIND_LOCATION;
457 ContactKind = CONTACTKIND_NONE;
462 void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString PropertySeg2){
464 size_t intPropertyLen = PropertySeg1.Len();
465 std::map<int, int> SplitPoints;
466 std::map<int, int> SplitLength;
467 std::map<int, int>::iterator SLiter;
468 wxString PropertyData;
469 wxString PropertyName;
470 wxString PropertyValue;
471 wxString PropertyTokens;
472 bool FirstToken = TRUE;
473 int intSplitsFound = 0;
474 int intSplitSize = 0;
475 int intPrevValue = 5;
479 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
483 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
484 intiter != SplitPoints.end(); ++intiter){
486 SLiter = SplitLength.find(intiter->first);
488 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
490 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
491 PropertyName = PropertyElement.GetNextToken();
492 PropertyValue = PropertyElement.GetNextToken();
494 intPrevValue = intiter->second;
496 // Process properties.
498 size_t intPropertyValueLen = PropertyValue.Len();
500 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
502 PropertyValue.Trim();
503 PropertyValue.RemoveLast();
507 if (PropertyValue.Mid(0, 1) == wxT("\"")){
509 PropertyValue.Remove(0, 1);
513 CaptureString(&PropertyValue, FALSE);
515 if (FirstToken == TRUE){
517 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
522 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
528 CaptureString(&PropertySeg2, FALSE);
530 Revision = PropertySeg2;
532 if (!PropertyTokens.IsEmpty()){
534 RevisionTokens = PropertyTokens;
541 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
543 size_t intPropertyLen = PropertySeg1.Len();
544 std::map<int, int> SplitPoints;
545 std::map<int, int> SplitLength;
546 std::map<int, int>::iterator SLiter;
547 wxString PropertyData;
548 wxString PropertyName;
549 wxString PropertyValue;
550 wxString PropertyTokens;
551 bool FirstToken = TRUE;
552 bool PropertyMatched = FALSE;
553 int intSplitsFound = 0;
554 int intSplitSize = 0;
555 int intPrevValue = 8;
559 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
563 PropertyType PropType = PROPERTY_NONE;
565 // Look for type before continuing.
567 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
571 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
572 intiter != SplitPoints.end(); ++intiter){
574 SLiter = SplitLength.find(intiter->first);
576 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
578 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
579 PropertyName = PropertyElement.GetNextToken();
580 PropertyValue = PropertyElement.GetNextToken();
582 intPrevValue = intiter->second;
584 // Process properties.
586 size_t intPropertyValueLen = PropertyValue.Len();
588 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
590 PropertyValue.Trim();
591 PropertyValue.RemoveLast();
595 if (PropertyValue.Mid(0, 1) == wxT("\"")){
597 PropertyValue.Remove(0, 1);
601 CaptureString(&PropertyValue, FALSE);
603 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
604 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
605 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
606 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
608 if (PropertyMatched == TRUE){
610 PropertyMatched = FALSE;
615 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
617 if (FirstToken == TRUE){
619 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
624 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
632 intPropertyLen = PropertySeg2.Len();
639 CaptureString(&PropertySeg2, FALSE);
641 // Add the data to the General/Home/Work address variables.
647 SourceListType.insert(std::make_pair(*SourceCount, "home"));
650 SourceListType.insert(std::make_pair(*SourceCount, "work"));
654 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
656 if (!PropertyTokens.IsEmpty()){
658 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
664 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
666 std::map<int, int> SplitPoints;
667 std::map<int, int> SplitLength;
669 int intPrevValue = 5;
673 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
677 wxString PropertyName;
678 wxString PropertyValue;
679 wxString PropertyData;
680 wxString PropertyTokens;
681 std::map<int,int>::iterator SLiter;
682 bool FirstToken = TRUE;
683 bool PropertyMatched = FALSE;
685 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
686 intiter != SplitPoints.end(); ++intiter){
688 SLiter = SplitLength.find(intiter->first);
690 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
692 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
693 PropertyName = PropertyElement.GetNextToken();
694 PropertyValue = PropertyElement.GetNextToken();
696 intPrevValue = intiter->second;
698 CaptureString(&PropertyValue, FALSE);
700 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
702 if (PropertyMatched == TRUE){
704 PropertyMatched = FALSE;
711 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
715 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
717 std::map<int, int> SplitPoints;
718 std::map<int, int> SplitLength;
720 int intPrevValue = 8;
724 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
728 wxString PropertyName;
729 wxString PropertyValue;
730 wxString PropertyData;
731 wxString PropertyTokens;
732 std::map<int,int>::iterator SLiter;
733 bool FirstToken = TRUE;
734 bool PropertyMatched = FALSE;
736 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
737 intiter != SplitPoints.end(); ++intiter){
739 SLiter = SplitLength.find(intiter->first);
741 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
743 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
744 PropertyName = PropertyElement.GetNextToken();
745 PropertyValue = PropertyElement.GetNextToken();
747 intPrevValue = intiter->second;
749 CaptureString(&PropertyValue, FALSE);
751 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
752 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
753 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
754 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
756 if (PropertyMatched == TRUE){
758 PropertyMatched = FALSE;
763 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
765 if (FirstToken == TRUE){
767 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
772 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
780 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
782 if (!PropertyTokens.IsEmpty()){
784 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
791 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
793 std::map<int, int> SplitPoints;
794 std::map<int, int> SplitLength;
796 int intPrevValue = 4;
800 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
804 wxString PropertyName;
805 wxString PropertyValue;
806 wxString PropertyData;
807 wxString PropertyTokens;
808 std::map<int,int>::iterator SLiter;
809 bool FirstToken = TRUE;
810 bool PropertyMatched = FALSE;
812 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
813 intiter != SplitPoints.end(); ++intiter){
815 SLiter = SplitLength.find(intiter->first);
817 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
819 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
820 PropertyName = PropertyElement.GetNextToken();
821 PropertyValue = PropertyElement.GetNextToken();
823 intPrevValue = intiter->second;
825 CaptureString(&PropertyValue, FALSE);
827 if (PropertyName == wxT("TYPE")){
829 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
830 PropertyValue == wxT("work") ){
832 FullNamesListType.erase(*FNCount);
833 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
837 PropertyMatched = TRUE;
841 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
842 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
843 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
844 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
846 if (PropertyMatched == TRUE){
848 PropertyMatched = FALSE;
853 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
855 if (FirstToken == TRUE){
857 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
862 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
870 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
872 if (!PropertyTokens.IsEmpty()){
874 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
880 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
882 std::map<int, int> SplitPoints;
883 std::map<int, int> SplitLength;
885 int intPrevValue = 3;
889 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
893 wxString PropertyName;
894 wxString PropertyValue;
895 wxString PropertyData;
896 wxString PropertyTokens;
897 std::map<int,int>::iterator SLiter;
898 bool FirstToken = TRUE;
900 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
901 intiter != SplitPoints.end(); ++intiter){
903 SLiter = SplitLength.find(intiter->first);
905 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
907 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
908 PropertyName = PropertyElement.GetNextToken();
909 PropertyValue = PropertyElement.GetNextToken();
911 intPrevValue = intiter->second;
913 CaptureString(&PropertyValue, FALSE);
915 if (PropertyName == wxT("ALTID")){
917 NameAltID = PropertyValue;
919 } else if (PropertyName == wxT("LANGUAGE")){
921 NameLanguage = PropertyValue;
923 } else if (PropertyName == wxT("SORT-AS")){
925 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
926 PropertyValue.Len() >= 3){
927 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
930 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
932 if (FirstToken == TRUE){
934 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
939 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
947 // Split the name data.
949 int intSplitSeek = 0;
950 int intSplitsFound = 0;
951 int intSplitSize = 0;
952 int intPropertyLen = PropertySeg2.Len();
954 std::map<int,wxString> NameValues;
957 for (int i = 0; i <= intPropertyLen; i++){
959 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
961 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
966 if (intSplitsFound == 4){
968 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
982 // Split the data into several parts.
984 for (std::map<int, wxString>::iterator iter = NameValues.begin();
985 iter != NameValues.end(); ++iter){
987 if (iter->first == 1){
989 // Deal with family name.
991 NameSurname = iter->second;
993 } else if (iter->first == 2){
995 // Deal with given names.
997 NameForename = iter->second;
999 } else if (iter->first == 3){
1001 // Deal with additional names.
1003 NameOtherNames = iter->second;
1005 } else if (iter->first == 4){
1007 // Deal with honorifix prefixes and suffixes.
1009 NameTitle = iter->second;
1013 if (iter == NameValues.end()){
1019 NameSuffix = iter->second;
1025 // Add the name token data.
1027 if (!PropertyTokens.IsEmpty()){
1029 NameTokens = PropertyTokens;
1035 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
1037 size_t intPropertyLen = PropertySeg1.Len();
1038 std::map<int, int> SplitPoints;
1039 std::map<int, int> SplitLength;
1040 std::map<int, int>::iterator SLiter;
1041 wxString PropertyData;
1042 wxString PropertyName;
1043 wxString PropertyValue;
1044 wxString PropertyTokens;
1045 bool FirstToken = TRUE;
1046 int intSplitsFound = 0;
1047 int intSplitSize = 0;
1048 int intPrevValue = 14;
1052 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1056 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1057 intiter != SplitPoints.end(); ++intiter){
1059 SLiter = SplitLength.find(intiter->first);
1061 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1063 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1064 PropertyName = PropertyElement.GetNextToken();
1065 PropertyValue = PropertyElement.GetNextToken();
1067 intPrevValue = intiter->second;
1069 // Process properties.
1071 CaptureString(&PropertyValue, FALSE);
1073 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1075 if (FirstToken == TRUE){
1077 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1082 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1090 CaptureString(&PropertySeg2, FALSE);
1092 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
1094 if (!PropertyTokens.IsEmpty()){
1096 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
1102 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
1104 std::map<int, int> SplitPoints;
1105 std::map<int, int> SplitLength;
1107 int intPrevValue = 10;
1110 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1114 PropertyType PropType = PROPERTY_NONE;
1116 // Look for type before continuing.
1118 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1122 std::map<int, wxString> *NicknamesList = NULL;
1123 std::map<int, wxString> *NicknamesListType = NULL;
1124 std::map<int, wxString> *NicknamesListLanguage = NULL;
1125 std::map<int, wxString> *NicknamesListAltID = NULL;
1126 std::map<int, wxString> *NicknamesListPID = NULL;
1127 std::map<int, wxString> *NicknamesListTokens = NULL;
1128 std::map<int, int> *NicknamesListPref = NULL;
1132 NicknamesList = &GeneralNicknamesList;
1133 NicknamesListType = &GeneralNicknamesListType;
1134 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1135 NicknamesListAltID = &GeneralNicknamesListAltID;
1136 NicknamesListPID = &GeneralNicknamesListPID;
1137 NicknamesListTokens = &GeneralNicknamesListTokens;
1138 NicknamesListPref = &GeneralNicknamesListPref;
1141 NicknamesList = &HomeNicknamesList;
1142 NicknamesListType = &HomeNicknamesListType;
1143 NicknamesListLanguage = &HomeNicknamesListLanguage;
1144 NicknamesListAltID = &HomeNicknamesListAltID;
1145 NicknamesListPID = &HomeNicknamesListPID;
1146 NicknamesListTokens = &HomeNicknamesListTokens;
1147 NicknamesListPref = &HomeNicknamesListPref;
1150 NicknamesList = &BusinessNicknamesList;
1151 NicknamesListType = &BusinessNicknamesListType;
1152 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1153 NicknamesListAltID = &BusinessNicknamesListAltID;
1154 NicknamesListPID = &BusinessNicknamesListPID;
1155 NicknamesListTokens = &BusinessNicknamesListTokens;
1156 NicknamesListPref = &BusinessNicknamesListPref;
1160 std::map<int, int>::iterator SLiter;
1161 wxString PropertyData;
1162 wxString PropertyName;
1163 wxString PropertyValue;
1164 wxString PropertyTokens;
1165 bool FirstToken = TRUE;
1166 bool PropertyMatched = FALSE;
1168 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1169 intiter != SplitPoints.end(); ++intiter){
1171 SLiter = SplitLength.find(intiter->first);
1173 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1175 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1176 PropertyName = PropertyElement.GetNextToken();
1177 PropertyValue = PropertyElement.GetNextToken();
1179 intPrevValue = intiter->second;
1181 CaptureString(&PropertyValue, FALSE);
1183 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1184 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1185 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1186 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1188 if (PropertyMatched == TRUE){
1190 PropertyMatched = FALSE;
1195 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1197 if (FirstToken == TRUE){
1199 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1204 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1212 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1214 // Add the name token data.
1216 if (!PropertyTokens.IsEmpty()){
1218 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1224 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1226 std::map<int, int> SplitPoints;
1227 std::map<int, int> SplitLength;
1228 std::map<int, int>::iterator SLiter;
1229 wxString PropertyData;
1230 wxString PropertyName;
1231 wxString PropertyValue;
1232 wxString PropertyTokens;
1233 bool FirstToken = TRUE;
1234 int intPrevValue = 8;
1236 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1240 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1241 intiter != SplitPoints.end(); ++intiter){
1243 SLiter = SplitLength.find(intiter->first);
1245 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1247 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1248 PropertyName = PropertyElement.GetNextToken();
1249 PropertyValue = PropertyElement.GetNextToken();
1251 intPrevValue = intiter->second;
1253 // Process properties.
1255 size_t intPropertyValueLen = PropertyValue.Len();
1257 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1259 PropertyValue.Trim();
1260 PropertyValue.RemoveLast();
1264 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1266 PropertyValue.Remove(0, 1);
1270 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1272 if (FirstToken == TRUE){
1274 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1279 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1287 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1289 wxString GenderComponent;
1291 if (GenderData.CountTokens() >= 2){
1293 Gender = GenderData.GetNextToken();
1294 GenderDetails = GenderData.GetString();
1296 CaptureString(&GenderDetails, FALSE);
1300 Gender = GenderData.GetNextToken();
1304 if (!PropertyTokens.IsEmpty()){
1306 GenderTokens = PropertyTokens;
1312 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1314 // Process date. Preserve the remainder in the string.
1316 std::map<int, int> SplitPoints;
1317 std::map<int, int> SplitLength;
1318 std::map<int, int>::iterator SLiter;
1319 wxString PropertyData;
1320 wxString PropertyName;
1321 wxString PropertyValue;
1322 wxString PropertyTokens;
1323 bool BirthdayText = FALSE;
1324 int intPrevValue = 6;
1326 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1330 // Look for type before continuing.
1332 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1333 intiter != SplitPoints.end(); ++intiter){
1335 SLiter = SplitLength.find(intiter->first);
1337 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1339 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1340 PropertyName = PropertyElement.GetNextToken();
1341 PropertyValue = PropertyElement.GetNextToken();
1343 intPrevValue = intiter->second;
1345 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1347 CaptureString(&PropertySeg2, FALSE);
1348 Birthday = PropertySeg2;
1349 BirthdayText = TRUE;
1355 // Setup blank lines for later on.
1358 bool FirstToken = TRUE;
1360 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1361 intiter != SplitPoints.end(); ++intiter){
1363 SLiter = SplitLength.find(intiter->first);
1365 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1367 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1368 PropertyName = PropertyElement.GetNextToken();
1369 PropertyValue = PropertyElement.GetNextToken();
1371 intPrevValue = intiter->second;
1373 // Process properties.
1375 CaptureString(&PropertyValue, FALSE);
1377 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1379 PropertyValue.Trim();
1380 PropertyValue.RemoveLast();
1384 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1386 PropertyValue.Remove(0, 1);
1390 if (PropertyName == wxT("ALTID")){
1392 BirthdayAltID = PropertyValue;
1394 } else if (PropertyName == wxT("CALSCALE")){
1396 BirthdayCalScale = PropertyValue;
1398 } else if (PropertyName != wxT("VALUE")) {
1400 // Something else we don't know about so append
1401 // to the tokens variable.
1403 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1405 if (FirstToken == TRUE){
1407 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1412 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1422 // Add the data to the variables and form.
1424 if (BirthdayText == FALSE){
1426 Birthday = PropertySeg2;
1430 if (!PropertyTokens.IsEmpty()){
1432 BirthdayTokens = PropertyTokens;
1438 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1440 // Process date. Preserve the remainder in the string.
1442 std::map<int, int> SplitPoints;
1443 std::map<int, int> SplitLength;
1444 std::map<int, int>::iterator SLiter;
1445 wxString PropertyData;
1446 wxString PropertyName;
1447 wxString PropertyValue;
1448 wxString PropertyTokens;
1449 bool AnniversaryText = FALSE;
1450 int intPrevValue = 13;
1452 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1456 // Look for type before continuing.
1458 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1459 intiter != SplitPoints.end(); ++intiter){
1461 SLiter = SplitLength.find(intiter->first);
1463 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1465 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1466 PropertyName = PropertyElement.GetNextToken();
1467 PropertyValue = PropertyElement.GetNextToken();
1469 intPrevValue = intiter->second;
1471 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1473 CaptureString(&PropertySeg2, FALSE);
1474 Anniversary = PropertySeg2;
1475 AnniversaryText = TRUE;
1481 // Setup blank lines for later on.
1484 bool FirstToken = TRUE;
1486 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1487 intiter != SplitPoints.end(); ++intiter){
1489 SLiter = SplitLength.find(intiter->first);
1491 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1493 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1494 PropertyName = PropertyElement.GetNextToken();
1495 PropertyValue = PropertyElement.GetNextToken();
1497 intPrevValue = intiter->second;
1499 // Process properties.
1501 CaptureString(&PropertyValue, FALSE);
1503 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1505 PropertyValue.Trim();
1506 PropertyValue.RemoveLast();
1510 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1512 PropertyValue.Remove(0, 1);
1516 if (PropertyName == wxT("ALTID")){
1518 AnniversaryAltID = PropertyValue;
1520 } else if (PropertyName == wxT("CALSCALE")){
1522 AnniversaryCalScale = PropertyValue;
1524 } else if (PropertyName != wxT("VALUE")) {
1526 // Something else we don't know about so append
1527 // to the tokens variable.
1529 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1531 if (FirstToken == TRUE){
1533 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1538 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1548 // Add the data to the variables and form.
1550 if (AnniversaryText == FALSE){
1552 Anniversary = PropertySeg2;
1556 if (!PropertyTokens.IsEmpty()){
1558 AnniversaryTokens = PropertyTokens;
1564 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1566 std::map<int, int> SplitPoints;
1567 std::map<int, int> SplitLength;
1569 int intPrevValue = 4;
1572 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1576 PropertyType PropType = PROPERTY_NONE;
1578 // Look for type before continuing.
1580 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1584 std::map<int, wxString> *TZList = NULL;
1585 std::map<int, wxString> *TZListType = NULL;
1586 std::map<int, wxString> *TZListMediatype = NULL;
1587 std::map<int, wxString> *TZListAltID = NULL;
1588 std::map<int, wxString> *TZListPID = NULL;
1589 std::map<int, wxString> *TZListTokens = NULL;
1590 std::map<int, int> *TZListPref = NULL;
1594 TZList = &GeneralTZList;
1595 TZListType = &GeneralTZListType;
1596 TZListMediatype = &GeneralTZListMediatype;
1597 TZListAltID = &GeneralTZListAltID;
1598 TZListPID = &GeneralTZListPID;
1599 TZListTokens = &GeneralTZListTokens;
1600 TZListPref = &GeneralTZListPref;
1603 TZList = &HomeTZList;
1604 TZListType = &HomeTZListType;
1605 TZListMediatype = &HomeTZListMediatype;
1606 TZListAltID = &HomeTZListAltID;
1607 TZListPID = &HomeTZListPID;
1608 TZListTokens = &HomeTZListTokens;
1609 TZListPref = &HomeTZListPref;
1612 TZList = &BusinessTZList;
1613 TZListType = &BusinessTZListType;
1614 TZListMediatype = &BusinessTZListMediatype;
1615 TZListAltID = &BusinessTZListAltID;
1616 TZListPID = &BusinessTZListPID;
1617 TZListTokens = &BusinessTZListTokens;
1618 TZListPref = &BusinessTZListPref;
1622 std::map<int, int>::iterator SLiter;
1623 wxString PropertyData;
1624 wxString PropertyName;
1625 wxString PropertyValue;
1626 wxString PropertyTokens;
1627 bool FirstToken = TRUE;
1628 bool PropertyMatched = FALSE;
1630 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1631 intiter != SplitPoints.end(); ++intiter){
1633 SLiter = SplitLength.find(intiter->first);
1635 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1637 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1638 PropertyName = PropertyElement.GetNextToken();
1639 PropertyValue = PropertyElement.GetNextToken();
1641 intPrevValue = intiter->second;
1643 CaptureString(&PropertyValue, FALSE);
1645 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1646 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1647 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1648 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1650 if (PropertyMatched == TRUE){
1652 PropertyMatched = FALSE;
1657 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1659 if (FirstToken == TRUE){
1661 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1666 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1674 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1676 // Add the name token data.
1678 if (!PropertyTokens.IsEmpty()){
1680 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1687 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1689 size_t intPropertyLen = PropertySeg1.Len();
1690 std::map<int, int> SplitPoints;
1691 std::map<int, int> SplitLength;
1692 std::map<int, int>::iterator SLiter;
1693 wxString PropertyData;
1694 wxString PropertyName;
1695 wxString PropertyValue;
1696 wxString PropertyTokens;
1697 wxString AddressLabel;
1698 wxString AddressLang;
1699 wxString AddressAltID;
1700 wxString AddressPID;
1701 wxString AddressTokens;
1702 wxString AddressGeo;
1703 wxString AddressTimezone;
1704 wxString AddressType;
1705 wxString AddressMediatype;
1706 wxString AddressPOBox;
1707 wxString AddressExtended;
1708 wxString AddressStreet;
1709 wxString AddressLocality;
1710 wxString AddressCity;
1711 wxString AddressRegion;
1712 wxString AddressPostalCode;
1713 wxString AddressCountry;
1714 bool FirstToken = TRUE;
1715 int intSplitsFound = 0;
1716 int intSplitSize = 0;
1717 int intPrevValue = 5;
1721 bool PropertyMatched = FALSE;
1723 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1727 PropertyType PropType = PROPERTY_NONE;
1729 // Look for type before continuing.
1731 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1735 std::map<int, wxString> *AddressList = NULL;
1736 std::map<int, wxString> *AddressListTown = NULL;
1737 std::map<int, wxString> *AddressListCounty = NULL;
1738 std::map<int, wxString> *AddressListPostCode = NULL;
1739 std::map<int, wxString> *AddressListCountry = NULL;
1740 std::map<int, wxString> *AddressListLabel = NULL;
1741 std::map<int, wxString> *AddressListLang = NULL;
1742 std::map<int, wxString> *AddressListAltID = NULL;
1743 std::map<int, wxString> *AddressListPID = NULL;
1744 std::map<int, wxString> *AddressListTokens = NULL;
1745 std::map<int, wxString> *AddressListGeo = NULL;
1746 std::map<int, wxString> *AddressListTimezone = NULL;
1747 std::map<int, wxString> *AddressListType = NULL;
1748 std::map<int, wxString> *AddressListMediatype = NULL;
1749 std::map<int, int> *AddressListPref = NULL;
1753 AddressList = &GeneralAddressList;
1754 AddressListTown = &GeneralAddressListTown;
1755 AddressListCounty = &GeneralAddressListCounty;
1756 AddressListPostCode = &GeneralAddressListPostCode;
1757 AddressListCountry = &GeneralAddressListCountry;
1758 AddressListLabel = &GeneralAddressListLabel;
1759 AddressListLang = &GeneralAddressListLang;
1760 AddressListAltID = &GeneralAddressListAltID;
1761 AddressListPID = &GeneralAddressListPID;
1762 AddressListTokens = &GeneralAddressListTokens;
1763 AddressListGeo = &GeneralAddressListGeo;
1764 AddressListTimezone = &GeneralAddressListTimezone;
1765 AddressListType = &GeneralAddressListType;
1766 AddressListMediatype = &GeneralAddressListMediatype;
1767 AddressListPref = &GeneralAddressListPref;
1770 AddressList = &HomeAddressList;
1771 AddressListTown = &HomeAddressListTown;
1772 AddressListCounty = &HomeAddressListCounty;
1773 AddressListPostCode = &HomeAddressListPostCode;
1774 AddressListCountry = &HomeAddressListCountry;
1775 AddressListLabel = &HomeAddressListLabel;
1776 AddressListLang = &HomeAddressListLang;
1777 AddressListAltID = &HomeAddressListAltID;
1778 AddressListPID = &HomeAddressListPID;
1779 AddressListTokens = &HomeAddressListTokens;
1780 AddressListGeo = &HomeAddressListGeo;
1781 AddressListTimezone = &HomeAddressListTimezone;
1782 AddressListType = &HomeAddressListType;
1783 AddressListMediatype = &HomeAddressListMediatype;
1784 AddressListPref = &HomeAddressListPref;
1787 AddressList = &BusinessAddressList;
1788 AddressListTown = &BusinessAddressListTown;
1789 AddressListCounty = &BusinessAddressListCounty;
1790 AddressListPostCode = &BusinessAddressListPostCode;
1791 AddressListCountry = &BusinessAddressListCountry;
1792 AddressListLabel = &BusinessAddressListLabel;
1793 AddressListLang = &BusinessAddressListLang;
1794 AddressListAltID = &BusinessAddressListAltID;
1795 AddressListPID = &BusinessAddressListPID;
1796 AddressListTokens = &BusinessAddressListTokens;
1797 AddressListGeo = &BusinessAddressListGeo;
1798 AddressListTimezone = &BusinessAddressListTimezone;
1799 AddressListType = &BusinessAddressListType;
1800 AddressListMediatype = &BusinessAddressListMediatype;
1801 AddressListPref = &BusinessAddressListPref;
1807 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1808 intiter != SplitPoints.end(); ++intiter){
1810 SLiter = SplitLength.find(intiter->first);
1812 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1814 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1815 PropertyName = PropertyElement.GetNextToken();
1816 PropertyValue = PropertyElement.GetNextToken();
1818 intPrevValue = intiter->second;
1820 CaptureString(&PropertyValue, FALSE);
1822 // Process properties.
1824 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1825 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1826 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1827 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1828 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1829 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1830 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1831 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1833 if (PropertyMatched == TRUE){
1835 PropertyMatched = FALSE;
1840 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1842 if (FirstToken == TRUE){
1844 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1849 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1857 // Split the address.
1859 //std::map<int, int>::iterator SLiter;
1860 intPropertyLen = PropertySeg2.Len();
1861 SplitPoints.clear();
1862 SplitLength.clear();
1867 for (int i = 0; i <= intPropertyLen; i++){
1871 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1874 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1876 if (intSplitsFound == 6){
1878 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1883 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1893 // Split the data into several parts.
1895 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1896 intiter != SplitPoints.end(); ++intiter){
1898 if (intiter->first == 1){
1900 // Deal with PO Box.
1902 SLiter = SplitLength.find(1);
1904 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1905 intPrevValue = intiter->second;
1907 } else if (intiter->first == 2){
1909 // Deal with extended address.
1911 SLiter = SplitLength.find(2);
1913 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1914 intPrevValue = intiter->second;
1916 } else if (intiter->first == 3){
1918 // Deal with street address.
1920 SLiter = SplitLength.find(3);
1922 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1923 intPrevValue = intiter->second;
1925 } else if (intiter->first == 4){
1927 // Deal with locality
1929 SLiter = SplitLength.find(4);
1931 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1932 intPrevValue = intiter->second;
1934 } else if (intiter->first == 5){
1936 // Deal with region.
1938 SLiter = SplitLength.find(5);
1940 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1941 intPrevValue = intiter->second;
1944 } else if (intiter->first == 6){
1946 // Deal with post code.
1948 SLiter = SplitLength.find(6);
1950 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1951 intPrevValue = intiter->second;
1953 // Deal with country.
1955 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1963 // Add the data to the General/Home/Work address variables.
1965 CaptureString(&AddressStreet, FALSE);
1966 CaptureString(&AddressLocality, FALSE);
1967 CaptureString(&AddressRegion, FALSE);
1968 CaptureString(&AddressPostalCode, FALSE);
1969 CaptureString(&AddressCountry, FALSE);
1971 if (!PropertyTokens.IsEmpty()){
1973 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1977 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1978 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1979 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1980 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1981 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1985 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1988 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1991 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1995 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1999 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
2001 std::map<int, int> SplitPoints;
2002 std::map<int, int> SplitLength;
2004 int intPrevValue = 7;
2007 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2011 PropertyType PropType = PROPERTY_NONE;
2013 // Look for type before continuing.
2015 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2017 std::map<int, wxString> *EmailList = NULL;
2018 std::map<int, wxString> *EmailListType = NULL;
2019 std::map<int, wxString> *EmailListAltID = NULL;
2020 std::map<int, wxString> *EmailListPID = NULL;
2021 std::map<int, wxString> *EmailListTokens = NULL;
2022 std::map<int, int> *EmailListPref = NULL;
2026 EmailList = &GeneralEmailList;
2027 EmailListType = &GeneralEmailListType;
2028 EmailListAltID = &GeneralEmailListAltID;
2029 EmailListPID = &GeneralEmailListPID;
2030 EmailListTokens = &GeneralEmailListTokens;
2031 EmailListPref = &GeneralEmailListPref;
2034 EmailList = &HomeEmailList;
2035 EmailListType = &HomeEmailListType;
2036 EmailListAltID = &HomeEmailListAltID;
2037 EmailListPID = &HomeEmailListPID;
2038 EmailListTokens = &HomeEmailListTokens;
2039 EmailListPref = &HomeEmailListPref;
2042 EmailList = &BusinessEmailList;
2043 EmailListType = &BusinessEmailListType;
2044 EmailListAltID = &BusinessEmailListAltID;
2045 EmailListPID = &BusinessEmailListPID;
2046 EmailListTokens = &BusinessEmailListTokens;
2047 EmailListPref = &BusinessEmailListPref;
2053 std::map<int,int>::iterator SLiter;
2054 wxString PropertyData;
2055 wxString PropertyName;
2056 wxString PropertyValue;
2057 wxString PropertyTokens;
2058 bool FirstToken = TRUE;
2059 bool PropertyMatched = FALSE;
2061 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2062 intiter != SplitPoints.end(); ++intiter){
2064 SLiter = SplitLength.find(intiter->first);
2066 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2068 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2069 PropertyName = PropertyElement.GetNextToken();
2070 PropertyValue = PropertyElement.GetNextToken();
2072 intPrevValue = intiter->second;
2074 CaptureString(&PropertyValue, FALSE);
2076 // Process properties.
2078 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
2079 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
2080 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
2082 if (PropertyMatched == TRUE){
2084 PropertyMatched = FALSE;
2089 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2091 if (FirstToken == TRUE){
2093 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2098 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2106 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
2108 // Add the name token data.
2110 if (!PropertyTokens.IsEmpty()){
2112 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
2119 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
2121 std::map<int, int> SplitPoints;
2122 std::map<int, int> SplitLength;
2124 int intPrevValue = 6;
2127 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2131 PropertyType PropType = PROPERTY_NONE;
2133 // Look for type before continuing.
2135 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2137 std::map<int, wxString> *IMList = NULL;
2138 std::map<int, wxString> *IMListType = NULL;
2139 std::map<int, wxString> *IMListAltID = NULL;
2140 std::map<int, wxString> *IMListPID = NULL;
2141 std::map<int, wxString> *IMListTokens = NULL;
2142 std::map<int, wxString> *IMListMediatype = NULL;
2143 std::map<int, int> *IMListPref = NULL;
2147 IMList = &GeneralIMList;
2148 IMListType = &GeneralIMListType;
2149 IMListAltID = &GeneralIMListAltID;
2150 IMListPID = &GeneralIMListPID;
2151 IMListTokens = &GeneralIMListTokens;
2152 IMListMediatype = &GeneralIMListMediatype;
2153 IMListPref = &GeneralIMListPref;
2156 IMList = &HomeIMList;
2157 IMListType = &HomeIMListType;
2158 IMListAltID = &HomeIMListAltID;
2159 IMListPID = &HomeIMListPID;
2160 IMListTokens = &HomeIMListTokens;
2161 IMListMediatype = &HomeIMListMediatype;
2162 IMListPref = &HomeIMListPref;
2165 IMList = &BusinessIMList;
2166 IMListType = &BusinessIMListType;
2167 IMListAltID = &BusinessIMListAltID;
2168 IMListPID = &BusinessIMListPID;
2169 IMListTokens = &BusinessIMListTokens;
2170 IMListMediatype = &BusinessIMListMediatype;
2171 IMListPref = &BusinessIMListPref;
2177 std::map<int,int>::iterator SLiter;
2178 wxString PropertyData;
2179 wxString PropertyName;
2180 wxString PropertyValue;
2181 wxString PropertyTokens;
2182 bool FirstToken = TRUE;
2183 bool PropertyMatched = FALSE;
2185 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2186 intiter != SplitPoints.end(); ++intiter){
2188 SLiter = SplitLength.find(intiter->first);
2190 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2192 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2193 PropertyName = PropertyElement.GetNextToken();
2194 PropertyValue = PropertyElement.GetNextToken();
2196 intPrevValue = intiter->second;
2198 CaptureString(&PropertyValue, FALSE);
2200 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
2201 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
2202 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
2203 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
2205 // Process properties.
2207 if (PropertyMatched == TRUE){
2209 PropertyMatched = FALSE;
2214 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2216 if (FirstToken == TRUE){
2218 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2223 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2231 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2233 // Add the name token data.
2235 if (!PropertyTokens.IsEmpty()){
2237 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2243 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2245 std::map<int, int> SplitPoints;
2246 std::map<int, int> SplitLength;
2247 std::map<int, int>::iterator SLiter;
2251 PropertyType PropType = PROPERTY_NONE;
2253 // Look for type before continuing.
2256 wxString TelTypeDetail;
2257 wxString PropertyData;
2258 wxString PropertyName;
2259 wxString PropertyValue;
2260 wxString PropertyTokens;
2262 std::map<int,int> TypeSplitPoints;
2263 std::map<int,int> TypeSplitLength;
2264 std::map<int,int>::iterator TSLiter;
2266 int intSplitSize = 0;
2267 int intSplitsFound = 0;
2268 int intSplitPoint = 0;
2270 int intPrevValue = 5;
2272 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2276 // Look for type before continuing.
2278 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2279 intiter != SplitPoints.end(); ++intiter){
2281 SLiter = SplitLength.find(intiter->first);
2283 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2285 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2286 PropertyName = PropertyElement.GetNextToken();
2287 PropertyValue = PropertyElement.GetNextToken();
2289 intPrevValue = intiter->second;
2291 if (PropertyName == wxT("TYPE")){
2293 // Process each value in type and translate each
2296 // Strip out the quotes if they are there.
2298 size_t intPropertyValueLen = PropertyValue.Len();
2300 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2302 PropertyValue.Trim();
2303 PropertyValue.RemoveLast();
2307 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2309 PropertyValue.Remove(0, 1);
2313 TelTypeDetail = PropertyValue;
2319 for (int i = 0; i <= intPropertyValueLen; i++){
2323 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2325 if (intSplitsFound == 0){
2327 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2328 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2332 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2333 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2346 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2347 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2349 int intTypeSeek = 0;
2351 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2352 typeiter != TypeSplitPoints.end(); ++typeiter){
2354 wxString TypePropertyName;
2356 TSLiter = TypeSplitLength.find(typeiter->first);
2358 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2360 if (intTypeSeek == 0){
2365 TelTypeUI.Append(wxT(","));
2369 if (TypePropertyName == wxT("home")){
2371 PropType = PROPERTY_HOME;
2373 } else if (TypePropertyName == wxT("work")){
2375 PropType = PROPERTY_WORK;
2380 if (TypePropertyName == wxT("text")){
2382 TelTypeUI.Append(_("text"));
2385 } else if (TypePropertyName == wxT("voice")){
2387 TelTypeUI.Append(_("voice"));
2390 } else if (TypePropertyName == wxT("fax")){
2392 TelTypeUI.Append(_("fax"));
2395 } else if (TypePropertyName == wxT("cell")){
2397 TelTypeUI.Append(_("mobile"));
2400 } else if (TypePropertyName == wxT("video")){
2402 TelTypeUI.Append(_("video"));
2405 } else if (TypePropertyName == wxT("pager")){
2407 TelTypeUI.Append(_("pager"));
2410 } else if (TypePropertyName == wxT("textphone")){
2412 TelTypeUI.Append(_("textphone"));
2423 std::map<int, wxString> *TelephoneList = NULL;
2424 std::map<int, wxString> *TelephoneListType = NULL;
2425 std::map<int, wxString> *TelephoneListAltID = NULL;
2426 std::map<int, wxString> *TelephoneListPID = NULL;
2427 std::map<int, wxString> *TelephoneListTokens = NULL;
2428 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2429 std::map<int, int> *TelephoneListPref = NULL;
2433 TelephoneList = &GeneralTelephoneList;
2434 TelephoneListType = &GeneralTelephoneListType;
2435 TelephoneListAltID = &GeneralTelephoneListAltID;
2436 TelephoneListPID = &GeneralTelephoneListPID;
2437 TelephoneListTokens = &GeneralTelephoneListTokens;
2438 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2439 TelephoneListPref = &GeneralTelephoneListPref;
2442 TelephoneList = &HomeTelephoneList;
2443 TelephoneListType = &HomeTelephoneListType;
2444 TelephoneListAltID = &HomeTelephoneListAltID;
2445 TelephoneListPID = &HomeTelephoneListPID;
2446 TelephoneListTokens = &HomeTelephoneListTokens;
2447 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2448 TelephoneListPref = &HomeTelephoneListPref;
2451 TelephoneList = &BusinessTelephoneList;
2452 TelephoneListType = &BusinessTelephoneListType;
2453 TelephoneListAltID = &BusinessTelephoneListAltID;
2454 TelephoneListPID = &BusinessTelephoneListPID;
2455 TelephoneListTokens = &BusinessTelephoneListTokens;
2456 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2457 TelephoneListPref = &BusinessTelephoneListPref;
2461 // Process the properties.
2463 bool FirstToken = TRUE;
2466 SplitPoints.clear();
2467 SplitLength.clear();
2469 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2473 bool PropertyMatched = FALSE;
2475 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2476 intiter != SplitPoints.end(); ++intiter){
2478 SLiter = SplitLength.find(intiter->first);
2480 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2482 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2483 PropertyName = PropertyElement.GetNextToken();
2484 PropertyValue = PropertyElement.GetNextToken();
2486 intPrevValue = intiter->second;
2488 CaptureString(&PropertyValue, FALSE);
2490 // Process properties.
2492 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2493 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2494 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2496 if (PropertyMatched == TRUE){
2498 PropertyMatched = FALSE;
2503 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2505 if (FirstToken == TRUE){
2507 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2512 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2520 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2521 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2523 // Add the name token data.
2525 if (!PropertyTokens.IsEmpty()){
2527 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2533 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2535 std::map<int, int> SplitPoints;
2536 std::map<int, int> SplitLength;
2538 int intPrevValue = 6;
2541 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2545 PropertyType PropType = PROPERTY_NONE;
2547 // Look for type before continuing.
2549 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2551 std::map<int, wxString> *LanguageList = NULL;
2552 std::map<int, wxString> *LanguageListType = NULL;
2553 std::map<int, wxString> *LanguageListAltID = NULL;
2554 std::map<int, wxString> *LanguageListPID = NULL;
2555 std::map<int, wxString> *LanguageListTokens = NULL;
2556 std::map<int, int> *LanguageListPref = NULL;
2560 LanguageList = &GeneralLanguageList;
2561 LanguageListType = &GeneralLanguageListType;
2562 LanguageListAltID = &GeneralLanguageListAltID;
2563 LanguageListPID = &GeneralLanguageListPID;
2564 LanguageListTokens = &GeneralLanguageListTokens;
2565 LanguageListPref = &GeneralLanguageListPref;
2568 LanguageList = &HomeLanguageList;
2569 LanguageListType = &HomeLanguageListType;
2570 LanguageListAltID = &HomeLanguageListAltID;
2571 LanguageListPID = &HomeLanguageListPID;
2572 LanguageListTokens = &HomeLanguageListTokens;
2573 LanguageListPref = &HomeLanguageListPref;
2576 LanguageList = &BusinessLanguageList;
2577 LanguageListType = &BusinessLanguageListType;
2578 LanguageListAltID = &BusinessLanguageListAltID;
2579 LanguageListPID = &BusinessLanguageListPID;
2580 LanguageListTokens = &BusinessLanguageListTokens;
2581 LanguageListPref = &BusinessLanguageListPref;
2587 std::map<int,int>::iterator SLiter;
2588 wxString PropertyData;
2589 wxString PropertyName;
2590 wxString PropertyValue;
2591 wxString PropertyTokens;
2592 bool FirstToken = TRUE;
2593 bool PropertyMatched = FALSE;
2595 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2596 intiter != SplitPoints.end(); ++intiter){
2598 SLiter = SplitLength.find(intiter->first);
2600 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2602 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2603 PropertyName = PropertyElement.GetNextToken();
2604 PropertyValue = PropertyElement.GetNextToken();
2606 intPrevValue = intiter->second;
2608 CaptureString(&PropertyValue, FALSE);
2610 // Process properties.
2612 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2613 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2614 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2616 if (PropertyMatched == TRUE){
2618 PropertyMatched = FALSE;
2623 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2625 if (FirstToken == TRUE){
2627 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2632 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2640 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2642 // Add the name token data.
2644 if (!PropertyTokens.IsEmpty()){
2646 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2652 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2654 std::map<int, int> SplitPoints;
2655 std::map<int, int> SplitLength;
2657 int intPrevValue = 5;
2660 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2664 PropertyType PropType = PROPERTY_NONE;
2666 // Look for type before continuing.
2668 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2670 std::map<int, wxString> *GeopositionList = NULL;
2671 std::map<int, wxString> *GeopositionListType = NULL;
2672 std::map<int, wxString> *GeopositionListAltID = NULL;
2673 std::map<int, wxString> *GeopositionListPID = NULL;
2674 std::map<int, wxString> *GeopositionListTokens = NULL;
2675 std::map<int, wxString> *GeopositionListMediatype = NULL;
2676 std::map<int, int> *GeopositionListPref = NULL;
2680 GeopositionList = &GeneralGeographyList;
2681 GeopositionListType = &GeneralGeographyListType;
2682 GeopositionListAltID = &GeneralGeographyListAltID;
2683 GeopositionListPID = &GeneralGeographyListPID;
2684 GeopositionListTokens = &GeneralGeographyListTokens;
2685 GeopositionListMediatype = &GeneralGeographyListMediatype;
2686 GeopositionListPref = &GeneralGeographyListPref;
2689 GeopositionList = &HomeGeographyList;
2690 GeopositionListType = &HomeGeographyListType;
2691 GeopositionListAltID = &HomeGeographyListAltID;
2692 GeopositionListPID = &HomeGeographyListPID;
2693 GeopositionListTokens = &HomeGeographyListTokens;
2694 GeopositionListMediatype = &HomeGeographyListMediatype;
2695 GeopositionListPref = &HomeGeographyListPref;
2698 GeopositionList = &BusinessGeographyList;
2699 GeopositionListType = &BusinessGeographyListType;
2700 GeopositionListAltID = &BusinessGeographyListAltID;
2701 GeopositionListPID = &BusinessGeographyListPID;
2702 GeopositionListTokens = &BusinessGeographyListTokens;
2703 GeopositionListMediatype = &BusinessGeographyListMediatype;
2704 GeopositionListPref = &BusinessGeographyListPref;
2710 std::map<int,int>::iterator SLiter;
2711 wxString PropertyData;
2712 wxString PropertyName;
2713 wxString PropertyValue;
2714 wxString PropertyTokens;
2715 bool FirstToken = TRUE;
2716 bool PropertyMatched = FALSE;
2718 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2719 intiter != SplitPoints.end(); ++intiter){
2721 SLiter = SplitLength.find(intiter->first);
2723 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2725 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2726 PropertyName = PropertyElement.GetNextToken();
2727 PropertyValue = PropertyElement.GetNextToken();
2729 intPrevValue = intiter->second;
2731 CaptureString(&PropertyValue, FALSE);
2733 // Process properties.
2735 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2736 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2737 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2738 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2740 if (PropertyMatched == TRUE){
2742 PropertyMatched = FALSE;
2747 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2749 if (FirstToken == TRUE){
2751 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2756 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2764 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2766 // Add the name token data.
2768 if (!PropertyTokens.IsEmpty()){
2770 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2776 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2778 size_t intPropertyLen = PropertySeg1.Len();
2779 std::map<int, int> SplitPoints;
2780 std::map<int, int> SplitLength;
2781 std::map<int, int>::iterator SLiter;
2782 wxString PropertyData;
2783 wxString PropertyName;
2784 wxString PropertyValue;
2785 wxString PropertyTokens;
2786 wxString RelatedType;
2787 wxString RelatedTypeOriginal;
2788 wxString RelatedName;
2789 bool FirstToken = TRUE;
2790 int intSplitsFound = 0;
2791 int intSplitSize = 0;
2792 int intPrevValue = 9;
2796 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2800 // Look for type before continuing.
2802 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2803 intiter != SplitPoints.end(); ++intiter){
2805 SLiter = SplitLength.find(intiter->first);
2807 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2809 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2810 PropertyName = PropertyElement.GetNextToken();
2811 PropertyValue = PropertyElement.GetNextToken();
2813 intPrevValue = intiter->second;
2817 RelatedTypeOriginal = PropertyValue;
2819 if (PropertyName == wxT("TYPE")){
2821 if (PropertyValue == wxT("contact")){
2823 RelatedType = _("Contact");
2825 } else if (PropertyValue == wxT("acquaintance")){
2827 RelatedType = _("Acquaintance");
2829 } else if (PropertyValue == wxT("friend")){
2831 RelatedType = _("Friend");
2833 } else if (PropertyValue == wxT("met")){
2835 RelatedType = _("Met");
2837 } else if (PropertyValue == wxT("co-worker")){
2839 RelatedType = _("Co-worker");
2841 } else if (PropertyValue == wxT("colleague")){
2843 RelatedType = _("Colleague");
2845 } else if (PropertyValue == wxT("co-resident")){
2847 RelatedType = _("Co-resident");
2849 } else if (PropertyValue == wxT("neighbor")){
2851 RelatedType = _("Neighbour");
2853 } else if (PropertyValue == wxT("child")){
2855 RelatedType = _("Child");
2857 } else if (PropertyValue == wxT("parent")){
2859 RelatedType = _("Parent");
2861 } else if (PropertyValue == wxT("sibling")){
2863 RelatedType = _("Sibling");
2865 } else if (PropertyValue == wxT("spouse")){
2867 RelatedType = _("Spouse");
2869 } else if (PropertyValue == wxT("kin")){
2871 RelatedType = _("Kin");
2873 } else if (PropertyValue == wxT("muse")){
2875 RelatedType = _("Muse");
2877 } else if (PropertyValue == wxT("crush")){
2879 RelatedType = _("Crush");
2881 } else if (PropertyValue == wxT("date")){
2883 RelatedType = _("Date");
2885 } else if (PropertyValue == wxT("sweetheart")){
2887 RelatedType = _("Sweetheart");
2889 } else if (PropertyValue == wxT("me")){
2891 RelatedType = _("Me");
2893 } else if (PropertyValue == wxT("agent")){
2895 RelatedType = _("Agent");
2897 } else if (PropertyValue == wxT("emergency")){
2899 RelatedType = _("Emergency");
2903 RelatedType = PropertyValue;
2913 bool PropertyMatched = FALSE;
2915 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2916 intiter != SplitPoints.end(); ++intiter){
2918 SLiter = SplitLength.find(intiter->first);
2920 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2922 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2923 PropertyName = PropertyElement.GetNextToken();
2924 PropertyValue = PropertyElement.GetNextToken();
2926 intPrevValue = intiter->second;
2928 // Process properties.
2930 size_t intPropertyValueLen = PropertyValue.Len();
2932 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2934 PropertyValue.Trim();
2935 PropertyValue.RemoveLast();
2939 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2941 PropertyValue.Remove(0, 1);
2945 CaptureString(&PropertyValue, FALSE);
2947 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2948 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2949 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2950 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2952 if (PropertyMatched == TRUE){
2954 PropertyMatched = FALSE;
2959 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2961 if (FirstToken == TRUE){
2963 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2968 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2976 // Add the data to the General/Home/Work address variables.
2978 GeneralRelatedList.erase(*RelatedCount);
2979 GeneralRelatedListRelType.erase(*RelatedCount);
2980 GeneralRelatedListType.erase(*RelatedCount);
2981 GeneralRelatedListTokens.erase(*RelatedCount);
2982 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2983 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2984 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2985 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2989 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2991 std::map<int, int> SplitPoints;
2992 std::map<int, int> SplitLength;
2993 std::map<int, int>::iterator SLiter;
2994 wxString PropertyData;
2995 wxString PropertyName;
2996 wxString PropertyValue;
2997 wxString PropertyTokens;
2998 bool FirstToken = TRUE;
2999 int intPrevValue = 5;
3004 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3008 PropertyType PropType = PROPERTY_NONE;
3010 // Look for type before continuing.
3012 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3014 // Setup the pointers.
3016 std::map<int, wxString> *WebsiteList = NULL;
3017 std::map<int, wxString> *WebsiteListAltID = NULL;
3018 std::map<int, wxString> *WebsiteListPID = NULL;
3019 std::map<int, wxString> *WebsiteListType = NULL;
3020 std::map<int, wxString> *WebsiteListTokens = NULL;
3021 std::map<int, wxString> *WebsiteListMediatype = NULL;
3022 std::map<int, int> *WebsiteListPref = NULL;
3024 // Setup blank lines for later on.
3028 WebsiteList = &GeneralWebsiteList;
3029 WebsiteListType = &GeneralWebsiteListType;
3030 WebsiteListAltID = &GeneralWebsiteListAltID;
3031 WebsiteListPID = &GeneralWebsiteListPID;
3032 WebsiteListTokens = &GeneralWebsiteListTokens;
3033 WebsiteListMediatype = &GeneralWebsiteListMediatype;
3034 WebsiteListPref = &GeneralWebsiteListPref;
3037 WebsiteList = &HomeWebsiteList;
3038 WebsiteListType = &HomeWebsiteListType;
3039 WebsiteListAltID = &HomeWebsiteListAltID;
3040 WebsiteListPID = &HomeWebsiteListPID;
3041 WebsiteListTokens = &HomeWebsiteListTokens;
3042 WebsiteListMediatype = &HomeWebsiteListMediatype;
3043 WebsiteListPref = &HomeWebsiteListPref;
3046 WebsiteList = &BusinessWebsiteList;
3047 WebsiteListType = &BusinessWebsiteListType;
3048 WebsiteListAltID = &BusinessWebsiteListAltID;
3049 WebsiteListPID = &BusinessWebsiteListPID;
3050 WebsiteListTokens = &BusinessWebsiteListTokens;
3051 WebsiteListMediatype = &BusinessWebsiteListMediatype;
3052 WebsiteListPref = &BusinessWebsiteListPref;
3057 bool PropertyMatched = FALSE;
3059 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3060 intiter != SplitPoints.end(); ++intiter){
3062 SLiter = SplitLength.find(intiter->first);
3064 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3066 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3067 PropertyName = PropertyElement.GetNextToken();
3068 PropertyValue = PropertyElement.GetNextToken();
3070 intPrevValue = intiter->second;
3072 // Process properties.
3074 size_t intPropertyValueLen = PropertyValue.Len();
3076 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3078 PropertyValue.Trim();
3079 PropertyValue.RemoveLast();
3083 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3085 PropertyValue.Remove(0, 1);
3089 CaptureString(&PropertyValue, FALSE);
3091 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
3092 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
3093 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
3094 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
3096 if (PropertyMatched == TRUE){
3098 PropertyMatched = FALSE;
3103 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3105 if (FirstToken == TRUE){
3107 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3112 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3120 // Add the data to the General/Home/Work address variables.
3122 CaptureString(&PropertySeg2, FALSE);
3124 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3126 if (!PropertyTokens.IsEmpty()){
3128 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3134 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3136 std::map<int, int> SplitPoints;
3137 std::map<int, int> SplitLength;
3138 std::map<int, int>::iterator SLiter;
3139 wxString PropertyData;
3140 wxString PropertyName;
3141 wxString PropertyValue;
3142 wxString PropertyTokens;
3143 bool FirstToken = TRUE;
3144 int intPrevValue = 7;
3149 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3153 PropertyType PropType = PROPERTY_NONE;
3155 // Look for type before continuing.
3157 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3159 // Setup the pointers.
3161 std::map<int, wxString> *TitleList = NULL;
3162 std::map<int, wxString> *TitleListAltID = NULL;
3163 std::map<int, wxString> *TitleListPID = NULL;
3164 std::map<int, wxString> *TitleListType = NULL;
3165 std::map<int, wxString> *TitleListTokens = NULL;
3166 std::map<int, wxString> *TitleListLanguage = NULL;
3167 std::map<int, int> *TitleListPref = NULL;
3169 // Setup blank lines for later on.
3173 TitleList = &GeneralTitleList;
3174 TitleListType = &GeneralTitleListType;
3175 TitleListAltID = &GeneralTitleListAltID;
3176 TitleListPID = &GeneralTitleListPID;
3177 TitleListTokens = &GeneralTitleListTokens;
3178 TitleListLanguage = &GeneralTitleListLanguage;
3179 TitleListPref = &GeneralTitleListPref;
3182 TitleList = &HomeTitleList;
3183 TitleListType = &HomeTitleListType;
3184 TitleListAltID = &HomeTitleListAltID;
3185 TitleListPID = &HomeTitleListPID;
3186 TitleListTokens = &HomeTitleListTokens;
3187 TitleListLanguage = &HomeTitleListLanguage;
3188 TitleListPref = &HomeTitleListPref;
3191 TitleList = &BusinessTitleList;
3192 TitleListType = &BusinessTitleListType;
3193 TitleListAltID = &BusinessTitleListAltID;
3194 TitleListPID = &BusinessTitleListPID;
3195 TitleListTokens = &BusinessTitleListTokens;
3196 TitleListLanguage = &BusinessTitleListLanguage;
3197 TitleListPref = &BusinessTitleListPref;
3202 bool PropertyMatched = FALSE;
3204 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3205 intiter != SplitPoints.end(); ++intiter){
3207 SLiter = SplitLength.find(intiter->first);
3209 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3211 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3212 PropertyName = PropertyElement.GetNextToken();
3213 PropertyValue = PropertyElement.GetNextToken();
3215 intPrevValue = intiter->second;
3217 // Process properties.
3219 size_t intPropertyValueLen = PropertyValue.Len();
3221 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3223 PropertyValue.Trim();
3224 PropertyValue.RemoveLast();
3228 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3230 PropertyValue.Remove(0, 1);
3234 CaptureString(&PropertyValue, FALSE);
3236 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
3237 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
3238 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
3239 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
3241 if (PropertyMatched == TRUE){
3243 PropertyMatched = FALSE;
3248 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3250 if (FirstToken == TRUE){
3252 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3257 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3265 // Add the data to the General/Home/Work address variables.
3267 CaptureString(&PropertySeg2, FALSE);
3269 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3271 if (!PropertyTokens.IsEmpty()){
3273 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3279 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3281 std::map<int, int> SplitPoints;
3282 std::map<int, int> SplitLength;
3283 std::map<int, int>::iterator SLiter;
3284 wxString PropertyData;
3285 wxString PropertyName;
3286 wxString PropertyValue;
3287 wxString PropertyTokens;
3288 bool FirstToken = TRUE;
3289 int intPrevValue = 6;
3294 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3298 PropertyType PropType = PROPERTY_NONE;
3300 // Look for type before continuing.
3302 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3304 // Setup the pointers.
3306 std::map<int, wxString> *RoleList = NULL;
3307 std::map<int, wxString> *RoleListAltID = NULL;
3308 std::map<int, wxString> *RoleListPID = NULL;
3309 std::map<int, wxString> *RoleListType = NULL;
3310 std::map<int, wxString> *RoleListTokens = NULL;
3311 std::map<int, wxString> *RoleListLanguage = NULL;
3312 std::map<int, int> *RoleListPref = NULL;
3314 // Setup blank lines for later on.
3318 RoleList = &GeneralRoleList;
3319 RoleListType = &GeneralRoleListType;
3320 RoleListAltID = &GeneralRoleListAltID;
3321 RoleListPID = &GeneralRoleListPID;
3322 RoleListTokens = &GeneralRoleListTokens;
3323 RoleListLanguage = &GeneralRoleListLanguage;
3324 RoleListPref = &GeneralRoleListPref;
3327 RoleList = &HomeRoleList;
3328 RoleListType = &HomeRoleListType;
3329 RoleListAltID = &HomeRoleListAltID;
3330 RoleListPID = &HomeRoleListPID;
3331 RoleListTokens = &HomeRoleListTokens;
3332 RoleListLanguage = &HomeRoleListLanguage;
3333 RoleListPref = &HomeRoleListPref;
3336 RoleList = &BusinessRoleList;
3337 RoleListType = &BusinessRoleListType;
3338 RoleListAltID = &BusinessRoleListAltID;
3339 RoleListPID = &BusinessRoleListPID;
3340 RoleListTokens = &BusinessRoleListTokens;
3341 RoleListLanguage = &BusinessRoleListLanguage;
3342 RoleListPref = &BusinessRoleListPref;
3347 bool PropertyMatched = FALSE;
3349 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3350 intiter != SplitPoints.end(); ++intiter){
3352 SLiter = SplitLength.find(intiter->first);
3354 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3356 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3357 PropertyName = PropertyElement.GetNextToken();
3358 PropertyValue = PropertyElement.GetNextToken();
3360 intPrevValue = intiter->second;
3362 // Process properties.
3364 size_t intPropertyValueLen = PropertyValue.Len();
3366 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3368 PropertyValue.Trim();
3369 PropertyValue.RemoveLast();
3373 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3375 PropertyValue.Remove(0, 1);
3379 CaptureString(&PropertyValue, FALSE);
3381 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3382 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3383 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3384 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3386 if (PropertyMatched == TRUE){
3388 PropertyMatched = FALSE;
3393 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3395 if (FirstToken == TRUE){
3397 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3402 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3410 // Add the data to the General/Home/Work address variables.
3412 CaptureString(&PropertySeg2, FALSE);
3414 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3416 if (!PropertyTokens.IsEmpty()){
3418 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3424 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3426 std::map<int, int> SplitPoints;
3427 std::map<int, int> SplitLength;
3428 std::map<int, int>::iterator SLiter;
3429 wxString PropertyData;
3430 wxString PropertyName;
3431 wxString PropertyValue;
3432 wxString PropertyTokens;
3433 bool FirstToken = TRUE;
3434 int intPrevValue = 5;
3439 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3443 PropertyType PropType = PROPERTY_NONE;
3445 // Look for type before continuing.
3447 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3449 // Setup the pointers.
3451 std::map<int, wxString> *OrganisationsList = NULL;
3452 std::map<int, wxString> *OrganisationsListAltID = NULL;
3453 std::map<int, wxString> *OrganisationsListPID = NULL;
3454 std::map<int, wxString> *OrganisationsListType = NULL;
3455 std::map<int, wxString> *OrganisationsListTokens = NULL;
3456 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3457 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3458 std::map<int, int> *OrganisationsListPref = NULL;
3460 // Setup blank lines for later on.
3464 OrganisationsList = &GeneralOrganisationsList;
3465 OrganisationsListType = &GeneralOrganisationsListType;
3466 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3467 OrganisationsListPID = &GeneralOrganisationsListPID;
3468 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3469 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3470 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3471 OrganisationsListPref = &GeneralOrganisationsListPref;
3474 OrganisationsList = &HomeOrganisationsList;
3475 OrganisationsListType = &HomeOrganisationsListType;
3476 OrganisationsListAltID = &HomeOrganisationsListAltID;
3477 OrganisationsListPID = &HomeOrganisationsListPID;
3478 OrganisationsListTokens = &HomeOrganisationsListTokens;
3479 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3480 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3481 OrganisationsListPref = &HomeOrganisationsListPref;
3484 OrganisationsList = &BusinessOrganisationsList;
3485 OrganisationsListType = &BusinessOrganisationsListType;
3486 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3487 OrganisationsListPID = &BusinessOrganisationsListPID;
3488 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3489 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3490 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3491 OrganisationsListPref = &BusinessOrganisationsListPref;
3496 bool PropertyMatched = FALSE;
3498 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3499 intiter != SplitPoints.end(); ++intiter){
3501 SLiter = SplitLength.find(intiter->first);
3503 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3505 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3506 PropertyName = PropertyElement.GetNextToken();
3507 PropertyValue = PropertyElement.GetNextToken();
3509 intPrevValue = intiter->second;
3511 // Process properties.
3513 size_t intPropertyValueLen = PropertyValue.Len();
3515 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3517 PropertyValue.Trim();
3518 PropertyValue.RemoveLast();
3522 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3524 PropertyValue.Remove(0, 1);
3528 CaptureString(&PropertyValue, FALSE);
3530 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3531 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3532 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3533 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3534 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3536 if (PropertyMatched == TRUE){
3538 PropertyMatched = FALSE;
3543 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3545 if (FirstToken == TRUE){
3547 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3552 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3560 // Add the data to the General/Home/Work address variables.
3562 CaptureString(&PropertySeg2, FALSE);
3564 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3566 if (!PropertyTokens.IsEmpty()){
3568 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3574 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3576 std::map<int, int> SplitPoints;
3577 std::map<int, int> SplitLength;
3578 std::map<int, int>::iterator SLiter;
3579 wxString PropertyData;
3580 wxString PropertyName;
3581 wxString PropertyValue;
3582 wxString PropertyTokens;
3583 bool FirstToken = TRUE;
3584 int intPrevValue = 6;
3589 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3593 PropertyType PropType = PROPERTY_NONE;
3595 // Look for type before continuing.
3597 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3599 // Setup the pointers.
3601 std::map<int, wxString> *NoteList = NULL;
3602 std::map<int, wxString> *NoteListAltID = NULL;
3603 std::map<int, wxString> *NoteListPID = NULL;
3604 std::map<int, wxString> *NoteListType = NULL;
3605 std::map<int, wxString> *NoteListTokens = NULL;
3606 std::map<int, wxString> *NoteListLanguage = NULL;
3607 std::map<int, int> *NoteListPref = NULL;
3609 // Setup blank lines for later on.
3613 NoteList = &GeneralNoteList;
3614 NoteListType = &GeneralNoteListType;
3615 NoteListAltID = &GeneralNoteListAltID;
3616 NoteListPID = &GeneralNoteListPID;
3617 NoteListTokens = &GeneralNoteListTokens;
3618 NoteListLanguage = &GeneralNoteListLanguage;
3619 NoteListPref = &GeneralNoteListPref;
3622 NoteList = &HomeNoteList;
3623 NoteListType = &HomeNoteListType;
3624 NoteListAltID = &HomeNoteListAltID;
3625 NoteListPID = &HomeNoteListPID;
3626 NoteListTokens = &HomeNoteListTokens;
3627 NoteListLanguage = &HomeNoteListLanguage;
3628 NoteListPref = &HomeNoteListPref;
3631 NoteList = &BusinessNoteList;
3632 NoteListType = &BusinessNoteListType;
3633 NoteListAltID = &BusinessNoteListAltID;
3634 NoteListPID = &BusinessNoteListPID;
3635 NoteListTokens = &BusinessNoteListTokens;
3636 NoteListLanguage = &BusinessNoteListLanguage;
3637 NoteListPref = &BusinessNoteListPref;
3642 bool PropertyMatched = FALSE;
3644 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3645 intiter != SplitPoints.end(); ++intiter){
3647 SLiter = SplitLength.find(intiter->first);
3649 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3651 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3652 PropertyName = PropertyElement.GetNextToken();
3653 PropertyValue = PropertyElement.GetNextToken();
3655 intPrevValue = intiter->second;
3657 // Process properties.
3659 size_t intPropertyValueLen = PropertyValue.Len();
3661 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3663 PropertyValue.Trim();
3664 PropertyValue.RemoveLast();
3668 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3670 PropertyValue.Remove(0, 1);
3674 CaptureString(&PropertyValue, FALSE);
3676 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3677 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3678 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3679 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3681 if (PropertyMatched == TRUE){
3683 PropertyMatched = FALSE;
3688 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3690 if (FirstToken == TRUE){
3692 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3697 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3705 // Add the data to the General/Home/Work address variables.
3707 CaptureString(&PropertySeg2, FALSE);
3709 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3711 if (!PropertyTokens.IsEmpty()){
3713 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3719 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3721 std::map<int, int> SplitPoints;
3722 std::map<int, int> SplitLength;
3723 std::map<int, int>::iterator SLiter;
3724 wxString PropertyData;
3725 wxString PropertyName;
3726 wxString PropertyValue;
3727 wxString PropertyTokens;
3728 bool FirstToken = TRUE;
3729 int intPrevValue = 12;
3734 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3738 PropertyType PropType = PROPERTY_NONE;
3740 // Look for type before continuing.
3742 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3744 // Setup blank lines for later on.
3750 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3753 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3758 bool PropertyMatched = FALSE;
3760 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3761 intiter != SplitPoints.end(); ++intiter){
3763 SLiter = SplitLength.find(intiter->first);
3765 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3767 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3768 PropertyName = PropertyElement.GetNextToken();
3769 PropertyValue = PropertyElement.GetNextToken();
3771 intPrevValue = intiter->second;
3773 // Process properties.
3775 size_t intPropertyValueLen = PropertyValue.Len();
3777 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3779 PropertyValue.Trim();
3780 PropertyValue.RemoveLast();
3784 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3786 PropertyValue.Remove(0, 1);
3790 CaptureString(&PropertyValue, FALSE);
3792 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3793 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3794 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3795 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3797 if (PropertyMatched == TRUE){
3799 PropertyMatched = FALSE;
3804 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3806 if (FirstToken == TRUE){
3808 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3813 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3821 // Deal with multiple categories.
3823 int intOrigCatCount = *CategoryCount;
3824 bool FirstCategoryProcessed = TRUE;
3825 bool AfterFirstToken = FALSE;
3826 int intSplitSize = 0;
3827 int intSplitsFound = 0;
3828 int intSplitSeek = 0;
3829 int intPropertyLen = PropertySeg2.Len();
3831 SplitPoints.clear();
3832 SplitLength.clear();
3835 for (int i = 0; i <= intPropertyLen; i++){
3837 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3845 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3847 if (AfterFirstToken == TRUE){
3849 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3850 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3854 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3855 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3856 AfterFirstToken = TRUE;
3868 if (SplitPoints.size() > 0){
3870 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3871 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3875 if (SplitPoints.size() == 0){
3877 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3879 if (!PropertyTokens.IsEmpty()){
3881 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3887 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3888 intiter != SplitPoints.end(); ++intiter){
3890 SLiter = SplitLength.find(intiter->first);
3892 intPrevValue = intiter->second;
3894 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3896 // Add the data to the General/Home/Work address variables.
3898 // Trim any whitespace from the start and end.
3900 PropertyData = PropertyData.Trim(FALSE);
3901 PropertyData = PropertyData.Trim(TRUE);
3903 CaptureString(&PropertyData, FALSE);
3905 if (FirstCategoryProcessed == TRUE){
3907 FirstCategoryProcessed = FALSE;
3909 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3911 if (!PropertyTokens.IsEmpty()){
3913 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3923 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3925 if (!PropertyTokens.IsEmpty()){
3927 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3933 // Copy the properties to each of the categories (if it exists).
3935 if (!PropertyTokens.IsEmpty()){
3937 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3941 // Check if ALTID was used.
3943 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3945 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3949 // Check if PID was used.
3951 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3953 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3957 // Check if PREF was used.
3959 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3961 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3965 // Check if LANGUAGE was used.
3967 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3969 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3973 // Check if TYPE was used.
3979 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3982 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3990 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3992 size_t intPropertyLen = PropertySeg1.Len();
3993 std::map<int, int> SplitPoints;
3994 std::map<int, int> SplitLength;
3995 std::map<int, int>::iterator SLiter;
3996 wxString PropertyData;
3997 wxString PropertyName;
3998 wxString PropertyValue;
3999 wxString PropertyTokens;
4000 bool FirstToken = TRUE;
4001 int intSplitsFound = 0;
4002 int intSplitSize = 0;
4003 int intPrevValue = 7;
4007 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4011 PropertyType PropType = PROPERTY_NONE;
4013 // Look for type before continuing.
4015 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4018 bool PropertyMatched = FALSE;
4020 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4021 intiter != SplitPoints.end(); ++intiter){
4023 SLiter = SplitLength.find(intiter->first);
4025 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4027 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4028 PropertyName = PropertyElement.GetNextToken();
4029 PropertyValue = PropertyElement.GetNextToken();
4031 intPrevValue = intiter->second;
4033 // Process properties.
4035 size_t intPropertyValueLen = PropertyValue.Len();
4037 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4039 PropertyValue.Trim();
4040 PropertyValue.RemoveLast();
4044 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4046 PropertyValue.Remove(0, 1);
4050 CaptureString(&PropertyValue, FALSE);
4052 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
4053 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
4054 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
4055 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
4057 if (PropertyMatched == TRUE){
4059 PropertyMatched = FALSE;
4064 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4066 if (FirstToken == TRUE){
4068 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4073 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4081 intPropertyLen = PropertySeg2.Len();
4082 SplitPoints.clear();
4083 SplitLength.clear();
4088 CaptureString(&PropertySeg2, FALSE);
4090 for (int i = 0; i <= intPropertyLen; i++){
4094 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4097 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4099 if (intSplitsFound == 6){
4101 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4106 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4116 wxString wxSPhotoURI;
4117 wxString wxSPhotoMIME;
4118 wxString wxSPhotoEncoding;
4119 wxString wxSPhotoData;
4120 std::string base64enc;
4122 if (intSplitsFound == 0){
4126 std::map<int, int>::iterator striter;
4128 striter = SplitLength.find(1);
4130 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4132 while (wSTDataType.HasMoreTokens() == TRUE){
4134 wxSPhotoURI = wSTDataType.GetNextToken();
4135 wxSPhotoMIME = wSTDataType.GetNextToken();
4140 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4142 while (wSTDataInfo.HasMoreTokens() == TRUE){
4144 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4145 wxSPhotoData = wSTDataInfo.GetNextToken();
4146 base64enc = wxSPhotoData.mb_str();
4153 // Add the data to the General/Home/Work address variables.
4155 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4156 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4157 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4163 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4166 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4170 if (!PropertyTokens.IsEmpty()){
4172 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4178 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4180 size_t intPropertyLen = PropertySeg1.Len();
4181 std::map<int, int> SplitPoints;
4182 std::map<int, int> SplitLength;
4183 std::map<int, int>::iterator SLiter;
4184 wxString PropertyData;
4185 wxString PropertyName;
4186 wxString PropertyValue;
4187 wxString PropertyTokens;
4188 bool FirstToken = TRUE;
4189 int intSplitsFound = 0;
4190 int intSplitSize = 0;
4191 int intPrevValue = 6;
4195 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4199 PropertyType PropType = PROPERTY_NONE;
4201 // Look for type before continuing.
4203 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4206 bool PropertyMatched = FALSE;
4208 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4209 intiter != SplitPoints.end(); ++intiter){
4211 SLiter = SplitLength.find(intiter->first);
4213 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4215 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4216 PropertyName = PropertyElement.GetNextToken();
4217 PropertyValue = PropertyElement.GetNextToken();
4219 intPrevValue = intiter->second;
4221 // Process properties.
4223 size_t intPropertyValueLen = PropertyValue.Len();
4225 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4227 PropertyValue.Trim();
4228 PropertyValue.RemoveLast();
4232 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4234 PropertyValue.Remove(0, 1);
4238 CaptureString(&PropertyValue, FALSE);
4240 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
4241 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
4242 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
4243 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
4245 if (PropertyMatched == TRUE){
4247 PropertyMatched = FALSE;
4252 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4254 if (FirstToken == TRUE){
4256 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4261 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4269 intPropertyLen = PropertySeg2.Len();
4270 SplitPoints.clear();
4271 SplitLength.clear();
4276 CaptureString(&PropertySeg2, FALSE);
4278 for (int i = 0; i <= intPropertyLen; i++){
4282 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4285 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4287 if (intSplitsFound == 6){
4289 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4294 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4304 wxString wxSPhotoURI;
4305 wxString wxSPhotoMIME;
4306 wxString wxSPhotoEncoding;
4307 wxString wxSPhotoData;
4308 std::string base64enc;
4310 if (intSplitsFound == 0){
4314 std::map<int, int>::iterator striter;
4316 striter = SplitLength.find(1);
4318 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4320 while (wSTDataType.HasMoreTokens() == TRUE){
4322 wxSPhotoURI = wSTDataType.GetNextToken();
4323 wxSPhotoMIME = wSTDataType.GetNextToken();
4328 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4330 while (wSTDataInfo.HasMoreTokens() == TRUE){
4332 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4333 wxSPhotoData = wSTDataInfo.GetNextToken();
4334 base64enc = wxSPhotoData.mb_str();
4341 // Add the data to the General/Home/Work address variables.
4343 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4344 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4345 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4351 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4354 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4358 if (!PropertyTokens.IsEmpty()){
4360 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4366 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4368 size_t intPropertyLen = PropertySeg1.Len();
4369 std::map<int, int> SplitPoints;
4370 std::map<int, int> SplitLength;
4371 std::map<int, int>::iterator SLiter;
4372 wxString PropertyData;
4373 wxString PropertyName;
4374 wxString PropertyValue;
4375 wxString PropertyTokens;
4376 bool FirstToken = TRUE;
4377 int intSplitsFound = 0;
4378 int intSplitSize = 0;
4379 int intPrevValue = 7;
4383 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4387 PropertyType PropType = PROPERTY_NONE;
4389 // Look for type before continuing.
4391 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4394 bool PropertyMatched = FALSE;
4396 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4397 intiter != SplitPoints.end(); ++intiter){
4399 SLiter = SplitLength.find(intiter->first);
4401 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4403 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4404 PropertyName = PropertyElement.GetNextToken();
4405 PropertyValue = PropertyElement.GetNextToken();
4407 intPrevValue = intiter->second;
4409 // Process properties.
4411 size_t intPropertyValueLen = PropertyValue.Len();
4413 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4415 PropertyValue.Trim();
4416 PropertyValue.RemoveLast();
4420 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4422 PropertyValue.Remove(0, 1);
4426 CaptureString(&PropertyValue, FALSE);
4428 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
4429 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
4430 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
4431 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
4432 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
4434 if (PropertyMatched == TRUE){
4436 PropertyMatched = FALSE;
4441 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4443 if (FirstToken == TRUE){
4445 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4450 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4458 intPropertyLen = PropertySeg2.Len();
4459 SplitPoints.clear();
4460 SplitLength.clear();
4465 CaptureString(&PropertySeg2, FALSE);
4467 for (int i = 0; i <= intPropertyLen; i++){
4471 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4474 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4476 if (intSplitsFound == 6){
4478 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4483 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4493 wxString wxSSoundURI;
4494 wxString wxSSoundMIME;
4495 wxString wxSSoundEncoding;
4496 wxString wxSSoundData;
4497 std::string base64enc;
4499 if (intSplitsFound == 0){
4503 std::map<int, int>::iterator striter;
4505 striter = SplitLength.find(1);
4507 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4509 while (wSTDataType.HasMoreTokens() == TRUE){
4511 wxSSoundURI = wSTDataType.GetNextToken();
4512 wxSSoundMIME = wSTDataType.GetNextToken();
4517 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4519 while (wSTDataInfo.HasMoreTokens() == TRUE){
4521 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4522 wxSSoundData = wSTDataInfo.GetNextToken();
4523 base64enc = wxSSoundData.mb_str();
4530 // Add the data to the General/Home/Work address variables.
4536 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4539 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4543 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4544 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4545 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4547 if (!PropertyTokens.IsEmpty()){
4549 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4555 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4557 size_t intPropertyLen = PropertySeg1.Len();
4558 std::map<int, int> SplitPoints;
4559 std::map<int, int> SplitLength;
4560 std::map<int, int>::iterator SLiter;
4561 wxString PropertyData;
4562 wxString PropertyName;
4563 wxString PropertyValue;
4564 wxString PropertyTokens;
4565 bool FirstToken = TRUE;
4566 int intSplitsFound = 0;
4567 int intSplitSize = 0;
4568 int intPrevValue = 8;
4572 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4576 PropertyType PropType = PROPERTY_NONE;
4578 // Look for type before continuing.
4580 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4583 bool PropertyMatched = FALSE;
4585 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4586 intiter != SplitPoints.end(); ++intiter){
4588 SLiter = SplitLength.find(intiter->first);
4590 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4592 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4593 PropertyName = PropertyElement.GetNextToken();
4594 PropertyValue = PropertyElement.GetNextToken();
4596 intPrevValue = intiter->second;
4598 // Process properties.
4600 size_t intPropertyValueLen = PropertyValue.Len();
4602 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4604 PropertyValue.Trim();
4605 PropertyValue.RemoveLast();
4609 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4611 PropertyValue.Remove(0, 1);
4615 CaptureString(&PropertyValue, FALSE);
4617 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4618 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4619 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4620 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4622 if (PropertyMatched == TRUE){
4624 PropertyMatched = FALSE;
4629 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4631 if (FirstToken == TRUE){
4633 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4638 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4646 intPropertyLen = PropertySeg2.Len();
4647 SplitPoints.clear();
4648 SplitLength.clear();
4653 CaptureString(&PropertySeg2, FALSE);
4655 // Add the data to the General/Home/Work address variables.
4661 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4664 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4668 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4670 if (!PropertyTokens.IsEmpty()){
4672 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4678 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4680 size_t intPropertyLen = PropertySeg1.Len();
4681 std::map<int, int> SplitPoints;
4682 std::map<int, int> SplitLength;
4683 std::map<int, int>::iterator SLiter;
4684 wxString PropertyData;
4685 wxString PropertyName;
4686 wxString PropertyValue;
4687 wxString PropertyTokens;
4688 bool FirstToken = TRUE;
4689 int intSplitsFound = 0;
4690 int intSplitSize = 0;
4691 int intPrevValue = 8;
4695 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4699 PropertyType PropType = PROPERTY_NONE;
4701 // Look for type before continuing.
4703 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4706 bool PropertyMatched = FALSE;
4708 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4709 intiter != SplitPoints.end(); ++intiter){
4711 SLiter = SplitLength.find(intiter->first);
4713 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4715 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4716 PropertyName = PropertyElement.GetNextToken();
4717 PropertyValue = PropertyElement.GetNextToken();
4719 intPrevValue = intiter->second;
4721 // Process properties.
4723 size_t intPropertyValueLen = PropertyValue.Len();
4725 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4727 PropertyValue.Trim();
4728 PropertyValue.RemoveLast();
4732 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4734 PropertyValue.Remove(0, 1);
4738 CaptureString(&PropertyValue, FALSE);
4740 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4741 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4742 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4743 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4745 if (PropertyMatched == TRUE){
4747 PropertyMatched = FALSE;
4752 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4754 if (FirstToken == TRUE){
4756 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4761 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4769 intPropertyLen = PropertySeg2.Len();
4770 SplitPoints.clear();
4771 SplitLength.clear();
4776 CaptureString(&PropertySeg2, FALSE);
4778 // Add the data to the General/Home/Work address variables.
4784 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4787 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4791 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4793 if (!PropertyTokens.IsEmpty()){
4795 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4801 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4803 size_t intPropertyLen = PropertySeg1.Len();
4804 std::map<int, int> SplitPoints;
4805 std::map<int, int> SplitLength;
4806 std::map<int, int>::iterator SLiter;
4807 wxString PropertyData;
4808 wxString PropertyName;
4809 wxString PropertyValue;
4810 wxString PropertyTokens;
4811 bool FirstToken = TRUE;
4812 int intSplitsFound = 0;
4813 int intSplitSize = 0;
4814 int intPrevValue = 7;
4818 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4822 PropertyType PropType = PROPERTY_NONE;
4824 // Look for type before continuing.
4826 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4829 bool PropertyMatched = FALSE;
4831 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4832 intiter != SplitPoints.end(); ++intiter){
4834 SLiter = SplitLength.find(intiter->first);
4836 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4838 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4839 PropertyName = PropertyElement.GetNextToken();
4840 PropertyValue = PropertyElement.GetNextToken();
4842 intPrevValue = intiter->second;
4844 // Process properties.
4846 size_t intPropertyValueLen = PropertyValue.Len();
4848 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4850 PropertyValue.Trim();
4851 PropertyValue.RemoveLast();
4855 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4857 PropertyValue.Remove(0, 1);
4861 CaptureString(&PropertyValue, FALSE);
4863 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4864 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4865 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4866 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4868 if (PropertyMatched == TRUE){
4870 PropertyMatched = FALSE;
4875 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4877 if (FirstToken == TRUE){
4879 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4884 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4892 intPropertyLen = PropertySeg2.Len();
4893 SplitPoints.clear();
4894 SplitLength.clear();
4899 CaptureString(&PropertySeg2, FALSE);
4901 // Add the data to the General/Home/Work address variables.
4907 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4910 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4914 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4916 if (!PropertyTokens.IsEmpty()){
4918 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4924 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4926 size_t intPropertyLen = PropertySeg1.Len();
4927 std::map<int, int> SplitPoints;
4928 std::map<int, int> SplitLength;
4929 std::map<int, int>::iterator SLiter;
4930 wxString PropertyData;
4931 wxString PropertyName;
4932 wxString PropertyValue;
4933 wxString PropertyTokens;
4934 bool FirstToken = TRUE;
4935 int intSplitsFound = 0;
4936 int intSplitSize = 0;
4937 int intPrevValue = 5;
4942 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4946 PropertyType PropType = PROPERTY_NONE;
4948 // Look for type before continuing.
4950 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4953 bool PropertyMatched = FALSE;
4955 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4956 intiter != SplitPoints.end(); ++intiter){
4958 SLiter = SplitLength.find(intiter->first);
4960 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4962 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4963 PropertyName = PropertyElement.GetNextToken();
4964 PropertyValue = PropertyElement.GetNextToken();
4966 intPrevValue = intiter->second;
4968 // Process properties.
4970 size_t intPropertyValueLen = PropertyValue.Len();
4972 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4974 PropertyValue.Trim();
4975 PropertyValue.RemoveLast();
4979 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4981 PropertyValue.Remove(0, 1);
4985 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4986 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4987 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4989 if (PropertyMatched == TRUE){
4991 PropertyMatched = FALSE;
4996 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4998 if (FirstToken == TRUE){
5000 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
5005 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
5013 intPropertyLen = PropertySeg2.Len();
5014 SplitPoints.clear();
5015 SplitLength.clear();
5020 for (int i = 0; i <= intPropertyLen; i++){
5024 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
5027 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
5029 if (intSplitsFound == 6){
5031 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5036 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5047 wxString wxSKeyMIME;
5048 wxString wxSKeyEncoding;
5049 wxString wxSKeyData;
5050 std::string base64enc;
5052 if (intSplitsFound == 0){
5056 std::map<int, int>::iterator striter;
5058 striter = SplitLength.find(1);
5060 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
5062 while (wSTDataType.HasMoreTokens() == TRUE){
5064 wxSKeyURI = wSTDataType.GetNextToken();
5065 wxSKeyMIME = wSTDataType.GetNextToken();
5070 if (wxSKeyURI == wxT("data")){
5072 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
5074 while (wSTDataInfo.HasMoreTokens() == TRUE){
5076 wxSKeyEncoding = wSTDataInfo.GetNextToken();
5077 wxSKeyData = wSTDataInfo.GetNextToken();
5086 // Add the data to the General/Home/Work address variables.
5088 if (wxSKeyURI == wxT("data")){
5090 KeyListDataEncType.erase(*KeyCount);
5091 KeyListKeyType.erase(*KeyCount);
5092 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
5093 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
5095 KeyList.erase(*KeyCount);
5096 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
5100 KeyList.erase(*KeyCount);
5101 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
5105 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
5111 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
5114 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
5118 if (!PropertyTokens.IsEmpty()){
5120 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
5126 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
5128 // Split the Vendor three ways.
5130 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
5133 wxString wxSVNDPropName;
5136 while (wSTVendorDetails.HasMoreTokens() == TRUE){
5138 wSTVendorDetails.GetNextToken();
5139 wxSVNDID = wSTVendorDetails.GetNextToken();
5140 wxSVNDPropName = wSTVendorDetails.GetNextToken();
5145 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
5147 // Add the data to the vendor variables.
5149 VendorList.erase(*VendorCount);
5150 VendorListPEN.erase(*VendorCount);
5151 VendorListElement.erase(*VendorCount);
5153 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
5154 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
5155 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
5161 void ProcessStringValue(wxString *PropertyName,
5162 wxString PropertyNameMatch,
5163 std::map<int,wxString> *MapPtr,
5164 wxString *PropertyValue,
5166 bool *PropertyMatched){
5168 if (*PropertyName == PropertyNameMatch){
5169 MapPtr->erase(*ItemCount);
5170 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5171 *PropertyMatched = TRUE;
5176 void ProcessIntegerValue(wxString *PropertyName,
5177 wxString PropertyNameMatch,
5178 std::map<int,int> *PrefPtr,
5179 wxString *PropertyValue,
5181 bool *PropertyMatched){
5183 if (*PropertyName == PropertyNameMatch){
5184 *PropertyMatched = TRUE;
5189 int PriorityNumber = 0;
5190 bool ValidNumber = TRUE;
5193 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5196 catch(std::invalid_argument &e){
5197 ValidNumber = FALSE;
5200 if (ValidNumber == TRUE){
5202 PrefPtr->erase(*ItemCount);
5203 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5209 void ProcessIntegerValue(std::map<int,int> *PrefPtr,
5210 wxString *PropertyValue,
5213 int PriorityNumber = 0;
5214 bool ValidNumber = TRUE;
5217 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5220 catch(std::invalid_argument &e){
5221 ValidNumber = FALSE;
5224 if (ValidNumber == TRUE){
5226 PrefPtr->erase(*ItemCount);
5227 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5233 void SplitValues(wxString *PropertyLine,
5234 std::map<int,int> *SplitPoints,
5235 std::map<int,int> *SplitLength,
5238 size_t intPropertyLen = PropertyLine->Len();
5239 int intSplitsFound = 0;
5240 int intSplitSize = 0;
5241 int intSplitSeek = 0;
5243 for (int i = intSize; i <= intPropertyLen; i++){
5247 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5248 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5250 if (intSplitsFound == 0){
5252 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5256 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5260 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5270 if (intSplitsFound == 0){
5272 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5273 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5277 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5278 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5284 void CheckType(wxString *PropertySeg1,
5285 std::map<int,int> *SplitPoints,
5286 std::map<int,int> *SplitLength,
5288 PropertyType *PropType){
5290 wxString PropertyData;
5291 wxString PropertyName;
5292 wxString PropertyValue;
5293 std::map<int,int>::iterator SLiter;
5295 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5296 intiter != SplitPoints->end(); ++intiter){
5298 SLiter = SplitLength->find(intiter->first);
5300 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5302 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5303 PropertyName = PropertyElement.GetNextToken();
5304 PropertyValue = PropertyElement.GetNextToken();
5306 *intPrevValue = intiter->second;
5308 if (PropertyName == wxT("TYPE")){
5310 if (PropertyValue == wxT("work")){
5312 *PropType = PROPERTY_WORK;
5314 } else if (PropertyValue == wxT("home")){
5316 *PropType = PROPERTY_HOME;
5320 *PropType = PROPERTY_NONE;