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 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
519 CaptureString(&PropertySeg2, FALSE);
521 Revision = PropertySeg2;
523 if (!PropertyTokens.IsEmpty()){
525 RevisionTokens = PropertyTokens;
532 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
534 size_t intPropertyLen = PropertySeg1.Len();
535 std::map<int, int> SplitPoints;
536 std::map<int, int> SplitLength;
537 std::map<int, int>::iterator SLiter;
538 wxString PropertyData;
539 wxString PropertyName;
540 wxString PropertyValue;
541 wxString PropertyTokens;
542 bool FirstToken = TRUE;
543 bool PropertyMatched = FALSE;
544 int intSplitsFound = 0;
545 int intSplitSize = 0;
546 int intPrevValue = 8;
550 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
554 PropertyType PropType = PROPERTY_NONE;
556 // Look for type before continuing.
558 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
562 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
563 intiter != SplitPoints.end(); ++intiter){
565 SLiter = SplitLength.find(intiter->first);
567 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
569 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
570 PropertyName = PropertyElement.GetNextToken();
571 PropertyValue = PropertyElement.GetNextToken();
573 intPrevValue = intiter->second;
575 // Process properties.
577 size_t intPropertyValueLen = PropertyValue.Len();
579 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
581 PropertyValue.Trim();
582 PropertyValue.RemoveLast();
586 if (PropertyValue.Mid(0, 1) == wxT("\"")){
588 PropertyValue.Remove(0, 1);
592 CaptureString(&PropertyValue, FALSE);
594 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
595 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
596 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
597 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
599 if (PropertyMatched == TRUE){
601 PropertyMatched = FALSE;
606 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
610 intPropertyLen = PropertySeg2.Len();
617 CaptureString(&PropertySeg2, FALSE);
619 // Add the data to the General/Home/Work address variables.
625 SourceListType.insert(std::make_pair(*SourceCount, "home"));
628 SourceListType.insert(std::make_pair(*SourceCount, "work"));
632 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
634 if (!PropertyTokens.IsEmpty()){
636 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
642 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
644 std::map<int, int> SplitPoints;
645 std::map<int, int> SplitLength;
647 int intPrevValue = 5;
651 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
655 wxString PropertyName;
656 wxString PropertyValue;
657 wxString PropertyData;
658 wxString PropertyTokens;
659 std::map<int,int>::iterator SLiter;
660 bool FirstToken = TRUE;
661 bool PropertyMatched = FALSE;
663 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
664 intiter != SplitPoints.end(); ++intiter){
666 SLiter = SplitLength.find(intiter->first);
668 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
670 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
671 PropertyName = PropertyElement.GetNextToken();
672 PropertyValue = PropertyElement.GetNextToken();
674 intPrevValue = intiter->second;
676 CaptureString(&PropertyValue, FALSE);
678 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
680 if (PropertyMatched == TRUE){
682 PropertyMatched = FALSE;
689 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
693 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
695 std::map<int, int> SplitPoints;
696 std::map<int, int> SplitLength;
698 int intPrevValue = 8;
702 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
706 wxString PropertyName;
707 wxString PropertyValue;
708 wxString PropertyData;
709 wxString PropertyTokens;
710 std::map<int,int>::iterator SLiter;
711 bool FirstToken = TRUE;
712 bool PropertyMatched = FALSE;
714 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
715 intiter != SplitPoints.end(); ++intiter){
717 SLiter = SplitLength.find(intiter->first);
719 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
721 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
722 PropertyName = PropertyElement.GetNextToken();
723 PropertyValue = PropertyElement.GetNextToken();
725 intPrevValue = intiter->second;
727 CaptureString(&PropertyValue, FALSE);
729 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
730 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
731 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
732 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
734 if (PropertyMatched == TRUE){
736 PropertyMatched = FALSE;
741 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
745 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
747 if (!PropertyTokens.IsEmpty()){
749 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
756 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
758 std::map<int, int> SplitPoints;
759 std::map<int, int> SplitLength;
761 int intPrevValue = 4;
765 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
769 wxString PropertyName;
770 wxString PropertyValue;
771 wxString PropertyData;
772 wxString PropertyTokens;
773 std::map<int,int>::iterator SLiter;
774 bool FirstToken = TRUE;
775 bool PropertyMatched = FALSE;
777 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
778 intiter != SplitPoints.end(); ++intiter){
780 SLiter = SplitLength.find(intiter->first);
782 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
784 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
785 PropertyName = PropertyElement.GetNextToken();
786 PropertyValue = PropertyElement.GetNextToken();
788 intPrevValue = intiter->second;
790 CaptureString(&PropertyValue, FALSE);
792 if (PropertyName == wxT("TYPE")){
794 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
795 PropertyValue == wxT("work") ){
797 FullNamesListType.erase(*FNCount);
798 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
802 PropertyMatched = TRUE;
806 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
807 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
808 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
809 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
811 if (PropertyMatched == TRUE){
813 PropertyMatched = FALSE;
818 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
822 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
824 if (!PropertyTokens.IsEmpty()){
826 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
832 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
834 std::map<int, int> SplitPoints;
835 std::map<int, int> SplitLength;
837 int intPrevValue = 3;
841 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
845 wxString PropertyName;
846 wxString PropertyValue;
847 wxString PropertyData;
848 wxString PropertyTokens;
849 std::map<int,int>::iterator SLiter;
850 bool FirstToken = TRUE;
852 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
853 intiter != SplitPoints.end(); ++intiter){
855 SLiter = SplitLength.find(intiter->first);
857 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
859 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
860 PropertyName = PropertyElement.GetNextToken();
861 PropertyValue = PropertyElement.GetNextToken();
863 intPrevValue = intiter->second;
865 CaptureString(&PropertyValue, FALSE);
867 if (PropertyName == wxT("ALTID")){
869 NameAltID = PropertyValue;
871 } else if (PropertyName == wxT("LANGUAGE")){
873 NameLanguage = PropertyValue;
875 } else if (PropertyName == wxT("SORT-AS")){
877 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
878 PropertyValue.Len() >= 3){
879 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
882 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
884 if (FirstToken == TRUE){
886 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
891 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
899 // Split the name data.
901 int intSplitSeek = 0;
902 int intSplitsFound = 0;
903 int intSplitSize = 0;
904 int intPropertyLen = PropertySeg2.Len();
906 std::map<int,wxString> NameValues;
909 for (int i = 0; i <= intPropertyLen; i++){
911 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
913 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
918 if (intSplitsFound == 4){
920 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
934 // Split the data into several parts.
936 for (std::map<int, wxString>::iterator iter = NameValues.begin();
937 iter != NameValues.end(); ++iter){
939 if (iter->first == 1){
941 // Deal with family name.
943 NameSurname = iter->second;
945 } else if (iter->first == 2){
947 // Deal with given names.
949 NameForename = iter->second;
951 } else if (iter->first == 3){
953 // Deal with additional names.
955 NameOtherNames = iter->second;
957 } else if (iter->first == 4){
959 // Deal with honorifix prefixes and suffixes.
961 NameTitle = iter->second;
965 if (iter == NameValues.end()){
971 NameSuffix = iter->second;
977 // Add the name token data.
979 if (!PropertyTokens.IsEmpty()){
981 NameTokens = PropertyTokens;
987 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
989 size_t intPropertyLen = PropertySeg1.Len();
990 std::map<int, int> SplitPoints;
991 std::map<int, int> SplitLength;
992 std::map<int, int>::iterator SLiter;
993 wxString PropertyData;
994 wxString PropertyName;
995 wxString PropertyValue;
996 wxString PropertyTokens;
997 bool FirstToken = TRUE;
998 int intSplitsFound = 0;
999 int intSplitSize = 0;
1000 int intPrevValue = 14;
1004 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1008 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1009 intiter != SplitPoints.end(); ++intiter){
1011 SLiter = SplitLength.find(intiter->first);
1013 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1015 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1016 PropertyName = PropertyElement.GetNextToken();
1017 PropertyValue = PropertyElement.GetNextToken();
1019 intPrevValue = intiter->second;
1021 // Process properties.
1023 CaptureString(&PropertyValue, FALSE);
1025 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1027 if (FirstToken == TRUE){
1029 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1034 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1042 CaptureString(&PropertySeg2, FALSE);
1044 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
1046 if (!PropertyTokens.IsEmpty()){
1048 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
1054 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
1056 std::map<int, int> SplitPoints;
1057 std::map<int, int> SplitLength;
1059 int intPrevValue = 10;
1062 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1066 PropertyType PropType = PROPERTY_NONE;
1068 // Look for type before continuing.
1070 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1074 std::map<int, wxString> *NicknamesList = NULL;
1075 std::map<int, wxString> *NicknamesListType = NULL;
1076 std::map<int, wxString> *NicknamesListLanguage = NULL;
1077 std::map<int, wxString> *NicknamesListAltID = NULL;
1078 std::map<int, wxString> *NicknamesListPID = NULL;
1079 std::map<int, wxString> *NicknamesListTokens = NULL;
1080 std::map<int, int> *NicknamesListPref = NULL;
1084 NicknamesList = &GeneralNicknamesList;
1085 NicknamesListType = &GeneralNicknamesListType;
1086 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1087 NicknamesListAltID = &GeneralNicknamesListAltID;
1088 NicknamesListPID = &GeneralNicknamesListPID;
1089 NicknamesListTokens = &GeneralNicknamesListTokens;
1090 NicknamesListPref = &GeneralNicknamesListPref;
1093 NicknamesList = &HomeNicknamesList;
1094 NicknamesListType = &HomeNicknamesListType;
1095 NicknamesListLanguage = &HomeNicknamesListLanguage;
1096 NicknamesListAltID = &HomeNicknamesListAltID;
1097 NicknamesListPID = &HomeNicknamesListPID;
1098 NicknamesListTokens = &HomeNicknamesListTokens;
1099 NicknamesListPref = &HomeNicknamesListPref;
1102 NicknamesList = &BusinessNicknamesList;
1103 NicknamesListType = &BusinessNicknamesListType;
1104 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1105 NicknamesListAltID = &BusinessNicknamesListAltID;
1106 NicknamesListPID = &BusinessNicknamesListPID;
1107 NicknamesListTokens = &BusinessNicknamesListTokens;
1108 NicknamesListPref = &BusinessNicknamesListPref;
1112 std::map<int, int>::iterator SLiter;
1113 wxString PropertyData;
1114 wxString PropertyName;
1115 wxString PropertyValue;
1116 wxString PropertyTokens;
1117 bool FirstToken = TRUE;
1118 bool PropertyMatched = FALSE;
1120 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1121 intiter != SplitPoints.end(); ++intiter){
1123 SLiter = SplitLength.find(intiter->first);
1125 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1127 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1128 PropertyName = PropertyElement.GetNextToken();
1129 PropertyValue = PropertyElement.GetNextToken();
1131 intPrevValue = intiter->second;
1133 CaptureString(&PropertyValue, FALSE);
1135 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1136 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1137 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1138 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1140 if (PropertyMatched == TRUE){
1142 PropertyMatched = FALSE;
1147 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1149 if (FirstToken == TRUE){
1151 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1156 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1164 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1166 // Add the name token data.
1168 if (!PropertyTokens.IsEmpty()){
1170 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1176 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1178 std::map<int, int> SplitPoints;
1179 std::map<int, int> SplitLength;
1180 std::map<int, int>::iterator SLiter;
1181 wxString PropertyData;
1182 wxString PropertyName;
1183 wxString PropertyValue;
1184 wxString PropertyTokens;
1185 bool FirstToken = TRUE;
1186 int intPrevValue = 8;
1188 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1192 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1193 intiter != SplitPoints.end(); ++intiter){
1195 SLiter = SplitLength.find(intiter->first);
1197 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1199 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1200 PropertyName = PropertyElement.GetNextToken();
1201 PropertyValue = PropertyElement.GetNextToken();
1203 intPrevValue = intiter->second;
1205 // Process properties.
1207 size_t intPropertyValueLen = PropertyValue.Len();
1209 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1211 PropertyValue.Trim();
1212 PropertyValue.RemoveLast();
1216 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1218 PropertyValue.Remove(0, 1);
1222 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1224 if (FirstToken == TRUE){
1226 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1231 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1239 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1241 wxString GenderComponent;
1243 if (GenderData.CountTokens() >= 2){
1245 Gender = GenderData.GetNextToken();
1246 GenderDetails = GenderData.GetString();
1248 CaptureString(&GenderDetails, FALSE);
1252 Gender = GenderData.GetNextToken();
1256 if (!PropertyTokens.IsEmpty()){
1258 GenderTokens = PropertyTokens;
1264 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1266 // Process date. Preserve the remainder in the string.
1268 std::map<int, int> SplitPoints;
1269 std::map<int, int> SplitLength;
1270 std::map<int, int>::iterator SLiter;
1271 wxString PropertyData;
1272 wxString PropertyName;
1273 wxString PropertyValue;
1274 wxString PropertyTokens;
1275 bool BirthdayText = FALSE;
1276 int intPrevValue = 6;
1278 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1282 // Look for type before continuing.
1284 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1285 intiter != SplitPoints.end(); ++intiter){
1287 SLiter = SplitLength.find(intiter->first);
1289 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1291 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1292 PropertyName = PropertyElement.GetNextToken();
1293 PropertyValue = PropertyElement.GetNextToken();
1295 intPrevValue = intiter->second;
1297 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1299 CaptureString(&PropertySeg2, FALSE);
1300 Birthday = PropertySeg2;
1301 BirthdayText = TRUE;
1307 // Setup blank lines for later on.
1310 bool FirstToken = TRUE;
1312 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1313 intiter != SplitPoints.end(); ++intiter){
1315 SLiter = SplitLength.find(intiter->first);
1317 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1319 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1320 PropertyName = PropertyElement.GetNextToken();
1321 PropertyValue = PropertyElement.GetNextToken();
1323 intPrevValue = intiter->second;
1325 // Process properties.
1327 CaptureString(&PropertyValue, FALSE);
1329 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1331 PropertyValue.Trim();
1332 PropertyValue.RemoveLast();
1336 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1338 PropertyValue.Remove(0, 1);
1342 if (PropertyName == wxT("ALTID")){
1344 BirthdayAltID = PropertyValue;
1346 } else if (PropertyName == wxT("CALSCALE")){
1348 BirthdayCalScale = PropertyValue;
1350 } else if (PropertyName != wxT("VALUE")) {
1352 // Something else we don't know about so append
1353 // to the tokens variable.
1355 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1357 if (FirstToken == TRUE){
1359 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1364 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1374 // Add the data to the variables and form.
1376 if (BirthdayText == FALSE){
1378 Birthday = PropertySeg2;
1382 if (!PropertyTokens.IsEmpty()){
1384 BirthdayTokens = PropertyTokens;
1390 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1392 // Process date. Preserve the remainder in the string.
1394 std::map<int, int> SplitPoints;
1395 std::map<int, int> SplitLength;
1396 std::map<int, int>::iterator SLiter;
1397 wxString PropertyData;
1398 wxString PropertyName;
1399 wxString PropertyValue;
1400 wxString PropertyTokens;
1401 bool AnniversaryText = FALSE;
1402 int intPrevValue = 13;
1404 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1408 // Look for type before continuing.
1410 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1411 intiter != SplitPoints.end(); ++intiter){
1413 SLiter = SplitLength.find(intiter->first);
1415 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1417 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1418 PropertyName = PropertyElement.GetNextToken();
1419 PropertyValue = PropertyElement.GetNextToken();
1421 intPrevValue = intiter->second;
1423 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1425 CaptureString(&PropertySeg2, FALSE);
1426 Anniversary = PropertySeg2;
1427 AnniversaryText = TRUE;
1433 // Setup blank lines for later on.
1436 bool FirstToken = TRUE;
1438 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1439 intiter != SplitPoints.end(); ++intiter){
1441 SLiter = SplitLength.find(intiter->first);
1443 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1445 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1446 PropertyName = PropertyElement.GetNextToken();
1447 PropertyValue = PropertyElement.GetNextToken();
1449 intPrevValue = intiter->second;
1451 // Process properties.
1453 CaptureString(&PropertyValue, FALSE);
1455 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1457 PropertyValue.Trim();
1458 PropertyValue.RemoveLast();
1462 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1464 PropertyValue.Remove(0, 1);
1468 if (PropertyName == wxT("ALTID")){
1470 AnniversaryAltID = PropertyValue;
1472 } else if (PropertyName == wxT("CALSCALE")){
1474 AnniversaryCalScale = PropertyValue;
1476 } else if (PropertyName != wxT("VALUE")) {
1478 // Something else we don't know about so append
1479 // to the tokens variable.
1481 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1483 if (FirstToken == TRUE){
1485 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1490 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1500 // Add the data to the variables and form.
1502 if (AnniversaryText == FALSE){
1504 Anniversary = PropertySeg2;
1508 if (!PropertyTokens.IsEmpty()){
1510 AnniversaryTokens = PropertyTokens;
1516 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1518 std::map<int, int> SplitPoints;
1519 std::map<int, int> SplitLength;
1521 int intPrevValue = 4;
1524 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1528 PropertyType PropType = PROPERTY_NONE;
1530 // Look for type before continuing.
1532 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1536 std::map<int, wxString> *TZList = NULL;
1537 std::map<int, wxString> *TZListType = NULL;
1538 std::map<int, wxString> *TZListMediatype = NULL;
1539 std::map<int, wxString> *TZListAltID = NULL;
1540 std::map<int, wxString> *TZListPID = NULL;
1541 std::map<int, wxString> *TZListTokens = NULL;
1542 std::map<int, int> *TZListPref = NULL;
1546 TZList = &GeneralTZList;
1547 TZListType = &GeneralTZListType;
1548 TZListMediatype = &GeneralTZListMediatype;
1549 TZListAltID = &GeneralTZListAltID;
1550 TZListPID = &GeneralTZListPID;
1551 TZListTokens = &GeneralTZListTokens;
1552 TZListPref = &GeneralTZListPref;
1555 TZList = &HomeTZList;
1556 TZListType = &HomeTZListType;
1557 TZListMediatype = &HomeTZListMediatype;
1558 TZListAltID = &HomeTZListAltID;
1559 TZListPID = &HomeTZListPID;
1560 TZListTokens = &HomeTZListTokens;
1561 TZListPref = &HomeTZListPref;
1564 TZList = &BusinessTZList;
1565 TZListType = &BusinessTZListType;
1566 TZListMediatype = &BusinessTZListMediatype;
1567 TZListAltID = &BusinessTZListAltID;
1568 TZListPID = &BusinessTZListPID;
1569 TZListTokens = &BusinessTZListTokens;
1570 TZListPref = &BusinessTZListPref;
1574 std::map<int, int>::iterator SLiter;
1575 wxString PropertyData;
1576 wxString PropertyName;
1577 wxString PropertyValue;
1578 wxString PropertyTokens;
1579 bool FirstToken = TRUE;
1580 bool PropertyMatched = FALSE;
1582 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1583 intiter != SplitPoints.end(); ++intiter){
1585 SLiter = SplitLength.find(intiter->first);
1587 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1589 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1590 PropertyName = PropertyElement.GetNextToken();
1591 PropertyValue = PropertyElement.GetNextToken();
1593 intPrevValue = intiter->second;
1595 CaptureString(&PropertyValue, FALSE);
1597 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1598 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1599 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1600 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1602 if (PropertyMatched == TRUE){
1604 PropertyMatched = FALSE;
1609 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1611 if (FirstToken == TRUE){
1613 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1618 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1626 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1628 // Add the name token data.
1630 if (!PropertyTokens.IsEmpty()){
1632 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1639 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1641 size_t intPropertyLen = PropertySeg1.Len();
1642 std::map<int, int> SplitPoints;
1643 std::map<int, int> SplitLength;
1644 std::map<int, int>::iterator SLiter;
1645 wxString PropertyData;
1646 wxString PropertyName;
1647 wxString PropertyValue;
1648 wxString PropertyTokens;
1649 wxString AddressLabel;
1650 wxString AddressLang;
1651 wxString AddressAltID;
1652 wxString AddressPID;
1653 wxString AddressTokens;
1654 wxString AddressGeo;
1655 wxString AddressTimezone;
1656 wxString AddressType;
1657 wxString AddressMediatype;
1658 wxString AddressPOBox;
1659 wxString AddressExtended;
1660 wxString AddressStreet;
1661 wxString AddressLocality;
1662 wxString AddressCity;
1663 wxString AddressRegion;
1664 wxString AddressPostalCode;
1665 wxString AddressCountry;
1666 bool FirstToken = TRUE;
1667 int intSplitsFound = 0;
1668 int intSplitSize = 0;
1669 int intPrevValue = 5;
1673 bool PropertyMatched = FALSE;
1675 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1679 PropertyType PropType = PROPERTY_NONE;
1681 // Look for type before continuing.
1683 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1687 std::map<int, wxString> *AddressList = NULL;
1688 std::map<int, wxString> *AddressListTown = NULL;
1689 std::map<int, wxString> *AddressListCounty = NULL;
1690 std::map<int, wxString> *AddressListPostCode = NULL;
1691 std::map<int, wxString> *AddressListCountry = NULL;
1692 std::map<int, wxString> *AddressListLabel = NULL;
1693 std::map<int, wxString> *AddressListLang = NULL;
1694 std::map<int, wxString> *AddressListAltID = NULL;
1695 std::map<int, wxString> *AddressListPID = NULL;
1696 std::map<int, wxString> *AddressListTokens = NULL;
1697 std::map<int, wxString> *AddressListGeo = NULL;
1698 std::map<int, wxString> *AddressListTimezone = NULL;
1699 std::map<int, wxString> *AddressListType = NULL;
1700 std::map<int, wxString> *AddressListMediatype = NULL;
1701 std::map<int, int> *AddressListPref = NULL;
1705 AddressList = &GeneralAddressList;
1706 AddressListTown = &GeneralAddressListTown;
1707 AddressListCounty = &GeneralAddressListCounty;
1708 AddressListPostCode = &GeneralAddressListPostCode;
1709 AddressListCountry = &GeneralAddressListCountry;
1710 AddressListLabel = &GeneralAddressListLabel;
1711 AddressListLang = &GeneralAddressListLang;
1712 AddressListAltID = &GeneralAddressListAltID;
1713 AddressListPID = &GeneralAddressListPID;
1714 AddressListTokens = &GeneralAddressListTokens;
1715 AddressListGeo = &GeneralAddressListGeo;
1716 AddressListTimezone = &GeneralAddressListTimezone;
1717 AddressListType = &GeneralAddressListType;
1718 AddressListMediatype = &GeneralAddressListMediatype;
1719 AddressListPref = &GeneralAddressListPref;
1722 AddressList = &HomeAddressList;
1723 AddressListTown = &HomeAddressListTown;
1724 AddressListCounty = &HomeAddressListCounty;
1725 AddressListPostCode = &HomeAddressListPostCode;
1726 AddressListCountry = &HomeAddressListCountry;
1727 AddressListLabel = &HomeAddressListLabel;
1728 AddressListLang = &HomeAddressListLang;
1729 AddressListAltID = &HomeAddressListAltID;
1730 AddressListPID = &HomeAddressListPID;
1731 AddressListTokens = &HomeAddressListTokens;
1732 AddressListGeo = &HomeAddressListGeo;
1733 AddressListTimezone = &HomeAddressListTimezone;
1734 AddressListType = &HomeAddressListType;
1735 AddressListMediatype = &HomeAddressListMediatype;
1736 AddressListPref = &HomeAddressListPref;
1739 AddressList = &BusinessAddressList;
1740 AddressListTown = &BusinessAddressListTown;
1741 AddressListCounty = &BusinessAddressListCounty;
1742 AddressListPostCode = &BusinessAddressListPostCode;
1743 AddressListCountry = &BusinessAddressListCountry;
1744 AddressListLabel = &BusinessAddressListLabel;
1745 AddressListLang = &BusinessAddressListLang;
1746 AddressListAltID = &BusinessAddressListAltID;
1747 AddressListPID = &BusinessAddressListPID;
1748 AddressListTokens = &BusinessAddressListTokens;
1749 AddressListGeo = &BusinessAddressListGeo;
1750 AddressListTimezone = &BusinessAddressListTimezone;
1751 AddressListType = &BusinessAddressListType;
1752 AddressListMediatype = &BusinessAddressListMediatype;
1753 AddressListPref = &BusinessAddressListPref;
1759 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1760 intiter != SplitPoints.end(); ++intiter){
1762 SLiter = SplitLength.find(intiter->first);
1764 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1766 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1767 PropertyName = PropertyElement.GetNextToken();
1768 PropertyValue = PropertyElement.GetNextToken();
1770 intPrevValue = intiter->second;
1772 CaptureString(&PropertyValue, FALSE);
1774 // Process properties.
1776 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1777 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1778 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1779 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1780 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1781 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1782 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1783 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1785 if (PropertyMatched == TRUE){
1787 PropertyMatched = FALSE;
1792 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1794 if (FirstToken == TRUE){
1796 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1801 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1809 // Split the address.
1811 //std::map<int, int>::iterator SLiter;
1812 intPropertyLen = PropertySeg2.Len();
1813 SplitPoints.clear();
1814 SplitLength.clear();
1819 for (int i = 0; i <= intPropertyLen; i++){
1823 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1826 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1828 if (intSplitsFound == 6){
1830 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1835 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1845 // Split the data into several parts.
1847 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1848 intiter != SplitPoints.end(); ++intiter){
1850 if (intiter->first == 1){
1852 // Deal with PO Box.
1854 SLiter = SplitLength.find(1);
1856 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1857 intPrevValue = intiter->second;
1859 } else if (intiter->first == 2){
1861 // Deal with extended address.
1863 SLiter = SplitLength.find(2);
1865 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1866 intPrevValue = intiter->second;
1868 } else if (intiter->first == 3){
1870 // Deal with street address.
1872 SLiter = SplitLength.find(3);
1874 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1875 intPrevValue = intiter->second;
1877 } else if (intiter->first == 4){
1879 // Deal with locality
1881 SLiter = SplitLength.find(4);
1883 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1884 intPrevValue = intiter->second;
1886 } else if (intiter->first == 5){
1888 // Deal with region.
1890 SLiter = SplitLength.find(5);
1892 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1893 intPrevValue = intiter->second;
1896 } else if (intiter->first == 6){
1898 // Deal with post code.
1900 SLiter = SplitLength.find(6);
1902 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1903 intPrevValue = intiter->second;
1905 // Deal with country.
1907 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1915 // Add the data to the General/Home/Work address variables.
1917 CaptureString(&AddressStreet, FALSE);
1918 CaptureString(&AddressLocality, FALSE);
1919 CaptureString(&AddressRegion, FALSE);
1920 CaptureString(&AddressPostalCode, FALSE);
1921 CaptureString(&AddressCountry, FALSE);
1923 if (!PropertyTokens.IsEmpty()){
1925 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1929 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1930 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1931 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1932 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1933 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1937 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1940 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1943 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1947 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1951 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1953 std::map<int, int> SplitPoints;
1954 std::map<int, int> SplitLength;
1956 int intPrevValue = 7;
1959 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1963 PropertyType PropType = PROPERTY_NONE;
1965 // Look for type before continuing.
1967 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1969 std::map<int, wxString> *EmailList = NULL;
1970 std::map<int, wxString> *EmailListType = NULL;
1971 std::map<int, wxString> *EmailListAltID = NULL;
1972 std::map<int, wxString> *EmailListPID = NULL;
1973 std::map<int, wxString> *EmailListTokens = NULL;
1974 std::map<int, int> *EmailListPref = NULL;
1978 EmailList = &GeneralEmailList;
1979 EmailListType = &GeneralEmailListType;
1980 EmailListAltID = &GeneralEmailListAltID;
1981 EmailListPID = &GeneralEmailListPID;
1982 EmailListTokens = &GeneralEmailListTokens;
1983 EmailListPref = &GeneralEmailListPref;
1986 EmailList = &HomeEmailList;
1987 EmailListType = &HomeEmailListType;
1988 EmailListAltID = &HomeEmailListAltID;
1989 EmailListPID = &HomeEmailListPID;
1990 EmailListTokens = &HomeEmailListTokens;
1991 EmailListPref = &HomeEmailListPref;
1994 EmailList = &BusinessEmailList;
1995 EmailListType = &BusinessEmailListType;
1996 EmailListAltID = &BusinessEmailListAltID;
1997 EmailListPID = &BusinessEmailListPID;
1998 EmailListTokens = &BusinessEmailListTokens;
1999 EmailListPref = &BusinessEmailListPref;
2005 std::map<int,int>::iterator SLiter;
2006 wxString PropertyData;
2007 wxString PropertyName;
2008 wxString PropertyValue;
2009 wxString PropertyTokens;
2010 bool FirstToken = TRUE;
2011 bool PropertyMatched = FALSE;
2013 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2014 intiter != SplitPoints.end(); ++intiter){
2016 SLiter = SplitLength.find(intiter->first);
2018 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2020 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2021 PropertyName = PropertyElement.GetNextToken();
2022 PropertyValue = PropertyElement.GetNextToken();
2024 intPrevValue = intiter->second;
2026 CaptureString(&PropertyValue, FALSE);
2028 // Process properties.
2030 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
2031 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
2032 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
2034 if (PropertyMatched == TRUE){
2036 PropertyMatched = FALSE;
2041 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2043 if (FirstToken == TRUE){
2045 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2050 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2058 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
2060 // Add the name token data.
2062 if (!PropertyTokens.IsEmpty()){
2064 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
2071 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
2073 std::map<int, int> SplitPoints;
2074 std::map<int, int> SplitLength;
2076 int intPrevValue = 6;
2079 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2083 PropertyType PropType = PROPERTY_NONE;
2085 // Look for type before continuing.
2087 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2089 std::map<int, wxString> *IMList = NULL;
2090 std::map<int, wxString> *IMListType = NULL;
2091 std::map<int, wxString> *IMListAltID = NULL;
2092 std::map<int, wxString> *IMListPID = NULL;
2093 std::map<int, wxString> *IMListTokens = NULL;
2094 std::map<int, wxString> *IMListMediatype = NULL;
2095 std::map<int, int> *IMListPref = NULL;
2099 IMList = &GeneralIMList;
2100 IMListType = &GeneralIMListType;
2101 IMListAltID = &GeneralIMListAltID;
2102 IMListPID = &GeneralIMListPID;
2103 IMListTokens = &GeneralIMListTokens;
2104 IMListMediatype = &GeneralIMListMediatype;
2105 IMListPref = &GeneralIMListPref;
2108 IMList = &HomeIMList;
2109 IMListType = &HomeIMListType;
2110 IMListAltID = &HomeIMListAltID;
2111 IMListPID = &HomeIMListPID;
2112 IMListTokens = &HomeIMListTokens;
2113 IMListMediatype = &HomeIMListMediatype;
2114 IMListPref = &HomeIMListPref;
2117 IMList = &BusinessIMList;
2118 IMListType = &BusinessIMListType;
2119 IMListAltID = &BusinessIMListAltID;
2120 IMListPID = &BusinessIMListPID;
2121 IMListTokens = &BusinessIMListTokens;
2122 IMListMediatype = &BusinessIMListMediatype;
2123 IMListPref = &BusinessIMListPref;
2129 std::map<int,int>::iterator SLiter;
2130 wxString PropertyData;
2131 wxString PropertyName;
2132 wxString PropertyValue;
2133 wxString PropertyTokens;
2134 bool FirstToken = TRUE;
2135 bool PropertyMatched = FALSE;
2137 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2138 intiter != SplitPoints.end(); ++intiter){
2140 SLiter = SplitLength.find(intiter->first);
2142 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2144 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2145 PropertyName = PropertyElement.GetNextToken();
2146 PropertyValue = PropertyElement.GetNextToken();
2148 intPrevValue = intiter->second;
2150 CaptureString(&PropertyValue, FALSE);
2152 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
2153 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
2154 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
2155 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
2157 // Process properties.
2159 if (PropertyMatched == TRUE){
2161 PropertyMatched = FALSE;
2166 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2168 if (FirstToken == TRUE){
2170 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2175 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2183 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2185 // Add the name token data.
2187 if (!PropertyTokens.IsEmpty()){
2189 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2195 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2197 std::map<int, int> SplitPoints;
2198 std::map<int, int> SplitLength;
2199 std::map<int, int>::iterator SLiter;
2203 PropertyType PropType = PROPERTY_NONE;
2205 // Look for type before continuing.
2208 wxString TelTypeDetail;
2209 wxString PropertyData;
2210 wxString PropertyName;
2211 wxString PropertyValue;
2212 wxString PropertyTokens;
2214 std::map<int,int> TypeSplitPoints;
2215 std::map<int,int> TypeSplitLength;
2216 std::map<int,int>::iterator TSLiter;
2218 int intSplitSize = 0;
2219 int intSplitsFound = 0;
2220 int intSplitPoint = 0;
2222 int intPrevValue = 5;
2224 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2228 // Look for type before continuing.
2230 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2231 intiter != SplitPoints.end(); ++intiter){
2233 SLiter = SplitLength.find(intiter->first);
2235 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2237 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2238 PropertyName = PropertyElement.GetNextToken();
2239 PropertyValue = PropertyElement.GetNextToken();
2241 intPrevValue = intiter->second;
2243 if (PropertyName == wxT("TYPE")){
2245 // Process each value in type and translate each
2248 // Strip out the quotes if they are there.
2250 size_t intPropertyValueLen = PropertyValue.Len();
2252 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2254 PropertyValue.Trim();
2255 PropertyValue.RemoveLast();
2259 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2261 PropertyValue.Remove(0, 1);
2265 TelTypeDetail = PropertyValue;
2271 for (int i = 0; i <= intPropertyValueLen; i++){
2275 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2277 if (intSplitsFound == 0){
2279 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2280 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2284 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2285 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2298 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2299 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2301 int intTypeSeek = 0;
2303 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2304 typeiter != TypeSplitPoints.end(); ++typeiter){
2306 wxString TypePropertyName;
2308 TSLiter = TypeSplitLength.find(typeiter->first);
2310 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2312 if (intTypeSeek == 0){
2317 TelTypeUI.Append(wxT(","));
2321 if (TypePropertyName == wxT("home")){
2323 PropType = PROPERTY_HOME;
2325 } else if (TypePropertyName == wxT("work")){
2327 PropType = PROPERTY_WORK;
2332 if (TypePropertyName == wxT("text")){
2334 TelTypeUI.Append(_("text"));
2337 } else if (TypePropertyName == wxT("voice")){
2339 TelTypeUI.Append(_("voice"));
2342 } else if (TypePropertyName == wxT("fax")){
2344 TelTypeUI.Append(_("fax"));
2347 } else if (TypePropertyName == wxT("cell")){
2349 TelTypeUI.Append(_("mobile"));
2352 } else if (TypePropertyName == wxT("video")){
2354 TelTypeUI.Append(_("video"));
2357 } else if (TypePropertyName == wxT("pager")){
2359 TelTypeUI.Append(_("pager"));
2362 } else if (TypePropertyName == wxT("textphone")){
2364 TelTypeUI.Append(_("textphone"));
2375 std::map<int, wxString> *TelephoneList = NULL;
2376 std::map<int, wxString> *TelephoneListType = NULL;
2377 std::map<int, wxString> *TelephoneListAltID = NULL;
2378 std::map<int, wxString> *TelephoneListPID = NULL;
2379 std::map<int, wxString> *TelephoneListTokens = NULL;
2380 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2381 std::map<int, int> *TelephoneListPref = NULL;
2385 TelephoneList = &GeneralTelephoneList;
2386 TelephoneListType = &GeneralTelephoneListType;
2387 TelephoneListAltID = &GeneralTelephoneListAltID;
2388 TelephoneListPID = &GeneralTelephoneListPID;
2389 TelephoneListTokens = &GeneralTelephoneListTokens;
2390 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2391 TelephoneListPref = &GeneralTelephoneListPref;
2394 TelephoneList = &HomeTelephoneList;
2395 TelephoneListType = &HomeTelephoneListType;
2396 TelephoneListAltID = &HomeTelephoneListAltID;
2397 TelephoneListPID = &HomeTelephoneListPID;
2398 TelephoneListTokens = &HomeTelephoneListTokens;
2399 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2400 TelephoneListPref = &HomeTelephoneListPref;
2403 TelephoneList = &BusinessTelephoneList;
2404 TelephoneListType = &BusinessTelephoneListType;
2405 TelephoneListAltID = &BusinessTelephoneListAltID;
2406 TelephoneListPID = &BusinessTelephoneListPID;
2407 TelephoneListTokens = &BusinessTelephoneListTokens;
2408 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2409 TelephoneListPref = &BusinessTelephoneListPref;
2413 // Process the properties.
2415 bool FirstToken = TRUE;
2418 SplitPoints.clear();
2419 SplitLength.clear();
2421 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2425 bool PropertyMatched = FALSE;
2427 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2428 intiter != SplitPoints.end(); ++intiter){
2430 SLiter = SplitLength.find(intiter->first);
2432 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2434 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2435 PropertyName = PropertyElement.GetNextToken();
2436 PropertyValue = PropertyElement.GetNextToken();
2438 intPrevValue = intiter->second;
2440 CaptureString(&PropertyValue, FALSE);
2442 // Process properties.
2444 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2445 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2446 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2448 if (PropertyMatched == TRUE){
2450 PropertyMatched = FALSE;
2455 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2457 if (FirstToken == TRUE){
2459 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2464 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2472 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2473 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2475 // Add the name token data.
2477 if (!PropertyTokens.IsEmpty()){
2479 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2485 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2487 std::map<int, int> SplitPoints;
2488 std::map<int, int> SplitLength;
2490 int intPrevValue = 6;
2493 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2497 PropertyType PropType = PROPERTY_NONE;
2499 // Look for type before continuing.
2501 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2503 std::map<int, wxString> *LanguageList = NULL;
2504 std::map<int, wxString> *LanguageListType = NULL;
2505 std::map<int, wxString> *LanguageListAltID = NULL;
2506 std::map<int, wxString> *LanguageListPID = NULL;
2507 std::map<int, wxString> *LanguageListTokens = NULL;
2508 std::map<int, int> *LanguageListPref = NULL;
2512 LanguageList = &GeneralLanguageList;
2513 LanguageListType = &GeneralLanguageListType;
2514 LanguageListAltID = &GeneralLanguageListAltID;
2515 LanguageListPID = &GeneralLanguageListPID;
2516 LanguageListTokens = &GeneralLanguageListTokens;
2517 LanguageListPref = &GeneralLanguageListPref;
2520 LanguageList = &HomeLanguageList;
2521 LanguageListType = &HomeLanguageListType;
2522 LanguageListAltID = &HomeLanguageListAltID;
2523 LanguageListPID = &HomeLanguageListPID;
2524 LanguageListTokens = &HomeLanguageListTokens;
2525 LanguageListPref = &HomeLanguageListPref;
2528 LanguageList = &BusinessLanguageList;
2529 LanguageListType = &BusinessLanguageListType;
2530 LanguageListAltID = &BusinessLanguageListAltID;
2531 LanguageListPID = &BusinessLanguageListPID;
2532 LanguageListTokens = &BusinessLanguageListTokens;
2533 LanguageListPref = &BusinessLanguageListPref;
2539 std::map<int,int>::iterator SLiter;
2540 wxString PropertyData;
2541 wxString PropertyName;
2542 wxString PropertyValue;
2543 wxString PropertyTokens;
2544 bool FirstToken = TRUE;
2545 bool PropertyMatched = FALSE;
2547 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2548 intiter != SplitPoints.end(); ++intiter){
2550 SLiter = SplitLength.find(intiter->first);
2552 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2554 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2555 PropertyName = PropertyElement.GetNextToken();
2556 PropertyValue = PropertyElement.GetNextToken();
2558 intPrevValue = intiter->second;
2560 CaptureString(&PropertyValue, FALSE);
2562 // Process properties.
2564 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2565 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2566 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2568 if (PropertyMatched == TRUE){
2570 PropertyMatched = FALSE;
2575 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2577 if (FirstToken == TRUE){
2579 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2584 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2592 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2594 // Add the name token data.
2596 if (!PropertyTokens.IsEmpty()){
2598 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2604 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2606 std::map<int, int> SplitPoints;
2607 std::map<int, int> SplitLength;
2609 int intPrevValue = 5;
2612 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2616 PropertyType PropType = PROPERTY_NONE;
2618 // Look for type before continuing.
2620 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2622 std::map<int, wxString> *GeopositionList = NULL;
2623 std::map<int, wxString> *GeopositionListType = NULL;
2624 std::map<int, wxString> *GeopositionListAltID = NULL;
2625 std::map<int, wxString> *GeopositionListPID = NULL;
2626 std::map<int, wxString> *GeopositionListTokens = NULL;
2627 std::map<int, wxString> *GeopositionListMediatype = NULL;
2628 std::map<int, int> *GeopositionListPref = NULL;
2632 GeopositionList = &GeneralGeographyList;
2633 GeopositionListType = &GeneralGeographyListType;
2634 GeopositionListAltID = &GeneralGeographyListAltID;
2635 GeopositionListPID = &GeneralGeographyListPID;
2636 GeopositionListTokens = &GeneralGeographyListTokens;
2637 GeopositionListMediatype = &GeneralGeographyListMediatype;
2638 GeopositionListPref = &GeneralGeographyListPref;
2641 GeopositionList = &HomeGeographyList;
2642 GeopositionListType = &HomeGeographyListType;
2643 GeopositionListAltID = &HomeGeographyListAltID;
2644 GeopositionListPID = &HomeGeographyListPID;
2645 GeopositionListTokens = &HomeGeographyListTokens;
2646 GeopositionListMediatype = &HomeGeographyListMediatype;
2647 GeopositionListPref = &HomeGeographyListPref;
2650 GeopositionList = &BusinessGeographyList;
2651 GeopositionListType = &BusinessGeographyListType;
2652 GeopositionListAltID = &BusinessGeographyListAltID;
2653 GeopositionListPID = &BusinessGeographyListPID;
2654 GeopositionListTokens = &BusinessGeographyListTokens;
2655 GeopositionListMediatype = &BusinessGeographyListMediatype;
2656 GeopositionListPref = &BusinessGeographyListPref;
2662 std::map<int,int>::iterator SLiter;
2663 wxString PropertyData;
2664 wxString PropertyName;
2665 wxString PropertyValue;
2666 wxString PropertyTokens;
2667 bool FirstToken = TRUE;
2668 bool PropertyMatched = FALSE;
2670 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2671 intiter != SplitPoints.end(); ++intiter){
2673 SLiter = SplitLength.find(intiter->first);
2675 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2677 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2678 PropertyName = PropertyElement.GetNextToken();
2679 PropertyValue = PropertyElement.GetNextToken();
2681 intPrevValue = intiter->second;
2683 CaptureString(&PropertyValue, FALSE);
2685 // Process properties.
2687 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2688 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2689 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2690 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2692 if (PropertyMatched == TRUE){
2694 PropertyMatched = FALSE;
2699 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2701 if (FirstToken == TRUE){
2703 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2708 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2716 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2718 // Add the name token data.
2720 if (!PropertyTokens.IsEmpty()){
2722 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2728 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2730 size_t intPropertyLen = PropertySeg1.Len();
2731 std::map<int, int> SplitPoints;
2732 std::map<int, int> SplitLength;
2733 std::map<int, int>::iterator SLiter;
2734 wxString PropertyData;
2735 wxString PropertyName;
2736 wxString PropertyValue;
2737 wxString PropertyTokens;
2738 wxString RelatedType;
2739 wxString RelatedTypeOriginal;
2740 wxString RelatedName;
2741 bool FirstToken = TRUE;
2742 int intSplitsFound = 0;
2743 int intSplitSize = 0;
2744 int intPrevValue = 9;
2748 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2752 // Look for type before continuing.
2754 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2755 intiter != SplitPoints.end(); ++intiter){
2757 SLiter = SplitLength.find(intiter->first);
2759 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2761 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2762 PropertyName = PropertyElement.GetNextToken();
2763 PropertyValue = PropertyElement.GetNextToken();
2765 intPrevValue = intiter->second;
2769 RelatedTypeOriginal = PropertyValue;
2771 if (PropertyName == wxT("TYPE")){
2773 if (PropertyValue == wxT("contact")){
2775 RelatedType = _("Contact");
2777 } else if (PropertyValue == wxT("acquaintance")){
2779 RelatedType = _("Acquaintance");
2781 } else if (PropertyValue == wxT("friend")){
2783 RelatedType = _("Friend");
2785 } else if (PropertyValue == wxT("met")){
2787 RelatedType = _("Met");
2789 } else if (PropertyValue == wxT("co-worker")){
2791 RelatedType = _("Co-worker");
2793 } else if (PropertyValue == wxT("colleague")){
2795 RelatedType = _("Colleague");
2797 } else if (PropertyValue == wxT("co-resident")){
2799 RelatedType = _("Co-resident");
2801 } else if (PropertyValue == wxT("neighbor")){
2803 RelatedType = _("Neighbour");
2805 } else if (PropertyValue == wxT("child")){
2807 RelatedType = _("Child");
2809 } else if (PropertyValue == wxT("parent")){
2811 RelatedType = _("Parent");
2813 } else if (PropertyValue == wxT("sibling")){
2815 RelatedType = _("Sibling");
2817 } else if (PropertyValue == wxT("spouse")){
2819 RelatedType = _("Spouse");
2821 } else if (PropertyValue == wxT("kin")){
2823 RelatedType = _("Kin");
2825 } else if (PropertyValue == wxT("muse")){
2827 RelatedType = _("Muse");
2829 } else if (PropertyValue == wxT("crush")){
2831 RelatedType = _("Crush");
2833 } else if (PropertyValue == wxT("date")){
2835 RelatedType = _("Date");
2837 } else if (PropertyValue == wxT("sweetheart")){
2839 RelatedType = _("Sweetheart");
2841 } else if (PropertyValue == wxT("me")){
2843 RelatedType = _("Me");
2845 } else if (PropertyValue == wxT("agent")){
2847 RelatedType = _("Agent");
2849 } else if (PropertyValue == wxT("emergency")){
2851 RelatedType = _("Emergency");
2855 RelatedType = PropertyValue;
2865 bool PropertyMatched = FALSE;
2867 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2868 intiter != SplitPoints.end(); ++intiter){
2870 SLiter = SplitLength.find(intiter->first);
2872 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2874 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2875 PropertyName = PropertyElement.GetNextToken();
2876 PropertyValue = PropertyElement.GetNextToken();
2878 intPrevValue = intiter->second;
2880 // Process properties.
2882 size_t intPropertyValueLen = PropertyValue.Len();
2884 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2886 PropertyValue.Trim();
2887 PropertyValue.RemoveLast();
2891 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2893 PropertyValue.Remove(0, 1);
2897 CaptureString(&PropertyValue, FALSE);
2899 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2900 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2901 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2902 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2904 if (PropertyMatched == TRUE){
2906 PropertyMatched = FALSE;
2911 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2913 if (FirstToken == TRUE){
2915 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2920 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2928 // Add the data to the General/Home/Work address variables.
2930 GeneralRelatedList.erase(*RelatedCount);
2931 GeneralRelatedListRelType.erase(*RelatedCount);
2932 GeneralRelatedListType.erase(*RelatedCount);
2933 GeneralRelatedListTokens.erase(*RelatedCount);
2934 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2935 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2936 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2937 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2941 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2943 std::map<int, int> SplitPoints;
2944 std::map<int, int> SplitLength;
2945 std::map<int, int>::iterator SLiter;
2946 wxString PropertyData;
2947 wxString PropertyName;
2948 wxString PropertyValue;
2949 wxString PropertyTokens;
2950 bool FirstToken = TRUE;
2951 int intPrevValue = 5;
2956 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2960 PropertyType PropType = PROPERTY_NONE;
2962 // Look for type before continuing.
2964 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2966 // Setup the pointers.
2968 std::map<int, wxString> *WebsiteList = NULL;
2969 std::map<int, wxString> *WebsiteListAltID = NULL;
2970 std::map<int, wxString> *WebsiteListPID = NULL;
2971 std::map<int, wxString> *WebsiteListType = NULL;
2972 std::map<int, wxString> *WebsiteListTokens = NULL;
2973 std::map<int, wxString> *WebsiteListMediatype = NULL;
2974 std::map<int, int> *WebsiteListPref = NULL;
2976 // Setup blank lines for later on.
2980 WebsiteList = &GeneralWebsiteList;
2981 WebsiteListType = &GeneralWebsiteListType;
2982 WebsiteListAltID = &GeneralWebsiteListAltID;
2983 WebsiteListPID = &GeneralWebsiteListPID;
2984 WebsiteListTokens = &GeneralWebsiteListTokens;
2985 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2986 WebsiteListPref = &GeneralWebsiteListPref;
2989 WebsiteList = &HomeWebsiteList;
2990 WebsiteListType = &HomeWebsiteListType;
2991 WebsiteListAltID = &HomeWebsiteListAltID;
2992 WebsiteListPID = &HomeWebsiteListPID;
2993 WebsiteListTokens = &HomeWebsiteListTokens;
2994 WebsiteListMediatype = &HomeWebsiteListMediatype;
2995 WebsiteListPref = &HomeWebsiteListPref;
2998 WebsiteList = &BusinessWebsiteList;
2999 WebsiteListType = &BusinessWebsiteListType;
3000 WebsiteListAltID = &BusinessWebsiteListAltID;
3001 WebsiteListPID = &BusinessWebsiteListPID;
3002 WebsiteListTokens = &BusinessWebsiteListTokens;
3003 WebsiteListMediatype = &BusinessWebsiteListMediatype;
3004 WebsiteListPref = &BusinessWebsiteListPref;
3009 bool PropertyMatched = FALSE;
3011 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3012 intiter != SplitPoints.end(); ++intiter){
3014 SLiter = SplitLength.find(intiter->first);
3016 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3018 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3019 PropertyName = PropertyElement.GetNextToken();
3020 PropertyValue = PropertyElement.GetNextToken();
3022 intPrevValue = intiter->second;
3024 // Process properties.
3026 size_t intPropertyValueLen = PropertyValue.Len();
3028 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3030 PropertyValue.Trim();
3031 PropertyValue.RemoveLast();
3035 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3037 PropertyValue.Remove(0, 1);
3041 CaptureString(&PropertyValue, FALSE);
3043 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
3044 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
3045 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
3046 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
3048 if (PropertyMatched == TRUE){
3050 PropertyMatched = FALSE;
3055 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3057 if (FirstToken == TRUE){
3059 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3064 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3072 // Add the data to the General/Home/Work address variables.
3074 CaptureString(&PropertySeg2, FALSE);
3076 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3078 if (!PropertyTokens.IsEmpty()){
3080 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3086 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3088 std::map<int, int> SplitPoints;
3089 std::map<int, int> SplitLength;
3090 std::map<int, int>::iterator SLiter;
3091 wxString PropertyData;
3092 wxString PropertyName;
3093 wxString PropertyValue;
3094 wxString PropertyTokens;
3095 bool FirstToken = TRUE;
3096 int intPrevValue = 7;
3101 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3105 PropertyType PropType = PROPERTY_NONE;
3107 // Look for type before continuing.
3109 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3111 // Setup the pointers.
3113 std::map<int, wxString> *TitleList = NULL;
3114 std::map<int, wxString> *TitleListAltID = NULL;
3115 std::map<int, wxString> *TitleListPID = NULL;
3116 std::map<int, wxString> *TitleListType = NULL;
3117 std::map<int, wxString> *TitleListTokens = NULL;
3118 std::map<int, wxString> *TitleListLanguage = NULL;
3119 std::map<int, int> *TitleListPref = NULL;
3121 // Setup blank lines for later on.
3125 TitleList = &GeneralTitleList;
3126 TitleListType = &GeneralTitleListType;
3127 TitleListAltID = &GeneralTitleListAltID;
3128 TitleListPID = &GeneralTitleListPID;
3129 TitleListTokens = &GeneralTitleListTokens;
3130 TitleListLanguage = &GeneralTitleListLanguage;
3131 TitleListPref = &GeneralTitleListPref;
3134 TitleList = &HomeTitleList;
3135 TitleListType = &HomeTitleListType;
3136 TitleListAltID = &HomeTitleListAltID;
3137 TitleListPID = &HomeTitleListPID;
3138 TitleListTokens = &HomeTitleListTokens;
3139 TitleListLanguage = &HomeTitleListLanguage;
3140 TitleListPref = &HomeTitleListPref;
3143 TitleList = &BusinessTitleList;
3144 TitleListType = &BusinessTitleListType;
3145 TitleListAltID = &BusinessTitleListAltID;
3146 TitleListPID = &BusinessTitleListPID;
3147 TitleListTokens = &BusinessTitleListTokens;
3148 TitleListLanguage = &BusinessTitleListLanguage;
3149 TitleListPref = &BusinessTitleListPref;
3154 bool PropertyMatched = FALSE;
3156 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3157 intiter != SplitPoints.end(); ++intiter){
3159 SLiter = SplitLength.find(intiter->first);
3161 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3163 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3164 PropertyName = PropertyElement.GetNextToken();
3165 PropertyValue = PropertyElement.GetNextToken();
3167 intPrevValue = intiter->second;
3169 // Process properties.
3171 size_t intPropertyValueLen = PropertyValue.Len();
3173 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3175 PropertyValue.Trim();
3176 PropertyValue.RemoveLast();
3180 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3182 PropertyValue.Remove(0, 1);
3186 CaptureString(&PropertyValue, FALSE);
3188 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
3189 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
3190 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
3191 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
3193 if (PropertyMatched == TRUE){
3195 PropertyMatched = FALSE;
3200 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3202 if (FirstToken == TRUE){
3204 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3209 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3217 // Add the data to the General/Home/Work address variables.
3219 CaptureString(&PropertySeg2, FALSE);
3221 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3223 if (!PropertyTokens.IsEmpty()){
3225 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3231 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3233 std::map<int, int> SplitPoints;
3234 std::map<int, int> SplitLength;
3235 std::map<int, int>::iterator SLiter;
3236 wxString PropertyData;
3237 wxString PropertyName;
3238 wxString PropertyValue;
3239 wxString PropertyTokens;
3240 bool FirstToken = TRUE;
3241 int intPrevValue = 6;
3246 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3250 PropertyType PropType = PROPERTY_NONE;
3252 // Look for type before continuing.
3254 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3256 // Setup the pointers.
3258 std::map<int, wxString> *RoleList = NULL;
3259 std::map<int, wxString> *RoleListAltID = NULL;
3260 std::map<int, wxString> *RoleListPID = NULL;
3261 std::map<int, wxString> *RoleListType = NULL;
3262 std::map<int, wxString> *RoleListTokens = NULL;
3263 std::map<int, wxString> *RoleListLanguage = NULL;
3264 std::map<int, int> *RoleListPref = NULL;
3266 // Setup blank lines for later on.
3270 RoleList = &GeneralRoleList;
3271 RoleListType = &GeneralRoleListType;
3272 RoleListAltID = &GeneralRoleListAltID;
3273 RoleListPID = &GeneralRoleListPID;
3274 RoleListTokens = &GeneralRoleListTokens;
3275 RoleListLanguage = &GeneralRoleListLanguage;
3276 RoleListPref = &GeneralRoleListPref;
3279 RoleList = &HomeRoleList;
3280 RoleListType = &HomeRoleListType;
3281 RoleListAltID = &HomeRoleListAltID;
3282 RoleListPID = &HomeRoleListPID;
3283 RoleListTokens = &HomeRoleListTokens;
3284 RoleListLanguage = &HomeRoleListLanguage;
3285 RoleListPref = &HomeRoleListPref;
3288 RoleList = &BusinessRoleList;
3289 RoleListType = &BusinessRoleListType;
3290 RoleListAltID = &BusinessRoleListAltID;
3291 RoleListPID = &BusinessRoleListPID;
3292 RoleListTokens = &BusinessRoleListTokens;
3293 RoleListLanguage = &BusinessRoleListLanguage;
3294 RoleListPref = &BusinessRoleListPref;
3299 bool PropertyMatched = FALSE;
3301 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3302 intiter != SplitPoints.end(); ++intiter){
3304 SLiter = SplitLength.find(intiter->first);
3306 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3308 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3309 PropertyName = PropertyElement.GetNextToken();
3310 PropertyValue = PropertyElement.GetNextToken();
3312 intPrevValue = intiter->second;
3314 // Process properties.
3316 size_t intPropertyValueLen = PropertyValue.Len();
3318 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3320 PropertyValue.Trim();
3321 PropertyValue.RemoveLast();
3325 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3327 PropertyValue.Remove(0, 1);
3331 CaptureString(&PropertyValue, FALSE);
3333 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3334 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3335 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3336 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3338 if (PropertyMatched == TRUE){
3340 PropertyMatched = FALSE;
3345 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3347 if (FirstToken == TRUE){
3349 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3354 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3362 // Add the data to the General/Home/Work address variables.
3364 CaptureString(&PropertySeg2, FALSE);
3366 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3368 if (!PropertyTokens.IsEmpty()){
3370 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3376 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3378 std::map<int, int> SplitPoints;
3379 std::map<int, int> SplitLength;
3380 std::map<int, int>::iterator SLiter;
3381 wxString PropertyData;
3382 wxString PropertyName;
3383 wxString PropertyValue;
3384 wxString PropertyTokens;
3385 bool FirstToken = TRUE;
3386 int intPrevValue = 5;
3391 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3395 PropertyType PropType = PROPERTY_NONE;
3397 // Look for type before continuing.
3399 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3401 // Setup the pointers.
3403 std::map<int, wxString> *OrganisationsList = NULL;
3404 std::map<int, wxString> *OrganisationsListAltID = NULL;
3405 std::map<int, wxString> *OrganisationsListPID = NULL;
3406 std::map<int, wxString> *OrganisationsListType = NULL;
3407 std::map<int, wxString> *OrganisationsListTokens = NULL;
3408 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3409 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3410 std::map<int, int> *OrganisationsListPref = NULL;
3412 // Setup blank lines for later on.
3416 OrganisationsList = &GeneralOrganisationsList;
3417 OrganisationsListType = &GeneralOrganisationsListType;
3418 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3419 OrganisationsListPID = &GeneralOrganisationsListPID;
3420 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3421 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3422 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3423 OrganisationsListPref = &GeneralOrganisationsListPref;
3426 OrganisationsList = &HomeOrganisationsList;
3427 OrganisationsListType = &HomeOrganisationsListType;
3428 OrganisationsListAltID = &HomeOrganisationsListAltID;
3429 OrganisationsListPID = &HomeOrganisationsListPID;
3430 OrganisationsListTokens = &HomeOrganisationsListTokens;
3431 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3432 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3433 OrganisationsListPref = &HomeOrganisationsListPref;
3436 OrganisationsList = &BusinessOrganisationsList;
3437 OrganisationsListType = &BusinessOrganisationsListType;
3438 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3439 OrganisationsListPID = &BusinessOrganisationsListPID;
3440 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3441 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3442 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3443 OrganisationsListPref = &BusinessOrganisationsListPref;
3448 bool PropertyMatched = FALSE;
3450 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3451 intiter != SplitPoints.end(); ++intiter){
3453 SLiter = SplitLength.find(intiter->first);
3455 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3457 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3458 PropertyName = PropertyElement.GetNextToken();
3459 PropertyValue = PropertyElement.GetNextToken();
3461 intPrevValue = intiter->second;
3463 // Process properties.
3465 size_t intPropertyValueLen = PropertyValue.Len();
3467 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3469 PropertyValue.Trim();
3470 PropertyValue.RemoveLast();
3474 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3476 PropertyValue.Remove(0, 1);
3480 CaptureString(&PropertyValue, FALSE);
3482 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3483 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3484 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3485 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3486 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3488 if (PropertyMatched == TRUE){
3490 PropertyMatched = FALSE;
3495 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3497 if (FirstToken == TRUE){
3499 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3504 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3512 // Add the data to the General/Home/Work address variables.
3514 CaptureString(&PropertySeg2, FALSE);
3516 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3518 if (!PropertyTokens.IsEmpty()){
3520 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3526 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3528 std::map<int, int> SplitPoints;
3529 std::map<int, int> SplitLength;
3530 std::map<int, int>::iterator SLiter;
3531 wxString PropertyData;
3532 wxString PropertyName;
3533 wxString PropertyValue;
3534 wxString PropertyTokens;
3535 bool FirstToken = TRUE;
3536 int intPrevValue = 6;
3541 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3545 PropertyType PropType = PROPERTY_NONE;
3547 // Look for type before continuing.
3549 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3551 // Setup the pointers.
3553 std::map<int, wxString> *NoteList = NULL;
3554 std::map<int, wxString> *NoteListAltID = NULL;
3555 std::map<int, wxString> *NoteListPID = NULL;
3556 std::map<int, wxString> *NoteListType = NULL;
3557 std::map<int, wxString> *NoteListTokens = NULL;
3558 std::map<int, wxString> *NoteListLanguage = NULL;
3559 std::map<int, int> *NoteListPref = NULL;
3561 // Setup blank lines for later on.
3565 NoteList = &GeneralNoteList;
3566 NoteListType = &GeneralNoteListType;
3567 NoteListAltID = &GeneralNoteListAltID;
3568 NoteListPID = &GeneralNoteListPID;
3569 NoteListTokens = &GeneralNoteListTokens;
3570 NoteListLanguage = &GeneralNoteListLanguage;
3571 NoteListPref = &GeneralNoteListPref;
3574 NoteList = &HomeNoteList;
3575 NoteListType = &HomeNoteListType;
3576 NoteListAltID = &HomeNoteListAltID;
3577 NoteListPID = &HomeNoteListPID;
3578 NoteListTokens = &HomeNoteListTokens;
3579 NoteListLanguage = &HomeNoteListLanguage;
3580 NoteListPref = &HomeNoteListPref;
3583 NoteList = &BusinessNoteList;
3584 NoteListType = &BusinessNoteListType;
3585 NoteListAltID = &BusinessNoteListAltID;
3586 NoteListPID = &BusinessNoteListPID;
3587 NoteListTokens = &BusinessNoteListTokens;
3588 NoteListLanguage = &BusinessNoteListLanguage;
3589 NoteListPref = &BusinessNoteListPref;
3594 bool PropertyMatched = FALSE;
3596 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3597 intiter != SplitPoints.end(); ++intiter){
3599 SLiter = SplitLength.find(intiter->first);
3601 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3603 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3604 PropertyName = PropertyElement.GetNextToken();
3605 PropertyValue = PropertyElement.GetNextToken();
3607 intPrevValue = intiter->second;
3609 // Process properties.
3611 size_t intPropertyValueLen = PropertyValue.Len();
3613 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3615 PropertyValue.Trim();
3616 PropertyValue.RemoveLast();
3620 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3622 PropertyValue.Remove(0, 1);
3626 CaptureString(&PropertyValue, FALSE);
3628 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3629 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3630 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3631 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3633 if (PropertyMatched == TRUE){
3635 PropertyMatched = FALSE;
3640 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3642 if (FirstToken == TRUE){
3644 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3649 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3657 // Add the data to the General/Home/Work address variables.
3659 CaptureString(&PropertySeg2, FALSE);
3661 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3663 if (!PropertyTokens.IsEmpty()){
3665 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3671 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3673 std::map<int, int> SplitPoints;
3674 std::map<int, int> SplitLength;
3675 std::map<int, int>::iterator SLiter;
3676 wxString PropertyData;
3677 wxString PropertyName;
3678 wxString PropertyValue;
3679 wxString PropertyTokens;
3680 bool FirstToken = TRUE;
3681 int intPrevValue = 12;
3686 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3690 PropertyType PropType = PROPERTY_NONE;
3692 // Look for type before continuing.
3694 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3696 // Setup blank lines for later on.
3702 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3705 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3710 bool PropertyMatched = FALSE;
3712 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3713 intiter != SplitPoints.end(); ++intiter){
3715 SLiter = SplitLength.find(intiter->first);
3717 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3719 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3720 PropertyName = PropertyElement.GetNextToken();
3721 PropertyValue = PropertyElement.GetNextToken();
3723 intPrevValue = intiter->second;
3725 // Process properties.
3727 size_t intPropertyValueLen = PropertyValue.Len();
3729 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3731 PropertyValue.Trim();
3732 PropertyValue.RemoveLast();
3736 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3738 PropertyValue.Remove(0, 1);
3742 CaptureString(&PropertyValue, FALSE);
3744 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3745 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3746 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3747 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3749 if (PropertyMatched == TRUE){
3751 PropertyMatched = FALSE;
3756 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3758 if (FirstToken == TRUE){
3760 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3765 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3773 // Deal with multiple categories.
3775 int intOrigCatCount = *CategoryCount;
3776 bool FirstCategoryProcessed = TRUE;
3777 bool AfterFirstToken = FALSE;
3778 int intSplitSize = 0;
3779 int intSplitsFound = 0;
3780 int intSplitSeek = 0;
3781 int intPropertyLen = PropertySeg2.Len();
3783 SplitPoints.clear();
3784 SplitLength.clear();
3787 for (int i = 0; i <= intPropertyLen; i++){
3789 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3797 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3799 if (AfterFirstToken == TRUE){
3801 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3802 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3806 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3807 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3808 AfterFirstToken = TRUE;
3820 if (SplitPoints.size() > 0){
3822 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3823 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3827 if (SplitPoints.size() == 0){
3829 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3831 if (!PropertyTokens.IsEmpty()){
3833 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3839 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3840 intiter != SplitPoints.end(); ++intiter){
3842 SLiter = SplitLength.find(intiter->first);
3844 intPrevValue = intiter->second;
3846 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3848 // Add the data to the General/Home/Work address variables.
3850 // Trim any whitespace from the start and end.
3852 PropertyData = PropertyData.Trim(FALSE);
3853 PropertyData = PropertyData.Trim(TRUE);
3855 CaptureString(&PropertyData, FALSE);
3857 if (FirstCategoryProcessed == TRUE){
3859 FirstCategoryProcessed = FALSE;
3861 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3863 if (!PropertyTokens.IsEmpty()){
3865 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3875 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3877 if (!PropertyTokens.IsEmpty()){
3879 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3885 // Copy the properties to each of the categories (if it exists).
3887 if (!PropertyTokens.IsEmpty()){
3889 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3893 // Check if ALTID was used.
3895 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3897 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3901 // Check if PID was used.
3903 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3905 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3909 // Check if PREF was used.
3911 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3913 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3917 // Check if LANGUAGE was used.
3919 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3921 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3925 // Check if TYPE was used.
3931 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3934 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3942 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3944 size_t intPropertyLen = PropertySeg1.Len();
3945 std::map<int, int> SplitPoints;
3946 std::map<int, int> SplitLength;
3947 std::map<int, int>::iterator SLiter;
3948 wxString PropertyData;
3949 wxString PropertyName;
3950 wxString PropertyValue;
3951 wxString PropertyTokens;
3952 bool FirstToken = TRUE;
3953 int intSplitsFound = 0;
3954 int intSplitSize = 0;
3955 int intPrevValue = 7;
3959 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3963 PropertyType PropType = PROPERTY_NONE;
3965 // Look for type before continuing.
3967 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3970 bool PropertyMatched = FALSE;
3972 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3973 intiter != SplitPoints.end(); ++intiter){
3975 SLiter = SplitLength.find(intiter->first);
3977 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3979 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3980 PropertyName = PropertyElement.GetNextToken();
3981 PropertyValue = PropertyElement.GetNextToken();
3983 intPrevValue = intiter->second;
3985 // Process properties.
3987 size_t intPropertyValueLen = PropertyValue.Len();
3989 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3991 PropertyValue.Trim();
3992 PropertyValue.RemoveLast();
3996 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3998 PropertyValue.Remove(0, 1);
4002 CaptureString(&PropertyValue, FALSE);
4004 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
4005 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
4006 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
4007 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
4009 if (PropertyMatched == TRUE){
4011 PropertyMatched = FALSE;
4016 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4018 if (FirstToken == TRUE){
4020 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4025 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4033 intPropertyLen = PropertySeg2.Len();
4034 SplitPoints.clear();
4035 SplitLength.clear();
4040 CaptureString(&PropertySeg2, FALSE);
4042 for (int i = 0; i <= intPropertyLen; i++){
4046 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4049 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4051 if (intSplitsFound == 6){
4053 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4058 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4068 wxString wxSPhotoURI;
4069 wxString wxSPhotoMIME;
4070 wxString wxSPhotoEncoding;
4071 wxString wxSPhotoData;
4072 std::string base64enc;
4074 if (intSplitsFound == 0){
4078 std::map<int, int>::iterator striter;
4080 striter = SplitLength.find(1);
4082 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4084 while (wSTDataType.HasMoreTokens() == TRUE){
4086 wxSPhotoURI = wSTDataType.GetNextToken();
4087 wxSPhotoMIME = wSTDataType.GetNextToken();
4092 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4094 while (wSTDataInfo.HasMoreTokens() == TRUE){
4096 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4097 wxSPhotoData = wSTDataInfo.GetNextToken();
4098 base64enc = wxSPhotoData.mb_str();
4105 // Add the data to the General/Home/Work address variables.
4107 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4108 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4109 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4115 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4118 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4122 if (!PropertyTokens.IsEmpty()){
4124 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4130 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4132 size_t intPropertyLen = PropertySeg1.Len();
4133 std::map<int, int> SplitPoints;
4134 std::map<int, int> SplitLength;
4135 std::map<int, int>::iterator SLiter;
4136 wxString PropertyData;
4137 wxString PropertyName;
4138 wxString PropertyValue;
4139 wxString PropertyTokens;
4140 bool FirstToken = TRUE;
4141 int intSplitsFound = 0;
4142 int intSplitSize = 0;
4143 int intPrevValue = 6;
4147 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4151 PropertyType PropType = PROPERTY_NONE;
4153 // Look for type before continuing.
4155 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4158 bool PropertyMatched = FALSE;
4160 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4161 intiter != SplitPoints.end(); ++intiter){
4163 SLiter = SplitLength.find(intiter->first);
4165 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4167 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4168 PropertyName = PropertyElement.GetNextToken();
4169 PropertyValue = PropertyElement.GetNextToken();
4171 intPrevValue = intiter->second;
4173 // Process properties.
4175 size_t intPropertyValueLen = PropertyValue.Len();
4177 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4179 PropertyValue.Trim();
4180 PropertyValue.RemoveLast();
4184 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4186 PropertyValue.Remove(0, 1);
4190 CaptureString(&PropertyValue, FALSE);
4192 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
4193 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
4194 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
4195 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
4197 if (PropertyMatched == TRUE){
4199 PropertyMatched = FALSE;
4204 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4206 if (FirstToken == TRUE){
4208 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4213 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4221 intPropertyLen = PropertySeg2.Len();
4222 SplitPoints.clear();
4223 SplitLength.clear();
4228 CaptureString(&PropertySeg2, FALSE);
4230 for (int i = 0; i <= intPropertyLen; i++){
4234 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4237 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4239 if (intSplitsFound == 6){
4241 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4246 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4256 wxString wxSPhotoURI;
4257 wxString wxSPhotoMIME;
4258 wxString wxSPhotoEncoding;
4259 wxString wxSPhotoData;
4260 std::string base64enc;
4262 if (intSplitsFound == 0){
4266 std::map<int, int>::iterator striter;
4268 striter = SplitLength.find(1);
4270 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4272 while (wSTDataType.HasMoreTokens() == TRUE){
4274 wxSPhotoURI = wSTDataType.GetNextToken();
4275 wxSPhotoMIME = wSTDataType.GetNextToken();
4280 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4282 while (wSTDataInfo.HasMoreTokens() == TRUE){
4284 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4285 wxSPhotoData = wSTDataInfo.GetNextToken();
4286 base64enc = wxSPhotoData.mb_str();
4293 // Add the data to the General/Home/Work address variables.
4295 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4296 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4297 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4303 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4306 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4310 if (!PropertyTokens.IsEmpty()){
4312 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4318 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4320 size_t intPropertyLen = PropertySeg1.Len();
4321 std::map<int, int> SplitPoints;
4322 std::map<int, int> SplitLength;
4323 std::map<int, int>::iterator SLiter;
4324 wxString PropertyData;
4325 wxString PropertyName;
4326 wxString PropertyValue;
4327 wxString PropertyTokens;
4328 bool FirstToken = TRUE;
4329 int intSplitsFound = 0;
4330 int intSplitSize = 0;
4331 int intPrevValue = 7;
4335 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4339 PropertyType PropType = PROPERTY_NONE;
4341 // Look for type before continuing.
4343 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4346 bool PropertyMatched = FALSE;
4348 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4349 intiter != SplitPoints.end(); ++intiter){
4351 SLiter = SplitLength.find(intiter->first);
4353 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4355 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4356 PropertyName = PropertyElement.GetNextToken();
4357 PropertyValue = PropertyElement.GetNextToken();
4359 intPrevValue = intiter->second;
4361 // Process properties.
4363 size_t intPropertyValueLen = PropertyValue.Len();
4365 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4367 PropertyValue.Trim();
4368 PropertyValue.RemoveLast();
4372 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4374 PropertyValue.Remove(0, 1);
4378 CaptureString(&PropertyValue, FALSE);
4380 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
4381 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
4382 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
4383 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
4384 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
4386 if (PropertyMatched == TRUE){
4388 PropertyMatched = FALSE;
4393 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4395 if (FirstToken == TRUE){
4397 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4402 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4410 intPropertyLen = PropertySeg2.Len();
4411 SplitPoints.clear();
4412 SplitLength.clear();
4417 CaptureString(&PropertySeg2, FALSE);
4419 for (int i = 0; i <= intPropertyLen; i++){
4423 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4426 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4428 if (intSplitsFound == 6){
4430 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4435 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4445 wxString wxSSoundURI;
4446 wxString wxSSoundMIME;
4447 wxString wxSSoundEncoding;
4448 wxString wxSSoundData;
4449 std::string base64enc;
4451 if (intSplitsFound == 0){
4455 std::map<int, int>::iterator striter;
4457 striter = SplitLength.find(1);
4459 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4461 while (wSTDataType.HasMoreTokens() == TRUE){
4463 wxSSoundURI = wSTDataType.GetNextToken();
4464 wxSSoundMIME = wSTDataType.GetNextToken();
4469 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4471 while (wSTDataInfo.HasMoreTokens() == TRUE){
4473 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4474 wxSSoundData = wSTDataInfo.GetNextToken();
4475 base64enc = wxSSoundData.mb_str();
4482 // Add the data to the General/Home/Work address variables.
4488 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4491 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4495 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4496 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4497 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4499 if (!PropertyTokens.IsEmpty()){
4501 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4507 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4509 size_t intPropertyLen = PropertySeg1.Len();
4510 std::map<int, int> SplitPoints;
4511 std::map<int, int> SplitLength;
4512 std::map<int, int>::iterator SLiter;
4513 wxString PropertyData;
4514 wxString PropertyName;
4515 wxString PropertyValue;
4516 wxString PropertyTokens;
4517 bool FirstToken = TRUE;
4518 int intSplitsFound = 0;
4519 int intSplitSize = 0;
4520 int intPrevValue = 8;
4524 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4528 PropertyType PropType = PROPERTY_NONE;
4530 // Look for type before continuing.
4532 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4535 bool PropertyMatched = FALSE;
4537 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4538 intiter != SplitPoints.end(); ++intiter){
4540 SLiter = SplitLength.find(intiter->first);
4542 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4544 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4545 PropertyName = PropertyElement.GetNextToken();
4546 PropertyValue = PropertyElement.GetNextToken();
4548 intPrevValue = intiter->second;
4550 // Process properties.
4552 size_t intPropertyValueLen = PropertyValue.Len();
4554 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4556 PropertyValue.Trim();
4557 PropertyValue.RemoveLast();
4561 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4563 PropertyValue.Remove(0, 1);
4567 CaptureString(&PropertyValue, FALSE);
4569 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4570 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4571 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4572 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4574 if (PropertyMatched == TRUE){
4576 PropertyMatched = FALSE;
4581 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4583 if (FirstToken == TRUE){
4585 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4590 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4598 intPropertyLen = PropertySeg2.Len();
4599 SplitPoints.clear();
4600 SplitLength.clear();
4605 CaptureString(&PropertySeg2, FALSE);
4607 // Add the data to the General/Home/Work address variables.
4613 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4616 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4620 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4622 if (!PropertyTokens.IsEmpty()){
4624 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4630 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4632 size_t intPropertyLen = PropertySeg1.Len();
4633 std::map<int, int> SplitPoints;
4634 std::map<int, int> SplitLength;
4635 std::map<int, int>::iterator SLiter;
4636 wxString PropertyData;
4637 wxString PropertyName;
4638 wxString PropertyValue;
4639 wxString PropertyTokens;
4640 bool FirstToken = TRUE;
4641 int intSplitsFound = 0;
4642 int intSplitSize = 0;
4643 int intPrevValue = 8;
4647 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4651 PropertyType PropType = PROPERTY_NONE;
4653 // Look for type before continuing.
4655 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4658 bool PropertyMatched = FALSE;
4660 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4661 intiter != SplitPoints.end(); ++intiter){
4663 SLiter = SplitLength.find(intiter->first);
4665 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4667 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4668 PropertyName = PropertyElement.GetNextToken();
4669 PropertyValue = PropertyElement.GetNextToken();
4671 intPrevValue = intiter->second;
4673 // Process properties.
4675 size_t intPropertyValueLen = PropertyValue.Len();
4677 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4679 PropertyValue.Trim();
4680 PropertyValue.RemoveLast();
4684 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4686 PropertyValue.Remove(0, 1);
4690 CaptureString(&PropertyValue, FALSE);
4692 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4693 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4694 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4695 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4697 if (PropertyMatched == TRUE){
4699 PropertyMatched = FALSE;
4704 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4706 if (FirstToken == TRUE){
4708 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4713 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4721 intPropertyLen = PropertySeg2.Len();
4722 SplitPoints.clear();
4723 SplitLength.clear();
4728 CaptureString(&PropertySeg2, FALSE);
4730 // Add the data to the General/Home/Work address variables.
4736 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4739 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4743 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4745 if (!PropertyTokens.IsEmpty()){
4747 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4753 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4755 size_t intPropertyLen = PropertySeg1.Len();
4756 std::map<int, int> SplitPoints;
4757 std::map<int, int> SplitLength;
4758 std::map<int, int>::iterator SLiter;
4759 wxString PropertyData;
4760 wxString PropertyName;
4761 wxString PropertyValue;
4762 wxString PropertyTokens;
4763 bool FirstToken = TRUE;
4764 int intSplitsFound = 0;
4765 int intSplitSize = 0;
4766 int intPrevValue = 7;
4770 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4774 PropertyType PropType = PROPERTY_NONE;
4776 // Look for type before continuing.
4778 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4781 bool PropertyMatched = FALSE;
4783 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4784 intiter != SplitPoints.end(); ++intiter){
4786 SLiter = SplitLength.find(intiter->first);
4788 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4790 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4791 PropertyName = PropertyElement.GetNextToken();
4792 PropertyValue = PropertyElement.GetNextToken();
4794 intPrevValue = intiter->second;
4796 // Process properties.
4798 size_t intPropertyValueLen = PropertyValue.Len();
4800 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4802 PropertyValue.Trim();
4803 PropertyValue.RemoveLast();
4807 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4809 PropertyValue.Remove(0, 1);
4813 CaptureString(&PropertyValue, FALSE);
4815 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4816 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4817 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4818 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4820 if (PropertyMatched == TRUE){
4822 PropertyMatched = FALSE;
4827 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4829 if (FirstToken == TRUE){
4831 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4836 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4844 intPropertyLen = PropertySeg2.Len();
4845 SplitPoints.clear();
4846 SplitLength.clear();
4851 CaptureString(&PropertySeg2, FALSE);
4853 // Add the data to the General/Home/Work address variables.
4859 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4862 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4866 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4868 if (!PropertyTokens.IsEmpty()){
4870 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4876 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4878 size_t intPropertyLen = PropertySeg1.Len();
4879 std::map<int, int> SplitPoints;
4880 std::map<int, int> SplitLength;
4881 std::map<int, int>::iterator SLiter;
4882 wxString PropertyData;
4883 wxString PropertyName;
4884 wxString PropertyValue;
4885 wxString PropertyTokens;
4886 bool FirstToken = TRUE;
4887 int intSplitsFound = 0;
4888 int intSplitSize = 0;
4889 int intPrevValue = 5;
4894 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4898 PropertyType PropType = PROPERTY_NONE;
4900 // Look for type before continuing.
4902 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4905 bool PropertyMatched = FALSE;
4907 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4908 intiter != SplitPoints.end(); ++intiter){
4910 SLiter = SplitLength.find(intiter->first);
4912 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4914 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4915 PropertyName = PropertyElement.GetNextToken();
4916 PropertyValue = PropertyElement.GetNextToken();
4918 intPrevValue = intiter->second;
4920 // Process properties.
4922 size_t intPropertyValueLen = PropertyValue.Len();
4924 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4926 PropertyValue.Trim();
4927 PropertyValue.RemoveLast();
4931 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4933 PropertyValue.Remove(0, 1);
4937 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4938 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4939 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4941 if (PropertyMatched == TRUE){
4943 PropertyMatched = FALSE;
4948 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4950 if (FirstToken == TRUE){
4952 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4957 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4965 intPropertyLen = PropertySeg2.Len();
4966 SplitPoints.clear();
4967 SplitLength.clear();
4972 for (int i = 0; i <= intPropertyLen; i++){
4976 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4979 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4981 if (intSplitsFound == 6){
4983 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4988 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4999 wxString wxSKeyMIME;
5000 wxString wxSKeyEncoding;
5001 wxString wxSKeyData;
5002 std::string base64enc;
5004 if (intSplitsFound == 0){
5008 std::map<int, int>::iterator striter;
5010 striter = SplitLength.find(1);
5012 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
5014 while (wSTDataType.HasMoreTokens() == TRUE){
5016 wxSKeyURI = wSTDataType.GetNextToken();
5017 wxSKeyMIME = wSTDataType.GetNextToken();
5022 if (wxSKeyURI == wxT("data")){
5024 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
5026 while (wSTDataInfo.HasMoreTokens() == TRUE){
5028 wxSKeyEncoding = wSTDataInfo.GetNextToken();
5029 wxSKeyData = wSTDataInfo.GetNextToken();
5038 // Add the data to the General/Home/Work address variables.
5040 if (wxSKeyURI == wxT("data")){
5042 KeyListDataEncType.erase(*KeyCount);
5043 KeyListKeyType.erase(*KeyCount);
5044 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
5045 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
5047 KeyList.erase(*KeyCount);
5048 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
5052 KeyList.erase(*KeyCount);
5053 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
5057 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
5063 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
5066 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
5070 if (!PropertyTokens.IsEmpty()){
5072 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
5078 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
5080 // Split the Vendor three ways.
5082 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
5085 wxString wxSVNDPropName;
5088 while (wSTVendorDetails.HasMoreTokens() == TRUE){
5090 wSTVendorDetails.GetNextToken();
5091 wxSVNDID = wSTVendorDetails.GetNextToken();
5092 wxSVNDPropName = wSTVendorDetails.GetNextToken();
5097 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
5099 // Add the data to the vendor variables.
5101 VendorList.erase(*VendorCount);
5102 VendorListPEN.erase(*VendorCount);
5103 VendorListElement.erase(*VendorCount);
5105 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
5106 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
5107 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
5113 void ProcessTokens(wxString *PropertyName,
5114 wxString *PropertyValue,
5115 wxString *PropertyTokens,
5118 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5120 if (*FirstToken == TRUE){
5122 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5123 *FirstToken = FALSE;
5127 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5135 void ProcessStringValue(wxString *PropertyName,
5136 wxString PropertyNameMatch,
5137 std::map<int,wxString> *MapPtr,
5138 wxString *PropertyValue,
5140 bool *PropertyMatched){
5142 if (*PropertyName == PropertyNameMatch){
5143 MapPtr->erase(*ItemCount);
5144 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5145 *PropertyMatched = TRUE;
5150 void ProcessIntegerValue(wxString *PropertyName,
5151 wxString PropertyNameMatch,
5152 std::map<int,int> *PrefPtr,
5153 wxString *PropertyValue,
5155 bool *PropertyMatched){
5157 if (*PropertyName == PropertyNameMatch){
5158 *PropertyMatched = TRUE;
5163 int PriorityNumber = 0;
5164 bool ValidNumber = TRUE;
5167 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5170 catch(std::invalid_argument &e){
5171 ValidNumber = FALSE;
5174 if (ValidNumber == TRUE){
5176 PrefPtr->erase(*ItemCount);
5177 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5183 void SplitValues(wxString *PropertyLine,
5184 std::map<int,int> *SplitPoints,
5185 std::map<int,int> *SplitLength,
5188 size_t intPropertyLen = PropertyLine->Len();
5189 int intSplitsFound = 0;
5190 int intSplitSize = 0;
5191 int intSplitSeek = 0;
5193 for (int i = intSize; i <= intPropertyLen; i++){
5197 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5198 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5200 if (intSplitsFound == 0){
5202 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5206 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5210 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5220 if (intSplitsFound == 0){
5222 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5223 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5227 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5228 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5234 void CheckType(wxString *PropertySeg1,
5235 std::map<int,int> *SplitPoints,
5236 std::map<int,int> *SplitLength,
5238 PropertyType *PropType){
5240 wxString PropertyData;
5241 wxString PropertyName;
5242 wxString PropertyValue;
5243 std::map<int,int>::iterator SLiter;
5245 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5246 intiter != SplitPoints->end(); ++intiter){
5248 SLiter = SplitLength->find(intiter->first);
5250 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5252 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5253 PropertyName = PropertyElement.GetNextToken();
5254 PropertyValue = PropertyElement.GetNextToken();
5256 *intPrevValue = intiter->second;
5258 if (PropertyName == wxT("TYPE")){
5260 if (PropertyValue == wxT("work")){
5262 *PropType = PROPERTY_WORK;
5264 } else if (PropertyValue == wxT("home")){
5266 *PropType = PROPERTY_HOME;
5270 *PropType = PROPERTY_NONE;