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 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
890 // Split the name data.
892 int intSplitSeek = 0;
893 int intSplitsFound = 0;
894 int intSplitSize = 0;
895 int intPropertyLen = PropertySeg2.Len();
897 std::map<int,wxString> NameValues;
900 for (int i = 0; i <= intPropertyLen; i++){
902 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
904 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
909 if (intSplitsFound == 4){
911 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
925 // Split the data into several parts.
927 for (std::map<int, wxString>::iterator iter = NameValues.begin();
928 iter != NameValues.end(); ++iter){
930 if (iter->first == 1){
932 // Deal with family name.
934 NameSurname = iter->second;
936 } else if (iter->first == 2){
938 // Deal with given names.
940 NameForename = iter->second;
942 } else if (iter->first == 3){
944 // Deal with additional names.
946 NameOtherNames = iter->second;
948 } else if (iter->first == 4){
950 // Deal with honorifix prefixes and suffixes.
952 NameTitle = iter->second;
956 if (iter == NameValues.end()){
962 NameSuffix = iter->second;
968 // Add the name token data.
970 if (!PropertyTokens.IsEmpty()){
972 NameTokens = PropertyTokens;
978 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
980 size_t intPropertyLen = PropertySeg1.Len();
981 std::map<int, int> SplitPoints;
982 std::map<int, int> SplitLength;
983 std::map<int, int>::iterator SLiter;
984 wxString PropertyData;
985 wxString PropertyName;
986 wxString PropertyValue;
987 wxString PropertyTokens;
988 bool FirstToken = TRUE;
989 int intSplitsFound = 0;
990 int intSplitSize = 0;
991 int intPrevValue = 14;
995 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
999 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1000 intiter != SplitPoints.end(); ++intiter){
1002 SLiter = SplitLength.find(intiter->first);
1004 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1006 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1007 PropertyName = PropertyElement.GetNextToken();
1008 PropertyValue = PropertyElement.GetNextToken();
1010 intPrevValue = intiter->second;
1012 // Process properties.
1014 CaptureString(&PropertyValue, FALSE);
1016 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1018 if (FirstToken == TRUE){
1020 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1025 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1033 CaptureString(&PropertySeg2, FALSE);
1035 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
1037 if (!PropertyTokens.IsEmpty()){
1039 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
1045 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
1047 std::map<int, int> SplitPoints;
1048 std::map<int, int> SplitLength;
1050 int intPrevValue = 10;
1053 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1057 PropertyType PropType = PROPERTY_NONE;
1059 // Look for type before continuing.
1061 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1065 std::map<int, wxString> *NicknamesList = NULL;
1066 std::map<int, wxString> *NicknamesListType = NULL;
1067 std::map<int, wxString> *NicknamesListLanguage = NULL;
1068 std::map<int, wxString> *NicknamesListAltID = NULL;
1069 std::map<int, wxString> *NicknamesListPID = NULL;
1070 std::map<int, wxString> *NicknamesListTokens = NULL;
1071 std::map<int, int> *NicknamesListPref = NULL;
1075 NicknamesList = &GeneralNicknamesList;
1076 NicknamesListType = &GeneralNicknamesListType;
1077 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1078 NicknamesListAltID = &GeneralNicknamesListAltID;
1079 NicknamesListPID = &GeneralNicknamesListPID;
1080 NicknamesListTokens = &GeneralNicknamesListTokens;
1081 NicknamesListPref = &GeneralNicknamesListPref;
1084 NicknamesList = &HomeNicknamesList;
1085 NicknamesListType = &HomeNicknamesListType;
1086 NicknamesListLanguage = &HomeNicknamesListLanguage;
1087 NicknamesListAltID = &HomeNicknamesListAltID;
1088 NicknamesListPID = &HomeNicknamesListPID;
1089 NicknamesListTokens = &HomeNicknamesListTokens;
1090 NicknamesListPref = &HomeNicknamesListPref;
1093 NicknamesList = &BusinessNicknamesList;
1094 NicknamesListType = &BusinessNicknamesListType;
1095 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1096 NicknamesListAltID = &BusinessNicknamesListAltID;
1097 NicknamesListPID = &BusinessNicknamesListPID;
1098 NicknamesListTokens = &BusinessNicknamesListTokens;
1099 NicknamesListPref = &BusinessNicknamesListPref;
1103 std::map<int, int>::iterator SLiter;
1104 wxString PropertyData;
1105 wxString PropertyName;
1106 wxString PropertyValue;
1107 wxString PropertyTokens;
1108 bool FirstToken = TRUE;
1109 bool PropertyMatched = FALSE;
1111 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1112 intiter != SplitPoints.end(); ++intiter){
1114 SLiter = SplitLength.find(intiter->first);
1116 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1118 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1119 PropertyName = PropertyElement.GetNextToken();
1120 PropertyValue = PropertyElement.GetNextToken();
1122 intPrevValue = intiter->second;
1124 CaptureString(&PropertyValue, FALSE);
1126 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1127 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1128 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1129 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1131 if (PropertyMatched == TRUE){
1133 PropertyMatched = FALSE;
1138 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1140 if (FirstToken == TRUE){
1142 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1147 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1155 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1157 // Add the name token data.
1159 if (!PropertyTokens.IsEmpty()){
1161 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1167 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1169 std::map<int, int> SplitPoints;
1170 std::map<int, int> SplitLength;
1171 std::map<int, int>::iterator SLiter;
1172 wxString PropertyData;
1173 wxString PropertyName;
1174 wxString PropertyValue;
1175 wxString PropertyTokens;
1176 bool FirstToken = TRUE;
1177 int intPrevValue = 8;
1179 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1183 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1184 intiter != SplitPoints.end(); ++intiter){
1186 SLiter = SplitLength.find(intiter->first);
1188 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1190 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1191 PropertyName = PropertyElement.GetNextToken();
1192 PropertyValue = PropertyElement.GetNextToken();
1194 intPrevValue = intiter->second;
1196 // Process properties.
1198 size_t intPropertyValueLen = PropertyValue.Len();
1200 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1202 PropertyValue.Trim();
1203 PropertyValue.RemoveLast();
1207 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1209 PropertyValue.Remove(0, 1);
1213 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1215 if (FirstToken == TRUE){
1217 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1222 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1230 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1232 wxString GenderComponent;
1234 if (GenderData.CountTokens() >= 2){
1236 Gender = GenderData.GetNextToken();
1237 GenderDetails = GenderData.GetString();
1239 CaptureString(&GenderDetails, FALSE);
1243 Gender = GenderData.GetNextToken();
1247 if (!PropertyTokens.IsEmpty()){
1249 GenderTokens = PropertyTokens;
1255 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1257 // Process date. Preserve the remainder in the string.
1259 std::map<int, int> SplitPoints;
1260 std::map<int, int> SplitLength;
1261 std::map<int, int>::iterator SLiter;
1262 wxString PropertyData;
1263 wxString PropertyName;
1264 wxString PropertyValue;
1265 wxString PropertyTokens;
1266 bool BirthdayText = FALSE;
1267 int intPrevValue = 6;
1269 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1273 // Look for type before continuing.
1275 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1276 intiter != SplitPoints.end(); ++intiter){
1278 SLiter = SplitLength.find(intiter->first);
1280 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1282 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1283 PropertyName = PropertyElement.GetNextToken();
1284 PropertyValue = PropertyElement.GetNextToken();
1286 intPrevValue = intiter->second;
1288 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1290 CaptureString(&PropertySeg2, FALSE);
1291 Birthday = PropertySeg2;
1292 BirthdayText = TRUE;
1298 // Setup blank lines for later on.
1301 bool FirstToken = TRUE;
1303 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1304 intiter != SplitPoints.end(); ++intiter){
1306 SLiter = SplitLength.find(intiter->first);
1308 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1310 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1311 PropertyName = PropertyElement.GetNextToken();
1312 PropertyValue = PropertyElement.GetNextToken();
1314 intPrevValue = intiter->second;
1316 // Process properties.
1318 CaptureString(&PropertyValue, FALSE);
1320 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1322 PropertyValue.Trim();
1323 PropertyValue.RemoveLast();
1327 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1329 PropertyValue.Remove(0, 1);
1333 if (PropertyName == wxT("ALTID")){
1335 BirthdayAltID = PropertyValue;
1337 } else if (PropertyName == wxT("CALSCALE")){
1339 BirthdayCalScale = PropertyValue;
1341 } else if (PropertyName != wxT("VALUE")) {
1343 // Something else we don't know about so append
1344 // to the tokens variable.
1346 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1348 if (FirstToken == TRUE){
1350 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1355 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1365 // Add the data to the variables and form.
1367 if (BirthdayText == FALSE){
1369 Birthday = PropertySeg2;
1373 if (!PropertyTokens.IsEmpty()){
1375 BirthdayTokens = PropertyTokens;
1381 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1383 // Process date. Preserve the remainder in the string.
1385 std::map<int, int> SplitPoints;
1386 std::map<int, int> SplitLength;
1387 std::map<int, int>::iterator SLiter;
1388 wxString PropertyData;
1389 wxString PropertyName;
1390 wxString PropertyValue;
1391 wxString PropertyTokens;
1392 bool AnniversaryText = FALSE;
1393 int intPrevValue = 13;
1395 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1399 // Look for type before continuing.
1401 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1402 intiter != SplitPoints.end(); ++intiter){
1404 SLiter = SplitLength.find(intiter->first);
1406 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1408 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1409 PropertyName = PropertyElement.GetNextToken();
1410 PropertyValue = PropertyElement.GetNextToken();
1412 intPrevValue = intiter->second;
1414 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1416 CaptureString(&PropertySeg2, FALSE);
1417 Anniversary = PropertySeg2;
1418 AnniversaryText = TRUE;
1424 // Setup blank lines for later on.
1427 bool FirstToken = TRUE;
1429 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1430 intiter != SplitPoints.end(); ++intiter){
1432 SLiter = SplitLength.find(intiter->first);
1434 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1436 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1437 PropertyName = PropertyElement.GetNextToken();
1438 PropertyValue = PropertyElement.GetNextToken();
1440 intPrevValue = intiter->second;
1442 // Process properties.
1444 CaptureString(&PropertyValue, FALSE);
1446 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1448 PropertyValue.Trim();
1449 PropertyValue.RemoveLast();
1453 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1455 PropertyValue.Remove(0, 1);
1459 if (PropertyName == wxT("ALTID")){
1461 AnniversaryAltID = PropertyValue;
1463 } else if (PropertyName == wxT("CALSCALE")){
1465 AnniversaryCalScale = PropertyValue;
1467 } else if (PropertyName != wxT("VALUE")) {
1469 // Something else we don't know about so append
1470 // to the tokens variable.
1472 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
1474 if (FirstToken == TRUE){
1476 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1481 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1491 // Add the data to the variables and form.
1493 if (AnniversaryText == FALSE){
1495 Anniversary = PropertySeg2;
1499 if (!PropertyTokens.IsEmpty()){
1501 AnniversaryTokens = PropertyTokens;
1507 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1509 std::map<int, int> SplitPoints;
1510 std::map<int, int> SplitLength;
1512 int intPrevValue = 4;
1515 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1519 PropertyType PropType = PROPERTY_NONE;
1521 // Look for type before continuing.
1523 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1527 std::map<int, wxString> *TZList = NULL;
1528 std::map<int, wxString> *TZListType = NULL;
1529 std::map<int, wxString> *TZListMediatype = NULL;
1530 std::map<int, wxString> *TZListAltID = NULL;
1531 std::map<int, wxString> *TZListPID = NULL;
1532 std::map<int, wxString> *TZListTokens = NULL;
1533 std::map<int, int> *TZListPref = NULL;
1537 TZList = &GeneralTZList;
1538 TZListType = &GeneralTZListType;
1539 TZListMediatype = &GeneralTZListMediatype;
1540 TZListAltID = &GeneralTZListAltID;
1541 TZListPID = &GeneralTZListPID;
1542 TZListTokens = &GeneralTZListTokens;
1543 TZListPref = &GeneralTZListPref;
1546 TZList = &HomeTZList;
1547 TZListType = &HomeTZListType;
1548 TZListMediatype = &HomeTZListMediatype;
1549 TZListAltID = &HomeTZListAltID;
1550 TZListPID = &HomeTZListPID;
1551 TZListTokens = &HomeTZListTokens;
1552 TZListPref = &HomeTZListPref;
1555 TZList = &BusinessTZList;
1556 TZListType = &BusinessTZListType;
1557 TZListMediatype = &BusinessTZListMediatype;
1558 TZListAltID = &BusinessTZListAltID;
1559 TZListPID = &BusinessTZListPID;
1560 TZListTokens = &BusinessTZListTokens;
1561 TZListPref = &BusinessTZListPref;
1565 std::map<int, int>::iterator SLiter;
1566 wxString PropertyData;
1567 wxString PropertyName;
1568 wxString PropertyValue;
1569 wxString PropertyTokens;
1570 bool FirstToken = TRUE;
1571 bool PropertyMatched = FALSE;
1573 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1574 intiter != SplitPoints.end(); ++intiter){
1576 SLiter = SplitLength.find(intiter->first);
1578 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1580 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1581 PropertyName = PropertyElement.GetNextToken();
1582 PropertyValue = PropertyElement.GetNextToken();
1584 intPrevValue = intiter->second;
1586 CaptureString(&PropertyValue, FALSE);
1588 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1589 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1590 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1591 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1593 if (PropertyMatched == TRUE){
1595 PropertyMatched = FALSE;
1600 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1602 if (FirstToken == TRUE){
1604 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1609 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1617 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1619 // Add the name token data.
1621 if (!PropertyTokens.IsEmpty()){
1623 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1630 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1632 size_t intPropertyLen = PropertySeg1.Len();
1633 std::map<int, int> SplitPoints;
1634 std::map<int, int> SplitLength;
1635 std::map<int, int>::iterator SLiter;
1636 wxString PropertyData;
1637 wxString PropertyName;
1638 wxString PropertyValue;
1639 wxString PropertyTokens;
1640 wxString AddressLabel;
1641 wxString AddressLang;
1642 wxString AddressAltID;
1643 wxString AddressPID;
1644 wxString AddressTokens;
1645 wxString AddressGeo;
1646 wxString AddressTimezone;
1647 wxString AddressType;
1648 wxString AddressMediatype;
1649 wxString AddressPOBox;
1650 wxString AddressExtended;
1651 wxString AddressStreet;
1652 wxString AddressLocality;
1653 wxString AddressCity;
1654 wxString AddressRegion;
1655 wxString AddressPostalCode;
1656 wxString AddressCountry;
1657 bool FirstToken = TRUE;
1658 int intSplitsFound = 0;
1659 int intSplitSize = 0;
1660 int intPrevValue = 5;
1664 bool PropertyMatched = FALSE;
1666 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1670 PropertyType PropType = PROPERTY_NONE;
1672 // Look for type before continuing.
1674 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1678 std::map<int, wxString> *AddressList = NULL;
1679 std::map<int, wxString> *AddressListTown = NULL;
1680 std::map<int, wxString> *AddressListCounty = NULL;
1681 std::map<int, wxString> *AddressListPostCode = NULL;
1682 std::map<int, wxString> *AddressListCountry = NULL;
1683 std::map<int, wxString> *AddressListLabel = NULL;
1684 std::map<int, wxString> *AddressListLang = NULL;
1685 std::map<int, wxString> *AddressListAltID = NULL;
1686 std::map<int, wxString> *AddressListPID = NULL;
1687 std::map<int, wxString> *AddressListTokens = NULL;
1688 std::map<int, wxString> *AddressListGeo = NULL;
1689 std::map<int, wxString> *AddressListTimezone = NULL;
1690 std::map<int, wxString> *AddressListType = NULL;
1691 std::map<int, wxString> *AddressListMediatype = NULL;
1692 std::map<int, int> *AddressListPref = NULL;
1696 AddressList = &GeneralAddressList;
1697 AddressListTown = &GeneralAddressListTown;
1698 AddressListCounty = &GeneralAddressListCounty;
1699 AddressListPostCode = &GeneralAddressListPostCode;
1700 AddressListCountry = &GeneralAddressListCountry;
1701 AddressListLabel = &GeneralAddressListLabel;
1702 AddressListLang = &GeneralAddressListLang;
1703 AddressListAltID = &GeneralAddressListAltID;
1704 AddressListPID = &GeneralAddressListPID;
1705 AddressListTokens = &GeneralAddressListTokens;
1706 AddressListGeo = &GeneralAddressListGeo;
1707 AddressListTimezone = &GeneralAddressListTimezone;
1708 AddressListType = &GeneralAddressListType;
1709 AddressListMediatype = &GeneralAddressListMediatype;
1710 AddressListPref = &GeneralAddressListPref;
1713 AddressList = &HomeAddressList;
1714 AddressListTown = &HomeAddressListTown;
1715 AddressListCounty = &HomeAddressListCounty;
1716 AddressListPostCode = &HomeAddressListPostCode;
1717 AddressListCountry = &HomeAddressListCountry;
1718 AddressListLabel = &HomeAddressListLabel;
1719 AddressListLang = &HomeAddressListLang;
1720 AddressListAltID = &HomeAddressListAltID;
1721 AddressListPID = &HomeAddressListPID;
1722 AddressListTokens = &HomeAddressListTokens;
1723 AddressListGeo = &HomeAddressListGeo;
1724 AddressListTimezone = &HomeAddressListTimezone;
1725 AddressListType = &HomeAddressListType;
1726 AddressListMediatype = &HomeAddressListMediatype;
1727 AddressListPref = &HomeAddressListPref;
1730 AddressList = &BusinessAddressList;
1731 AddressListTown = &BusinessAddressListTown;
1732 AddressListCounty = &BusinessAddressListCounty;
1733 AddressListPostCode = &BusinessAddressListPostCode;
1734 AddressListCountry = &BusinessAddressListCountry;
1735 AddressListLabel = &BusinessAddressListLabel;
1736 AddressListLang = &BusinessAddressListLang;
1737 AddressListAltID = &BusinessAddressListAltID;
1738 AddressListPID = &BusinessAddressListPID;
1739 AddressListTokens = &BusinessAddressListTokens;
1740 AddressListGeo = &BusinessAddressListGeo;
1741 AddressListTimezone = &BusinessAddressListTimezone;
1742 AddressListType = &BusinessAddressListType;
1743 AddressListMediatype = &BusinessAddressListMediatype;
1744 AddressListPref = &BusinessAddressListPref;
1750 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1751 intiter != SplitPoints.end(); ++intiter){
1753 SLiter = SplitLength.find(intiter->first);
1755 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1757 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1758 PropertyName = PropertyElement.GetNextToken();
1759 PropertyValue = PropertyElement.GetNextToken();
1761 intPrevValue = intiter->second;
1763 CaptureString(&PropertyValue, FALSE);
1765 // Process properties.
1767 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1768 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1769 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1770 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1771 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1772 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1773 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1774 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1776 if (PropertyMatched == TRUE){
1778 PropertyMatched = FALSE;
1783 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1785 if (FirstToken == TRUE){
1787 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
1792 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
1800 // Split the address.
1802 //std::map<int, int>::iterator SLiter;
1803 intPropertyLen = PropertySeg2.Len();
1804 SplitPoints.clear();
1805 SplitLength.clear();
1810 for (int i = 0; i <= intPropertyLen; i++){
1814 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1817 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1819 if (intSplitsFound == 6){
1821 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1826 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1836 // Split the data into several parts.
1838 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1839 intiter != SplitPoints.end(); ++intiter){
1841 if (intiter->first == 1){
1843 // Deal with PO Box.
1845 SLiter = SplitLength.find(1);
1847 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1848 intPrevValue = intiter->second;
1850 } else if (intiter->first == 2){
1852 // Deal with extended address.
1854 SLiter = SplitLength.find(2);
1856 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1857 intPrevValue = intiter->second;
1859 } else if (intiter->first == 3){
1861 // Deal with street address.
1863 SLiter = SplitLength.find(3);
1865 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1866 intPrevValue = intiter->second;
1868 } else if (intiter->first == 4){
1870 // Deal with locality
1872 SLiter = SplitLength.find(4);
1874 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1875 intPrevValue = intiter->second;
1877 } else if (intiter->first == 5){
1879 // Deal with region.
1881 SLiter = SplitLength.find(5);
1883 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1884 intPrevValue = intiter->second;
1887 } else if (intiter->first == 6){
1889 // Deal with post code.
1891 SLiter = SplitLength.find(6);
1893 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1894 intPrevValue = intiter->second;
1896 // Deal with country.
1898 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1906 // Add the data to the General/Home/Work address variables.
1908 CaptureString(&AddressStreet, FALSE);
1909 CaptureString(&AddressLocality, FALSE);
1910 CaptureString(&AddressRegion, FALSE);
1911 CaptureString(&AddressPostalCode, FALSE);
1912 CaptureString(&AddressCountry, FALSE);
1914 if (!PropertyTokens.IsEmpty()){
1916 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1920 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1921 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1922 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1923 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1924 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1928 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1931 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1934 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1938 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1942 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1944 std::map<int, int> SplitPoints;
1945 std::map<int, int> SplitLength;
1947 int intPrevValue = 7;
1950 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1954 PropertyType PropType = PROPERTY_NONE;
1956 // Look for type before continuing.
1958 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1960 std::map<int, wxString> *EmailList = NULL;
1961 std::map<int, wxString> *EmailListType = NULL;
1962 std::map<int, wxString> *EmailListAltID = NULL;
1963 std::map<int, wxString> *EmailListPID = NULL;
1964 std::map<int, wxString> *EmailListTokens = NULL;
1965 std::map<int, int> *EmailListPref = NULL;
1969 EmailList = &GeneralEmailList;
1970 EmailListType = &GeneralEmailListType;
1971 EmailListAltID = &GeneralEmailListAltID;
1972 EmailListPID = &GeneralEmailListPID;
1973 EmailListTokens = &GeneralEmailListTokens;
1974 EmailListPref = &GeneralEmailListPref;
1977 EmailList = &HomeEmailList;
1978 EmailListType = &HomeEmailListType;
1979 EmailListAltID = &HomeEmailListAltID;
1980 EmailListPID = &HomeEmailListPID;
1981 EmailListTokens = &HomeEmailListTokens;
1982 EmailListPref = &HomeEmailListPref;
1985 EmailList = &BusinessEmailList;
1986 EmailListType = &BusinessEmailListType;
1987 EmailListAltID = &BusinessEmailListAltID;
1988 EmailListPID = &BusinessEmailListPID;
1989 EmailListTokens = &BusinessEmailListTokens;
1990 EmailListPref = &BusinessEmailListPref;
1996 std::map<int,int>::iterator SLiter;
1997 wxString PropertyData;
1998 wxString PropertyName;
1999 wxString PropertyValue;
2000 wxString PropertyTokens;
2001 bool FirstToken = TRUE;
2002 bool PropertyMatched = FALSE;
2004 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2005 intiter != SplitPoints.end(); ++intiter){
2007 SLiter = SplitLength.find(intiter->first);
2009 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2011 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2012 PropertyName = PropertyElement.GetNextToken();
2013 PropertyValue = PropertyElement.GetNextToken();
2015 intPrevValue = intiter->second;
2017 CaptureString(&PropertyValue, FALSE);
2019 // Process properties.
2021 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
2022 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
2023 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
2025 if (PropertyMatched == TRUE){
2027 PropertyMatched = FALSE;
2032 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2034 if (FirstToken == TRUE){
2036 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2041 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2049 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
2051 // Add the name token data.
2053 if (!PropertyTokens.IsEmpty()){
2055 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
2062 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
2064 std::map<int, int> SplitPoints;
2065 std::map<int, int> SplitLength;
2067 int intPrevValue = 6;
2070 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2074 PropertyType PropType = PROPERTY_NONE;
2076 // Look for type before continuing.
2078 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2080 std::map<int, wxString> *IMList = NULL;
2081 std::map<int, wxString> *IMListType = NULL;
2082 std::map<int, wxString> *IMListAltID = NULL;
2083 std::map<int, wxString> *IMListPID = NULL;
2084 std::map<int, wxString> *IMListTokens = NULL;
2085 std::map<int, wxString> *IMListMediatype = NULL;
2086 std::map<int, int> *IMListPref = NULL;
2090 IMList = &GeneralIMList;
2091 IMListType = &GeneralIMListType;
2092 IMListAltID = &GeneralIMListAltID;
2093 IMListPID = &GeneralIMListPID;
2094 IMListTokens = &GeneralIMListTokens;
2095 IMListMediatype = &GeneralIMListMediatype;
2096 IMListPref = &GeneralIMListPref;
2099 IMList = &HomeIMList;
2100 IMListType = &HomeIMListType;
2101 IMListAltID = &HomeIMListAltID;
2102 IMListPID = &HomeIMListPID;
2103 IMListTokens = &HomeIMListTokens;
2104 IMListMediatype = &HomeIMListMediatype;
2105 IMListPref = &HomeIMListPref;
2108 IMList = &BusinessIMList;
2109 IMListType = &BusinessIMListType;
2110 IMListAltID = &BusinessIMListAltID;
2111 IMListPID = &BusinessIMListPID;
2112 IMListTokens = &BusinessIMListTokens;
2113 IMListMediatype = &BusinessIMListMediatype;
2114 IMListPref = &BusinessIMListPref;
2120 std::map<int,int>::iterator SLiter;
2121 wxString PropertyData;
2122 wxString PropertyName;
2123 wxString PropertyValue;
2124 wxString PropertyTokens;
2125 bool FirstToken = TRUE;
2126 bool PropertyMatched = FALSE;
2128 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2129 intiter != SplitPoints.end(); ++intiter){
2131 SLiter = SplitLength.find(intiter->first);
2133 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2135 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2136 PropertyName = PropertyElement.GetNextToken();
2137 PropertyValue = PropertyElement.GetNextToken();
2139 intPrevValue = intiter->second;
2141 CaptureString(&PropertyValue, FALSE);
2143 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
2144 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
2145 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
2146 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
2148 // Process properties.
2150 if (PropertyMatched == TRUE){
2152 PropertyMatched = FALSE;
2157 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2159 if (FirstToken == TRUE){
2161 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2166 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2174 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
2176 // Add the name token data.
2178 if (!PropertyTokens.IsEmpty()){
2180 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2186 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2188 std::map<int, int> SplitPoints;
2189 std::map<int, int> SplitLength;
2190 std::map<int, int>::iterator SLiter;
2194 PropertyType PropType = PROPERTY_NONE;
2196 // Look for type before continuing.
2199 wxString TelTypeDetail;
2200 wxString PropertyData;
2201 wxString PropertyName;
2202 wxString PropertyValue;
2203 wxString PropertyTokens;
2205 std::map<int,int> TypeSplitPoints;
2206 std::map<int,int> TypeSplitLength;
2207 std::map<int,int>::iterator TSLiter;
2209 int intSplitSize = 0;
2210 int intSplitsFound = 0;
2211 int intSplitPoint = 0;
2213 int intPrevValue = 5;
2215 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2219 // Look for type before continuing.
2221 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2222 intiter != SplitPoints.end(); ++intiter){
2224 SLiter = SplitLength.find(intiter->first);
2226 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2228 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2229 PropertyName = PropertyElement.GetNextToken();
2230 PropertyValue = PropertyElement.GetNextToken();
2232 intPrevValue = intiter->second;
2234 if (PropertyName == wxT("TYPE")){
2236 // Process each value in type and translate each
2239 // Strip out the quotes if they are there.
2241 size_t intPropertyValueLen = PropertyValue.Len();
2243 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2245 PropertyValue.Trim();
2246 PropertyValue.RemoveLast();
2250 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2252 PropertyValue.Remove(0, 1);
2256 TelTypeDetail = PropertyValue;
2262 for (int i = 0; i <= intPropertyValueLen; i++){
2266 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2268 if (intSplitsFound == 0){
2270 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2271 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2275 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2276 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2289 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2290 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2292 int intTypeSeek = 0;
2294 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2295 typeiter != TypeSplitPoints.end(); ++typeiter){
2297 wxString TypePropertyName;
2299 TSLiter = TypeSplitLength.find(typeiter->first);
2301 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2303 if (intTypeSeek == 0){
2308 TelTypeUI.Append(wxT(","));
2312 if (TypePropertyName == wxT("home")){
2314 PropType = PROPERTY_HOME;
2316 } else if (TypePropertyName == wxT("work")){
2318 PropType = PROPERTY_WORK;
2323 if (TypePropertyName == wxT("text")){
2325 TelTypeUI.Append(_("text"));
2328 } else if (TypePropertyName == wxT("voice")){
2330 TelTypeUI.Append(_("voice"));
2333 } else if (TypePropertyName == wxT("fax")){
2335 TelTypeUI.Append(_("fax"));
2338 } else if (TypePropertyName == wxT("cell")){
2340 TelTypeUI.Append(_("mobile"));
2343 } else if (TypePropertyName == wxT("video")){
2345 TelTypeUI.Append(_("video"));
2348 } else if (TypePropertyName == wxT("pager")){
2350 TelTypeUI.Append(_("pager"));
2353 } else if (TypePropertyName == wxT("textphone")){
2355 TelTypeUI.Append(_("textphone"));
2366 std::map<int, wxString> *TelephoneList = NULL;
2367 std::map<int, wxString> *TelephoneListType = NULL;
2368 std::map<int, wxString> *TelephoneListAltID = NULL;
2369 std::map<int, wxString> *TelephoneListPID = NULL;
2370 std::map<int, wxString> *TelephoneListTokens = NULL;
2371 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2372 std::map<int, int> *TelephoneListPref = NULL;
2376 TelephoneList = &GeneralTelephoneList;
2377 TelephoneListType = &GeneralTelephoneListType;
2378 TelephoneListAltID = &GeneralTelephoneListAltID;
2379 TelephoneListPID = &GeneralTelephoneListPID;
2380 TelephoneListTokens = &GeneralTelephoneListTokens;
2381 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2382 TelephoneListPref = &GeneralTelephoneListPref;
2385 TelephoneList = &HomeTelephoneList;
2386 TelephoneListType = &HomeTelephoneListType;
2387 TelephoneListAltID = &HomeTelephoneListAltID;
2388 TelephoneListPID = &HomeTelephoneListPID;
2389 TelephoneListTokens = &HomeTelephoneListTokens;
2390 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2391 TelephoneListPref = &HomeTelephoneListPref;
2394 TelephoneList = &BusinessTelephoneList;
2395 TelephoneListType = &BusinessTelephoneListType;
2396 TelephoneListAltID = &BusinessTelephoneListAltID;
2397 TelephoneListPID = &BusinessTelephoneListPID;
2398 TelephoneListTokens = &BusinessTelephoneListTokens;
2399 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2400 TelephoneListPref = &BusinessTelephoneListPref;
2404 // Process the properties.
2406 bool FirstToken = TRUE;
2409 SplitPoints.clear();
2410 SplitLength.clear();
2412 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2416 bool PropertyMatched = FALSE;
2418 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2419 intiter != SplitPoints.end(); ++intiter){
2421 SLiter = SplitLength.find(intiter->first);
2423 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2425 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2426 PropertyName = PropertyElement.GetNextToken();
2427 PropertyValue = PropertyElement.GetNextToken();
2429 intPrevValue = intiter->second;
2431 CaptureString(&PropertyValue, FALSE);
2433 // Process properties.
2435 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2436 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2437 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2439 if (PropertyMatched == TRUE){
2441 PropertyMatched = FALSE;
2446 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2448 if (FirstToken == TRUE){
2450 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2455 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2463 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2464 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2466 // Add the name token data.
2468 if (!PropertyTokens.IsEmpty()){
2470 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2476 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2478 std::map<int, int> SplitPoints;
2479 std::map<int, int> SplitLength;
2481 int intPrevValue = 6;
2484 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2488 PropertyType PropType = PROPERTY_NONE;
2490 // Look for type before continuing.
2492 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2494 std::map<int, wxString> *LanguageList = NULL;
2495 std::map<int, wxString> *LanguageListType = NULL;
2496 std::map<int, wxString> *LanguageListAltID = NULL;
2497 std::map<int, wxString> *LanguageListPID = NULL;
2498 std::map<int, wxString> *LanguageListTokens = NULL;
2499 std::map<int, int> *LanguageListPref = NULL;
2503 LanguageList = &GeneralLanguageList;
2504 LanguageListType = &GeneralLanguageListType;
2505 LanguageListAltID = &GeneralLanguageListAltID;
2506 LanguageListPID = &GeneralLanguageListPID;
2507 LanguageListTokens = &GeneralLanguageListTokens;
2508 LanguageListPref = &GeneralLanguageListPref;
2511 LanguageList = &HomeLanguageList;
2512 LanguageListType = &HomeLanguageListType;
2513 LanguageListAltID = &HomeLanguageListAltID;
2514 LanguageListPID = &HomeLanguageListPID;
2515 LanguageListTokens = &HomeLanguageListTokens;
2516 LanguageListPref = &HomeLanguageListPref;
2519 LanguageList = &BusinessLanguageList;
2520 LanguageListType = &BusinessLanguageListType;
2521 LanguageListAltID = &BusinessLanguageListAltID;
2522 LanguageListPID = &BusinessLanguageListPID;
2523 LanguageListTokens = &BusinessLanguageListTokens;
2524 LanguageListPref = &BusinessLanguageListPref;
2530 std::map<int,int>::iterator SLiter;
2531 wxString PropertyData;
2532 wxString PropertyName;
2533 wxString PropertyValue;
2534 wxString PropertyTokens;
2535 bool FirstToken = TRUE;
2536 bool PropertyMatched = FALSE;
2538 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2539 intiter != SplitPoints.end(); ++intiter){
2541 SLiter = SplitLength.find(intiter->first);
2543 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2545 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2546 PropertyName = PropertyElement.GetNextToken();
2547 PropertyValue = PropertyElement.GetNextToken();
2549 intPrevValue = intiter->second;
2551 CaptureString(&PropertyValue, FALSE);
2553 // Process properties.
2555 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2556 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2557 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2559 if (PropertyMatched == TRUE){
2561 PropertyMatched = FALSE;
2566 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2568 if (FirstToken == TRUE){
2570 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2575 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2583 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2585 // Add the name token data.
2587 if (!PropertyTokens.IsEmpty()){
2589 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2595 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2597 std::map<int, int> SplitPoints;
2598 std::map<int, int> SplitLength;
2600 int intPrevValue = 5;
2603 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2607 PropertyType PropType = PROPERTY_NONE;
2609 // Look for type before continuing.
2611 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2613 std::map<int, wxString> *GeopositionList = NULL;
2614 std::map<int, wxString> *GeopositionListType = NULL;
2615 std::map<int, wxString> *GeopositionListAltID = NULL;
2616 std::map<int, wxString> *GeopositionListPID = NULL;
2617 std::map<int, wxString> *GeopositionListTokens = NULL;
2618 std::map<int, wxString> *GeopositionListMediatype = NULL;
2619 std::map<int, int> *GeopositionListPref = NULL;
2623 GeopositionList = &GeneralGeographyList;
2624 GeopositionListType = &GeneralGeographyListType;
2625 GeopositionListAltID = &GeneralGeographyListAltID;
2626 GeopositionListPID = &GeneralGeographyListPID;
2627 GeopositionListTokens = &GeneralGeographyListTokens;
2628 GeopositionListMediatype = &GeneralGeographyListMediatype;
2629 GeopositionListPref = &GeneralGeographyListPref;
2632 GeopositionList = &HomeGeographyList;
2633 GeopositionListType = &HomeGeographyListType;
2634 GeopositionListAltID = &HomeGeographyListAltID;
2635 GeopositionListPID = &HomeGeographyListPID;
2636 GeopositionListTokens = &HomeGeographyListTokens;
2637 GeopositionListMediatype = &HomeGeographyListMediatype;
2638 GeopositionListPref = &HomeGeographyListPref;
2641 GeopositionList = &BusinessGeographyList;
2642 GeopositionListType = &BusinessGeographyListType;
2643 GeopositionListAltID = &BusinessGeographyListAltID;
2644 GeopositionListPID = &BusinessGeographyListPID;
2645 GeopositionListTokens = &BusinessGeographyListTokens;
2646 GeopositionListMediatype = &BusinessGeographyListMediatype;
2647 GeopositionListPref = &BusinessGeographyListPref;
2653 std::map<int,int>::iterator SLiter;
2654 wxString PropertyData;
2655 wxString PropertyName;
2656 wxString PropertyValue;
2657 wxString PropertyTokens;
2658 bool FirstToken = TRUE;
2659 bool PropertyMatched = FALSE;
2661 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2662 intiter != SplitPoints.end(); ++intiter){
2664 SLiter = SplitLength.find(intiter->first);
2666 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2668 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2669 PropertyName = PropertyElement.GetNextToken();
2670 PropertyValue = PropertyElement.GetNextToken();
2672 intPrevValue = intiter->second;
2674 CaptureString(&PropertyValue, FALSE);
2676 // Process properties.
2678 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2679 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2680 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2681 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2683 if (PropertyMatched == TRUE){
2685 PropertyMatched = FALSE;
2690 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2692 if (FirstToken == TRUE){
2694 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2699 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2707 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2709 // Add the name token data.
2711 if (!PropertyTokens.IsEmpty()){
2713 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2719 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2721 size_t intPropertyLen = PropertySeg1.Len();
2722 std::map<int, int> SplitPoints;
2723 std::map<int, int> SplitLength;
2724 std::map<int, int>::iterator SLiter;
2725 wxString PropertyData;
2726 wxString PropertyName;
2727 wxString PropertyValue;
2728 wxString PropertyTokens;
2729 wxString RelatedType;
2730 wxString RelatedTypeOriginal;
2731 wxString RelatedName;
2732 bool FirstToken = TRUE;
2733 int intSplitsFound = 0;
2734 int intSplitSize = 0;
2735 int intPrevValue = 9;
2739 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2743 // Look for type before continuing.
2745 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2746 intiter != SplitPoints.end(); ++intiter){
2748 SLiter = SplitLength.find(intiter->first);
2750 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2752 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2753 PropertyName = PropertyElement.GetNextToken();
2754 PropertyValue = PropertyElement.GetNextToken();
2756 intPrevValue = intiter->second;
2760 RelatedTypeOriginal = PropertyValue;
2762 if (PropertyName == wxT("TYPE")){
2764 if (PropertyValue == wxT("contact")){
2766 RelatedType = _("Contact");
2768 } else if (PropertyValue == wxT("acquaintance")){
2770 RelatedType = _("Acquaintance");
2772 } else if (PropertyValue == wxT("friend")){
2774 RelatedType = _("Friend");
2776 } else if (PropertyValue == wxT("met")){
2778 RelatedType = _("Met");
2780 } else if (PropertyValue == wxT("co-worker")){
2782 RelatedType = _("Co-worker");
2784 } else if (PropertyValue == wxT("colleague")){
2786 RelatedType = _("Colleague");
2788 } else if (PropertyValue == wxT("co-resident")){
2790 RelatedType = _("Co-resident");
2792 } else if (PropertyValue == wxT("neighbor")){
2794 RelatedType = _("Neighbour");
2796 } else if (PropertyValue == wxT("child")){
2798 RelatedType = _("Child");
2800 } else if (PropertyValue == wxT("parent")){
2802 RelatedType = _("Parent");
2804 } else if (PropertyValue == wxT("sibling")){
2806 RelatedType = _("Sibling");
2808 } else if (PropertyValue == wxT("spouse")){
2810 RelatedType = _("Spouse");
2812 } else if (PropertyValue == wxT("kin")){
2814 RelatedType = _("Kin");
2816 } else if (PropertyValue == wxT("muse")){
2818 RelatedType = _("Muse");
2820 } else if (PropertyValue == wxT("crush")){
2822 RelatedType = _("Crush");
2824 } else if (PropertyValue == wxT("date")){
2826 RelatedType = _("Date");
2828 } else if (PropertyValue == wxT("sweetheart")){
2830 RelatedType = _("Sweetheart");
2832 } else if (PropertyValue == wxT("me")){
2834 RelatedType = _("Me");
2836 } else if (PropertyValue == wxT("agent")){
2838 RelatedType = _("Agent");
2840 } else if (PropertyValue == wxT("emergency")){
2842 RelatedType = _("Emergency");
2846 RelatedType = PropertyValue;
2856 bool PropertyMatched = FALSE;
2858 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2859 intiter != SplitPoints.end(); ++intiter){
2861 SLiter = SplitLength.find(intiter->first);
2863 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2865 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2866 PropertyName = PropertyElement.GetNextToken();
2867 PropertyValue = PropertyElement.GetNextToken();
2869 intPrevValue = intiter->second;
2871 // Process properties.
2873 size_t intPropertyValueLen = PropertyValue.Len();
2875 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2877 PropertyValue.Trim();
2878 PropertyValue.RemoveLast();
2882 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2884 PropertyValue.Remove(0, 1);
2888 CaptureString(&PropertyValue, FALSE);
2890 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2891 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2892 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2893 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2895 if (PropertyMatched == TRUE){
2897 PropertyMatched = FALSE;
2902 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
2904 if (FirstToken == TRUE){
2906 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
2911 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
2919 // Add the data to the General/Home/Work address variables.
2921 GeneralRelatedList.erase(*RelatedCount);
2922 GeneralRelatedListRelType.erase(*RelatedCount);
2923 GeneralRelatedListType.erase(*RelatedCount);
2924 GeneralRelatedListTokens.erase(*RelatedCount);
2925 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2926 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2927 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2928 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2932 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2934 std::map<int, int> SplitPoints;
2935 std::map<int, int> SplitLength;
2936 std::map<int, int>::iterator SLiter;
2937 wxString PropertyData;
2938 wxString PropertyName;
2939 wxString PropertyValue;
2940 wxString PropertyTokens;
2941 bool FirstToken = TRUE;
2942 int intPrevValue = 5;
2947 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2951 PropertyType PropType = PROPERTY_NONE;
2953 // Look for type before continuing.
2955 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2957 // Setup the pointers.
2959 std::map<int, wxString> *WebsiteList = NULL;
2960 std::map<int, wxString> *WebsiteListAltID = NULL;
2961 std::map<int, wxString> *WebsiteListPID = NULL;
2962 std::map<int, wxString> *WebsiteListType = NULL;
2963 std::map<int, wxString> *WebsiteListTokens = NULL;
2964 std::map<int, wxString> *WebsiteListMediatype = NULL;
2965 std::map<int, int> *WebsiteListPref = NULL;
2967 // Setup blank lines for later on.
2971 WebsiteList = &GeneralWebsiteList;
2972 WebsiteListType = &GeneralWebsiteListType;
2973 WebsiteListAltID = &GeneralWebsiteListAltID;
2974 WebsiteListPID = &GeneralWebsiteListPID;
2975 WebsiteListTokens = &GeneralWebsiteListTokens;
2976 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2977 WebsiteListPref = &GeneralWebsiteListPref;
2980 WebsiteList = &HomeWebsiteList;
2981 WebsiteListType = &HomeWebsiteListType;
2982 WebsiteListAltID = &HomeWebsiteListAltID;
2983 WebsiteListPID = &HomeWebsiteListPID;
2984 WebsiteListTokens = &HomeWebsiteListTokens;
2985 WebsiteListMediatype = &HomeWebsiteListMediatype;
2986 WebsiteListPref = &HomeWebsiteListPref;
2989 WebsiteList = &BusinessWebsiteList;
2990 WebsiteListType = &BusinessWebsiteListType;
2991 WebsiteListAltID = &BusinessWebsiteListAltID;
2992 WebsiteListPID = &BusinessWebsiteListPID;
2993 WebsiteListTokens = &BusinessWebsiteListTokens;
2994 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2995 WebsiteListPref = &BusinessWebsiteListPref;
3000 bool PropertyMatched = FALSE;
3002 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3003 intiter != SplitPoints.end(); ++intiter){
3005 SLiter = SplitLength.find(intiter->first);
3007 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3009 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3010 PropertyName = PropertyElement.GetNextToken();
3011 PropertyValue = PropertyElement.GetNextToken();
3013 intPrevValue = intiter->second;
3015 // Process properties.
3017 size_t intPropertyValueLen = PropertyValue.Len();
3019 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3021 PropertyValue.Trim();
3022 PropertyValue.RemoveLast();
3026 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3028 PropertyValue.Remove(0, 1);
3032 CaptureString(&PropertyValue, FALSE);
3034 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
3035 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
3036 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
3037 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
3039 if (PropertyMatched == TRUE){
3041 PropertyMatched = FALSE;
3046 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3048 if (FirstToken == TRUE){
3050 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3055 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3063 // Add the data to the General/Home/Work address variables.
3065 CaptureString(&PropertySeg2, FALSE);
3067 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
3069 if (!PropertyTokens.IsEmpty()){
3071 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
3077 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
3079 std::map<int, int> SplitPoints;
3080 std::map<int, int> SplitLength;
3081 std::map<int, int>::iterator SLiter;
3082 wxString PropertyData;
3083 wxString PropertyName;
3084 wxString PropertyValue;
3085 wxString PropertyTokens;
3086 bool FirstToken = TRUE;
3087 int intPrevValue = 7;
3092 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3096 PropertyType PropType = PROPERTY_NONE;
3098 // Look for type before continuing.
3100 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3102 // Setup the pointers.
3104 std::map<int, wxString> *TitleList = NULL;
3105 std::map<int, wxString> *TitleListAltID = NULL;
3106 std::map<int, wxString> *TitleListPID = NULL;
3107 std::map<int, wxString> *TitleListType = NULL;
3108 std::map<int, wxString> *TitleListTokens = NULL;
3109 std::map<int, wxString> *TitleListLanguage = NULL;
3110 std::map<int, int> *TitleListPref = NULL;
3112 // Setup blank lines for later on.
3116 TitleList = &GeneralTitleList;
3117 TitleListType = &GeneralTitleListType;
3118 TitleListAltID = &GeneralTitleListAltID;
3119 TitleListPID = &GeneralTitleListPID;
3120 TitleListTokens = &GeneralTitleListTokens;
3121 TitleListLanguage = &GeneralTitleListLanguage;
3122 TitleListPref = &GeneralTitleListPref;
3125 TitleList = &HomeTitleList;
3126 TitleListType = &HomeTitleListType;
3127 TitleListAltID = &HomeTitleListAltID;
3128 TitleListPID = &HomeTitleListPID;
3129 TitleListTokens = &HomeTitleListTokens;
3130 TitleListLanguage = &HomeTitleListLanguage;
3131 TitleListPref = &HomeTitleListPref;
3134 TitleList = &BusinessTitleList;
3135 TitleListType = &BusinessTitleListType;
3136 TitleListAltID = &BusinessTitleListAltID;
3137 TitleListPID = &BusinessTitleListPID;
3138 TitleListTokens = &BusinessTitleListTokens;
3139 TitleListLanguage = &BusinessTitleListLanguage;
3140 TitleListPref = &BusinessTitleListPref;
3145 bool PropertyMatched = FALSE;
3147 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3148 intiter != SplitPoints.end(); ++intiter){
3150 SLiter = SplitLength.find(intiter->first);
3152 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3154 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3155 PropertyName = PropertyElement.GetNextToken();
3156 PropertyValue = PropertyElement.GetNextToken();
3158 intPrevValue = intiter->second;
3160 // Process properties.
3162 size_t intPropertyValueLen = PropertyValue.Len();
3164 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3166 PropertyValue.Trim();
3167 PropertyValue.RemoveLast();
3171 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3173 PropertyValue.Remove(0, 1);
3177 CaptureString(&PropertyValue, FALSE);
3179 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
3180 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
3181 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
3182 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
3184 if (PropertyMatched == TRUE){
3186 PropertyMatched = FALSE;
3191 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3193 if (FirstToken == TRUE){
3195 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3200 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3208 // Add the data to the General/Home/Work address variables.
3210 CaptureString(&PropertySeg2, FALSE);
3212 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
3214 if (!PropertyTokens.IsEmpty()){
3216 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
3222 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
3224 std::map<int, int> SplitPoints;
3225 std::map<int, int> SplitLength;
3226 std::map<int, int>::iterator SLiter;
3227 wxString PropertyData;
3228 wxString PropertyName;
3229 wxString PropertyValue;
3230 wxString PropertyTokens;
3231 bool FirstToken = TRUE;
3232 int intPrevValue = 6;
3237 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3241 PropertyType PropType = PROPERTY_NONE;
3243 // Look for type before continuing.
3245 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3247 // Setup the pointers.
3249 std::map<int, wxString> *RoleList = NULL;
3250 std::map<int, wxString> *RoleListAltID = NULL;
3251 std::map<int, wxString> *RoleListPID = NULL;
3252 std::map<int, wxString> *RoleListType = NULL;
3253 std::map<int, wxString> *RoleListTokens = NULL;
3254 std::map<int, wxString> *RoleListLanguage = NULL;
3255 std::map<int, int> *RoleListPref = NULL;
3257 // Setup blank lines for later on.
3261 RoleList = &GeneralRoleList;
3262 RoleListType = &GeneralRoleListType;
3263 RoleListAltID = &GeneralRoleListAltID;
3264 RoleListPID = &GeneralRoleListPID;
3265 RoleListTokens = &GeneralRoleListTokens;
3266 RoleListLanguage = &GeneralRoleListLanguage;
3267 RoleListPref = &GeneralRoleListPref;
3270 RoleList = &HomeRoleList;
3271 RoleListType = &HomeRoleListType;
3272 RoleListAltID = &HomeRoleListAltID;
3273 RoleListPID = &HomeRoleListPID;
3274 RoleListTokens = &HomeRoleListTokens;
3275 RoleListLanguage = &HomeRoleListLanguage;
3276 RoleListPref = &HomeRoleListPref;
3279 RoleList = &BusinessRoleList;
3280 RoleListType = &BusinessRoleListType;
3281 RoleListAltID = &BusinessRoleListAltID;
3282 RoleListPID = &BusinessRoleListPID;
3283 RoleListTokens = &BusinessRoleListTokens;
3284 RoleListLanguage = &BusinessRoleListLanguage;
3285 RoleListPref = &BusinessRoleListPref;
3290 bool PropertyMatched = FALSE;
3292 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3293 intiter != SplitPoints.end(); ++intiter){
3295 SLiter = SplitLength.find(intiter->first);
3297 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3299 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3300 PropertyName = PropertyElement.GetNextToken();
3301 PropertyValue = PropertyElement.GetNextToken();
3303 intPrevValue = intiter->second;
3305 // Process properties.
3307 size_t intPropertyValueLen = PropertyValue.Len();
3309 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3311 PropertyValue.Trim();
3312 PropertyValue.RemoveLast();
3316 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3318 PropertyValue.Remove(0, 1);
3322 CaptureString(&PropertyValue, FALSE);
3324 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3325 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3326 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3327 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3329 if (PropertyMatched == TRUE){
3331 PropertyMatched = FALSE;
3336 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3338 if (FirstToken == TRUE){
3340 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3345 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3353 // Add the data to the General/Home/Work address variables.
3355 CaptureString(&PropertySeg2, FALSE);
3357 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3359 if (!PropertyTokens.IsEmpty()){
3361 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3367 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3369 std::map<int, int> SplitPoints;
3370 std::map<int, int> SplitLength;
3371 std::map<int, int>::iterator SLiter;
3372 wxString PropertyData;
3373 wxString PropertyName;
3374 wxString PropertyValue;
3375 wxString PropertyTokens;
3376 bool FirstToken = TRUE;
3377 int intPrevValue = 5;
3382 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3386 PropertyType PropType = PROPERTY_NONE;
3388 // Look for type before continuing.
3390 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3392 // Setup the pointers.
3394 std::map<int, wxString> *OrganisationsList = NULL;
3395 std::map<int, wxString> *OrganisationsListAltID = NULL;
3396 std::map<int, wxString> *OrganisationsListPID = NULL;
3397 std::map<int, wxString> *OrganisationsListType = NULL;
3398 std::map<int, wxString> *OrganisationsListTokens = NULL;
3399 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3400 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3401 std::map<int, int> *OrganisationsListPref = NULL;
3403 // Setup blank lines for later on.
3407 OrganisationsList = &GeneralOrganisationsList;
3408 OrganisationsListType = &GeneralOrganisationsListType;
3409 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3410 OrganisationsListPID = &GeneralOrganisationsListPID;
3411 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3412 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3413 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3414 OrganisationsListPref = &GeneralOrganisationsListPref;
3417 OrganisationsList = &HomeOrganisationsList;
3418 OrganisationsListType = &HomeOrganisationsListType;
3419 OrganisationsListAltID = &HomeOrganisationsListAltID;
3420 OrganisationsListPID = &HomeOrganisationsListPID;
3421 OrganisationsListTokens = &HomeOrganisationsListTokens;
3422 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3423 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3424 OrganisationsListPref = &HomeOrganisationsListPref;
3427 OrganisationsList = &BusinessOrganisationsList;
3428 OrganisationsListType = &BusinessOrganisationsListType;
3429 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3430 OrganisationsListPID = &BusinessOrganisationsListPID;
3431 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3432 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3433 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3434 OrganisationsListPref = &BusinessOrganisationsListPref;
3439 bool PropertyMatched = FALSE;
3441 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3442 intiter != SplitPoints.end(); ++intiter){
3444 SLiter = SplitLength.find(intiter->first);
3446 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3448 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3449 PropertyName = PropertyElement.GetNextToken();
3450 PropertyValue = PropertyElement.GetNextToken();
3452 intPrevValue = intiter->second;
3454 // Process properties.
3456 size_t intPropertyValueLen = PropertyValue.Len();
3458 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3460 PropertyValue.Trim();
3461 PropertyValue.RemoveLast();
3465 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3467 PropertyValue.Remove(0, 1);
3471 CaptureString(&PropertyValue, FALSE);
3473 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3474 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3475 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3476 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3477 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3479 if (PropertyMatched == TRUE){
3481 PropertyMatched = FALSE;
3486 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3488 if (FirstToken == TRUE){
3490 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3495 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3503 // Add the data to the General/Home/Work address variables.
3505 CaptureString(&PropertySeg2, FALSE);
3507 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3509 if (!PropertyTokens.IsEmpty()){
3511 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3517 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3519 std::map<int, int> SplitPoints;
3520 std::map<int, int> SplitLength;
3521 std::map<int, int>::iterator SLiter;
3522 wxString PropertyData;
3523 wxString PropertyName;
3524 wxString PropertyValue;
3525 wxString PropertyTokens;
3526 bool FirstToken = TRUE;
3527 int intPrevValue = 6;
3532 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3536 PropertyType PropType = PROPERTY_NONE;
3538 // Look for type before continuing.
3540 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3542 // Setup the pointers.
3544 std::map<int, wxString> *NoteList = NULL;
3545 std::map<int, wxString> *NoteListAltID = NULL;
3546 std::map<int, wxString> *NoteListPID = NULL;
3547 std::map<int, wxString> *NoteListType = NULL;
3548 std::map<int, wxString> *NoteListTokens = NULL;
3549 std::map<int, wxString> *NoteListLanguage = NULL;
3550 std::map<int, int> *NoteListPref = NULL;
3552 // Setup blank lines for later on.
3556 NoteList = &GeneralNoteList;
3557 NoteListType = &GeneralNoteListType;
3558 NoteListAltID = &GeneralNoteListAltID;
3559 NoteListPID = &GeneralNoteListPID;
3560 NoteListTokens = &GeneralNoteListTokens;
3561 NoteListLanguage = &GeneralNoteListLanguage;
3562 NoteListPref = &GeneralNoteListPref;
3565 NoteList = &HomeNoteList;
3566 NoteListType = &HomeNoteListType;
3567 NoteListAltID = &HomeNoteListAltID;
3568 NoteListPID = &HomeNoteListPID;
3569 NoteListTokens = &HomeNoteListTokens;
3570 NoteListLanguage = &HomeNoteListLanguage;
3571 NoteListPref = &HomeNoteListPref;
3574 NoteList = &BusinessNoteList;
3575 NoteListType = &BusinessNoteListType;
3576 NoteListAltID = &BusinessNoteListAltID;
3577 NoteListPID = &BusinessNoteListPID;
3578 NoteListTokens = &BusinessNoteListTokens;
3579 NoteListLanguage = &BusinessNoteListLanguage;
3580 NoteListPref = &BusinessNoteListPref;
3585 bool PropertyMatched = FALSE;
3587 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3588 intiter != SplitPoints.end(); ++intiter){
3590 SLiter = SplitLength.find(intiter->first);
3592 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3594 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3595 PropertyName = PropertyElement.GetNextToken();
3596 PropertyValue = PropertyElement.GetNextToken();
3598 intPrevValue = intiter->second;
3600 // Process properties.
3602 size_t intPropertyValueLen = PropertyValue.Len();
3604 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3606 PropertyValue.Trim();
3607 PropertyValue.RemoveLast();
3611 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3613 PropertyValue.Remove(0, 1);
3617 CaptureString(&PropertyValue, FALSE);
3619 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3620 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3621 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3622 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3624 if (PropertyMatched == TRUE){
3626 PropertyMatched = FALSE;
3631 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3633 if (FirstToken == TRUE){
3635 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3640 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3648 // Add the data to the General/Home/Work address variables.
3650 CaptureString(&PropertySeg2, FALSE);
3652 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3654 if (!PropertyTokens.IsEmpty()){
3656 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3662 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3664 std::map<int, int> SplitPoints;
3665 std::map<int, int> SplitLength;
3666 std::map<int, int>::iterator SLiter;
3667 wxString PropertyData;
3668 wxString PropertyName;
3669 wxString PropertyValue;
3670 wxString PropertyTokens;
3671 bool FirstToken = TRUE;
3672 int intPrevValue = 12;
3677 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3681 PropertyType PropType = PROPERTY_NONE;
3683 // Look for type before continuing.
3685 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3687 // Setup blank lines for later on.
3693 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3696 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3701 bool PropertyMatched = FALSE;
3703 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3704 intiter != SplitPoints.end(); ++intiter){
3706 SLiter = SplitLength.find(intiter->first);
3708 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3710 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3711 PropertyName = PropertyElement.GetNextToken();
3712 PropertyValue = PropertyElement.GetNextToken();
3714 intPrevValue = intiter->second;
3716 // Process properties.
3718 size_t intPropertyValueLen = PropertyValue.Len();
3720 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3722 PropertyValue.Trim();
3723 PropertyValue.RemoveLast();
3727 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3729 PropertyValue.Remove(0, 1);
3733 CaptureString(&PropertyValue, FALSE);
3735 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3736 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3737 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3738 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3740 if (PropertyMatched == TRUE){
3742 PropertyMatched = FALSE;
3747 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
3749 if (FirstToken == TRUE){
3751 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
3756 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
3764 // Deal with multiple categories.
3766 int intOrigCatCount = *CategoryCount;
3767 bool FirstCategoryProcessed = TRUE;
3768 bool AfterFirstToken = FALSE;
3769 int intSplitSize = 0;
3770 int intSplitsFound = 0;
3771 int intSplitSeek = 0;
3772 int intPropertyLen = PropertySeg2.Len();
3774 SplitPoints.clear();
3775 SplitLength.clear();
3778 for (int i = 0; i <= intPropertyLen; i++){
3780 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3788 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3790 if (AfterFirstToken == TRUE){
3792 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3793 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3797 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3798 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3799 AfterFirstToken = TRUE;
3811 if (SplitPoints.size() > 0){
3813 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3814 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3818 if (SplitPoints.size() == 0){
3820 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3822 if (!PropertyTokens.IsEmpty()){
3824 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3830 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3831 intiter != SplitPoints.end(); ++intiter){
3833 SLiter = SplitLength.find(intiter->first);
3835 intPrevValue = intiter->second;
3837 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3839 // Add the data to the General/Home/Work address variables.
3841 // Trim any whitespace from the start and end.
3843 PropertyData = PropertyData.Trim(FALSE);
3844 PropertyData = PropertyData.Trim(TRUE);
3846 CaptureString(&PropertyData, FALSE);
3848 if (FirstCategoryProcessed == TRUE){
3850 FirstCategoryProcessed = FALSE;
3852 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3854 if (!PropertyTokens.IsEmpty()){
3856 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3866 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3868 if (!PropertyTokens.IsEmpty()){
3870 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3876 // Copy the properties to each of the categories (if it exists).
3878 if (!PropertyTokens.IsEmpty()){
3880 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3884 // Check if ALTID was used.
3886 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3888 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3892 // Check if PID was used.
3894 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3896 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3900 // Check if PREF was used.
3902 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3904 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3908 // Check if LANGUAGE was used.
3910 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3912 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3916 // Check if TYPE was used.
3922 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3925 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3933 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3935 size_t intPropertyLen = PropertySeg1.Len();
3936 std::map<int, int> SplitPoints;
3937 std::map<int, int> SplitLength;
3938 std::map<int, int>::iterator SLiter;
3939 wxString PropertyData;
3940 wxString PropertyName;
3941 wxString PropertyValue;
3942 wxString PropertyTokens;
3943 bool FirstToken = TRUE;
3944 int intSplitsFound = 0;
3945 int intSplitSize = 0;
3946 int intPrevValue = 7;
3950 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3954 PropertyType PropType = PROPERTY_NONE;
3956 // Look for type before continuing.
3958 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3961 bool PropertyMatched = FALSE;
3963 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3964 intiter != SplitPoints.end(); ++intiter){
3966 SLiter = SplitLength.find(intiter->first);
3968 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3970 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3971 PropertyName = PropertyElement.GetNextToken();
3972 PropertyValue = PropertyElement.GetNextToken();
3974 intPrevValue = intiter->second;
3976 // Process properties.
3978 size_t intPropertyValueLen = PropertyValue.Len();
3980 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3982 PropertyValue.Trim();
3983 PropertyValue.RemoveLast();
3987 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3989 PropertyValue.Remove(0, 1);
3993 CaptureString(&PropertyValue, FALSE);
3995 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3996 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3997 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3998 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
4000 if (PropertyMatched == TRUE){
4002 PropertyMatched = FALSE;
4007 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4009 if (FirstToken == TRUE){
4011 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4016 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4024 intPropertyLen = PropertySeg2.Len();
4025 SplitPoints.clear();
4026 SplitLength.clear();
4031 CaptureString(&PropertySeg2, FALSE);
4033 for (int i = 0; i <= intPropertyLen; i++){
4037 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4040 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4042 if (intSplitsFound == 6){
4044 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4049 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4059 wxString wxSPhotoURI;
4060 wxString wxSPhotoMIME;
4061 wxString wxSPhotoEncoding;
4062 wxString wxSPhotoData;
4063 std::string base64enc;
4065 if (intSplitsFound == 0){
4069 std::map<int, int>::iterator striter;
4071 striter = SplitLength.find(1);
4073 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4075 while (wSTDataType.HasMoreTokens() == TRUE){
4077 wxSPhotoURI = wSTDataType.GetNextToken();
4078 wxSPhotoMIME = wSTDataType.GetNextToken();
4083 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4085 while (wSTDataInfo.HasMoreTokens() == TRUE){
4087 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4088 wxSPhotoData = wSTDataInfo.GetNextToken();
4089 base64enc = wxSPhotoData.mb_str();
4096 // Add the data to the General/Home/Work address variables.
4098 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
4099 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
4100 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
4106 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
4109 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
4113 if (!PropertyTokens.IsEmpty()){
4115 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
4121 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
4123 size_t intPropertyLen = PropertySeg1.Len();
4124 std::map<int, int> SplitPoints;
4125 std::map<int, int> SplitLength;
4126 std::map<int, int>::iterator SLiter;
4127 wxString PropertyData;
4128 wxString PropertyName;
4129 wxString PropertyValue;
4130 wxString PropertyTokens;
4131 bool FirstToken = TRUE;
4132 int intSplitsFound = 0;
4133 int intSplitSize = 0;
4134 int intPrevValue = 6;
4138 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4142 PropertyType PropType = PROPERTY_NONE;
4144 // Look for type before continuing.
4146 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4149 bool PropertyMatched = FALSE;
4151 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4152 intiter != SplitPoints.end(); ++intiter){
4154 SLiter = SplitLength.find(intiter->first);
4156 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4158 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4159 PropertyName = PropertyElement.GetNextToken();
4160 PropertyValue = PropertyElement.GetNextToken();
4162 intPrevValue = intiter->second;
4164 // Process properties.
4166 size_t intPropertyValueLen = PropertyValue.Len();
4168 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4170 PropertyValue.Trim();
4171 PropertyValue.RemoveLast();
4175 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4177 PropertyValue.Remove(0, 1);
4181 CaptureString(&PropertyValue, FALSE);
4183 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
4184 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
4185 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
4186 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
4188 if (PropertyMatched == TRUE){
4190 PropertyMatched = FALSE;
4195 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4197 if (FirstToken == TRUE){
4199 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4204 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4212 intPropertyLen = PropertySeg2.Len();
4213 SplitPoints.clear();
4214 SplitLength.clear();
4219 CaptureString(&PropertySeg2, FALSE);
4221 for (int i = 0; i <= intPropertyLen; i++){
4225 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4228 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4230 if (intSplitsFound == 6){
4232 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4237 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4247 wxString wxSPhotoURI;
4248 wxString wxSPhotoMIME;
4249 wxString wxSPhotoEncoding;
4250 wxString wxSPhotoData;
4251 std::string base64enc;
4253 if (intSplitsFound == 0){
4257 std::map<int, int>::iterator striter;
4259 striter = SplitLength.find(1);
4261 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4263 while (wSTDataType.HasMoreTokens() == TRUE){
4265 wxSPhotoURI = wSTDataType.GetNextToken();
4266 wxSPhotoMIME = wSTDataType.GetNextToken();
4271 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4273 while (wSTDataInfo.HasMoreTokens() == TRUE){
4275 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
4276 wxSPhotoData = wSTDataInfo.GetNextToken();
4277 base64enc = wxSPhotoData.mb_str();
4284 // Add the data to the General/Home/Work address variables.
4286 LogosList.insert(std::make_pair(*LogoCount, base64enc));
4287 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
4288 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
4294 LogosListType.insert(std::make_pair(*LogoCount, "home"));
4297 LogosListType.insert(std::make_pair(*LogoCount, "work"));
4301 if (!PropertyTokens.IsEmpty()){
4303 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
4309 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
4311 size_t intPropertyLen = PropertySeg1.Len();
4312 std::map<int, int> SplitPoints;
4313 std::map<int, int> SplitLength;
4314 std::map<int, int>::iterator SLiter;
4315 wxString PropertyData;
4316 wxString PropertyName;
4317 wxString PropertyValue;
4318 wxString PropertyTokens;
4319 bool FirstToken = TRUE;
4320 int intSplitsFound = 0;
4321 int intSplitSize = 0;
4322 int intPrevValue = 7;
4326 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4330 PropertyType PropType = PROPERTY_NONE;
4332 // Look for type before continuing.
4334 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4337 bool PropertyMatched = FALSE;
4339 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4340 intiter != SplitPoints.end(); ++intiter){
4342 SLiter = SplitLength.find(intiter->first);
4344 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4346 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4347 PropertyName = PropertyElement.GetNextToken();
4348 PropertyValue = PropertyElement.GetNextToken();
4350 intPrevValue = intiter->second;
4352 // Process properties.
4354 size_t intPropertyValueLen = PropertyValue.Len();
4356 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4358 PropertyValue.Trim();
4359 PropertyValue.RemoveLast();
4363 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4365 PropertyValue.Remove(0, 1);
4369 CaptureString(&PropertyValue, FALSE);
4371 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
4372 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
4373 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
4374 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
4375 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
4377 if (PropertyMatched == TRUE){
4379 PropertyMatched = FALSE;
4384 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4386 if (FirstToken == TRUE){
4388 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4393 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4401 intPropertyLen = PropertySeg2.Len();
4402 SplitPoints.clear();
4403 SplitLength.clear();
4408 CaptureString(&PropertySeg2, FALSE);
4410 for (int i = 0; i <= intPropertyLen; i++){
4414 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4417 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4419 if (intSplitsFound == 6){
4421 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4426 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4436 wxString wxSSoundURI;
4437 wxString wxSSoundMIME;
4438 wxString wxSSoundEncoding;
4439 wxString wxSSoundData;
4440 std::string base64enc;
4442 if (intSplitsFound == 0){
4446 std::map<int, int>::iterator striter;
4448 striter = SplitLength.find(1);
4450 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4452 while (wSTDataType.HasMoreTokens() == TRUE){
4454 wxSSoundURI = wSTDataType.GetNextToken();
4455 wxSSoundMIME = wSTDataType.GetNextToken();
4460 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4462 while (wSTDataInfo.HasMoreTokens() == TRUE){
4464 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4465 wxSSoundData = wSTDataInfo.GetNextToken();
4466 base64enc = wxSSoundData.mb_str();
4473 // Add the data to the General/Home/Work address variables.
4479 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4482 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4486 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4487 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4488 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4490 if (!PropertyTokens.IsEmpty()){
4492 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4498 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4500 size_t intPropertyLen = PropertySeg1.Len();
4501 std::map<int, int> SplitPoints;
4502 std::map<int, int> SplitLength;
4503 std::map<int, int>::iterator SLiter;
4504 wxString PropertyData;
4505 wxString PropertyName;
4506 wxString PropertyValue;
4507 wxString PropertyTokens;
4508 bool FirstToken = TRUE;
4509 int intSplitsFound = 0;
4510 int intSplitSize = 0;
4511 int intPrevValue = 8;
4515 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4519 PropertyType PropType = PROPERTY_NONE;
4521 // Look for type before continuing.
4523 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4526 bool PropertyMatched = FALSE;
4528 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4529 intiter != SplitPoints.end(); ++intiter){
4531 SLiter = SplitLength.find(intiter->first);
4533 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4535 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4536 PropertyName = PropertyElement.GetNextToken();
4537 PropertyValue = PropertyElement.GetNextToken();
4539 intPrevValue = intiter->second;
4541 // Process properties.
4543 size_t intPropertyValueLen = PropertyValue.Len();
4545 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4547 PropertyValue.Trim();
4548 PropertyValue.RemoveLast();
4552 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4554 PropertyValue.Remove(0, 1);
4558 CaptureString(&PropertyValue, FALSE);
4560 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4561 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4562 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4563 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4565 if (PropertyMatched == TRUE){
4567 PropertyMatched = FALSE;
4572 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4574 if (FirstToken == TRUE){
4576 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4581 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4589 intPropertyLen = PropertySeg2.Len();
4590 SplitPoints.clear();
4591 SplitLength.clear();
4596 CaptureString(&PropertySeg2, FALSE);
4598 // Add the data to the General/Home/Work address variables.
4604 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4607 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4611 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4613 if (!PropertyTokens.IsEmpty()){
4615 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4621 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4623 size_t intPropertyLen = PropertySeg1.Len();
4624 std::map<int, int> SplitPoints;
4625 std::map<int, int> SplitLength;
4626 std::map<int, int>::iterator SLiter;
4627 wxString PropertyData;
4628 wxString PropertyName;
4629 wxString PropertyValue;
4630 wxString PropertyTokens;
4631 bool FirstToken = TRUE;
4632 int intSplitsFound = 0;
4633 int intSplitSize = 0;
4634 int intPrevValue = 8;
4638 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4642 PropertyType PropType = PROPERTY_NONE;
4644 // Look for type before continuing.
4646 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4649 bool PropertyMatched = FALSE;
4651 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4652 intiter != SplitPoints.end(); ++intiter){
4654 SLiter = SplitLength.find(intiter->first);
4656 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4658 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4659 PropertyName = PropertyElement.GetNextToken();
4660 PropertyValue = PropertyElement.GetNextToken();
4662 intPrevValue = intiter->second;
4664 // Process properties.
4666 size_t intPropertyValueLen = PropertyValue.Len();
4668 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4670 PropertyValue.Trim();
4671 PropertyValue.RemoveLast();
4675 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4677 PropertyValue.Remove(0, 1);
4681 CaptureString(&PropertyValue, FALSE);
4683 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4684 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4685 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4686 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4688 if (PropertyMatched == TRUE){
4690 PropertyMatched = FALSE;
4695 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4697 if (FirstToken == TRUE){
4699 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4704 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4712 intPropertyLen = PropertySeg2.Len();
4713 SplitPoints.clear();
4714 SplitLength.clear();
4719 CaptureString(&PropertySeg2, FALSE);
4721 // Add the data to the General/Home/Work address variables.
4727 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4730 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4734 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4736 if (!PropertyTokens.IsEmpty()){
4738 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4744 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4746 size_t intPropertyLen = PropertySeg1.Len();
4747 std::map<int, int> SplitPoints;
4748 std::map<int, int> SplitLength;
4749 std::map<int, int>::iterator SLiter;
4750 wxString PropertyData;
4751 wxString PropertyName;
4752 wxString PropertyValue;
4753 wxString PropertyTokens;
4754 bool FirstToken = TRUE;
4755 int intSplitsFound = 0;
4756 int intSplitSize = 0;
4757 int intPrevValue = 7;
4761 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4765 PropertyType PropType = PROPERTY_NONE;
4767 // Look for type before continuing.
4769 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4772 bool PropertyMatched = FALSE;
4774 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4775 intiter != SplitPoints.end(); ++intiter){
4777 SLiter = SplitLength.find(intiter->first);
4779 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4781 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4782 PropertyName = PropertyElement.GetNextToken();
4783 PropertyValue = PropertyElement.GetNextToken();
4785 intPrevValue = intiter->second;
4787 // Process properties.
4789 size_t intPropertyValueLen = PropertyValue.Len();
4791 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4793 PropertyValue.Trim();
4794 PropertyValue.RemoveLast();
4798 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4800 PropertyValue.Remove(0, 1);
4804 CaptureString(&PropertyValue, FALSE);
4806 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4807 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4808 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4809 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4811 if (PropertyMatched == TRUE){
4813 PropertyMatched = FALSE;
4818 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4820 if (FirstToken == TRUE){
4822 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4827 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4835 intPropertyLen = PropertySeg2.Len();
4836 SplitPoints.clear();
4837 SplitLength.clear();
4842 CaptureString(&PropertySeg2, FALSE);
4844 // Add the data to the General/Home/Work address variables.
4850 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4853 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4857 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4859 if (!PropertyTokens.IsEmpty()){
4861 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4867 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4869 size_t intPropertyLen = PropertySeg1.Len();
4870 std::map<int, int> SplitPoints;
4871 std::map<int, int> SplitLength;
4872 std::map<int, int>::iterator SLiter;
4873 wxString PropertyData;
4874 wxString PropertyName;
4875 wxString PropertyValue;
4876 wxString PropertyTokens;
4877 bool FirstToken = TRUE;
4878 int intSplitsFound = 0;
4879 int intSplitSize = 0;
4880 int intPrevValue = 5;
4885 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4889 PropertyType PropType = PROPERTY_NONE;
4891 // Look for type before continuing.
4893 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4896 bool PropertyMatched = FALSE;
4898 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4899 intiter != SplitPoints.end(); ++intiter){
4901 SLiter = SplitLength.find(intiter->first);
4903 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4905 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4906 PropertyName = PropertyElement.GetNextToken();
4907 PropertyValue = PropertyElement.GetNextToken();
4909 intPrevValue = intiter->second;
4911 // Process properties.
4913 size_t intPropertyValueLen = PropertyValue.Len();
4915 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4917 PropertyValue.Trim();
4918 PropertyValue.RemoveLast();
4922 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4924 PropertyValue.Remove(0, 1);
4928 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4929 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4930 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4932 if (PropertyMatched == TRUE){
4934 PropertyMatched = FALSE;
4939 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
4941 if (FirstToken == TRUE){
4943 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
4948 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
4956 intPropertyLen = PropertySeg2.Len();
4957 SplitPoints.clear();
4958 SplitLength.clear();
4963 for (int i = 0; i <= intPropertyLen; i++){
4967 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4970 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4972 if (intSplitsFound == 6){
4974 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4979 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4990 wxString wxSKeyMIME;
4991 wxString wxSKeyEncoding;
4992 wxString wxSKeyData;
4993 std::string base64enc;
4995 if (intSplitsFound == 0){
4999 std::map<int, int>::iterator striter;
5001 striter = SplitLength.find(1);
5003 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
5005 while (wSTDataType.HasMoreTokens() == TRUE){
5007 wxSKeyURI = wSTDataType.GetNextToken();
5008 wxSKeyMIME = wSTDataType.GetNextToken();
5013 if (wxSKeyURI == wxT("data")){
5015 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
5017 while (wSTDataInfo.HasMoreTokens() == TRUE){
5019 wxSKeyEncoding = wSTDataInfo.GetNextToken();
5020 wxSKeyData = wSTDataInfo.GetNextToken();
5029 // Add the data to the General/Home/Work address variables.
5031 if (wxSKeyURI == wxT("data")){
5033 KeyListDataEncType.erase(*KeyCount);
5034 KeyListKeyType.erase(*KeyCount);
5035 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
5036 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
5038 KeyList.erase(*KeyCount);
5039 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
5043 KeyList.erase(*KeyCount);
5044 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
5048 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
5054 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
5057 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
5061 if (!PropertyTokens.IsEmpty()){
5063 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
5069 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
5071 // Split the Vendor three ways.
5073 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
5076 wxString wxSVNDPropName;
5079 while (wSTVendorDetails.HasMoreTokens() == TRUE){
5081 wSTVendorDetails.GetNextToken();
5082 wxSVNDID = wSTVendorDetails.GetNextToken();
5083 wxSVNDPropName = wSTVendorDetails.GetNextToken();
5088 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
5090 // Add the data to the vendor variables.
5092 VendorList.erase(*VendorCount);
5093 VendorListPEN.erase(*VendorCount);
5094 VendorListElement.erase(*VendorCount);
5096 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
5097 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
5098 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
5104 void ProcessTokens(wxString *PropertyName,
5105 wxString *PropertyValue,
5106 wxString *PropertyTokens,
5109 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5111 if (*FirstToken == TRUE){
5113 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5114 *FirstToken = FALSE;
5118 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5126 void ProcessStringValue(wxString *PropertyName,
5127 wxString PropertyNameMatch,
5128 std::map<int,wxString> *MapPtr,
5129 wxString *PropertyValue,
5131 bool *PropertyMatched){
5133 if (*PropertyName == PropertyNameMatch){
5134 MapPtr->erase(*ItemCount);
5135 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5136 *PropertyMatched = TRUE;
5141 void ProcessIntegerValue(wxString *PropertyName,
5142 wxString PropertyNameMatch,
5143 std::map<int,int> *PrefPtr,
5144 wxString *PropertyValue,
5146 bool *PropertyMatched){
5148 if (*PropertyName == PropertyNameMatch){
5149 *PropertyMatched = TRUE;
5154 int PriorityNumber = 0;
5155 bool ValidNumber = TRUE;
5158 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5161 catch(std::invalid_argument &e){
5162 ValidNumber = FALSE;
5165 if (ValidNumber == TRUE){
5167 PrefPtr->erase(*ItemCount);
5168 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5174 void SplitValues(wxString *PropertyLine,
5175 std::map<int,int> *SplitPoints,
5176 std::map<int,int> *SplitLength,
5179 size_t intPropertyLen = PropertyLine->Len();
5180 int intSplitsFound = 0;
5181 int intSplitSize = 0;
5182 int intSplitSeek = 0;
5184 for (int i = intSize; i <= intPropertyLen; i++){
5188 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5189 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5191 if (intSplitsFound == 0){
5193 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5197 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5201 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5211 if (intSplitsFound == 0){
5213 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5214 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5218 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5219 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5225 void CheckType(wxString *PropertySeg1,
5226 std::map<int,int> *SplitPoints,
5227 std::map<int,int> *SplitLength,
5229 PropertyType *PropType){
5231 wxString PropertyData;
5232 wxString PropertyName;
5233 wxString PropertyValue;
5234 std::map<int,int>::iterator SLiter;
5236 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5237 intiter != SplitPoints->end(); ++intiter){
5239 SLiter = SplitLength->find(intiter->first);
5241 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5243 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5244 PropertyName = PropertyElement.GetNextToken();
5245 PropertyValue = PropertyElement.GetNextToken();
5247 *intPrevValue = intiter->second;
5249 if (PropertyName == wxT("TYPE")){
5251 if (PropertyValue == wxT("work")){
5253 *PropType = PROPERTY_WORK;
5255 } else if (PropertyValue == wxT("home")){
5257 *PropType = PROPERTY_HOME;
5261 *PropType = PROPERTY_NONE;