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;
477 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
481 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
482 intiter != SplitPoints.end(); ++intiter){
484 SLiter = SplitLength.find(intiter->first);
485 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
486 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
487 intPrevValue = intiter->second;
489 // Process properties.
491 size_t intPropertyValueLen = PropertyValue.Len();
493 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
495 PropertyValue.Trim();
496 PropertyValue.RemoveLast();
500 if (PropertyValue.Mid(0, 1) == wxT("\"")){
502 PropertyValue.Remove(0, 1);
506 CaptureString(&PropertyValue, FALSE);
508 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
512 CaptureString(&PropertySeg2, FALSE);
514 Revision = PropertySeg2;
516 if (!PropertyTokens.IsEmpty()){
518 RevisionTokens = PropertyTokens;
525 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
527 size_t intPropertyLen = PropertySeg1.Len();
528 std::map<int, int> SplitPoints;
529 std::map<int, int> SplitLength;
530 std::map<int, int>::iterator SLiter;
531 wxString PropertyData;
532 wxString PropertyName;
533 wxString PropertyValue;
534 wxString PropertyTokens;
535 bool FirstToken = TRUE;
536 bool PropertyMatched = FALSE;
537 int intSplitsFound = 0;
538 int intSplitSize = 0;
539 int intPrevValue = 8;
541 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
545 PropertyType PropType = PROPERTY_NONE;
547 // Look for type before continuing.
549 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
553 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
554 intiter != SplitPoints.end(); ++intiter){
556 SLiter = SplitLength.find(intiter->first);
558 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
560 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
562 intPrevValue = intiter->second;
564 // Process properties.
566 size_t intPropertyValueLen = PropertyValue.Len();
568 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
570 PropertyValue.Trim();
571 PropertyValue.RemoveLast();
575 if (PropertyValue.Mid(0, 1) == wxT("\"")){
577 PropertyValue.Remove(0, 1);
581 CaptureString(&PropertyValue, FALSE);
583 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
584 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
585 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
586 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
588 if (PropertyMatched == TRUE){
590 PropertyMatched = FALSE;
595 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
599 intPropertyLen = PropertySeg2.Len();
606 CaptureString(&PropertySeg2, FALSE);
608 // Add the data to the General/Home/Work address variables.
614 SourceListType.insert(std::make_pair(*SourceCount, "home"));
617 SourceListType.insert(std::make_pair(*SourceCount, "work"));
621 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
623 if (!PropertyTokens.IsEmpty()){
625 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
631 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
633 std::map<int, int> SplitPoints;
634 std::map<int, int> SplitLength;
636 int intPrevValue = 5;
638 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
642 wxString PropertyName;
643 wxString PropertyValue;
644 wxString PropertyData;
645 wxString PropertyTokens;
646 std::map<int,int>::iterator SLiter;
647 bool FirstToken = TRUE;
648 bool PropertyMatched = FALSE;
650 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
651 intiter != SplitPoints.end(); ++intiter){
653 SLiter = SplitLength.find(intiter->first);
654 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
655 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
656 intPrevValue = intiter->second;
658 CaptureString(&PropertyValue, FALSE);
660 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
662 if (PropertyMatched == TRUE){
664 PropertyMatched = FALSE;
671 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
675 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
677 std::map<int, int> SplitPoints;
678 std::map<int, int> SplitLength;
680 int intPrevValue = 8;
682 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
686 wxString PropertyName;
687 wxString PropertyValue;
688 wxString PropertyData;
689 wxString PropertyTokens;
690 std::map<int,int>::iterator SLiter;
691 bool FirstToken = TRUE;
692 bool PropertyMatched = FALSE;
694 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
695 intiter != SplitPoints.end(); ++intiter){
697 SLiter = SplitLength.find(intiter->first);
698 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
699 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
700 intPrevValue = intiter->second;
702 CaptureString(&PropertyValue, FALSE);
704 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
705 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
706 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
707 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
709 if (PropertyMatched == TRUE){
711 PropertyMatched = FALSE;
716 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
720 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
722 if (!PropertyTokens.IsEmpty()){
724 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
731 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
733 std::map<int, int> SplitPoints;
734 std::map<int, int> SplitLength;
736 int intPrevValue = 4;
738 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
742 wxString PropertyName;
743 wxString PropertyValue;
744 wxString PropertyData;
745 wxString PropertyTokens;
746 std::map<int,int>::iterator SLiter;
747 bool FirstToken = TRUE;
748 bool PropertyMatched = FALSE;
750 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
751 intiter != SplitPoints.end(); ++intiter){
753 SLiter = SplitLength.find(intiter->first);
754 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
755 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
756 intPrevValue = intiter->second;
758 CaptureString(&PropertyValue, FALSE);
760 if (PropertyName == wxT("TYPE")){
762 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
763 PropertyValue == wxT("work") ){
765 FullNamesListType.erase(*FNCount);
766 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
770 PropertyMatched = TRUE;
774 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
775 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
776 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
777 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
779 if (PropertyMatched == TRUE){
781 PropertyMatched = FALSE;
786 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
790 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
792 if (!PropertyTokens.IsEmpty()){
794 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
800 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
802 std::map<int, int> SplitPoints;
803 std::map<int, int> SplitLength;
805 int intPrevValue = 3;
807 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
811 wxString PropertyName;
812 wxString PropertyValue;
813 wxString PropertyData;
814 wxString PropertyTokens;
815 std::map<int,int>::iterator SLiter;
816 bool FirstToken = TRUE;
818 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
819 intiter != SplitPoints.end(); ++intiter){
821 SLiter = SplitLength.find(intiter->first);
822 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
823 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
824 intPrevValue = intiter->second;
826 CaptureString(&PropertyValue, FALSE);
828 if (PropertyName == wxT("ALTID")){
830 NameAltID = PropertyValue;
832 } else if (PropertyName == wxT("LANGUAGE")){
834 NameLanguage = PropertyValue;
836 } else if (PropertyName == wxT("SORT-AS")){
838 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
839 PropertyValue.Len() >= 3){
840 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
843 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
845 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
851 // Split the name data.
853 int intSplitSeek = 0;
854 int intSplitsFound = 0;
855 int intSplitSize = 0;
856 int intPropertyLen = PropertySeg2.Len();
858 std::map<int,wxString> NameValues;
861 for (int i = 0; i <= intPropertyLen; i++){
863 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
865 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
870 if (intSplitsFound == 4){
872 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
886 // Split the data into several parts.
888 for (std::map<int, wxString>::iterator iter = NameValues.begin();
889 iter != NameValues.end(); ++iter){
891 if (iter->first == 1){
893 // Deal with family name.
895 NameSurname = iter->second;
897 } else if (iter->first == 2){
899 // Deal with given names.
901 NameForename = iter->second;
903 } else if (iter->first == 3){
905 // Deal with additional names.
907 NameOtherNames = iter->second;
909 } else if (iter->first == 4){
911 // Deal with honorifix prefixes and suffixes.
913 NameTitle = iter->second;
917 if (iter == NameValues.end()){
923 NameSuffix = iter->second;
929 // Add the name token data.
931 if (!PropertyTokens.IsEmpty()){
933 NameTokens = PropertyTokens;
939 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
941 size_t intPropertyLen = PropertySeg1.Len();
942 std::map<int, int> SplitPoints;
943 std::map<int, int> SplitLength;
944 std::map<int, int>::iterator SLiter;
945 wxString PropertyData;
946 wxString PropertyName;
947 wxString PropertyValue;
948 wxString PropertyTokens;
949 bool FirstToken = TRUE;
950 int intSplitsFound = 0;
951 int intSplitSize = 0;
952 int intPrevValue = 14;
954 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
958 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
959 intiter != SplitPoints.end(); ++intiter){
961 SLiter = SplitLength.find(intiter->first);
962 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
963 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
964 intPrevValue = intiter->second;
966 // Process properties.
968 CaptureString(&PropertyValue, FALSE);
970 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
974 CaptureString(&PropertySeg2, FALSE);
976 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
978 if (!PropertyTokens.IsEmpty()){
980 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
986 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
988 std::map<int, int> SplitPoints;
989 std::map<int, int> SplitLength;
991 int intPrevValue = 10;
993 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
997 PropertyType PropType = PROPERTY_NONE;
999 // Look for type before continuing.
1001 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1005 std::map<int, wxString> *NicknamesList = NULL;
1006 std::map<int, wxString> *NicknamesListType = NULL;
1007 std::map<int, wxString> *NicknamesListLanguage = NULL;
1008 std::map<int, wxString> *NicknamesListAltID = NULL;
1009 std::map<int, wxString> *NicknamesListPID = NULL;
1010 std::map<int, wxString> *NicknamesListTokens = NULL;
1011 std::map<int, int> *NicknamesListPref = NULL;
1015 NicknamesList = &GeneralNicknamesList;
1016 NicknamesListType = &GeneralNicknamesListType;
1017 NicknamesListLanguage = &GeneralNicknamesListLanguage;
1018 NicknamesListAltID = &GeneralNicknamesListAltID;
1019 NicknamesListPID = &GeneralNicknamesListPID;
1020 NicknamesListTokens = &GeneralNicknamesListTokens;
1021 NicknamesListPref = &GeneralNicknamesListPref;
1024 NicknamesList = &HomeNicknamesList;
1025 NicknamesListType = &HomeNicknamesListType;
1026 NicknamesListLanguage = &HomeNicknamesListLanguage;
1027 NicknamesListAltID = &HomeNicknamesListAltID;
1028 NicknamesListPID = &HomeNicknamesListPID;
1029 NicknamesListTokens = &HomeNicknamesListTokens;
1030 NicknamesListPref = &HomeNicknamesListPref;
1033 NicknamesList = &BusinessNicknamesList;
1034 NicknamesListType = &BusinessNicknamesListType;
1035 NicknamesListLanguage = &BusinessNicknamesListLanguage;
1036 NicknamesListAltID = &BusinessNicknamesListAltID;
1037 NicknamesListPID = &BusinessNicknamesListPID;
1038 NicknamesListTokens = &BusinessNicknamesListTokens;
1039 NicknamesListPref = &BusinessNicknamesListPref;
1043 std::map<int, int>::iterator SLiter;
1044 wxString PropertyData;
1045 wxString PropertyName;
1046 wxString PropertyValue;
1047 wxString PropertyTokens;
1048 bool FirstToken = TRUE;
1049 bool PropertyMatched = FALSE;
1051 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1052 intiter != SplitPoints.end(); ++intiter){
1054 SLiter = SplitLength.find(intiter->first);
1055 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1056 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1057 intPrevValue = intiter->second;
1059 CaptureString(&PropertyValue, FALSE);
1061 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1062 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1063 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1064 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1066 if (PropertyMatched == TRUE){
1068 PropertyMatched = FALSE;
1073 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1077 NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1079 // Add the name token data.
1081 if (!PropertyTokens.IsEmpty()){
1083 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1089 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1091 std::map<int, int> SplitPoints;
1092 std::map<int, int> SplitLength;
1093 std::map<int, int>::iterator SLiter;
1094 wxString PropertyData;
1095 wxString PropertyName;
1096 wxString PropertyValue;
1097 wxString PropertyTokens;
1098 bool FirstToken = TRUE;
1099 int intPrevValue = 8;
1101 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1105 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1106 intiter != SplitPoints.end(); ++intiter){
1108 SLiter = SplitLength.find(intiter->first);
1109 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1110 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1111 intPrevValue = intiter->second;
1113 // Process properties.
1115 size_t intPropertyValueLen = PropertyValue.Len();
1117 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1119 PropertyValue.Trim();
1120 PropertyValue.RemoveLast();
1124 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1126 PropertyValue.Remove(0, 1);
1130 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1134 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1136 wxString GenderComponent;
1138 if (GenderData.CountTokens() >= 2){
1140 Gender = GenderData.GetNextToken();
1141 GenderDetails = GenderData.GetString();
1143 CaptureString(&GenderDetails, FALSE);
1147 Gender = GenderData.GetNextToken();
1151 if (!PropertyTokens.IsEmpty()){
1153 GenderTokens = PropertyTokens;
1159 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1161 // Process date. Preserve the remainder in the string.
1163 std::map<int, int> SplitPoints;
1164 std::map<int, int> SplitLength;
1165 std::map<int, int>::iterator SLiter;
1166 wxString PropertyData;
1167 wxString PropertyName;
1168 wxString PropertyValue;
1169 wxString PropertyTokens;
1170 bool BirthdayText = FALSE;
1171 int intPrevValue = 6;
1173 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1177 // Look for type before continuing.
1179 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1180 intiter != SplitPoints.end(); ++intiter){
1182 SLiter = SplitLength.find(intiter->first);
1183 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1184 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1185 intPrevValue = intiter->second;
1187 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1189 CaptureString(&PropertySeg2, FALSE);
1190 Birthday = PropertySeg2;
1191 BirthdayText = TRUE;
1197 // Setup blank lines for later on.
1200 bool FirstToken = TRUE;
1202 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1203 intiter != SplitPoints.end(); ++intiter){
1205 SLiter = SplitLength.find(intiter->first);
1206 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1207 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1208 intPrevValue = intiter->second;
1210 // Process properties.
1212 CaptureString(&PropertyValue, FALSE);
1214 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1216 PropertyValue.Trim();
1217 PropertyValue.RemoveLast();
1221 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1223 PropertyValue.Remove(0, 1);
1227 if (PropertyName == wxT("ALTID")){
1229 BirthdayAltID = PropertyValue;
1231 } else if (PropertyName == wxT("CALSCALE")){
1233 BirthdayCalScale = PropertyValue;
1235 } else if (PropertyName != wxT("VALUE")) {
1237 // Something else we don't know about so append
1238 // to the tokens variable.
1240 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1246 // Add the data to the variables and form.
1248 if (BirthdayText == FALSE){
1250 Birthday = PropertySeg2;
1254 if (!PropertyTokens.IsEmpty()){
1256 BirthdayTokens = PropertyTokens;
1262 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1264 // Process date. Preserve the remainder in the string.
1266 std::map<int, int> SplitPoints;
1267 std::map<int, int> SplitLength;
1268 std::map<int, int>::iterator SLiter;
1269 wxString PropertyData;
1270 wxString PropertyName;
1271 wxString PropertyValue;
1272 wxString PropertyTokens;
1273 bool AnniversaryText = FALSE;
1274 int intPrevValue = 13;
1276 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1280 // Look for type before continuing.
1282 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1283 intiter != SplitPoints.end(); ++intiter){
1285 SLiter = SplitLength.find(intiter->first);
1286 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1287 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1288 intPrevValue = intiter->second;
1290 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1292 CaptureString(&PropertySeg2, FALSE);
1293 Anniversary = PropertySeg2;
1294 AnniversaryText = TRUE;
1300 // Setup blank lines for later on.
1303 bool FirstToken = TRUE;
1305 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1306 intiter != SplitPoints.end(); ++intiter){
1308 SLiter = SplitLength.find(intiter->first);
1309 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1310 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1311 intPrevValue = intiter->second;
1313 // Process properties.
1315 CaptureString(&PropertyValue, FALSE);
1317 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1319 PropertyValue.Trim();
1320 PropertyValue.RemoveLast();
1324 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1326 PropertyValue.Remove(0, 1);
1330 if (PropertyName == wxT("ALTID")){
1332 AnniversaryAltID = PropertyValue;
1334 } else if (PropertyName == wxT("CALSCALE")){
1336 AnniversaryCalScale = PropertyValue;
1338 } else if (PropertyName != wxT("VALUE")) {
1340 // Something else we don't know about so append
1341 // to the tokens variable.
1343 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1349 // Add the data to the variables and form.
1351 if (AnniversaryText == FALSE){
1353 Anniversary = PropertySeg2;
1357 if (!PropertyTokens.IsEmpty()){
1359 AnniversaryTokens = PropertyTokens;
1365 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1367 std::map<int, int> SplitPoints;
1368 std::map<int, int> SplitLength;
1370 int intPrevValue = 4;
1372 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1376 PropertyType PropType = PROPERTY_NONE;
1378 // Look for type before continuing.
1380 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1384 std::map<int, wxString> *TZList = NULL;
1385 std::map<int, wxString> *TZListType = NULL;
1386 std::map<int, wxString> *TZListMediatype = NULL;
1387 std::map<int, wxString> *TZListAltID = NULL;
1388 std::map<int, wxString> *TZListPID = NULL;
1389 std::map<int, wxString> *TZListTokens = NULL;
1390 std::map<int, int> *TZListPref = NULL;
1394 TZList = &GeneralTZList;
1395 TZListType = &GeneralTZListType;
1396 TZListMediatype = &GeneralTZListMediatype;
1397 TZListAltID = &GeneralTZListAltID;
1398 TZListPID = &GeneralTZListPID;
1399 TZListTokens = &GeneralTZListTokens;
1400 TZListPref = &GeneralTZListPref;
1403 TZList = &HomeTZList;
1404 TZListType = &HomeTZListType;
1405 TZListMediatype = &HomeTZListMediatype;
1406 TZListAltID = &HomeTZListAltID;
1407 TZListPID = &HomeTZListPID;
1408 TZListTokens = &HomeTZListTokens;
1409 TZListPref = &HomeTZListPref;
1412 TZList = &BusinessTZList;
1413 TZListType = &BusinessTZListType;
1414 TZListMediatype = &BusinessTZListMediatype;
1415 TZListAltID = &BusinessTZListAltID;
1416 TZListPID = &BusinessTZListPID;
1417 TZListTokens = &BusinessTZListTokens;
1418 TZListPref = &BusinessTZListPref;
1422 std::map<int, int>::iterator SLiter;
1423 wxString PropertyData;
1424 wxString PropertyName;
1425 wxString PropertyValue;
1426 wxString PropertyTokens;
1427 bool FirstToken = TRUE;
1428 bool PropertyMatched = FALSE;
1430 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1431 intiter != SplitPoints.end(); ++intiter){
1433 SLiter = SplitLength.find(intiter->first);
1434 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1435 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1436 intPrevValue = intiter->second;
1438 CaptureString(&PropertyValue, FALSE);
1440 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1441 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1442 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1443 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1445 if (PropertyMatched == TRUE){
1447 PropertyMatched = FALSE;
1452 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1454 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1460 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1462 // Add the name token data.
1464 if (!PropertyTokens.IsEmpty()){
1466 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1473 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1475 size_t intPropertyLen = PropertySeg1.Len();
1476 std::map<int, int> SplitPoints;
1477 std::map<int, int> SplitLength;
1478 std::map<int, int>::iterator SLiter;
1479 wxString PropertyData;
1480 wxString PropertyName;
1481 wxString PropertyValue;
1482 wxString PropertyTokens;
1483 wxString AddressLabel;
1484 wxString AddressLang;
1485 wxString AddressAltID;
1486 wxString AddressPID;
1487 wxString AddressTokens;
1488 wxString AddressGeo;
1489 wxString AddressTimezone;
1490 wxString AddressType;
1491 wxString AddressMediatype;
1492 wxString AddressPOBox;
1493 wxString AddressExtended;
1494 wxString AddressStreet;
1495 wxString AddressLocality;
1496 wxString AddressCity;
1497 wxString AddressRegion;
1498 wxString AddressPostalCode;
1499 wxString AddressCountry;
1500 bool FirstToken = TRUE;
1501 int intSplitsFound = 0;
1502 int intSplitSize = 0;
1503 int intPrevValue = 5;
1504 bool PropertyMatched = FALSE;
1506 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1510 PropertyType PropType = PROPERTY_NONE;
1512 // Look for type before continuing.
1514 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1518 std::map<int, wxString> *AddressList = NULL;
1519 std::map<int, wxString> *AddressListTown = NULL;
1520 std::map<int, wxString> *AddressListCounty = NULL;
1521 std::map<int, wxString> *AddressListPostCode = NULL;
1522 std::map<int, wxString> *AddressListCountry = NULL;
1523 std::map<int, wxString> *AddressListLabel = NULL;
1524 std::map<int, wxString> *AddressListLang = NULL;
1525 std::map<int, wxString> *AddressListAltID = NULL;
1526 std::map<int, wxString> *AddressListPID = NULL;
1527 std::map<int, wxString> *AddressListTokens = NULL;
1528 std::map<int, wxString> *AddressListGeo = NULL;
1529 std::map<int, wxString> *AddressListTimezone = NULL;
1530 std::map<int, wxString> *AddressListType = NULL;
1531 std::map<int, wxString> *AddressListMediatype = NULL;
1532 std::map<int, int> *AddressListPref = NULL;
1536 AddressList = &GeneralAddressList;
1537 AddressListTown = &GeneralAddressListTown;
1538 AddressListCounty = &GeneralAddressListCounty;
1539 AddressListPostCode = &GeneralAddressListPostCode;
1540 AddressListCountry = &GeneralAddressListCountry;
1541 AddressListLabel = &GeneralAddressListLabel;
1542 AddressListLang = &GeneralAddressListLang;
1543 AddressListAltID = &GeneralAddressListAltID;
1544 AddressListPID = &GeneralAddressListPID;
1545 AddressListTokens = &GeneralAddressListTokens;
1546 AddressListGeo = &GeneralAddressListGeo;
1547 AddressListTimezone = &GeneralAddressListTimezone;
1548 AddressListType = &GeneralAddressListType;
1549 AddressListMediatype = &GeneralAddressListMediatype;
1550 AddressListPref = &GeneralAddressListPref;
1553 AddressList = &HomeAddressList;
1554 AddressListTown = &HomeAddressListTown;
1555 AddressListCounty = &HomeAddressListCounty;
1556 AddressListPostCode = &HomeAddressListPostCode;
1557 AddressListCountry = &HomeAddressListCountry;
1558 AddressListLabel = &HomeAddressListLabel;
1559 AddressListLang = &HomeAddressListLang;
1560 AddressListAltID = &HomeAddressListAltID;
1561 AddressListPID = &HomeAddressListPID;
1562 AddressListTokens = &HomeAddressListTokens;
1563 AddressListGeo = &HomeAddressListGeo;
1564 AddressListTimezone = &HomeAddressListTimezone;
1565 AddressListType = &HomeAddressListType;
1566 AddressListMediatype = &HomeAddressListMediatype;
1567 AddressListPref = &HomeAddressListPref;
1570 AddressList = &BusinessAddressList;
1571 AddressListTown = &BusinessAddressListTown;
1572 AddressListCounty = &BusinessAddressListCounty;
1573 AddressListPostCode = &BusinessAddressListPostCode;
1574 AddressListCountry = &BusinessAddressListCountry;
1575 AddressListLabel = &BusinessAddressListLabel;
1576 AddressListLang = &BusinessAddressListLang;
1577 AddressListAltID = &BusinessAddressListAltID;
1578 AddressListPID = &BusinessAddressListPID;
1579 AddressListTokens = &BusinessAddressListTokens;
1580 AddressListGeo = &BusinessAddressListGeo;
1581 AddressListTimezone = &BusinessAddressListTimezone;
1582 AddressListType = &BusinessAddressListType;
1583 AddressListMediatype = &BusinessAddressListMediatype;
1584 AddressListPref = &BusinessAddressListPref;
1590 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1591 intiter != SplitPoints.end(); ++intiter){
1593 SLiter = SplitLength.find(intiter->first);
1594 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1595 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1596 intPrevValue = intiter->second;
1598 CaptureString(&PropertyValue, FALSE);
1600 // Process properties.
1602 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1603 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1604 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1605 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1606 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1607 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1608 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1609 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1611 if (PropertyMatched == TRUE){
1613 PropertyMatched = FALSE;
1618 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1622 // Split the address.
1624 //std::map<int, int>::iterator SLiter;
1625 intPropertyLen = PropertySeg2.Len();
1626 SplitPoints.clear();
1627 SplitLength.clear();
1632 for (int i = 0; i <= intPropertyLen; i++){
1636 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1639 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1641 if (intSplitsFound == 6){
1643 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1648 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1658 // Split the data into several parts.
1660 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1661 intiter != SplitPoints.end(); ++intiter){
1663 if (intiter->first == 1){
1665 // Deal with PO Box.
1667 SLiter = SplitLength.find(1);
1669 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1670 intPrevValue = intiter->second;
1672 } else if (intiter->first == 2){
1674 // Deal with extended address.
1676 SLiter = SplitLength.find(2);
1678 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1679 intPrevValue = intiter->second;
1681 } else if (intiter->first == 3){
1683 // Deal with street address.
1685 SLiter = SplitLength.find(3);
1687 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1688 intPrevValue = intiter->second;
1690 } else if (intiter->first == 4){
1692 // Deal with locality
1694 SLiter = SplitLength.find(4);
1696 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1697 intPrevValue = intiter->second;
1699 } else if (intiter->first == 5){
1701 // Deal with region.
1703 SLiter = SplitLength.find(5);
1705 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1706 intPrevValue = intiter->second;
1709 } else if (intiter->first == 6){
1711 // Deal with post code.
1713 SLiter = SplitLength.find(6);
1715 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1716 intPrevValue = intiter->second;
1718 // Deal with country.
1720 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1728 // Add the data to the General/Home/Work address variables.
1730 CaptureString(&AddressStreet, FALSE);
1731 CaptureString(&AddressLocality, FALSE);
1732 CaptureString(&AddressRegion, FALSE);
1733 CaptureString(&AddressPostalCode, FALSE);
1734 CaptureString(&AddressCountry, FALSE);
1736 if (!PropertyTokens.IsEmpty()){
1738 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1742 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1743 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1744 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1745 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1746 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1750 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1753 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1756 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1760 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1764 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1766 std::map<int, int> SplitPoints;
1767 std::map<int, int> SplitLength;
1769 int intPrevValue = 7;
1771 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1775 PropertyType PropType = PROPERTY_NONE;
1777 // Look for type before continuing.
1779 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1781 std::map<int, wxString> *EmailList = NULL;
1782 std::map<int, wxString> *EmailListType = NULL;
1783 std::map<int, wxString> *EmailListAltID = NULL;
1784 std::map<int, wxString> *EmailListPID = NULL;
1785 std::map<int, wxString> *EmailListTokens = NULL;
1786 std::map<int, int> *EmailListPref = NULL;
1790 EmailList = &GeneralEmailList;
1791 EmailListType = &GeneralEmailListType;
1792 EmailListAltID = &GeneralEmailListAltID;
1793 EmailListPID = &GeneralEmailListPID;
1794 EmailListTokens = &GeneralEmailListTokens;
1795 EmailListPref = &GeneralEmailListPref;
1798 EmailList = &HomeEmailList;
1799 EmailListType = &HomeEmailListType;
1800 EmailListAltID = &HomeEmailListAltID;
1801 EmailListPID = &HomeEmailListPID;
1802 EmailListTokens = &HomeEmailListTokens;
1803 EmailListPref = &HomeEmailListPref;
1806 EmailList = &BusinessEmailList;
1807 EmailListType = &BusinessEmailListType;
1808 EmailListAltID = &BusinessEmailListAltID;
1809 EmailListPID = &BusinessEmailListPID;
1810 EmailListTokens = &BusinessEmailListTokens;
1811 EmailListPref = &BusinessEmailListPref;
1817 std::map<int,int>::iterator SLiter;
1818 wxString PropertyData;
1819 wxString PropertyName;
1820 wxString PropertyValue;
1821 wxString PropertyTokens;
1822 bool FirstToken = TRUE;
1823 bool PropertyMatched = FALSE;
1825 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1826 intiter != SplitPoints.end(); ++intiter){
1828 SLiter = SplitLength.find(intiter->first);
1829 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1830 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1831 intPrevValue = intiter->second;
1833 CaptureString(&PropertyValue, FALSE);
1835 // Process properties.
1837 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
1838 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
1839 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
1841 if (PropertyMatched == TRUE){
1843 PropertyMatched = FALSE;
1848 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1852 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1854 // Add the name token data.
1856 if (!PropertyTokens.IsEmpty()){
1858 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1865 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1867 std::map<int, int> SplitPoints;
1868 std::map<int, int> SplitLength;
1870 int intPrevValue = 6;
1872 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1876 PropertyType PropType = PROPERTY_NONE;
1878 // Look for type before continuing.
1880 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1882 std::map<int, wxString> *IMList = NULL;
1883 std::map<int, wxString> *IMListType = NULL;
1884 std::map<int, wxString> *IMListAltID = NULL;
1885 std::map<int, wxString> *IMListPID = NULL;
1886 std::map<int, wxString> *IMListTokens = NULL;
1887 std::map<int, wxString> *IMListMediatype = NULL;
1888 std::map<int, int> *IMListPref = NULL;
1892 IMList = &GeneralIMList;
1893 IMListType = &GeneralIMListType;
1894 IMListAltID = &GeneralIMListAltID;
1895 IMListPID = &GeneralIMListPID;
1896 IMListTokens = &GeneralIMListTokens;
1897 IMListMediatype = &GeneralIMListMediatype;
1898 IMListPref = &GeneralIMListPref;
1901 IMList = &HomeIMList;
1902 IMListType = &HomeIMListType;
1903 IMListAltID = &HomeIMListAltID;
1904 IMListPID = &HomeIMListPID;
1905 IMListTokens = &HomeIMListTokens;
1906 IMListMediatype = &HomeIMListMediatype;
1907 IMListPref = &HomeIMListPref;
1910 IMList = &BusinessIMList;
1911 IMListType = &BusinessIMListType;
1912 IMListAltID = &BusinessIMListAltID;
1913 IMListPID = &BusinessIMListPID;
1914 IMListTokens = &BusinessIMListTokens;
1915 IMListMediatype = &BusinessIMListMediatype;
1916 IMListPref = &BusinessIMListPref;
1922 std::map<int,int>::iterator SLiter;
1923 wxString PropertyData;
1924 wxString PropertyName;
1925 wxString PropertyValue;
1926 wxString PropertyTokens;
1927 bool FirstToken = TRUE;
1928 bool PropertyMatched = FALSE;
1930 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1931 intiter != SplitPoints.end(); ++intiter){
1933 SLiter = SplitLength.find(intiter->first);
1934 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1935 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1936 intPrevValue = intiter->second;
1938 CaptureString(&PropertyValue, FALSE);
1940 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
1941 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
1942 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
1943 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
1945 // Process properties.
1947 if (PropertyMatched == TRUE){
1949 PropertyMatched = FALSE;
1954 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1958 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
1960 // Add the name token data.
1962 if (!PropertyTokens.IsEmpty()){
1964 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
1970 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
1972 std::map<int, int> SplitPoints;
1973 std::map<int, int> SplitLength;
1974 std::map<int, int>::iterator SLiter;
1976 PropertyType PropType = PROPERTY_NONE;
1978 // Look for type before continuing.
1981 wxString TelTypeDetail;
1982 wxString PropertyData;
1983 wxString PropertyName;
1984 wxString PropertyValue;
1985 wxString PropertyTokens;
1987 std::map<int,int> TypeSplitPoints;
1988 std::map<int,int> TypeSplitLength;
1989 std::map<int,int>::iterator TSLiter;
1991 int intSplitSize = 0;
1992 int intSplitsFound = 0;
1993 int intSplitPoint = 0;
1995 int intPrevValue = 5;
1997 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2001 // Look for type before continuing.
2003 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2004 intiter != SplitPoints.end(); ++intiter){
2006 SLiter = SplitLength.find(intiter->first);
2007 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2008 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2009 intPrevValue = intiter->second;
2011 if (PropertyName == wxT("TYPE")){
2013 // Process each value in type and translate each
2016 // Strip out the quotes if they are there.
2018 size_t intPropertyValueLen = PropertyValue.Len();
2020 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2022 PropertyValue.Trim();
2023 PropertyValue.RemoveLast();
2027 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2029 PropertyValue.Remove(0, 1);
2033 TelTypeDetail = PropertyValue;
2039 for (int i = 0; i <= intPropertyValueLen; i++){
2043 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2045 if (intSplitsFound == 0){
2047 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2048 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2052 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2053 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2066 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2067 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2069 int intTypeSeek = 0;
2071 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2072 typeiter != TypeSplitPoints.end(); ++typeiter){
2074 wxString TypePropertyName;
2076 TSLiter = TypeSplitLength.find(typeiter->first);
2078 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2080 if (intTypeSeek == 0){
2085 TelTypeUI.Append(wxT(","));
2089 if (TypePropertyName == wxT("home")){
2091 PropType = PROPERTY_HOME;
2093 } else if (TypePropertyName == wxT("work")){
2095 PropType = PROPERTY_WORK;
2100 if (TypePropertyName == wxT("text")){
2102 TelTypeUI.Append(_("text"));
2105 } else if (TypePropertyName == wxT("voice")){
2107 TelTypeUI.Append(_("voice"));
2110 } else if (TypePropertyName == wxT("fax")){
2112 TelTypeUI.Append(_("fax"));
2115 } else if (TypePropertyName == wxT("cell")){
2117 TelTypeUI.Append(_("mobile"));
2120 } else if (TypePropertyName == wxT("video")){
2122 TelTypeUI.Append(_("video"));
2125 } else if (TypePropertyName == wxT("pager")){
2127 TelTypeUI.Append(_("pager"));
2130 } else if (TypePropertyName == wxT("textphone")){
2132 TelTypeUI.Append(_("textphone"));
2143 std::map<int, wxString> *TelephoneList = NULL;
2144 std::map<int, wxString> *TelephoneListType = NULL;
2145 std::map<int, wxString> *TelephoneListAltID = NULL;
2146 std::map<int, wxString> *TelephoneListPID = NULL;
2147 std::map<int, wxString> *TelephoneListTokens = NULL;
2148 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2149 std::map<int, int> *TelephoneListPref = NULL;
2153 TelephoneList = &GeneralTelephoneList;
2154 TelephoneListType = &GeneralTelephoneListType;
2155 TelephoneListAltID = &GeneralTelephoneListAltID;
2156 TelephoneListPID = &GeneralTelephoneListPID;
2157 TelephoneListTokens = &GeneralTelephoneListTokens;
2158 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2159 TelephoneListPref = &GeneralTelephoneListPref;
2162 TelephoneList = &HomeTelephoneList;
2163 TelephoneListType = &HomeTelephoneListType;
2164 TelephoneListAltID = &HomeTelephoneListAltID;
2165 TelephoneListPID = &HomeTelephoneListPID;
2166 TelephoneListTokens = &HomeTelephoneListTokens;
2167 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2168 TelephoneListPref = &HomeTelephoneListPref;
2171 TelephoneList = &BusinessTelephoneList;
2172 TelephoneListType = &BusinessTelephoneListType;
2173 TelephoneListAltID = &BusinessTelephoneListAltID;
2174 TelephoneListPID = &BusinessTelephoneListPID;
2175 TelephoneListTokens = &BusinessTelephoneListTokens;
2176 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2177 TelephoneListPref = &BusinessTelephoneListPref;
2181 // Process the properties.
2183 bool FirstToken = TRUE;
2186 SplitPoints.clear();
2187 SplitLength.clear();
2189 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2193 bool PropertyMatched = FALSE;
2195 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2196 intiter != SplitPoints.end(); ++intiter){
2198 SLiter = SplitLength.find(intiter->first);
2199 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2200 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2201 intPrevValue = intiter->second;
2203 CaptureString(&PropertyValue, FALSE);
2205 // Process properties.
2207 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2208 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2209 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2211 if (PropertyMatched == TRUE){
2213 PropertyMatched = FALSE;
2218 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2222 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2223 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2225 // Add the name token data.
2227 if (!PropertyTokens.IsEmpty()){
2229 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2235 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2237 std::map<int, int> SplitPoints;
2238 std::map<int, int> SplitLength;
2240 int intPrevValue = 6;
2242 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2246 PropertyType PropType = PROPERTY_NONE;
2248 // Look for type before continuing.
2250 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2252 std::map<int, wxString> *LanguageList = NULL;
2253 std::map<int, wxString> *LanguageListType = NULL;
2254 std::map<int, wxString> *LanguageListAltID = NULL;
2255 std::map<int, wxString> *LanguageListPID = NULL;
2256 std::map<int, wxString> *LanguageListTokens = NULL;
2257 std::map<int, int> *LanguageListPref = NULL;
2261 LanguageList = &GeneralLanguageList;
2262 LanguageListType = &GeneralLanguageListType;
2263 LanguageListAltID = &GeneralLanguageListAltID;
2264 LanguageListPID = &GeneralLanguageListPID;
2265 LanguageListTokens = &GeneralLanguageListTokens;
2266 LanguageListPref = &GeneralLanguageListPref;
2269 LanguageList = &HomeLanguageList;
2270 LanguageListType = &HomeLanguageListType;
2271 LanguageListAltID = &HomeLanguageListAltID;
2272 LanguageListPID = &HomeLanguageListPID;
2273 LanguageListTokens = &HomeLanguageListTokens;
2274 LanguageListPref = &HomeLanguageListPref;
2277 LanguageList = &BusinessLanguageList;
2278 LanguageListType = &BusinessLanguageListType;
2279 LanguageListAltID = &BusinessLanguageListAltID;
2280 LanguageListPID = &BusinessLanguageListPID;
2281 LanguageListTokens = &BusinessLanguageListTokens;
2282 LanguageListPref = &BusinessLanguageListPref;
2288 std::map<int,int>::iterator SLiter;
2289 wxString PropertyData;
2290 wxString PropertyName;
2291 wxString PropertyValue;
2292 wxString PropertyTokens;
2293 bool FirstToken = TRUE;
2294 bool PropertyMatched = FALSE;
2296 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2297 intiter != SplitPoints.end(); ++intiter){
2299 SLiter = SplitLength.find(intiter->first);
2300 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2301 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2302 intPrevValue = intiter->second;
2304 CaptureString(&PropertyValue, FALSE);
2306 // Process properties.
2308 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2309 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2310 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2312 if (PropertyMatched == TRUE){
2314 PropertyMatched = FALSE;
2319 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2323 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2325 // Add the name token data.
2327 if (!PropertyTokens.IsEmpty()){
2329 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2335 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2337 std::map<int, int> SplitPoints;
2338 std::map<int, int> SplitLength;
2340 int intPrevValue = 5;
2342 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2346 PropertyType PropType = PROPERTY_NONE;
2348 // Look for type before continuing.
2350 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2352 std::map<int, wxString> *GeopositionList = NULL;
2353 std::map<int, wxString> *GeopositionListType = NULL;
2354 std::map<int, wxString> *GeopositionListAltID = NULL;
2355 std::map<int, wxString> *GeopositionListPID = NULL;
2356 std::map<int, wxString> *GeopositionListTokens = NULL;
2357 std::map<int, wxString> *GeopositionListMediatype = NULL;
2358 std::map<int, int> *GeopositionListPref = NULL;
2362 GeopositionList = &GeneralGeographyList;
2363 GeopositionListType = &GeneralGeographyListType;
2364 GeopositionListAltID = &GeneralGeographyListAltID;
2365 GeopositionListPID = &GeneralGeographyListPID;
2366 GeopositionListTokens = &GeneralGeographyListTokens;
2367 GeopositionListMediatype = &GeneralGeographyListMediatype;
2368 GeopositionListPref = &GeneralGeographyListPref;
2371 GeopositionList = &HomeGeographyList;
2372 GeopositionListType = &HomeGeographyListType;
2373 GeopositionListAltID = &HomeGeographyListAltID;
2374 GeopositionListPID = &HomeGeographyListPID;
2375 GeopositionListTokens = &HomeGeographyListTokens;
2376 GeopositionListMediatype = &HomeGeographyListMediatype;
2377 GeopositionListPref = &HomeGeographyListPref;
2380 GeopositionList = &BusinessGeographyList;
2381 GeopositionListType = &BusinessGeographyListType;
2382 GeopositionListAltID = &BusinessGeographyListAltID;
2383 GeopositionListPID = &BusinessGeographyListPID;
2384 GeopositionListTokens = &BusinessGeographyListTokens;
2385 GeopositionListMediatype = &BusinessGeographyListMediatype;
2386 GeopositionListPref = &BusinessGeographyListPref;
2392 std::map<int,int>::iterator SLiter;
2393 wxString PropertyData;
2394 wxString PropertyName;
2395 wxString PropertyValue;
2396 wxString PropertyTokens;
2397 bool FirstToken = TRUE;
2398 bool PropertyMatched = FALSE;
2400 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2401 intiter != SplitPoints.end(); ++intiter){
2403 SLiter = SplitLength.find(intiter->first);
2404 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2405 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2406 intPrevValue = intiter->second;
2408 CaptureString(&PropertyValue, FALSE);
2410 // Process properties.
2412 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2413 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2414 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2415 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2417 if (PropertyMatched == TRUE){
2419 PropertyMatched = FALSE;
2424 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2428 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2430 // Add the name token data.
2432 if (!PropertyTokens.IsEmpty()){
2434 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2440 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2442 size_t intPropertyLen = PropertySeg1.Len();
2443 std::map<int, int> SplitPoints;
2444 std::map<int, int> SplitLength;
2445 std::map<int, int>::iterator SLiter;
2446 wxString PropertyData;
2447 wxString PropertyName;
2448 wxString PropertyValue;
2449 wxString PropertyTokens;
2450 wxString RelatedType;
2451 wxString RelatedTypeOriginal;
2452 wxString RelatedName;
2453 bool FirstToken = TRUE;
2454 int intSplitsFound = 0;
2455 int intSplitSize = 0;
2456 int intPrevValue = 9;
2458 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2462 // Look for type before continuing.
2464 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2465 intiter != SplitPoints.end(); ++intiter){
2467 SLiter = SplitLength.find(intiter->first);
2468 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2469 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2470 intPrevValue = intiter->second;
2474 RelatedTypeOriginal = PropertyValue;
2476 if (PropertyName == wxT("TYPE")){
2478 if (PropertyValue == wxT("contact")){
2480 RelatedType = _("Contact");
2482 } else if (PropertyValue == wxT("acquaintance")){
2484 RelatedType = _("Acquaintance");
2486 } else if (PropertyValue == wxT("friend")){
2488 RelatedType = _("Friend");
2490 } else if (PropertyValue == wxT("met")){
2492 RelatedType = _("Met");
2494 } else if (PropertyValue == wxT("co-worker")){
2496 RelatedType = _("Co-worker");
2498 } else if (PropertyValue == wxT("colleague")){
2500 RelatedType = _("Colleague");
2502 } else if (PropertyValue == wxT("co-resident")){
2504 RelatedType = _("Co-resident");
2506 } else if (PropertyValue == wxT("neighbor")){
2508 RelatedType = _("Neighbour");
2510 } else if (PropertyValue == wxT("child")){
2512 RelatedType = _("Child");
2514 } else if (PropertyValue == wxT("parent")){
2516 RelatedType = _("Parent");
2518 } else if (PropertyValue == wxT("sibling")){
2520 RelatedType = _("Sibling");
2522 } else if (PropertyValue == wxT("spouse")){
2524 RelatedType = _("Spouse");
2526 } else if (PropertyValue == wxT("kin")){
2528 RelatedType = _("Kin");
2530 } else if (PropertyValue == wxT("muse")){
2532 RelatedType = _("Muse");
2534 } else if (PropertyValue == wxT("crush")){
2536 RelatedType = _("Crush");
2538 } else if (PropertyValue == wxT("date")){
2540 RelatedType = _("Date");
2542 } else if (PropertyValue == wxT("sweetheart")){
2544 RelatedType = _("Sweetheart");
2546 } else if (PropertyValue == wxT("me")){
2548 RelatedType = _("Me");
2550 } else if (PropertyValue == wxT("agent")){
2552 RelatedType = _("Agent");
2554 } else if (PropertyValue == wxT("emergency")){
2556 RelatedType = _("Emergency");
2560 RelatedType = PropertyValue;
2570 bool PropertyMatched = FALSE;
2572 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2573 intiter != SplitPoints.end(); ++intiter){
2575 SLiter = SplitLength.find(intiter->first);
2576 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2577 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2578 intPrevValue = intiter->second;
2580 // Process properties.
2582 size_t intPropertyValueLen = PropertyValue.Len();
2584 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2586 PropertyValue.Trim();
2587 PropertyValue.RemoveLast();
2591 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2593 PropertyValue.Remove(0, 1);
2597 CaptureString(&PropertyValue, FALSE);
2599 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2600 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2601 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2602 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2604 if (PropertyMatched == TRUE){
2606 PropertyMatched = FALSE;
2611 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2615 // Add the data to the General/Home/Work address variables.
2617 GeneralRelatedList.erase(*RelatedCount);
2618 GeneralRelatedListRelType.erase(*RelatedCount);
2619 GeneralRelatedListType.erase(*RelatedCount);
2620 GeneralRelatedListTokens.erase(*RelatedCount);
2621 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2622 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2623 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2624 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2628 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2630 std::map<int, int> SplitPoints;
2631 std::map<int, int> SplitLength;
2632 std::map<int, int>::iterator SLiter;
2633 wxString PropertyData;
2634 wxString PropertyName;
2635 wxString PropertyValue;
2636 wxString PropertyTokens;
2637 bool FirstToken = TRUE;
2638 int intPrevValue = 5;
2640 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2644 PropertyType PropType = PROPERTY_NONE;
2646 // Look for type before continuing.
2648 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2650 // Setup the pointers.
2652 std::map<int, wxString> *WebsiteList = NULL;
2653 std::map<int, wxString> *WebsiteListAltID = NULL;
2654 std::map<int, wxString> *WebsiteListPID = NULL;
2655 std::map<int, wxString> *WebsiteListType = NULL;
2656 std::map<int, wxString> *WebsiteListTokens = NULL;
2657 std::map<int, wxString> *WebsiteListMediatype = NULL;
2658 std::map<int, int> *WebsiteListPref = NULL;
2660 // Setup blank lines for later on.
2664 WebsiteList = &GeneralWebsiteList;
2665 WebsiteListType = &GeneralWebsiteListType;
2666 WebsiteListAltID = &GeneralWebsiteListAltID;
2667 WebsiteListPID = &GeneralWebsiteListPID;
2668 WebsiteListTokens = &GeneralWebsiteListTokens;
2669 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2670 WebsiteListPref = &GeneralWebsiteListPref;
2673 WebsiteList = &HomeWebsiteList;
2674 WebsiteListType = &HomeWebsiteListType;
2675 WebsiteListAltID = &HomeWebsiteListAltID;
2676 WebsiteListPID = &HomeWebsiteListPID;
2677 WebsiteListTokens = &HomeWebsiteListTokens;
2678 WebsiteListMediatype = &HomeWebsiteListMediatype;
2679 WebsiteListPref = &HomeWebsiteListPref;
2682 WebsiteList = &BusinessWebsiteList;
2683 WebsiteListType = &BusinessWebsiteListType;
2684 WebsiteListAltID = &BusinessWebsiteListAltID;
2685 WebsiteListPID = &BusinessWebsiteListPID;
2686 WebsiteListTokens = &BusinessWebsiteListTokens;
2687 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2688 WebsiteListPref = &BusinessWebsiteListPref;
2693 bool PropertyMatched = FALSE;
2695 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2696 intiter != SplitPoints.end(); ++intiter){
2698 SLiter = SplitLength.find(intiter->first);
2699 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2700 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2701 intPrevValue = intiter->second;
2703 // Process properties.
2705 size_t intPropertyValueLen = PropertyValue.Len();
2707 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2709 PropertyValue.Trim();
2710 PropertyValue.RemoveLast();
2714 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2716 PropertyValue.Remove(0, 1);
2720 CaptureString(&PropertyValue, FALSE);
2722 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2723 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2724 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2725 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2727 if (PropertyMatched == TRUE){
2729 PropertyMatched = FALSE;
2734 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2738 // Add the data to the General/Home/Work address variables.
2740 CaptureString(&PropertySeg2, FALSE);
2742 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2744 if (!PropertyTokens.IsEmpty()){
2746 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2752 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2754 std::map<int, int> SplitPoints;
2755 std::map<int, int> SplitLength;
2756 std::map<int, int>::iterator SLiter;
2757 wxString PropertyData;
2758 wxString PropertyName;
2759 wxString PropertyValue;
2760 wxString PropertyTokens;
2761 bool FirstToken = TRUE;
2762 int intPrevValue = 7;
2764 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2768 PropertyType PropType = PROPERTY_NONE;
2770 // Look for type before continuing.
2772 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2774 // Setup the pointers.
2776 std::map<int, wxString> *TitleList = NULL;
2777 std::map<int, wxString> *TitleListAltID = NULL;
2778 std::map<int, wxString> *TitleListPID = NULL;
2779 std::map<int, wxString> *TitleListType = NULL;
2780 std::map<int, wxString> *TitleListTokens = NULL;
2781 std::map<int, wxString> *TitleListLanguage = NULL;
2782 std::map<int, int> *TitleListPref = NULL;
2784 // Setup blank lines for later on.
2788 TitleList = &GeneralTitleList;
2789 TitleListType = &GeneralTitleListType;
2790 TitleListAltID = &GeneralTitleListAltID;
2791 TitleListPID = &GeneralTitleListPID;
2792 TitleListTokens = &GeneralTitleListTokens;
2793 TitleListLanguage = &GeneralTitleListLanguage;
2794 TitleListPref = &GeneralTitleListPref;
2797 TitleList = &HomeTitleList;
2798 TitleListType = &HomeTitleListType;
2799 TitleListAltID = &HomeTitleListAltID;
2800 TitleListPID = &HomeTitleListPID;
2801 TitleListTokens = &HomeTitleListTokens;
2802 TitleListLanguage = &HomeTitleListLanguage;
2803 TitleListPref = &HomeTitleListPref;
2806 TitleList = &BusinessTitleList;
2807 TitleListType = &BusinessTitleListType;
2808 TitleListAltID = &BusinessTitleListAltID;
2809 TitleListPID = &BusinessTitleListPID;
2810 TitleListTokens = &BusinessTitleListTokens;
2811 TitleListLanguage = &BusinessTitleListLanguage;
2812 TitleListPref = &BusinessTitleListPref;
2817 bool PropertyMatched = FALSE;
2819 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2820 intiter != SplitPoints.end(); ++intiter){
2822 SLiter = SplitLength.find(intiter->first);
2823 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2824 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2825 intPrevValue = intiter->second;
2827 // Process properties.
2829 size_t intPropertyValueLen = PropertyValue.Len();
2831 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2833 PropertyValue.Trim();
2834 PropertyValue.RemoveLast();
2838 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2840 PropertyValue.Remove(0, 1);
2844 CaptureString(&PropertyValue, FALSE);
2846 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2847 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2848 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2849 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2851 if (PropertyMatched == TRUE){
2853 PropertyMatched = FALSE;
2858 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2862 // Add the data to the General/Home/Work address variables.
2864 CaptureString(&PropertySeg2, FALSE);
2866 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2868 if (!PropertyTokens.IsEmpty()){
2870 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2876 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2878 std::map<int, int> SplitPoints;
2879 std::map<int, int> SplitLength;
2880 std::map<int, int>::iterator SLiter;
2881 wxString PropertyData;
2882 wxString PropertyName;
2883 wxString PropertyValue;
2884 wxString PropertyTokens;
2885 bool FirstToken = TRUE;
2886 int intPrevValue = 6;
2888 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2892 PropertyType PropType = PROPERTY_NONE;
2894 // Look for type before continuing.
2896 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2898 // Setup the pointers.
2900 std::map<int, wxString> *RoleList = NULL;
2901 std::map<int, wxString> *RoleListAltID = NULL;
2902 std::map<int, wxString> *RoleListPID = NULL;
2903 std::map<int, wxString> *RoleListType = NULL;
2904 std::map<int, wxString> *RoleListTokens = NULL;
2905 std::map<int, wxString> *RoleListLanguage = NULL;
2906 std::map<int, int> *RoleListPref = NULL;
2908 // Setup blank lines for later on.
2912 RoleList = &GeneralRoleList;
2913 RoleListType = &GeneralRoleListType;
2914 RoleListAltID = &GeneralRoleListAltID;
2915 RoleListPID = &GeneralRoleListPID;
2916 RoleListTokens = &GeneralRoleListTokens;
2917 RoleListLanguage = &GeneralRoleListLanguage;
2918 RoleListPref = &GeneralRoleListPref;
2921 RoleList = &HomeRoleList;
2922 RoleListType = &HomeRoleListType;
2923 RoleListAltID = &HomeRoleListAltID;
2924 RoleListPID = &HomeRoleListPID;
2925 RoleListTokens = &HomeRoleListTokens;
2926 RoleListLanguage = &HomeRoleListLanguage;
2927 RoleListPref = &HomeRoleListPref;
2930 RoleList = &BusinessRoleList;
2931 RoleListType = &BusinessRoleListType;
2932 RoleListAltID = &BusinessRoleListAltID;
2933 RoleListPID = &BusinessRoleListPID;
2934 RoleListTokens = &BusinessRoleListTokens;
2935 RoleListLanguage = &BusinessRoleListLanguage;
2936 RoleListPref = &BusinessRoleListPref;
2941 bool PropertyMatched = FALSE;
2943 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2944 intiter != SplitPoints.end(); ++intiter){
2946 SLiter = SplitLength.find(intiter->first);
2947 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2948 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2949 intPrevValue = intiter->second;
2951 // Process properties.
2953 size_t intPropertyValueLen = PropertyValue.Len();
2955 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2957 PropertyValue.Trim();
2958 PropertyValue.RemoveLast();
2962 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2964 PropertyValue.Remove(0, 1);
2968 CaptureString(&PropertyValue, FALSE);
2970 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
2971 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
2972 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
2973 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
2975 if (PropertyMatched == TRUE){
2977 PropertyMatched = FALSE;
2982 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2986 // Add the data to the General/Home/Work address variables.
2988 CaptureString(&PropertySeg2, FALSE);
2990 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
2992 if (!PropertyTokens.IsEmpty()){
2994 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3000 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3002 std::map<int, int> SplitPoints;
3003 std::map<int, int> SplitLength;
3004 std::map<int, int>::iterator SLiter;
3005 wxString PropertyData;
3006 wxString PropertyName;
3007 wxString PropertyValue;
3008 wxString PropertyTokens;
3009 bool FirstToken = TRUE;
3010 int intPrevValue = 5;
3012 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3016 PropertyType PropType = PROPERTY_NONE;
3018 // Look for type before continuing.
3020 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3022 // Setup the pointers.
3024 std::map<int, wxString> *OrganisationsList = NULL;
3025 std::map<int, wxString> *OrganisationsListAltID = NULL;
3026 std::map<int, wxString> *OrganisationsListPID = NULL;
3027 std::map<int, wxString> *OrganisationsListType = NULL;
3028 std::map<int, wxString> *OrganisationsListTokens = NULL;
3029 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3030 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3031 std::map<int, int> *OrganisationsListPref = NULL;
3033 // Setup blank lines for later on.
3037 OrganisationsList = &GeneralOrganisationsList;
3038 OrganisationsListType = &GeneralOrganisationsListType;
3039 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3040 OrganisationsListPID = &GeneralOrganisationsListPID;
3041 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3042 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3043 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3044 OrganisationsListPref = &GeneralOrganisationsListPref;
3047 OrganisationsList = &HomeOrganisationsList;
3048 OrganisationsListType = &HomeOrganisationsListType;
3049 OrganisationsListAltID = &HomeOrganisationsListAltID;
3050 OrganisationsListPID = &HomeOrganisationsListPID;
3051 OrganisationsListTokens = &HomeOrganisationsListTokens;
3052 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3053 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3054 OrganisationsListPref = &HomeOrganisationsListPref;
3057 OrganisationsList = &BusinessOrganisationsList;
3058 OrganisationsListType = &BusinessOrganisationsListType;
3059 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3060 OrganisationsListPID = &BusinessOrganisationsListPID;
3061 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3062 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3063 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3064 OrganisationsListPref = &BusinessOrganisationsListPref;
3069 bool PropertyMatched = FALSE;
3071 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3072 intiter != SplitPoints.end(); ++intiter){
3074 SLiter = SplitLength.find(intiter->first);
3075 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3076 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3077 intPrevValue = intiter->second;
3079 // Process properties.
3081 size_t intPropertyValueLen = PropertyValue.Len();
3083 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3085 PropertyValue.Trim();
3086 PropertyValue.RemoveLast();
3090 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3092 PropertyValue.Remove(0, 1);
3096 CaptureString(&PropertyValue, FALSE);
3098 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3099 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3100 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3101 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3102 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3104 if (PropertyMatched == TRUE){
3106 PropertyMatched = FALSE;
3111 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3115 // Add the data to the General/Home/Work address variables.
3117 CaptureString(&PropertySeg2, FALSE);
3119 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3121 if (!PropertyTokens.IsEmpty()){
3123 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3129 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3131 std::map<int, int> SplitPoints;
3132 std::map<int, int> SplitLength;
3133 std::map<int, int>::iterator SLiter;
3134 wxString PropertyData;
3135 wxString PropertyName;
3136 wxString PropertyValue;
3137 wxString PropertyTokens;
3138 bool FirstToken = TRUE;
3139 int intPrevValue = 6;
3141 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3145 PropertyType PropType = PROPERTY_NONE;
3147 // Look for type before continuing.
3149 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3151 // Setup the pointers.
3153 std::map<int, wxString> *NoteList = NULL;
3154 std::map<int, wxString> *NoteListAltID = NULL;
3155 std::map<int, wxString> *NoteListPID = NULL;
3156 std::map<int, wxString> *NoteListType = NULL;
3157 std::map<int, wxString> *NoteListTokens = NULL;
3158 std::map<int, wxString> *NoteListLanguage = NULL;
3159 std::map<int, int> *NoteListPref = NULL;
3161 // Setup blank lines for later on.
3165 NoteList = &GeneralNoteList;
3166 NoteListType = &GeneralNoteListType;
3167 NoteListAltID = &GeneralNoteListAltID;
3168 NoteListPID = &GeneralNoteListPID;
3169 NoteListTokens = &GeneralNoteListTokens;
3170 NoteListLanguage = &GeneralNoteListLanguage;
3171 NoteListPref = &GeneralNoteListPref;
3174 NoteList = &HomeNoteList;
3175 NoteListType = &HomeNoteListType;
3176 NoteListAltID = &HomeNoteListAltID;
3177 NoteListPID = &HomeNoteListPID;
3178 NoteListTokens = &HomeNoteListTokens;
3179 NoteListLanguage = &HomeNoteListLanguage;
3180 NoteListPref = &HomeNoteListPref;
3183 NoteList = &BusinessNoteList;
3184 NoteListType = &BusinessNoteListType;
3185 NoteListAltID = &BusinessNoteListAltID;
3186 NoteListPID = &BusinessNoteListPID;
3187 NoteListTokens = &BusinessNoteListTokens;
3188 NoteListLanguage = &BusinessNoteListLanguage;
3189 NoteListPref = &BusinessNoteListPref;
3194 bool PropertyMatched = FALSE;
3196 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3197 intiter != SplitPoints.end(); ++intiter){
3199 SLiter = SplitLength.find(intiter->first);
3200 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3201 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3202 intPrevValue = intiter->second;
3204 // Process properties.
3206 size_t intPropertyValueLen = PropertyValue.Len();
3208 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3210 PropertyValue.Trim();
3211 PropertyValue.RemoveLast();
3215 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3217 PropertyValue.Remove(0, 1);
3221 CaptureString(&PropertyValue, FALSE);
3223 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3224 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3225 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3226 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3228 if (PropertyMatched == TRUE){
3230 PropertyMatched = FALSE;
3235 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3239 // Add the data to the General/Home/Work address variables.
3241 CaptureString(&PropertySeg2, FALSE);
3243 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3245 if (!PropertyTokens.IsEmpty()){
3247 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3253 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3255 std::map<int, int> SplitPoints;
3256 std::map<int, int> SplitLength;
3257 std::map<int, int>::iterator SLiter;
3258 wxString PropertyData;
3259 wxString PropertyName;
3260 wxString PropertyValue;
3261 wxString PropertyTokens;
3262 bool FirstToken = TRUE;
3263 int intPrevValue = 12;
3265 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3269 PropertyType PropType = PROPERTY_NONE;
3271 // Look for type before continuing.
3273 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3275 // Setup blank lines for later on.
3281 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3284 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3289 bool PropertyMatched = FALSE;
3291 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3292 intiter != SplitPoints.end(); ++intiter){
3294 SLiter = SplitLength.find(intiter->first);
3295 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3296 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3297 intPrevValue = intiter->second;
3299 // Process properties.
3301 size_t intPropertyValueLen = PropertyValue.Len();
3303 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3305 PropertyValue.Trim();
3306 PropertyValue.RemoveLast();
3310 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3312 PropertyValue.Remove(0, 1);
3316 CaptureString(&PropertyValue, FALSE);
3318 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3319 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3320 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3321 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3323 if (PropertyMatched == TRUE){
3325 PropertyMatched = FALSE;
3330 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3334 // Deal with multiple categories.
3336 int intOrigCatCount = *CategoryCount;
3337 bool FirstCategoryProcessed = TRUE;
3338 bool AfterFirstToken = FALSE;
3339 int intSplitSize = 0;
3340 int intSplitsFound = 0;
3341 int intSplitSeek = 0;
3342 int intPropertyLen = PropertySeg2.Len();
3344 SplitPoints.clear();
3345 SplitLength.clear();
3348 for (int i = 0; i <= intPropertyLen; i++){
3350 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3358 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3360 if (AfterFirstToken == TRUE){
3362 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3363 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3367 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3368 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3369 AfterFirstToken = TRUE;
3381 if (SplitPoints.size() > 0){
3383 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3384 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3388 if (SplitPoints.size() == 0){
3390 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3392 if (!PropertyTokens.IsEmpty()){
3394 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3400 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3401 intiter != SplitPoints.end(); ++intiter){
3403 SLiter = SplitLength.find(intiter->first);
3405 intPrevValue = intiter->second;
3407 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3409 // Add the data to the General/Home/Work address variables.
3411 // Trim any whitespace from the start and end.
3413 PropertyData = PropertyData.Trim(FALSE);
3414 PropertyData = PropertyData.Trim(TRUE);
3416 CaptureString(&PropertyData, FALSE);
3418 if (FirstCategoryProcessed == TRUE){
3420 FirstCategoryProcessed = FALSE;
3422 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3424 if (!PropertyTokens.IsEmpty()){
3426 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3436 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3438 if (!PropertyTokens.IsEmpty()){
3440 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3446 // Copy the properties to each of the categories (if it exists).
3448 if (!PropertyTokens.IsEmpty()){
3450 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3454 // Check if ALTID was used.
3456 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3458 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3462 // Check if PID was used.
3464 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3466 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3470 // Check if PREF was used.
3472 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3474 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3478 // Check if LANGUAGE was used.
3480 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3482 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3486 // Check if TYPE was used.
3492 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3495 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3503 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3505 size_t intPropertyLen = PropertySeg1.Len();
3506 std::map<int, int> SplitPoints;
3507 std::map<int, int> SplitLength;
3508 std::map<int, int>::iterator SLiter;
3509 wxString PropertyData;
3510 wxString PropertyName;
3511 wxString PropertyValue;
3512 wxString PropertyTokens;
3513 bool FirstToken = TRUE;
3514 int intSplitsFound = 0;
3515 int intSplitSize = 0;
3516 int intPrevValue = 7;
3518 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3522 PropertyType PropType = PROPERTY_NONE;
3524 // Look for type before continuing.
3526 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3529 bool PropertyMatched = FALSE;
3531 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3532 intiter != SplitPoints.end(); ++intiter){
3534 SLiter = SplitLength.find(intiter->first);
3535 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3536 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3537 intPrevValue = intiter->second;
3539 // Process properties.
3541 size_t intPropertyValueLen = PropertyValue.Len();
3543 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3545 PropertyValue.Trim();
3546 PropertyValue.RemoveLast();
3550 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3552 PropertyValue.Remove(0, 1);
3556 CaptureString(&PropertyValue, FALSE);
3558 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3559 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3560 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3561 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3563 if (PropertyMatched == TRUE){
3565 PropertyMatched = FALSE;
3570 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3574 intPropertyLen = PropertySeg2.Len();
3575 SplitPoints.clear();
3576 SplitLength.clear();
3581 CaptureString(&PropertySeg2, FALSE);
3583 for (int i = 0; i <= intPropertyLen; i++){
3587 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3590 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3592 if (intSplitsFound == 6){
3594 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3599 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3609 wxString wxSPhotoURI;
3610 wxString wxSPhotoMIME;
3611 wxString wxSPhotoEncoding;
3612 wxString wxSPhotoData;
3613 std::string base64enc;
3615 if (intSplitsFound == 0){
3619 std::map<int, int>::iterator striter;
3621 striter = SplitLength.find(1);
3623 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3625 while (wSTDataType.HasMoreTokens() == TRUE){
3627 wxSPhotoURI = wSTDataType.GetNextToken();
3628 wxSPhotoMIME = wSTDataType.GetNextToken();
3633 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3635 while (wSTDataInfo.HasMoreTokens() == TRUE){
3637 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3638 wxSPhotoData = wSTDataInfo.GetNextToken();
3639 base64enc = wxSPhotoData.mb_str();
3646 // Add the data to the General/Home/Work address variables.
3648 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3649 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3650 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3656 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3659 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3663 if (!PropertyTokens.IsEmpty()){
3665 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3671 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3673 size_t intPropertyLen = PropertySeg1.Len();
3674 std::map<int, int> SplitPoints;
3675 std::map<int, int> SplitLength;
3676 std::map<int, int>::iterator SLiter;
3677 wxString PropertyData;
3678 wxString PropertyName;
3679 wxString PropertyValue;
3680 wxString PropertyTokens;
3681 bool FirstToken = TRUE;
3682 int intSplitsFound = 0;
3683 int intSplitSize = 0;
3684 int intPrevValue = 6;
3686 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3690 PropertyType PropType = PROPERTY_NONE;
3692 // Look for type before continuing.
3694 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3697 bool PropertyMatched = FALSE;
3699 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3700 intiter != SplitPoints.end(); ++intiter){
3702 SLiter = SplitLength.find(intiter->first);
3703 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3704 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3705 intPrevValue = intiter->second;
3707 // Process properties.
3709 size_t intPropertyValueLen = PropertyValue.Len();
3711 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3713 PropertyValue.Trim();
3714 PropertyValue.RemoveLast();
3718 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3720 PropertyValue.Remove(0, 1);
3724 CaptureString(&PropertyValue, FALSE);
3726 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3727 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3728 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3729 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3731 if (PropertyMatched == TRUE){
3733 PropertyMatched = FALSE;
3738 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3742 intPropertyLen = PropertySeg2.Len();
3743 SplitPoints.clear();
3744 SplitLength.clear();
3749 CaptureString(&PropertySeg2, FALSE);
3751 for (int i = 0; i <= intPropertyLen; i++){
3755 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3758 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3760 if (intSplitsFound == 6){
3762 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3767 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3777 wxString wxSPhotoURI;
3778 wxString wxSPhotoMIME;
3779 wxString wxSPhotoEncoding;
3780 wxString wxSPhotoData;
3781 std::string base64enc;
3783 if (intSplitsFound == 0){
3787 std::map<int, int>::iterator striter;
3789 striter = SplitLength.find(1);
3791 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3793 while (wSTDataType.HasMoreTokens() == TRUE){
3795 wxSPhotoURI = wSTDataType.GetNextToken();
3796 wxSPhotoMIME = wSTDataType.GetNextToken();
3801 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3803 while (wSTDataInfo.HasMoreTokens() == TRUE){
3805 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3806 wxSPhotoData = wSTDataInfo.GetNextToken();
3807 base64enc = wxSPhotoData.mb_str();
3814 // Add the data to the General/Home/Work address variables.
3816 LogosList.insert(std::make_pair(*LogoCount, base64enc));
3817 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3818 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3824 LogosListType.insert(std::make_pair(*LogoCount, "home"));
3827 LogosListType.insert(std::make_pair(*LogoCount, "work"));
3831 if (!PropertyTokens.IsEmpty()){
3833 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3839 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3841 size_t intPropertyLen = PropertySeg1.Len();
3842 std::map<int, int> SplitPoints;
3843 std::map<int, int> SplitLength;
3844 std::map<int, int>::iterator SLiter;
3845 wxString PropertyData;
3846 wxString PropertyName;
3847 wxString PropertyValue;
3848 wxString PropertyTokens;
3849 bool FirstToken = TRUE;
3850 int intSplitsFound = 0;
3851 int intSplitSize = 0;
3852 int intPrevValue = 7;
3854 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3858 PropertyType PropType = PROPERTY_NONE;
3860 // Look for type before continuing.
3862 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3865 bool PropertyMatched = FALSE;
3867 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3868 intiter != SplitPoints.end(); ++intiter){
3870 SLiter = SplitLength.find(intiter->first);
3871 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3872 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3873 intPrevValue = intiter->second;
3875 // Process properties.
3877 size_t intPropertyValueLen = PropertyValue.Len();
3879 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3881 PropertyValue.Trim();
3882 PropertyValue.RemoveLast();
3886 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3888 PropertyValue.Remove(0, 1);
3892 CaptureString(&PropertyValue, FALSE);
3894 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
3895 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
3896 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
3897 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
3898 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
3900 if (PropertyMatched == TRUE){
3902 PropertyMatched = FALSE;
3907 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3911 intPropertyLen = PropertySeg2.Len();
3912 SplitPoints.clear();
3913 SplitLength.clear();
3918 CaptureString(&PropertySeg2, FALSE);
3920 for (int i = 0; i <= intPropertyLen; i++){
3924 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3927 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3929 if (intSplitsFound == 6){
3931 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3936 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3946 wxString wxSSoundURI;
3947 wxString wxSSoundMIME;
3948 wxString wxSSoundEncoding;
3949 wxString wxSSoundData;
3950 std::string base64enc;
3952 if (intSplitsFound == 0){
3956 std::map<int, int>::iterator striter;
3958 striter = SplitLength.find(1);
3960 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3962 while (wSTDataType.HasMoreTokens() == TRUE){
3964 wxSSoundURI = wSTDataType.GetNextToken();
3965 wxSSoundMIME = wSTDataType.GetNextToken();
3970 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3972 while (wSTDataInfo.HasMoreTokens() == TRUE){
3974 wxSSoundEncoding = wSTDataInfo.GetNextToken();
3975 wxSSoundData = wSTDataInfo.GetNextToken();
3976 base64enc = wxSSoundData.mb_str();
3983 // Add the data to the General/Home/Work address variables.
3989 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
3992 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
3996 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
3997 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
3998 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4000 if (!PropertyTokens.IsEmpty()){
4002 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4008 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4010 size_t intPropertyLen = PropertySeg1.Len();
4011 std::map<int, int> SplitPoints;
4012 std::map<int, int> SplitLength;
4013 std::map<int, int>::iterator SLiter;
4014 wxString PropertyData;
4015 wxString PropertyName;
4016 wxString PropertyValue;
4017 wxString PropertyTokens;
4018 bool FirstToken = TRUE;
4019 int intSplitsFound = 0;
4020 int intSplitSize = 0;
4021 int intPrevValue = 8;
4023 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4027 PropertyType PropType = PROPERTY_NONE;
4029 // Look for type before continuing.
4031 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4034 bool PropertyMatched = FALSE;
4036 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4037 intiter != SplitPoints.end(); ++intiter){
4039 SLiter = SplitLength.find(intiter->first);
4040 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4041 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4042 intPrevValue = intiter->second;
4044 // Process properties.
4046 size_t intPropertyValueLen = PropertyValue.Len();
4048 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4050 PropertyValue.Trim();
4051 PropertyValue.RemoveLast();
4055 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4057 PropertyValue.Remove(0, 1);
4061 CaptureString(&PropertyValue, FALSE);
4063 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4064 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4065 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4066 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4068 if (PropertyMatched == TRUE){
4070 PropertyMatched = FALSE;
4075 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4079 intPropertyLen = PropertySeg2.Len();
4080 SplitPoints.clear();
4081 SplitLength.clear();
4086 CaptureString(&PropertySeg2, FALSE);
4088 // Add the data to the General/Home/Work address variables.
4094 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4097 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4101 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4103 if (!PropertyTokens.IsEmpty()){
4105 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4111 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4113 size_t intPropertyLen = PropertySeg1.Len();
4114 std::map<int, int> SplitPoints;
4115 std::map<int, int> SplitLength;
4116 std::map<int, int>::iterator SLiter;
4117 wxString PropertyData;
4118 wxString PropertyName;
4119 wxString PropertyValue;
4120 wxString PropertyTokens;
4121 bool FirstToken = TRUE;
4122 int intSplitsFound = 0;
4123 int intSplitSize = 0;
4124 int intPrevValue = 8;
4126 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4130 PropertyType PropType = PROPERTY_NONE;
4132 // Look for type before continuing.
4134 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4137 bool PropertyMatched = FALSE;
4139 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4140 intiter != SplitPoints.end(); ++intiter){
4142 SLiter = SplitLength.find(intiter->first);
4143 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4144 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4145 intPrevValue = intiter->second;
4147 // Process properties.
4149 size_t intPropertyValueLen = PropertyValue.Len();
4151 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4153 PropertyValue.Trim();
4154 PropertyValue.RemoveLast();
4158 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4160 PropertyValue.Remove(0, 1);
4164 CaptureString(&PropertyValue, FALSE);
4166 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4167 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4168 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4169 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4171 if (PropertyMatched == TRUE){
4173 PropertyMatched = FALSE;
4178 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4182 intPropertyLen = PropertySeg2.Len();
4183 SplitPoints.clear();
4184 SplitLength.clear();
4189 CaptureString(&PropertySeg2, FALSE);
4191 // Add the data to the General/Home/Work address variables.
4197 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4200 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4204 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4206 if (!PropertyTokens.IsEmpty()){
4208 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4214 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4216 size_t intPropertyLen = PropertySeg1.Len();
4217 std::map<int, int> SplitPoints;
4218 std::map<int, int> SplitLength;
4219 std::map<int, int>::iterator SLiter;
4220 wxString PropertyData;
4221 wxString PropertyName;
4222 wxString PropertyValue;
4223 wxString PropertyTokens;
4224 bool FirstToken = TRUE;
4225 int intSplitsFound = 0;
4226 int intSplitSize = 0;
4227 int intPrevValue = 7;
4229 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4233 PropertyType PropType = PROPERTY_NONE;
4235 // Look for type before continuing.
4237 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4240 bool PropertyMatched = FALSE;
4242 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4243 intiter != SplitPoints.end(); ++intiter){
4245 SLiter = SplitLength.find(intiter->first);
4246 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4247 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4248 intPrevValue = intiter->second;
4250 // Process properties.
4252 size_t intPropertyValueLen = PropertyValue.Len();
4254 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4256 PropertyValue.Trim();
4257 PropertyValue.RemoveLast();
4261 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4263 PropertyValue.Remove(0, 1);
4267 CaptureString(&PropertyValue, FALSE);
4269 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4270 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4271 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4272 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4274 if (PropertyMatched == TRUE){
4276 PropertyMatched = FALSE;
4281 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4285 intPropertyLen = PropertySeg2.Len();
4286 SplitPoints.clear();
4287 SplitLength.clear();
4292 CaptureString(&PropertySeg2, FALSE);
4294 // Add the data to the General/Home/Work address variables.
4300 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4303 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4307 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4309 if (!PropertyTokens.IsEmpty()){
4311 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4317 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4319 size_t intPropertyLen = PropertySeg1.Len();
4320 std::map<int, int> SplitPoints;
4321 std::map<int, int> SplitLength;
4322 std::map<int, int>::iterator SLiter;
4323 wxString PropertyData;
4324 wxString PropertyName;
4325 wxString PropertyValue;
4326 wxString PropertyTokens;
4327 bool FirstToken = TRUE;
4328 int intSplitsFound = 0;
4329 int intSplitSize = 0;
4330 int intPrevValue = 5;
4332 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4336 PropertyType PropType = PROPERTY_NONE;
4338 // Look for type before continuing.
4340 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4343 bool PropertyMatched = FALSE;
4345 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4346 intiter != SplitPoints.end(); ++intiter){
4348 SLiter = SplitLength.find(intiter->first);
4349 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4350 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4351 intPrevValue = intiter->second;
4353 // Process properties.
4355 size_t intPropertyValueLen = PropertyValue.Len();
4357 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4359 PropertyValue.Trim();
4360 PropertyValue.RemoveLast();
4364 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4366 PropertyValue.Remove(0, 1);
4370 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4371 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4372 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4374 if (PropertyMatched == TRUE){
4376 PropertyMatched = FALSE;
4381 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4385 intPropertyLen = PropertySeg2.Len();
4386 SplitPoints.clear();
4387 SplitLength.clear();
4392 for (int i = 0; i <= intPropertyLen; i++){
4396 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4399 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4401 if (intSplitsFound == 6){
4403 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4408 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4419 wxString wxSKeyMIME;
4420 wxString wxSKeyEncoding;
4421 wxString wxSKeyData;
4422 std::string base64enc;
4424 if (intSplitsFound == 0){
4428 std::map<int, int>::iterator striter;
4430 striter = SplitLength.find(1);
4432 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4434 while (wSTDataType.HasMoreTokens() == TRUE){
4436 wxSKeyURI = wSTDataType.GetNextToken();
4437 wxSKeyMIME = wSTDataType.GetNextToken();
4442 if (wxSKeyURI == wxT("data")){
4444 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4446 while (wSTDataInfo.HasMoreTokens() == TRUE){
4448 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4449 wxSKeyData = wSTDataInfo.GetNextToken();
4458 // Add the data to the General/Home/Work address variables.
4460 if (wxSKeyURI == wxT("data")){
4462 KeyListDataEncType.erase(*KeyCount);
4463 KeyListKeyType.erase(*KeyCount);
4464 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4465 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4467 KeyList.erase(*KeyCount);
4468 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4472 KeyList.erase(*KeyCount);
4473 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4477 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4483 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4486 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4490 if (!PropertyTokens.IsEmpty()){
4492 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4498 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4500 // Split the Vendor three ways.
4502 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4505 wxString wxSVNDPropName;
4507 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4509 wSTVendorDetails.GetNextToken();
4510 wxSVNDID = wSTVendorDetails.GetNextToken();
4511 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4516 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4518 // Add the data to the vendor variables.
4520 VendorList.erase(*VendorCount);
4521 VendorListPEN.erase(*VendorCount);
4522 VendorListElement.erase(*VendorCount);
4524 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4525 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4526 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4532 void ProcessNameValue(wxString *PropertyData,
4533 wxString *PropertyName,
4534 wxString *PropertyValue){
4536 wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
4537 *PropertyName = PropertyElement.GetNextToken();
4538 *PropertyValue = PropertyElement.GetNextToken();
4542 void ProcessTokens(wxString *PropertyName,
4543 wxString *PropertyValue,
4544 wxString *PropertyTokens,
4547 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
4549 if (*FirstToken == TRUE){
4551 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
4552 *FirstToken = FALSE;
4556 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
4564 void ProcessStringValue(wxString *PropertyName,
4565 wxString PropertyNameMatch,
4566 std::map<int,wxString> *MapPtr,
4567 wxString *PropertyValue,
4569 bool *PropertyMatched){
4571 if (*PropertyName == PropertyNameMatch){
4572 MapPtr->erase(*ItemCount);
4573 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
4574 *PropertyMatched = TRUE;
4579 void ProcessIntegerValue(wxString *PropertyName,
4580 wxString PropertyNameMatch,
4581 std::map<int,int> *PrefPtr,
4582 wxString *PropertyValue,
4584 bool *PropertyMatched){
4586 if (*PropertyName == PropertyNameMatch){
4587 *PropertyMatched = TRUE;
4592 int PriorityNumber = 0;
4593 bool ValidNumber = TRUE;
4596 PriorityNumber = std::stoi(PropertyValue->ToStdString());
4599 catch(std::invalid_argument &e){
4600 ValidNumber = FALSE;
4603 if (ValidNumber == TRUE){
4605 PrefPtr->erase(*ItemCount);
4606 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
4612 void SplitValues(wxString *PropertyLine,
4613 std::map<int,int> *SplitPoints,
4614 std::map<int,int> *SplitLength,
4617 size_t intPropertyLen = PropertyLine->Len();
4618 int intSplitsFound = 0;
4619 int intSplitSize = 0;
4620 int intSplitSeek = 0;
4622 for (int i = intSize; i <= intPropertyLen; i++){
4626 if (PropertyLine->Mid(i, 1) == wxT(";") &&
4627 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
4629 if (intSplitsFound == 0){
4631 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
4635 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4639 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
4649 if (intSplitsFound == 0){
4651 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
4652 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
4656 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
4657 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
4663 void CheckType(wxString *PropertySeg1,
4664 std::map<int,int> *SplitPoints,
4665 std::map<int,int> *SplitLength,
4667 PropertyType *PropType){
4669 wxString PropertyData;
4670 wxString PropertyName;
4671 wxString PropertyValue;
4672 std::map<int,int>::iterator SLiter;
4674 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
4675 intiter != SplitPoints->end(); ++intiter){
4677 SLiter = SplitLength->find(intiter->first);
4678 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
4679 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4680 *intPrevValue = intiter->second;
4682 if (PropertyName == wxT("TYPE")){
4684 if (PropertyValue == wxT("work")){
4686 *PropType = PROPERTY_WORK;
4688 } else if (PropertyValue == wxT("home")){
4690 *PropType = PROPERTY_HOME;
4694 *PropType = PROPERTY_NONE;