1 // ContactDataObject.cpp - Client Data Object.
3 // (c) 2012-2016 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 // Load the ContactDataObject using the Filename given.
25 if (!wxFileExists(Filename)){
27 return CONTACTLOAD_FILEMISSING;
33 if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
35 return CONTACTLOAD_FILEERROR;
39 // Check that the vCard is a valid vCard 4.0 file.
41 vCard vCard4FormatCheck;
43 vCard4FormatCheck.LoadFile(Filename);
45 if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){
47 return CONTACTLOAD_FILEINVALIDFORMAT;
51 // Check that the vCard meets the base specification.
53 if (!vCard4FormatCheck.MeetBaseSpecification()){
55 return CONTACTLOAD_FILEBASESPECFAIL;
59 wxStringTokenizer wSTContactFileLines(vCard4FormatCheck.WriteString(), wxT("\r\n"));
61 std::map<int, wxString> ContactFileLines;
63 int ContactLineSeek = 0;
65 while (wSTContactFileLines.HasMoreTokens() == TRUE){
67 wxString ContactLine = wSTContactFileLines.GetNextToken();
68 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
73 wxString wxSPropertyNextLine;
75 bool ExtraLineSeek = TRUE;
76 bool QuoteMode = FALSE;
77 bool PropertyFind = TRUE;
78 bool KindProcessed = FALSE;
79 bool NameProcessed = FALSE;
80 bool GenderProcessed = FALSE;
81 bool BirthdayProcessed = FALSE;
82 bool AnniversaryProcessed = FALSE;
83 bool UIDProcessed = FALSE;
84 bool RevisionProcessed = FALSE;
85 int ContactLineLen = 0;
86 int QuoteBreakPoint = 0;
90 int NicknameCount = 0;
91 int TimeZoneCount = 0;
95 int TelephoneCount = 0;
96 int LanguageCount = 0;
97 int GeographicCount = 0;
102 int OrganisationCount = 0;
104 int CategoryCount = 0;
108 int CalendarCount = 0;
109 int CalendarAddressCount = 0;
110 int FreeBusyAddressCount = 0;
115 int ClientPIDCount = 0;
116 wxString ContactLine;
117 wxString PropertyLine;
118 wxString PropertySeg1;
119 wxString PropertySeg2;
120 wxString PropertyNextLine;
123 for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
124 iter != ContactFileLines.end(); ++iter){
126 ExtraLineSeek = TRUE;
132 PropertyLine.Clear();
133 PropertySeg1.Clear();
134 PropertySeg2.Clear();
137 ContactLine = iter->second;
139 while (ExtraLineSeek == TRUE){
141 // Check if there is extra data on the next line
142 // (indicated by space or tab at the start) and add data.
146 if (iter == ContactFileLines.end()){
153 PropertyNextLine = iter->second;
155 if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
157 PropertyNextLine.Remove(0, 1);
158 ContactLine.Append(PropertyNextLine);
163 ExtraLineSeek = FALSE;
169 ContactLineLen = ContactLine.Len();
171 // Make sure we are not in quotation mode.
172 // Make sure colon does not have \ or \\ before it.
174 for (int i = 0; i <= ContactLineLen; i++){
176 if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
178 PropertyFind = FALSE;
180 } else if (PropertyFind == TRUE){
182 Property.Append(ContactLine.Mid(i, 1));
186 if (ContactLine.Mid(i, 1) == wxT("\"")){
188 if (QuoteMode == TRUE){
200 if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
209 // Split that line at the point into two variables (ignore the colon).
211 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
212 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
214 if (Property == wxT("KIND") && KindProcessed == FALSE){
216 ProcessKind(PropertySeg2);
218 } else if (Property == wxT("UID") && UIDProcessed == FALSE){
220 UIDToken = PropertySeg2;
223 } else if (Property == wxT("SOURCE")){
225 ProcessSource(PropertySeg1, PropertySeg2, &SourceCount);
228 } else if (Property == wxT("XML")){
230 ProcessXML(PropertySeg1, PropertySeg2, &XMLCount);
233 } else if (Property == wxT("REV") && RevisionProcessed == FALSE){
235 ProcessRevision(PropertySeg1, PropertySeg2);
236 RevisionProcessed = TRUE;
238 } else if (Property == wxT("MEMBER")){
240 ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
243 } else if (Property == wxT("FN")){
245 ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
248 } else if (Property == wxT("N") && NameProcessed == FALSE){
250 ProcessN(PropertySeg1, PropertySeg2);
251 NameProcessed = TRUE;
253 } else if (Property == wxT("CLIENTPIDMAP")){
255 ProcessClientPIDMap(PropertySeg1, PropertySeg2, &ClientPIDCount);
258 } else if (Property == wxT("NICKNAME")){
260 ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
263 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
265 ProcessGender(PropertySeg1, PropertySeg2);
266 GenderProcessed = TRUE;
268 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
270 ProcessBirthday(PropertySeg1, PropertySeg2);
271 BirthdayProcessed = TRUE;
273 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
275 ProcessAnniversary(PropertySeg1, PropertySeg2);
276 AnniversaryProcessed = TRUE;
278 } else if (Property == wxT("TZ")){
280 ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
283 } else if (Property == wxT("ADR")){
285 ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
288 } else if (Property == wxT("EMAIL")){
290 ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);
293 } else if (Property == wxT("IMPP")){
295 ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
298 } else if (Property == wxT("TEL")){
300 ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
303 } else if (Property == wxT("LANG")){
305 // See frmContactEditor-LoadLanguage.cpp
307 ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
310 } else if (Property == wxT("GEO")){
312 // See frmContactEditor-LoadGeo.cpp
314 ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);
317 } else if (Property == wxT("RELATED")){
319 // See fromContactEditor-LoadRelated.cpp
321 ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);
324 } else if (Property == wxT("URL")){
326 // See frmContactEditor-LoadURL.cpp
328 ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
331 } else if (Property == wxT("TITLE")) {
333 // See frmContactEditor-LoadTitle.cpp
335 ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
338 } else if (Property == wxT("ROLE")) {
340 // See frmContactEditor-LoadTitle.cpp
342 ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
345 } else if (Property == wxT("ORG")) {
347 // See frmContactEditor-LoadOrg.cpp
349 ProcessOrganisation(PropertySeg1, PropertySeg2, &OrganisationCount);
352 } else if (Property == wxT("NOTE")) {
354 // See frmContactEditor-LoadNote.cpp
356 ProcessNote(PropertySeg1, PropertySeg2, &NoteCount);
359 } else if (Property == wxT("CATEGORIES")) {
361 // See frmContactEditor-LoadCategory.cpp
363 ProcessCategory(PropertySeg1, PropertySeg2, &CategoryCount);
366 } else if (Property == wxT("PHOTO")) {
368 // See frmContactEditor-LoadPhoto.cpp
370 ProcessPhoto(PropertySeg1, PropertySeg2, &PhotoCount);
373 } else if (Property == wxT("LOGO")) {
375 // See frmContactEditor-LoadPhoto.cpp
377 ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
380 } else if (Property == wxT("SOUND")) {
382 // See frmContactEditor-LoadSound.cpp
384 ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
387 } else if (Property == wxT("CALURI")){
389 // See frmContactEditor-LoadCalendar.cpp
391 ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
394 } else if (Property == wxT("CALADRURI")){
396 ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
397 CalendarAddressCount++;
399 } else if (Property == wxT("FBURL")){
401 // See frmContactEditor-LoadCalendar.cpp
403 ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
404 FreeBusyAddressCount++;
406 } else if (Property == wxT("KEY")){
408 // See frmContactEditor-LoadKey.cpp
410 ProcessKey(PropertySeg1, PropertySeg2, &KeyCount);
413 } else if (Property.Mid(0, 3) == wxT("VND")){
415 ProcessVendor(PropertySeg1, PropertySeg2, &VendorCount);
418 } else if (Property.Mid(0, 2) == wxT("X-")){
420 XTokenList.insert(std::make_pair(XTokenCount, PropertySeg2));
421 XTokenListTokens.insert(std::make_pair(XTokenCount, PropertySeg1.Mid(2)));
428 return CONTACTLOAD_OK;
432 void ContactDataObject::ProcessKind(wxString KindType){
434 // Process the type of contact.
436 if (KindType == wxT("individual")){
438 ContactKind = CONTACTKIND_INDIVIDUAL;
440 } else if (KindType == wxT("group")){
442 ContactKind = CONTACTKIND_GROUP;
444 } else if (KindType == wxT("org")){
446 ContactKind = CONTACTKIND_ORGANISATION;
448 } else if (KindType == wxT("location")){
450 ContactKind = CONTACTKIND_LOCATION;
454 ContactKind = CONTACTKIND_NONE;
459 void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString PropertySeg2){
461 // Process the revision date.
463 std::map<int, int> SplitPoints;
464 std::map<int, int> SplitLength;
465 std::map<int, int>::iterator SLiter;
466 wxString PropertyData;
467 wxString PropertyName;
468 wxString PropertyValue;
469 wxString PropertyTokens;
470 bool FirstToken = TRUE;
471 int intPrevValue = 5;
473 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
477 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
478 intiter != SplitPoints.end(); ++intiter){
480 SLiter = SplitLength.find(intiter->first);
481 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
482 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
483 intPrevValue = intiter->second;
485 // Process properties.
487 size_t intPropertyValueLen = PropertyValue.Len();
489 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
491 PropertyValue.Trim();
492 PropertyValue.RemoveLast();
496 if (PropertyValue.Mid(0, 1) == wxT("\"")){
498 PropertyValue.Remove(0, 1);
502 CaptureString(&PropertyValue, FALSE);
504 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
508 CaptureString(&PropertySeg2, FALSE);
510 Revision = PropertySeg2;
512 if (!PropertyTokens.IsEmpty()){
514 RevisionTokens = PropertyTokens;
521 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
523 // Process the source address.
525 std::map<int, int> SplitPoints;
526 std::map<int, int> SplitLength;
527 std::map<int, int>::iterator SLiter;
528 wxString PropertyData;
529 wxString PropertyName;
530 wxString PropertyValue;
531 wxString PropertyTokens;
532 bool FirstToken = TRUE;
533 bool PropertyMatched = FALSE;
534 int intPrevValue = 8;
536 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
540 PropertyType PropType = PROPERTY_NONE;
542 // Look for type before continuing.
544 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
548 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
549 intiter != SplitPoints.end(); ++intiter){
551 SLiter = SplitLength.find(intiter->first);
553 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
555 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
557 intPrevValue = intiter->second;
559 // Process properties.
561 size_t intPropertyValueLen = PropertyValue.Len();
563 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
565 PropertyValue.Trim();
566 PropertyValue.RemoveLast();
570 if (PropertyValue.Mid(0, 1) == wxT("\"")){
572 PropertyValue.Remove(0, 1);
576 CaptureString(&PropertyValue, FALSE);
578 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
579 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
580 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
581 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
583 if (PropertyMatched == TRUE){
585 PropertyMatched = FALSE;
590 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
598 CaptureString(&PropertySeg2, FALSE);
600 // Add the data to the General/Home/Work address variables.
606 SourceListType.insert(std::make_pair(*SourceCount, "home"));
609 SourceListType.insert(std::make_pair(*SourceCount, "work"));
613 SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
615 if (!PropertyTokens.IsEmpty()){
617 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
623 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
625 // Process the XML data.
627 std::map<int, int> SplitPoints;
628 std::map<int, int> SplitLength;
630 int intPrevValue = 5;
632 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
636 wxString PropertyName;
637 wxString PropertyValue;
638 wxString PropertyData;
639 wxString PropertyTokens;
640 std::map<int,int>::iterator SLiter;
641 bool PropertyMatched = FALSE;
643 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
644 intiter != SplitPoints.end(); ++intiter){
646 SLiter = SplitLength.find(intiter->first);
647 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
648 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
649 intPrevValue = intiter->second;
651 CaptureString(&PropertyValue, FALSE);
653 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
655 if (PropertyMatched == TRUE){
657 PropertyMatched = FALSE;
664 XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
668 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
670 // Process the membership data.
672 std::map<int, int> SplitPoints;
673 std::map<int, int> SplitLength;
675 int intPrevValue = 8;
677 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
681 wxString PropertyName;
682 wxString PropertyValue;
683 wxString PropertyData;
684 wxString PropertyTokens;
685 std::map<int,int>::iterator SLiter;
686 bool FirstToken = TRUE;
687 bool PropertyMatched = FALSE;
689 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
690 intiter != SplitPoints.end(); ++intiter){
692 SLiter = SplitLength.find(intiter->first);
693 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
694 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
695 intPrevValue = intiter->second;
697 CaptureString(&PropertyValue, FALSE);
699 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
700 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
701 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
702 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
704 if (PropertyMatched == TRUE){
706 PropertyMatched = FALSE;
711 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
715 GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
717 if (!PropertyTokens.IsEmpty()){
719 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
726 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
728 // Process the full name.
730 std::map<int, int> SplitPoints;
731 std::map<int, int> SplitLength;
733 int intPrevValue = 4;
735 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
739 wxString PropertyName;
740 wxString PropertyValue;
741 wxString PropertyData;
742 wxString PropertyTokens;
743 std::map<int,int>::iterator SLiter;
744 bool FirstToken = TRUE;
745 bool PropertyMatched = FALSE;
747 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
748 intiter != SplitPoints.end(); ++intiter){
750 SLiter = SplitLength.find(intiter->first);
751 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
752 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
753 intPrevValue = intiter->second;
755 CaptureString(&PropertyValue, FALSE);
757 if (PropertyName == wxT("TYPE")){
759 if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
760 PropertyValue == wxT("work") ){
762 FullNamesListType.erase(*FNCount);
763 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
767 PropertyMatched = TRUE;
771 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
772 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
773 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
774 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
776 if (PropertyMatched == TRUE){
778 PropertyMatched = FALSE;
783 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
787 FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
789 if (!PropertyTokens.IsEmpty()){
791 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
797 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
801 std::map<int, int> SplitPoints;
802 std::map<int, int> SplitLength;
804 int intPrevValue = 3;
806 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
810 wxString PropertyName;
811 wxString PropertyValue;
812 wxString PropertyData;
813 wxString PropertyTokens;
814 std::map<int,int>::iterator SLiter;
815 bool FirstToken = TRUE;
817 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
818 intiter != SplitPoints.end(); ++intiter){
820 SLiter = SplitLength.find(intiter->first);
821 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
822 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
823 intPrevValue = intiter->second;
825 CaptureString(&PropertyValue, FALSE);
827 if (PropertyName == wxT("ALTID")){
829 NameAltID = PropertyValue;
831 } else if (PropertyName == wxT("LANGUAGE")){
833 NameLanguage = PropertyValue;
835 } else if (PropertyName == wxT("SORT-AS")){
837 if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
838 PropertyValue.Len() >= 3){
839 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
842 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
844 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
850 // Split the name data.
852 int intSplitSeek = 0;
853 int intSplitsFound = 0;
854 int intSplitSize = 0;
855 int intPropertyLen = PropertySeg2.Len();
857 std::map<int,wxString> NameValues;
860 for (int i = 0; i <= intPropertyLen; i++){
862 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
864 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
869 if (intSplitsFound == 4){
871 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
885 // Split the data into several parts.
887 for (std::map<int, wxString>::iterator iter = NameValues.begin();
888 iter != NameValues.end(); ++iter){
890 if (iter->first == 1){
892 // Deal with family name.
894 NameSurname = iter->second;
896 } else if (iter->first == 2){
898 // Deal with given names.
900 NameForename = iter->second;
902 } else if (iter->first == 3){
904 // Deal with additional names.
906 NameOtherNames = iter->second;
908 } else if (iter->first == 4){
910 // Deal with honorifix prefixes and suffixes.
912 NameTitle = iter->second;
916 if (iter == NameValues.end()){
922 NameSuffix = iter->second;
928 // Add the name token data.
930 if (!PropertyTokens.IsEmpty()){
932 NameTokens = PropertyTokens;
938 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
940 // Process the Client PID Map.
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 intPrevValue = 14;
952 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
956 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
957 intiter != SplitPoints.end(); ++intiter){
959 SLiter = SplitLength.find(intiter->first);
960 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
961 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
962 intPrevValue = intiter->second;
964 // Process properties.
966 CaptureString(&PropertyValue, FALSE);
968 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
972 CaptureString(&PropertySeg2, FALSE);
974 ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
976 if (!PropertyTokens.IsEmpty()){
978 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
984 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
986 // Process the Nickname.
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 // Process the gender.
1093 std::map<int, int> SplitPoints;
1094 std::map<int, int> SplitLength;
1095 std::map<int, int>::iterator SLiter;
1096 wxString PropertyData;
1097 wxString PropertyName;
1098 wxString PropertyValue;
1099 wxString PropertyTokens;
1100 bool FirstToken = TRUE;
1101 int intPrevValue = 8;
1103 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1107 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1108 intiter != SplitPoints.end(); ++intiter){
1110 SLiter = SplitLength.find(intiter->first);
1111 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1112 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1113 intPrevValue = intiter->second;
1115 // Process properties.
1117 size_t intPropertyValueLen = PropertyValue.Len();
1119 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1121 PropertyValue.Trim();
1122 PropertyValue.RemoveLast();
1126 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1128 PropertyValue.Remove(0, 1);
1132 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1136 wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1138 wxString GenderComponent;
1140 if (GenderData.CountTokens() >= 2){
1142 Gender = GenderData.GetNextToken();
1143 GenderDetails = GenderData.GetString();
1145 CaptureString(&GenderDetails, FALSE);
1149 Gender = GenderData.GetNextToken();
1153 if (!PropertyTokens.IsEmpty()){
1155 GenderTokens = PropertyTokens;
1161 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1163 // Process birthday date.
1165 std::map<int, int> SplitPoints;
1166 std::map<int, int> SplitLength;
1167 std::map<int, int>::iterator SLiter;
1168 wxString PropertyData;
1169 wxString PropertyName;
1170 wxString PropertyValue;
1171 wxString PropertyTokens;
1172 int intPrevValue = 6;
1174 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1178 // Look for type before continuing.
1180 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1181 intiter != SplitPoints.end(); ++intiter){
1183 SLiter = SplitLength.find(intiter->first);
1184 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1185 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1186 intPrevValue = intiter->second;
1188 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1190 CaptureString(&PropertySeg2, FALSE);
1191 Birthday = PropertySeg2;
1192 BirthdayText = TRUE;
1198 // Setup blank lines for later on.
1201 bool FirstToken = TRUE;
1203 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1204 intiter != SplitPoints.end(); ++intiter){
1206 SLiter = SplitLength.find(intiter->first);
1207 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1208 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1209 intPrevValue = intiter->second;
1211 // Process properties.
1213 CaptureString(&PropertyValue, FALSE);
1215 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1217 PropertyValue.Trim();
1218 PropertyValue.RemoveLast();
1222 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1224 PropertyValue.Remove(0, 1);
1228 if (PropertyName == wxT("ALTID")){
1230 BirthdayAltID = PropertyValue;
1232 } else if (PropertyName == wxT("CALSCALE")){
1234 BirthdayCalScale = PropertyValue;
1236 } else if (PropertyName != wxT("VALUE")) {
1238 // Something else we don't know about so append
1239 // to the tokens variable.
1241 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1247 // Add the data to the variables and form.
1249 if (BirthdayText == FALSE){
1251 Birthday = PropertySeg2;
1255 if (!PropertyTokens.IsEmpty()){
1257 BirthdayTokens = PropertyTokens;
1263 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1265 // Process the anniversary.
1267 std::map<int, int> SplitPoints;
1268 std::map<int, int> SplitLength;
1269 std::map<int, int>::iterator SLiter;
1270 wxString PropertyData;
1271 wxString PropertyName;
1272 wxString PropertyValue;
1273 wxString PropertyTokens;
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 // Process the timezone.
1369 std::map<int, int> SplitPoints;
1370 std::map<int, int> SplitLength;
1372 int intPrevValue = 4;
1374 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1378 PropertyType PropType = PROPERTY_NONE;
1380 // Look for type before continuing.
1382 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1386 std::map<int, wxString> *TZList = NULL;
1387 std::map<int, wxString> *TZListType = NULL;
1388 std::map<int, wxString> *TZListMediatype = NULL;
1389 std::map<int, wxString> *TZListAltID = NULL;
1390 std::map<int, wxString> *TZListPID = NULL;
1391 std::map<int, wxString> *TZListTokens = NULL;
1392 std::map<int, int> *TZListPref = NULL;
1396 TZList = &GeneralTZList;
1397 TZListType = &GeneralTZListType;
1398 TZListMediatype = &GeneralTZListMediatype;
1399 TZListAltID = &GeneralTZListAltID;
1400 TZListPID = &GeneralTZListPID;
1401 TZListTokens = &GeneralTZListTokens;
1402 TZListPref = &GeneralTZListPref;
1405 TZList = &HomeTZList;
1406 TZListType = &HomeTZListType;
1407 TZListMediatype = &HomeTZListMediatype;
1408 TZListAltID = &HomeTZListAltID;
1409 TZListPID = &HomeTZListPID;
1410 TZListTokens = &HomeTZListTokens;
1411 TZListPref = &HomeTZListPref;
1414 TZList = &BusinessTZList;
1415 TZListType = &BusinessTZListType;
1416 TZListMediatype = &BusinessTZListMediatype;
1417 TZListAltID = &BusinessTZListAltID;
1418 TZListPID = &BusinessTZListPID;
1419 TZListTokens = &BusinessTZListTokens;
1420 TZListPref = &BusinessTZListPref;
1424 std::map<int, int>::iterator SLiter;
1425 wxString PropertyData;
1426 wxString PropertyName;
1427 wxString PropertyValue;
1428 wxString PropertyTokens;
1429 bool FirstToken = TRUE;
1430 bool PropertyMatched = FALSE;
1432 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1433 intiter != SplitPoints.end(); ++intiter){
1435 SLiter = SplitLength.find(intiter->first);
1436 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1437 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1438 intPrevValue = intiter->second;
1440 CaptureString(&PropertyValue, FALSE);
1442 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1443 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1444 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1445 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1447 if (PropertyMatched == TRUE){
1449 PropertyMatched = FALSE;
1454 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1456 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1462 TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1464 // Add the name token data.
1466 if (!PropertyTokens.IsEmpty()){
1468 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1475 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1477 // Process the address.
1479 size_t intPropertyLen = PropertySeg1.Len();
1480 std::map<int, int> SplitPoints;
1481 std::map<int, int> SplitLength;
1482 std::map<int, int>::iterator SLiter;
1483 wxString PropertyData;
1484 wxString PropertyName;
1485 wxString PropertyValue;
1486 wxString PropertyTokens;
1487 wxString AddressLabel;
1488 wxString AddressLang;
1489 wxString AddressAltID;
1490 wxString AddressPID;
1491 wxString AddressTokens;
1492 wxString AddressGeo;
1493 wxString AddressTimezone;
1494 wxString AddressType;
1495 wxString AddressMediatype;
1496 wxString AddressPOBox;
1497 wxString AddressExtended;
1498 wxString AddressStreet;
1499 wxString AddressLocality;
1500 wxString AddressCity;
1501 wxString AddressRegion;
1502 wxString AddressPostalCode;
1503 wxString AddressCountry;
1504 bool FirstToken = TRUE;
1505 int intSplitsFound = 0;
1506 int intSplitSize = 0;
1507 int intPrevValue = 5;
1508 bool PropertyMatched = FALSE;
1510 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1514 PropertyType PropType = PROPERTY_NONE;
1516 // Look for type before continuing.
1518 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1522 std::map<int, wxString> *AddressList = NULL;
1523 std::map<int, wxString> *AddressListTown = NULL;
1524 std::map<int, wxString> *AddressListCounty = NULL;
1525 std::map<int, wxString> *AddressListPostCode = NULL;
1526 std::map<int, wxString> *AddressListCountry = NULL;
1527 std::map<int, wxString> *AddressListLabel = NULL;
1528 std::map<int, wxString> *AddressListLang = NULL;
1529 std::map<int, wxString> *AddressListAltID = NULL;
1530 std::map<int, wxString> *AddressListPID = NULL;
1531 std::map<int, wxString> *AddressListTokens = NULL;
1532 std::map<int, wxString> *AddressListGeo = NULL;
1533 std::map<int, wxString> *AddressListTimezone = NULL;
1534 std::map<int, wxString> *AddressListType = NULL;
1535 std::map<int, wxString> *AddressListMediatype = NULL;
1536 std::map<int, int> *AddressListPref = NULL;
1540 AddressList = &GeneralAddressList;
1541 AddressListTown = &GeneralAddressListTown;
1542 AddressListCounty = &GeneralAddressListCounty;
1543 AddressListPostCode = &GeneralAddressListPostCode;
1544 AddressListCountry = &GeneralAddressListCountry;
1545 AddressListLabel = &GeneralAddressListLabel;
1546 AddressListLang = &GeneralAddressListLang;
1547 AddressListAltID = &GeneralAddressListAltID;
1548 AddressListPID = &GeneralAddressListPID;
1549 AddressListTokens = &GeneralAddressListTokens;
1550 AddressListGeo = &GeneralAddressListGeo;
1551 AddressListTimezone = &GeneralAddressListTimezone;
1552 AddressListType = &GeneralAddressListType;
1553 AddressListMediatype = &GeneralAddressListMediatype;
1554 AddressListPref = &GeneralAddressListPref;
1557 AddressList = &HomeAddressList;
1558 AddressListTown = &HomeAddressListTown;
1559 AddressListCounty = &HomeAddressListCounty;
1560 AddressListPostCode = &HomeAddressListPostCode;
1561 AddressListCountry = &HomeAddressListCountry;
1562 AddressListLabel = &HomeAddressListLabel;
1563 AddressListLang = &HomeAddressListLang;
1564 AddressListAltID = &HomeAddressListAltID;
1565 AddressListPID = &HomeAddressListPID;
1566 AddressListTokens = &HomeAddressListTokens;
1567 AddressListGeo = &HomeAddressListGeo;
1568 AddressListTimezone = &HomeAddressListTimezone;
1569 AddressListType = &HomeAddressListType;
1570 AddressListMediatype = &HomeAddressListMediatype;
1571 AddressListPref = &HomeAddressListPref;
1574 AddressList = &BusinessAddressList;
1575 AddressListTown = &BusinessAddressListTown;
1576 AddressListCounty = &BusinessAddressListCounty;
1577 AddressListPostCode = &BusinessAddressListPostCode;
1578 AddressListCountry = &BusinessAddressListCountry;
1579 AddressListLabel = &BusinessAddressListLabel;
1580 AddressListLang = &BusinessAddressListLang;
1581 AddressListAltID = &BusinessAddressListAltID;
1582 AddressListPID = &BusinessAddressListPID;
1583 AddressListTokens = &BusinessAddressListTokens;
1584 AddressListGeo = &BusinessAddressListGeo;
1585 AddressListTimezone = &BusinessAddressListTimezone;
1586 AddressListType = &BusinessAddressListType;
1587 AddressListMediatype = &BusinessAddressListMediatype;
1588 AddressListPref = &BusinessAddressListPref;
1594 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1595 intiter != SplitPoints.end(); ++intiter){
1597 SLiter = SplitLength.find(intiter->first);
1598 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1599 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1600 intPrevValue = intiter->second;
1602 if (PropertyName == "GEO"){
1604 CaptureString(&PropertyValue, TRUE);
1608 CaptureString(&PropertyValue, FALSE);
1612 // Process properties.
1614 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1615 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1616 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1617 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1618 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1619 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1620 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1621 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1623 if (PropertyMatched == TRUE){
1625 PropertyMatched = FALSE;
1630 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1634 // Split the address.
1636 //std::map<int, int>::iterator SLiter;
1637 intPropertyLen = PropertySeg2.Len();
1638 SplitPoints.clear();
1639 SplitLength.clear();
1644 for (int i = 0; i <= intPropertyLen; i++){
1648 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1651 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1653 if (intSplitsFound == 6){
1655 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1660 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1670 // Split the data into several parts.
1672 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1673 intiter != SplitPoints.end(); ++intiter){
1675 if (intiter->first == 1){
1677 // Deal with PO Box.
1679 SLiter = SplitLength.find(1);
1681 AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1682 intPrevValue = intiter->second;
1684 } else if (intiter->first == 2){
1686 // Deal with extended address.
1688 SLiter = SplitLength.find(2);
1690 AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1691 intPrevValue = intiter->second;
1693 } else if (intiter->first == 3){
1695 // Deal with street address.
1697 SLiter = SplitLength.find(3);
1699 AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1700 intPrevValue = intiter->second;
1702 } else if (intiter->first == 4){
1704 // Deal with locality
1706 SLiter = SplitLength.find(4);
1708 AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1709 intPrevValue = intiter->second;
1711 } else if (intiter->first == 5){
1713 // Deal with region.
1715 SLiter = SplitLength.find(5);
1717 AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1718 intPrevValue = intiter->second;
1721 } else if (intiter->first == 6){
1723 // Deal with post code.
1725 SLiter = SplitLength.find(6);
1727 AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1728 intPrevValue = intiter->second;
1730 // Deal with country.
1732 AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1740 // Add the data to the General/Home/Work address variables.
1742 CaptureString(&AddressStreet, FALSE);
1743 CaptureString(&AddressLocality, FALSE);
1744 CaptureString(&AddressRegion, FALSE);
1745 CaptureString(&AddressPostalCode, FALSE);
1746 CaptureString(&AddressCountry, FALSE);
1748 if (!PropertyTokens.IsEmpty()){
1750 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1754 AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));
1755 AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1756 AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1757 AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1758 AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1762 AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1765 AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1768 AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));
1772 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1776 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1778 // Process the email address.
1780 std::map<int, int> SplitPoints;
1781 std::map<int, int> SplitLength;
1783 int intPrevValue = 7;
1785 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1789 PropertyType PropType = PROPERTY_NONE;
1791 // Look for type before continuing.
1793 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1795 std::map<int, wxString> *EmailList = NULL;
1796 std::map<int, wxString> *EmailListType = NULL;
1797 std::map<int, wxString> *EmailListAltID = NULL;
1798 std::map<int, wxString> *EmailListPID = NULL;
1799 std::map<int, wxString> *EmailListTokens = NULL;
1800 std::map<int, int> *EmailListPref = NULL;
1804 EmailList = &GeneralEmailList;
1805 EmailListType = &GeneralEmailListType;
1806 EmailListAltID = &GeneralEmailListAltID;
1807 EmailListPID = &GeneralEmailListPID;
1808 EmailListTokens = &GeneralEmailListTokens;
1809 EmailListPref = &GeneralEmailListPref;
1812 EmailList = &HomeEmailList;
1813 EmailListType = &HomeEmailListType;
1814 EmailListAltID = &HomeEmailListAltID;
1815 EmailListPID = &HomeEmailListPID;
1816 EmailListTokens = &HomeEmailListTokens;
1817 EmailListPref = &HomeEmailListPref;
1820 EmailList = &BusinessEmailList;
1821 EmailListType = &BusinessEmailListType;
1822 EmailListAltID = &BusinessEmailListAltID;
1823 EmailListPID = &BusinessEmailListPID;
1824 EmailListTokens = &BusinessEmailListTokens;
1825 EmailListPref = &BusinessEmailListPref;
1831 std::map<int,int>::iterator SLiter;
1832 wxString PropertyData;
1833 wxString PropertyName;
1834 wxString PropertyValue;
1835 wxString PropertyTokens;
1836 bool FirstToken = TRUE;
1837 bool PropertyMatched = FALSE;
1839 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1840 intiter != SplitPoints.end(); ++intiter){
1842 SLiter = SplitLength.find(intiter->first);
1843 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1844 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1845 intPrevValue = intiter->second;
1847 CaptureString(&PropertyValue, FALSE);
1849 // Process properties.
1851 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
1852 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
1853 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
1855 if (PropertyMatched == TRUE){
1857 PropertyMatched = FALSE;
1862 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1866 EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1868 // Add the name token data.
1870 if (!PropertyTokens.IsEmpty()){
1872 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1879 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1883 std::map<int, int> SplitPoints;
1884 std::map<int, int> SplitLength;
1886 int intPrevValue = 6;
1888 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1892 PropertyType PropType = PROPERTY_NONE;
1894 // Look for type before continuing.
1896 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1898 std::map<int, wxString> *IMList = NULL;
1899 std::map<int, wxString> *IMListType = NULL;
1900 std::map<int, wxString> *IMListAltID = NULL;
1901 std::map<int, wxString> *IMListPID = NULL;
1902 std::map<int, wxString> *IMListTokens = NULL;
1903 std::map<int, wxString> *IMListMediatype = NULL;
1904 std::map<int, wxString> *IMListTypeInfo = NULL;
1905 std::map<int, int> *IMListPref = NULL;
1909 IMList = &GeneralIMList;
1910 IMListType = &GeneralIMListType;
1911 IMListAltID = &GeneralIMListAltID;
1912 IMListPID = &GeneralIMListPID;
1913 IMListTokens = &GeneralIMListTokens;
1914 IMListMediatype = &GeneralIMListMediatype;
1915 IMListTypeInfo = &GeneralIMListTypeInfo;
1916 IMListPref = &GeneralIMListPref;
1919 IMList = &HomeIMList;
1920 IMListType = &HomeIMListType;
1921 IMListAltID = &HomeIMListAltID;
1922 IMListPID = &HomeIMListPID;
1923 IMListTokens = &HomeIMListTokens;
1924 IMListMediatype = &HomeIMListMediatype;
1925 IMListTypeInfo = &HomeIMListTypeInfo;
1926 IMListPref = &HomeIMListPref;
1929 IMList = &BusinessIMList;
1930 IMListType = &BusinessIMListType;
1931 IMListAltID = &BusinessIMListAltID;
1932 IMListPID = &BusinessIMListPID;
1933 IMListTokens = &BusinessIMListTokens;
1934 IMListMediatype = &BusinessIMListMediatype;
1935 IMListTypeInfo = &BusinessIMListTypeInfo;
1936 IMListPref = &BusinessIMListPref;
1942 std::map<int,int>::iterator SLiter;
1943 wxString PropertyData;
1944 wxString PropertyName;
1945 wxString PropertyValue;
1946 wxString PropertyTokens;
1947 bool FirstToken = TRUE;
1948 bool PropertyMatched = FALSE;
1950 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
1951 intiter != SplitPoints.end(); ++intiter){
1953 SLiter = SplitLength.find(intiter->first);
1954 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1955 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1956 intPrevValue = intiter->second;
1958 CaptureString(&PropertyValue, FALSE);
1960 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
1961 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
1962 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
1963 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
1965 // Process properties.
1967 if (PropertyMatched == TRUE){
1969 PropertyMatched = FALSE;
1974 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1978 wxStringTokenizer IMPPSplitData(PropertySeg2, wxT(":"));
1980 if (IMPPSplitData.CountTokens() > 1){
1982 IMListTypeInfo->insert(std::make_pair(*IMCount, IMPPSplitData.GetNextToken()));
1983 IMList->insert(std::make_pair(*IMCount, IMPPSplitData.GetString()));
1987 IMList->insert(std::make_pair(*IMCount, PropertySeg2));
1988 IMListTypeInfo->insert(std::make_pair(*IMCount, "none"));
1992 // Add the name token data.
1994 if (!PropertyTokens.IsEmpty()){
1996 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
2002 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
2004 // Process the telephone.
2006 std::map<int, int> SplitPoints;
2007 std::map<int, int> SplitLength;
2008 std::map<int, int>::iterator SLiter;
2010 PropertyType PropType = PROPERTY_NONE;
2012 // Look for type before continuing.
2015 wxString TelTypeDetail;
2016 wxString PropertyData;
2017 wxString PropertyName;
2018 wxString PropertyValue;
2019 wxString PropertyTokens;
2021 std::map<int,int> TypeSplitPoints;
2022 std::map<int,int> TypeSplitLength;
2023 std::map<int,int>::iterator TSLiter;
2025 int intSplitSize = 0;
2026 int intSplitsFound = 0;
2027 int intSplitPoint = 0;
2028 int intPrevValue = 5;
2030 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2034 // Look for type before continuing.
2036 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2037 intiter != SplitPoints.end(); ++intiter){
2039 SLiter = SplitLength.find(intiter->first);
2040 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2041 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2042 intPrevValue = intiter->second;
2044 if (PropertyName == wxT("TYPE")){
2046 // Process each value in type and translate each
2049 // Strip out the quotes if they are there.
2051 size_t intPropertyValueLen = PropertyValue.Len();
2053 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2055 PropertyValue.Trim();
2056 PropertyValue.RemoveLast();
2060 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2062 PropertyValue.Remove(0, 1);
2066 TelTypeDetail = PropertyValue;
2072 for (int i = 0; i <= intPropertyValueLen; i++){
2076 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2078 if (intSplitsFound == 0){
2080 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2081 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2085 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2086 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2099 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2100 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2102 int intTypeSeek = 0;
2103 bool TypeFound = FALSE;
2105 for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
2106 typeiter != TypeSplitPoints.end(); ++typeiter){
2108 wxString TypePropertyName;
2110 TSLiter = TypeSplitLength.find(typeiter->first);
2112 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2114 if (intTypeSeek == 0){
2119 TelTypeUI.Append(wxT(","));
2123 if (TypePropertyName == wxT("home") && TypeFound == FALSE){
2125 PropType = PROPERTY_HOME;
2126 TelTypeUI.Append("home");
2130 } else if (TypePropertyName == wxT("work") && TypeFound == FALSE){
2132 PropType = PROPERTY_WORK;
2133 TelTypeUI.Append("work");
2139 if (TypePropertyName == wxT("text")){
2141 TelTypeUI.Append(_("text"));
2144 } else if (TypePropertyName == wxT("voice")){
2146 TelTypeUI.Append(_("voice"));
2149 } else if (TypePropertyName == wxT("fax")){
2151 TelTypeUI.Append(_("fax"));
2154 } else if (TypePropertyName == wxT("cell")){
2156 TelTypeUI.Append(_("cell"));
2159 } else if (TypePropertyName == wxT("video")){
2161 TelTypeUI.Append(_("video"));
2164 } else if (TypePropertyName == wxT("pager")){
2166 TelTypeUI.Append(_("pager"));
2169 } else if (TypePropertyName == wxT("textphone")){
2171 TelTypeUI.Append(_("textphone"));
2182 std::map<int, wxString> *TelephoneList = NULL;
2183 std::map<int, wxString> *TelephoneListType = NULL;
2184 std::map<int, wxString> *TelephoneListAltID = NULL;
2185 std::map<int, wxString> *TelephoneListPID = NULL;
2186 std::map<int, wxString> *TelephoneListTokens = NULL;
2187 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2188 std::map<int, wxString> *TelephoneListDataType = NULL;
2189 std::map<int, int> *TelephoneListPref = NULL;
2193 TelephoneList = &GeneralTelephoneList;
2194 TelephoneListType = &GeneralTelephoneListType;
2195 TelephoneListAltID = &GeneralTelephoneListAltID;
2196 TelephoneListPID = &GeneralTelephoneListPID;
2197 TelephoneListTokens = &GeneralTelephoneListTokens;
2198 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2199 TelephoneListDataType = &GeneralTelephoneListDataType;
2200 TelephoneListPref = &GeneralTelephoneListPref;
2203 TelephoneList = &HomeTelephoneList;
2204 TelephoneListType = &HomeTelephoneListType;
2205 TelephoneListAltID = &HomeTelephoneListAltID;
2206 TelephoneListPID = &HomeTelephoneListPID;
2207 TelephoneListTokens = &HomeTelephoneListTokens;
2208 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2209 TelephoneListDataType = &HomeTelephoneListDataType;
2210 TelephoneListPref = &HomeTelephoneListPref;
2213 TelephoneList = &BusinessTelephoneList;
2214 TelephoneListType = &BusinessTelephoneListType;
2215 TelephoneListAltID = &BusinessTelephoneListAltID;
2216 TelephoneListPID = &BusinessTelephoneListPID;
2217 TelephoneListTokens = &BusinessTelephoneListTokens;
2218 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2219 TelephoneListDataType = &BusinessTelephoneListDataType;
2220 TelephoneListPref = &BusinessTelephoneListPref;
2224 // Process the properties.
2226 bool FirstToken = TRUE;
2229 SplitPoints.clear();
2230 SplitLength.clear();
2232 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2236 bool PropertyMatched = FALSE;
2238 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2239 intiter != SplitPoints.end(); ++intiter){
2241 SLiter = SplitLength.find(intiter->first);
2242 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2243 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2244 intPrevValue = intiter->second;
2246 CaptureString(&PropertyValue, FALSE);
2248 // Process properties.
2250 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2251 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2252 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2254 if (PropertyMatched == TRUE){
2256 PropertyMatched = FALSE;
2261 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2265 // Check for the type information and split it down.
2267 wxStringTokenizer TelSplitData(PropertySeg2, wxT(":"));
2269 if (TelSplitData.CountTokens() > 1){
2271 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, TelSplitData.GetNextToken()));
2272 TelephoneList->insert(std::make_pair(*TelephoneCount, TelSplitData.GetString()));
2276 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2277 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, "tel"));
2281 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2283 // Add the name token data.
2285 if (!PropertyTokens.IsEmpty()){
2287 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2293 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2295 // Process the language.
2297 std::map<int, int> SplitPoints;
2298 std::map<int, int> SplitLength;
2300 int intPrevValue = 6;
2302 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2306 PropertyType PropType = PROPERTY_NONE;
2308 // Look for type before continuing.
2310 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2312 std::map<int, wxString> *LanguageList = NULL;
2313 std::map<int, wxString> *LanguageListType = NULL;
2314 std::map<int, wxString> *LanguageListAltID = NULL;
2315 std::map<int, wxString> *LanguageListPID = NULL;
2316 std::map<int, wxString> *LanguageListTokens = NULL;
2317 std::map<int, int> *LanguageListPref = NULL;
2321 LanguageList = &GeneralLanguageList;
2322 LanguageListType = &GeneralLanguageListType;
2323 LanguageListAltID = &GeneralLanguageListAltID;
2324 LanguageListPID = &GeneralLanguageListPID;
2325 LanguageListTokens = &GeneralLanguageListTokens;
2326 LanguageListPref = &GeneralLanguageListPref;
2329 LanguageList = &HomeLanguageList;
2330 LanguageListType = &HomeLanguageListType;
2331 LanguageListAltID = &HomeLanguageListAltID;
2332 LanguageListPID = &HomeLanguageListPID;
2333 LanguageListTokens = &HomeLanguageListTokens;
2334 LanguageListPref = &HomeLanguageListPref;
2337 LanguageList = &BusinessLanguageList;
2338 LanguageListType = &BusinessLanguageListType;
2339 LanguageListAltID = &BusinessLanguageListAltID;
2340 LanguageListPID = &BusinessLanguageListPID;
2341 LanguageListTokens = &BusinessLanguageListTokens;
2342 LanguageListPref = &BusinessLanguageListPref;
2348 std::map<int,int>::iterator SLiter;
2349 wxString PropertyData;
2350 wxString PropertyName;
2351 wxString PropertyValue;
2352 wxString PropertyTokens;
2353 bool FirstToken = TRUE;
2354 bool PropertyMatched = FALSE;
2356 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2357 intiter != SplitPoints.end(); ++intiter){
2359 SLiter = SplitLength.find(intiter->first);
2360 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2361 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2362 intPrevValue = intiter->second;
2364 CaptureString(&PropertyValue, FALSE);
2366 // Process properties.
2368 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2369 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2370 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2372 if (PropertyMatched == TRUE){
2374 PropertyMatched = FALSE;
2379 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2383 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2385 // Add the name token data.
2387 if (!PropertyTokens.IsEmpty()){
2389 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2395 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2397 // Process the geographic location.
2399 std::map<int, int> SplitPoints;
2400 std::map<int, int> SplitLength;
2402 int intPrevValue = 5;
2404 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2408 PropertyType PropType = PROPERTY_NONE;
2410 // Look for type before continuing.
2412 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2414 std::map<int, wxString> *GeopositionList = NULL;
2415 std::map<int, wxString> *GeopositionListType = NULL;
2416 std::map<int, wxString> *GeopositionListAltID = NULL;
2417 std::map<int, wxString> *GeopositionListPID = NULL;
2418 std::map<int, wxString> *GeopositionListTokens = NULL;
2419 std::map<int, wxString> *GeopositionListMediatype = NULL;
2420 std::map<int, wxString> *GeopositionListDataType = NULL;
2421 std::map<int, int> *GeopositionListPref = NULL;
2425 GeopositionList = &GeneralGeographyList;
2426 GeopositionListType = &GeneralGeographyListType;
2427 GeopositionListAltID = &GeneralGeographyListAltID;
2428 GeopositionListPID = &GeneralGeographyListPID;
2429 GeopositionListTokens = &GeneralGeographyListTokens;
2430 GeopositionListMediatype = &GeneralGeographyListMediatype;
2431 GeopositionListDataType = &GeneralGeographyListDataType;
2432 GeopositionListPref = &GeneralGeographyListPref;
2435 GeopositionList = &HomeGeographyList;
2436 GeopositionListType = &HomeGeographyListType;
2437 GeopositionListAltID = &HomeGeographyListAltID;
2438 GeopositionListPID = &HomeGeographyListPID;
2439 GeopositionListTokens = &HomeGeographyListTokens;
2440 GeopositionListMediatype = &HomeGeographyListMediatype;
2441 GeopositionListDataType = &HomeGeographyListDataType;
2442 GeopositionListPref = &HomeGeographyListPref;
2445 GeopositionList = &BusinessGeographyList;
2446 GeopositionListType = &BusinessGeographyListType;
2447 GeopositionListAltID = &BusinessGeographyListAltID;
2448 GeopositionListPID = &BusinessGeographyListPID;
2449 GeopositionListTokens = &BusinessGeographyListTokens;
2450 GeopositionListMediatype = &BusinessGeographyListMediatype;
2451 GeopositionListDataType = &BusinessGeographyListDataType;
2452 GeopositionListPref = &BusinessGeographyListPref;
2458 std::map<int,int>::iterator SLiter;
2459 wxString PropertyData;
2460 wxString PropertyName;
2461 wxString PropertyValue;
2462 wxString PropertyTokens;
2463 bool FirstToken = TRUE;
2464 bool PropertyMatched = FALSE;
2466 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2467 intiter != SplitPoints.end(); ++intiter){
2469 SLiter = SplitLength.find(intiter->first);
2470 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2471 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2472 intPrevValue = intiter->second;
2474 CaptureString(&PropertyValue, FALSE);
2476 // Process properties.
2478 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2479 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2480 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2481 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2483 if (PropertyMatched == TRUE){
2485 PropertyMatched = FALSE;
2490 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2494 wxStringTokenizer GeoSplitData(PropertySeg2, wxT(":"));
2496 if (GeoSplitData.CountTokens() > 1){
2498 GeopositionListDataType->insert(std::make_pair(*GeographicCount, GeoSplitData.GetNextToken()));
2499 GeopositionList->insert(std::make_pair(*GeographicCount, GeoSplitData.GetString()));
2503 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2504 GeopositionListDataType->insert(std::make_pair(*GeographicCount, "tel"));
2508 // Add the name token data.
2510 if (!PropertyTokens.IsEmpty()){
2512 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2518 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2520 // Process the relation.
2522 std::map<int, int> SplitPoints;
2523 std::map<int, int> SplitLength;
2524 std::map<int, int>::iterator SLiter;
2525 wxString PropertyData;
2526 wxString PropertyName;
2527 wxString PropertyValue;
2528 wxString PropertyTokens;
2529 wxString RelatedType;
2530 wxString RelatedTypeOriginal;
2531 wxString RelatedName;
2532 bool FirstToken = TRUE;
2533 int intPrevValue = 9;
2535 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2539 // Look for type before continuing.
2541 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2542 intiter != SplitPoints.end(); ++intiter){
2544 SLiter = SplitLength.find(intiter->first);
2545 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2546 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2547 intPrevValue = intiter->second;
2551 RelatedTypeOriginal = PropertyValue;
2553 if (PropertyName == wxT("TYPE")){
2555 if (PropertyValue == wxT("contact")){
2557 RelatedType = _("Contact");
2559 } else if (PropertyValue == wxT("acquaintance")){
2561 RelatedType = _("Acquaintance");
2563 } else if (PropertyValue == wxT("friend")){
2565 RelatedType = _("Friend");
2567 } else if (PropertyValue == wxT("met")){
2569 RelatedType = _("Met");
2571 } else if (PropertyValue == wxT("co-worker")){
2573 RelatedType = _("Co-worker");
2575 } else if (PropertyValue == wxT("colleague")){
2577 RelatedType = _("Colleague");
2579 } else if (PropertyValue == wxT("co-resident")){
2581 RelatedType = _("Co-resident");
2583 } else if (PropertyValue == wxT("neighbor")){
2585 RelatedType = _("Neighbour");
2587 } else if (PropertyValue == wxT("child")){
2589 RelatedType = _("Child");
2591 } else if (PropertyValue == wxT("parent")){
2593 RelatedType = _("Parent");
2595 } else if (PropertyValue == wxT("sibling")){
2597 RelatedType = _("Sibling");
2599 } else if (PropertyValue == wxT("spouse")){
2601 RelatedType = _("Spouse");
2603 } else if (PropertyValue == wxT("kin")){
2605 RelatedType = _("Kin");
2607 } else if (PropertyValue == wxT("muse")){
2609 RelatedType = _("Muse");
2611 } else if (PropertyValue == wxT("crush")){
2613 RelatedType = _("Crush");
2615 } else if (PropertyValue == wxT("date")){
2617 RelatedType = _("Date");
2619 } else if (PropertyValue == wxT("sweetheart")){
2621 RelatedType = _("Sweetheart");
2623 } else if (PropertyValue == wxT("me")){
2625 RelatedType = _("Me");
2627 } else if (PropertyValue == wxT("agent")){
2629 RelatedType = _("Agent");
2631 } else if (PropertyValue == wxT("emergency")){
2633 RelatedType = _("Emergency");
2637 RelatedType = PropertyValue;
2647 bool PropertyMatched = FALSE;
2649 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2650 intiter != SplitPoints.end(); ++intiter){
2652 SLiter = SplitLength.find(intiter->first);
2653 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2654 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2655 intPrevValue = intiter->second;
2657 // Process properties.
2659 size_t intPropertyValueLen = PropertyValue.Len();
2661 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2663 PropertyValue.Trim();
2664 PropertyValue.RemoveLast();
2668 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2670 PropertyValue.Remove(0, 1);
2674 CaptureString(&PropertyValue, FALSE);
2676 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2677 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2678 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2679 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2681 if (PropertyMatched == TRUE){
2683 PropertyMatched = FALSE;
2688 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2692 // Add the data to the General/Home/Work address variables.
2694 GeneralRelatedList.erase(*RelatedCount);
2695 GeneralRelatedListRelType.erase(*RelatedCount);
2696 GeneralRelatedListType.erase(*RelatedCount);
2697 GeneralRelatedListTokens.erase(*RelatedCount);
2698 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2699 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2700 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2701 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2705 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2709 std::map<int, int> SplitPoints;
2710 std::map<int, int> SplitLength;
2711 std::map<int, int>::iterator SLiter;
2712 wxString PropertyData;
2713 wxString PropertyName;
2714 wxString PropertyValue;
2715 wxString PropertyTokens;
2716 bool FirstToken = TRUE;
2717 int intPrevValue = 5;
2719 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2723 PropertyType PropType = PROPERTY_NONE;
2725 // Look for type before continuing.
2727 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2729 // Setup the pointers.
2731 std::map<int, wxString> *WebsiteList = NULL;
2732 std::map<int, wxString> *WebsiteListAltID = NULL;
2733 std::map<int, wxString> *WebsiteListPID = NULL;
2734 std::map<int, wxString> *WebsiteListType = NULL;
2735 std::map<int, wxString> *WebsiteListTokens = NULL;
2736 std::map<int, wxString> *WebsiteListMediatype = NULL;
2737 std::map<int, int> *WebsiteListPref = NULL;
2739 // Setup blank lines for later on.
2743 WebsiteList = &GeneralWebsiteList;
2744 WebsiteListType = &GeneralWebsiteListType;
2745 WebsiteListAltID = &GeneralWebsiteListAltID;
2746 WebsiteListPID = &GeneralWebsiteListPID;
2747 WebsiteListTokens = &GeneralWebsiteListTokens;
2748 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2749 WebsiteListPref = &GeneralWebsiteListPref;
2752 WebsiteList = &HomeWebsiteList;
2753 WebsiteListType = &HomeWebsiteListType;
2754 WebsiteListAltID = &HomeWebsiteListAltID;
2755 WebsiteListPID = &HomeWebsiteListPID;
2756 WebsiteListTokens = &HomeWebsiteListTokens;
2757 WebsiteListMediatype = &HomeWebsiteListMediatype;
2758 WebsiteListPref = &HomeWebsiteListPref;
2761 WebsiteList = &BusinessWebsiteList;
2762 WebsiteListType = &BusinessWebsiteListType;
2763 WebsiteListAltID = &BusinessWebsiteListAltID;
2764 WebsiteListPID = &BusinessWebsiteListPID;
2765 WebsiteListTokens = &BusinessWebsiteListTokens;
2766 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2767 WebsiteListPref = &BusinessWebsiteListPref;
2772 bool PropertyMatched = FALSE;
2774 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2775 intiter != SplitPoints.end(); ++intiter){
2777 SLiter = SplitLength.find(intiter->first);
2778 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2779 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2780 intPrevValue = intiter->second;
2782 // Process properties.
2784 size_t intPropertyValueLen = PropertyValue.Len();
2786 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2788 PropertyValue.Trim();
2789 PropertyValue.RemoveLast();
2793 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2795 PropertyValue.Remove(0, 1);
2799 CaptureString(&PropertyValue, FALSE);
2801 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2802 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2803 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2804 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2806 if (PropertyMatched == TRUE){
2808 PropertyMatched = FALSE;
2813 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2817 // Add the data to the General/Home/Work address variables.
2819 CaptureString(&PropertySeg2, FALSE);
2821 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2823 if (!PropertyTokens.IsEmpty()){
2825 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2831 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2833 // Process the title.
2835 std::map<int, int> SplitPoints;
2836 std::map<int, int> SplitLength;
2837 std::map<int, int>::iterator SLiter;
2838 wxString PropertyData;
2839 wxString PropertyName;
2840 wxString PropertyValue;
2841 wxString PropertyTokens;
2842 bool FirstToken = TRUE;
2843 int intPrevValue = 7;
2845 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2849 PropertyType PropType = PROPERTY_NONE;
2851 // Look for type before continuing.
2853 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2855 // Setup the pointers.
2857 std::map<int, wxString> *TitleList = NULL;
2858 std::map<int, wxString> *TitleListAltID = NULL;
2859 std::map<int, wxString> *TitleListPID = NULL;
2860 std::map<int, wxString> *TitleListType = NULL;
2861 std::map<int, wxString> *TitleListTokens = NULL;
2862 std::map<int, wxString> *TitleListLanguage = NULL;
2863 std::map<int, int> *TitleListPref = NULL;
2865 // Setup blank lines for later on.
2869 TitleList = &GeneralTitleList;
2870 TitleListType = &GeneralTitleListType;
2871 TitleListAltID = &GeneralTitleListAltID;
2872 TitleListPID = &GeneralTitleListPID;
2873 TitleListTokens = &GeneralTitleListTokens;
2874 TitleListLanguage = &GeneralTitleListLanguage;
2875 TitleListPref = &GeneralTitleListPref;
2878 TitleList = &HomeTitleList;
2879 TitleListType = &HomeTitleListType;
2880 TitleListAltID = &HomeTitleListAltID;
2881 TitleListPID = &HomeTitleListPID;
2882 TitleListTokens = &HomeTitleListTokens;
2883 TitleListLanguage = &HomeTitleListLanguage;
2884 TitleListPref = &HomeTitleListPref;
2887 TitleList = &BusinessTitleList;
2888 TitleListType = &BusinessTitleListType;
2889 TitleListAltID = &BusinessTitleListAltID;
2890 TitleListPID = &BusinessTitleListPID;
2891 TitleListTokens = &BusinessTitleListTokens;
2892 TitleListLanguage = &BusinessTitleListLanguage;
2893 TitleListPref = &BusinessTitleListPref;
2898 bool PropertyMatched = FALSE;
2900 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2901 intiter != SplitPoints.end(); ++intiter){
2903 SLiter = SplitLength.find(intiter->first);
2904 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2905 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2906 intPrevValue = intiter->second;
2908 // Process properties.
2910 size_t intPropertyValueLen = PropertyValue.Len();
2912 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2914 PropertyValue.Trim();
2915 PropertyValue.RemoveLast();
2919 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2921 PropertyValue.Remove(0, 1);
2925 CaptureString(&PropertyValue, FALSE);
2927 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2928 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2929 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2930 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2932 if (PropertyMatched == TRUE){
2934 PropertyMatched = FALSE;
2939 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2943 // Add the data to the General/Home/Work address variables.
2945 CaptureString(&PropertySeg2, FALSE);
2947 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2949 if (!PropertyTokens.IsEmpty()){
2951 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2957 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2959 // Process the role.
2961 std::map<int, int> SplitPoints;
2962 std::map<int, int> SplitLength;
2963 std::map<int, int>::iterator SLiter;
2964 wxString PropertyData;
2965 wxString PropertyName;
2966 wxString PropertyValue;
2967 wxString PropertyTokens;
2968 bool FirstToken = TRUE;
2969 int intPrevValue = 6;
2971 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2975 PropertyType PropType = PROPERTY_NONE;
2977 // Look for type before continuing.
2979 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2981 // Setup the pointers.
2983 std::map<int, wxString> *RoleList = NULL;
2984 std::map<int, wxString> *RoleListAltID = NULL;
2985 std::map<int, wxString> *RoleListPID = NULL;
2986 std::map<int, wxString> *RoleListType = NULL;
2987 std::map<int, wxString> *RoleListTokens = NULL;
2988 std::map<int, wxString> *RoleListLanguage = NULL;
2989 std::map<int, int> *RoleListPref = NULL;
2991 // Setup blank lines for later on.
2995 RoleList = &GeneralRoleList;
2996 RoleListType = &GeneralRoleListType;
2997 RoleListAltID = &GeneralRoleListAltID;
2998 RoleListPID = &GeneralRoleListPID;
2999 RoleListTokens = &GeneralRoleListTokens;
3000 RoleListLanguage = &GeneralRoleListLanguage;
3001 RoleListPref = &GeneralRoleListPref;
3004 RoleList = &HomeRoleList;
3005 RoleListType = &HomeRoleListType;
3006 RoleListAltID = &HomeRoleListAltID;
3007 RoleListPID = &HomeRoleListPID;
3008 RoleListTokens = &HomeRoleListTokens;
3009 RoleListLanguage = &HomeRoleListLanguage;
3010 RoleListPref = &HomeRoleListPref;
3013 RoleList = &BusinessRoleList;
3014 RoleListType = &BusinessRoleListType;
3015 RoleListAltID = &BusinessRoleListAltID;
3016 RoleListPID = &BusinessRoleListPID;
3017 RoleListTokens = &BusinessRoleListTokens;
3018 RoleListLanguage = &BusinessRoleListLanguage;
3019 RoleListPref = &BusinessRoleListPref;
3024 bool PropertyMatched = FALSE;
3026 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3027 intiter != SplitPoints.end(); ++intiter){
3029 SLiter = SplitLength.find(intiter->first);
3030 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3031 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3032 intPrevValue = intiter->second;
3034 // Process properties.
3036 size_t intPropertyValueLen = PropertyValue.Len();
3038 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3040 PropertyValue.Trim();
3041 PropertyValue.RemoveLast();
3045 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3047 PropertyValue.Remove(0, 1);
3051 CaptureString(&PropertyValue, FALSE);
3053 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3054 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3055 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3056 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3058 if (PropertyMatched == TRUE){
3060 PropertyMatched = FALSE;
3065 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3069 // Add the data to the General/Home/Work address variables.
3071 CaptureString(&PropertySeg2, FALSE);
3073 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3075 if (!PropertyTokens.IsEmpty()){
3077 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3083 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3085 // Process the organisation.
3087 std::map<int, int> SplitPoints;
3088 std::map<int, int> SplitLength;
3089 std::map<int, int>::iterator SLiter;
3090 wxString PropertyData;
3091 wxString PropertyName;
3092 wxString PropertyValue;
3093 wxString PropertyTokens;
3094 bool FirstToken = TRUE;
3095 int intPrevValue = 5;
3097 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3101 PropertyType PropType = PROPERTY_NONE;
3103 // Look for type before continuing.
3105 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3107 // Setup the pointers.
3109 std::map<int, wxString> *OrganisationsList = NULL;
3110 std::map<int, wxString> *OrganisationsListAltID = NULL;
3111 std::map<int, wxString> *OrganisationsListPID = NULL;
3112 std::map<int, wxString> *OrganisationsListType = NULL;
3113 std::map<int, wxString> *OrganisationsListTokens = NULL;
3114 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3115 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3116 std::map<int, int> *OrganisationsListPref = NULL;
3118 // Setup blank lines for later on.
3122 OrganisationsList = &GeneralOrganisationsList;
3123 OrganisationsListType = &GeneralOrganisationsListType;
3124 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3125 OrganisationsListPID = &GeneralOrganisationsListPID;
3126 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3127 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3128 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3129 OrganisationsListPref = &GeneralOrganisationsListPref;
3132 OrganisationsList = &HomeOrganisationsList;
3133 OrganisationsListType = &HomeOrganisationsListType;
3134 OrganisationsListAltID = &HomeOrganisationsListAltID;
3135 OrganisationsListPID = &HomeOrganisationsListPID;
3136 OrganisationsListTokens = &HomeOrganisationsListTokens;
3137 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3138 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3139 OrganisationsListPref = &HomeOrganisationsListPref;
3142 OrganisationsList = &BusinessOrganisationsList;
3143 OrganisationsListType = &BusinessOrganisationsListType;
3144 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3145 OrganisationsListPID = &BusinessOrganisationsListPID;
3146 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3147 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3148 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3149 OrganisationsListPref = &BusinessOrganisationsListPref;
3154 bool PropertyMatched = FALSE;
3156 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3157 intiter != SplitPoints.end(); ++intiter){
3159 SLiter = SplitLength.find(intiter->first);
3160 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3161 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3162 intPrevValue = intiter->second;
3164 // Process properties.
3166 size_t intPropertyValueLen = PropertyValue.Len();
3168 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3170 PropertyValue.Trim();
3171 PropertyValue.RemoveLast();
3175 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3177 PropertyValue.Remove(0, 1);
3181 CaptureString(&PropertyValue, FALSE);
3183 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3184 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3185 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3186 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3187 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3189 if (PropertyMatched == TRUE){
3191 PropertyMatched = FALSE;
3196 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3200 // Add the data to the General/Home/Work address variables.
3202 CaptureString(&PropertySeg2, FALSE);
3204 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3206 if (!PropertyTokens.IsEmpty()){
3208 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3214 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3216 // Process the note.
3218 std::map<int, int> SplitPoints;
3219 std::map<int, int> SplitLength;
3220 std::map<int, int>::iterator SLiter;
3221 wxString PropertyData;
3222 wxString PropertyName;
3223 wxString PropertyValue;
3224 wxString PropertyTokens;
3225 bool FirstToken = TRUE;
3226 int intPrevValue = 6;
3228 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3232 PropertyType PropType = PROPERTY_NONE;
3234 // Look for type before continuing.
3236 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3238 // Setup the pointers.
3240 std::map<int, wxString> *NoteList = NULL;
3241 std::map<int, wxString> *NoteListAltID = NULL;
3242 std::map<int, wxString> *NoteListPID = NULL;
3243 std::map<int, wxString> *NoteListType = NULL;
3244 std::map<int, wxString> *NoteListTokens = NULL;
3245 std::map<int, wxString> *NoteListLanguage = NULL;
3246 std::map<int, int> *NoteListPref = NULL;
3248 // Setup blank lines for later on.
3252 NoteList = &GeneralNoteList;
3253 NoteListType = &GeneralNoteListType;
3254 NoteListAltID = &GeneralNoteListAltID;
3255 NoteListPID = &GeneralNoteListPID;
3256 NoteListTokens = &GeneralNoteListTokens;
3257 NoteListLanguage = &GeneralNoteListLanguage;
3258 NoteListPref = &GeneralNoteListPref;
3261 NoteList = &HomeNoteList;
3262 NoteListType = &HomeNoteListType;
3263 NoteListAltID = &HomeNoteListAltID;
3264 NoteListPID = &HomeNoteListPID;
3265 NoteListTokens = &HomeNoteListTokens;
3266 NoteListLanguage = &HomeNoteListLanguage;
3267 NoteListPref = &HomeNoteListPref;
3270 NoteList = &BusinessNoteList;
3271 NoteListType = &BusinessNoteListType;
3272 NoteListAltID = &BusinessNoteListAltID;
3273 NoteListPID = &BusinessNoteListPID;
3274 NoteListTokens = &BusinessNoteListTokens;
3275 NoteListLanguage = &BusinessNoteListLanguage;
3276 NoteListPref = &BusinessNoteListPref;
3281 bool PropertyMatched = FALSE;
3283 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3284 intiter != SplitPoints.end(); ++intiter){
3286 SLiter = SplitLength.find(intiter->first);
3287 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3288 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3289 intPrevValue = intiter->second;
3291 // Process properties.
3293 size_t intPropertyValueLen = PropertyValue.Len();
3295 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3297 PropertyValue.Trim();
3298 PropertyValue.RemoveLast();
3302 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3304 PropertyValue.Remove(0, 1);
3308 CaptureString(&PropertyValue, FALSE);
3310 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3311 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3312 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3313 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3315 if (PropertyMatched == TRUE){
3317 PropertyMatched = FALSE;
3322 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3326 // Add the data to the General/Home/Work address variables.
3328 CaptureString(&PropertySeg2, FALSE);
3330 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3332 if (!PropertyTokens.IsEmpty()){
3334 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3340 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3342 // Process the category.
3344 std::map<int, int> SplitPoints;
3345 std::map<int, int> SplitLength;
3346 std::map<int, int>::iterator SLiter;
3347 wxString PropertyData;
3348 wxString PropertyName;
3349 wxString PropertyValue;
3350 wxString PropertyTokens;
3351 bool FirstToken = TRUE;
3352 int intPrevValue = 12;
3354 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3358 PropertyType PropType = PROPERTY_NONE;
3360 // Look for type before continuing.
3362 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3364 // Setup blank lines for later on.
3370 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3373 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3378 bool PropertyMatched = FALSE;
3380 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3381 intiter != SplitPoints.end(); ++intiter){
3383 SLiter = SplitLength.find(intiter->first);
3384 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3385 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3386 intPrevValue = intiter->second;
3388 // Process properties.
3390 size_t intPropertyValueLen = PropertyValue.Len();
3392 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3394 PropertyValue.Trim();
3395 PropertyValue.RemoveLast();
3399 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3401 PropertyValue.Remove(0, 1);
3405 CaptureString(&PropertyValue, FALSE);
3407 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3408 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3409 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3410 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3412 if (PropertyMatched == TRUE){
3414 PropertyMatched = FALSE;
3419 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3423 // Deal with multiple categories.
3425 int intOrigCatCount = *CategoryCount;
3426 bool FirstCategoryProcessed = TRUE;
3427 bool AfterFirstToken = FALSE;
3428 int intSplitSize = 0;
3429 int intSplitsFound = 0;
3430 int intSplitSeek = 0;
3431 int intPropertyLen = PropertySeg2.Len();
3433 SplitPoints.clear();
3434 SplitLength.clear();
3437 for (int i = 0; i <= intPropertyLen; i++){
3439 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3447 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3449 if (AfterFirstToken == TRUE){
3451 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3452 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3456 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3457 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3458 AfterFirstToken = TRUE;
3470 if (SplitPoints.size() > 0){
3472 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3473 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3477 if (SplitPoints.size() == 0){
3479 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3481 if (!PropertyTokens.IsEmpty()){
3483 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3489 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3490 intiter != SplitPoints.end(); ++intiter){
3492 SLiter = SplitLength.find(intiter->first);
3494 intPrevValue = intiter->second;
3496 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3498 // Add the data to the General/Home/Work address variables.
3500 // Trim any whitespace from the start and end.
3502 PropertyData = PropertyData.Trim(FALSE);
3503 PropertyData = PropertyData.Trim(TRUE);
3505 CaptureString(&PropertyData, FALSE);
3507 if (FirstCategoryProcessed == TRUE){
3509 FirstCategoryProcessed = FALSE;
3511 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3513 if (!PropertyTokens.IsEmpty()){
3515 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3525 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3527 if (!PropertyTokens.IsEmpty()){
3529 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3535 // Copy the properties to each of the categories (if it exists).
3537 if (!PropertyTokens.IsEmpty()){
3539 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3543 // Check if ALTID was used.
3545 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3547 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3551 // Check if PID was used.
3553 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3555 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3559 // Check if PREF was used.
3561 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3563 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3567 // Check if LANGUAGE was used.
3569 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3571 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3575 // Check if TYPE was used.
3581 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3584 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3592 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3594 // Process the photo.
3596 size_t intPropertyLen = PropertySeg1.Len();
3597 std::map<int, int> SplitPoints;
3598 std::map<int, int> SplitLength;
3599 std::map<int, int>::iterator SLiter;
3600 wxString PropertyData;
3601 wxString PropertyName;
3602 wxString PropertyValue;
3603 wxString PropertyTokens;
3604 bool FirstToken = TRUE;
3605 int intSplitsFound = 0;
3606 int intSplitSize = 0;
3607 int intPrevValue = 7;
3609 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3613 PropertyType PropType = PROPERTY_NONE;
3615 // Look for type before continuing.
3617 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3620 bool PropertyMatched = FALSE;
3622 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3623 intiter != SplitPoints.end(); ++intiter){
3625 SLiter = SplitLength.find(intiter->first);
3626 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3627 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3628 intPrevValue = intiter->second;
3630 // Process properties.
3632 size_t intPropertyValueLen = PropertyValue.Len();
3634 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3636 PropertyValue.Trim();
3637 PropertyValue.RemoveLast();
3641 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3643 PropertyValue.Remove(0, 1);
3647 CaptureString(&PropertyValue, FALSE);
3649 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3650 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3651 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3652 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3654 if (PropertyMatched == TRUE){
3656 PropertyMatched = FALSE;
3661 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3665 intPropertyLen = PropertySeg2.Len();
3666 SplitPoints.clear();
3667 SplitLength.clear();
3672 CaptureString(&PropertySeg2, FALSE);
3674 for (int i = 0; i <= intPropertyLen; i++){
3678 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3681 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3683 if (intSplitsFound == 6){
3685 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3690 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3700 wxString wxSPhotoURI;
3701 wxString wxSPhotoMIME;
3702 wxString wxSPhotoEncoding;
3703 wxString wxSPhotoData;
3704 std::string base64enc;
3706 if (intSplitsFound == 0){
3710 std::map<int, int>::iterator striter;
3712 striter = SplitLength.find(1);
3714 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3716 while (wSTDataType.HasMoreTokens() == TRUE){
3718 wxSPhotoURI = wSTDataType.GetNextToken();
3719 wxSPhotoMIME = wSTDataType.GetNextToken();
3724 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3726 while (wSTDataInfo.HasMoreTokens() == TRUE){
3728 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3729 wxSPhotoData = wSTDataInfo.GetNextToken();
3730 base64enc = wxSPhotoData.mb_str();
3737 // Add the data to the General/Home/Work address variables.
3739 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3740 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3741 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3747 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3750 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3754 if (!PropertyTokens.IsEmpty()){
3756 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3762 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3764 // Process the logo.
3766 size_t intPropertyLen = PropertySeg1.Len();
3767 std::map<int, int> SplitPoints;
3768 std::map<int, int> SplitLength;
3769 std::map<int, int>::iterator SLiter;
3770 wxString PropertyData;
3771 wxString PropertyName;
3772 wxString PropertyValue;
3773 wxString PropertyTokens;
3774 bool FirstToken = TRUE;
3775 int intSplitsFound = 0;
3776 int intSplitSize = 0;
3777 int intPrevValue = 6;
3779 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3783 PropertyType PropType = PROPERTY_NONE;
3785 // Look for type before continuing.
3787 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3790 bool PropertyMatched = FALSE;
3792 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3793 intiter != SplitPoints.end(); ++intiter){
3795 SLiter = SplitLength.find(intiter->first);
3796 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3797 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3798 intPrevValue = intiter->second;
3800 // Process properties.
3802 size_t intPropertyValueLen = PropertyValue.Len();
3804 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3806 PropertyValue.Trim();
3807 PropertyValue.RemoveLast();
3811 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3813 PropertyValue.Remove(0, 1);
3817 CaptureString(&PropertyValue, FALSE);
3819 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3820 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3821 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3822 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3824 if (PropertyMatched == TRUE){
3826 PropertyMatched = FALSE;
3831 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3835 intPropertyLen = PropertySeg2.Len();
3836 SplitPoints.clear();
3837 SplitLength.clear();
3842 CaptureString(&PropertySeg2, FALSE);
3844 for (int i = 0; i <= intPropertyLen; i++){
3848 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3851 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3853 if (intSplitsFound == 6){
3855 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3860 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3870 wxString wxSPhotoURI;
3871 wxString wxSPhotoMIME;
3872 wxString wxSPhotoEncoding;
3873 wxString wxSPhotoData;
3874 std::string base64enc;
3876 if (intSplitsFound == 0){
3880 std::map<int, int>::iterator striter;
3882 striter = SplitLength.find(1);
3884 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3886 while (wSTDataType.HasMoreTokens() == TRUE){
3888 wxSPhotoURI = wSTDataType.GetNextToken();
3889 wxSPhotoMIME = wSTDataType.GetNextToken();
3894 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3896 while (wSTDataInfo.HasMoreTokens() == TRUE){
3898 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3899 wxSPhotoData = wSTDataInfo.GetNextToken();
3900 base64enc = wxSPhotoData.mb_str();
3907 // Add the data to the General/Home/Work address variables.
3909 LogosList.insert(std::make_pair(*LogoCount, base64enc));
3910 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3911 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3917 LogosListType.insert(std::make_pair(*LogoCount, "home"));
3920 LogosListType.insert(std::make_pair(*LogoCount, "work"));
3924 if (!PropertyTokens.IsEmpty()){
3926 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3932 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3934 // Process the sound.
3936 size_t intPropertyLen = PropertySeg1.Len();
3937 std::map<int, int> SplitPoints;
3938 std::map<int, int> SplitLength;
3939 std::map<int, int>::iterator SLiter;
3940 wxString PropertyData;
3941 wxString PropertyName;
3942 wxString PropertyValue;
3943 wxString PropertyTokens;
3944 bool FirstToken = TRUE;
3945 int intSplitsFound = 0;
3946 int intSplitSize = 0;
3947 int intPrevValue = 7;
3949 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3953 PropertyType PropType = PROPERTY_NONE;
3955 // Look for type before continuing.
3957 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3960 bool PropertyMatched = FALSE;
3962 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3963 intiter != SplitPoints.end(); ++intiter){
3965 SLiter = SplitLength.find(intiter->first);
3966 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3967 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3968 intPrevValue = intiter->second;
3970 // Process properties.
3972 size_t intPropertyValueLen = PropertyValue.Len();
3974 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3976 PropertyValue.Trim();
3977 PropertyValue.RemoveLast();
3981 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3983 PropertyValue.Remove(0, 1);
3987 CaptureString(&PropertyValue, FALSE);
3989 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
3990 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
3991 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
3992 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
3993 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
3995 if (PropertyMatched == TRUE){
3997 PropertyMatched = FALSE;
4002 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4006 intPropertyLen = PropertySeg2.Len();
4007 SplitPoints.clear();
4008 SplitLength.clear();
4013 CaptureString(&PropertySeg2, FALSE);
4015 for (int i = 0; i <= intPropertyLen; i++){
4019 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4022 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4024 if (intSplitsFound == 6){
4026 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4031 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4041 wxString wxSSoundURI;
4042 wxString wxSSoundMIME;
4043 wxString wxSSoundEncoding;
4044 wxString wxSSoundData;
4045 std::string base64enc;
4047 if (intSplitsFound == 0){
4051 std::map<int, int>::iterator striter;
4053 striter = SplitLength.find(1);
4055 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4057 while (wSTDataType.HasMoreTokens() == TRUE){
4059 wxSSoundURI = wSTDataType.GetNextToken();
4060 wxSSoundMIME = wSTDataType.GetNextToken();
4065 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4067 while (wSTDataInfo.HasMoreTokens() == TRUE){
4069 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4070 wxSSoundData = wSTDataInfo.GetNextToken();
4071 base64enc = wxSSoundData.mb_str();
4078 // Add the data to the General/Home/Work address variables.
4084 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4087 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4091 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4092 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4093 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4095 if (!PropertyTokens.IsEmpty()){
4097 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4103 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4105 // Process the calendar URI.
4107 size_t intPropertyLen = PropertySeg1.Len();
4108 std::map<int, int> SplitPoints;
4109 std::map<int, int> SplitLength;
4110 std::map<int, int>::iterator SLiter;
4111 wxString PropertyData;
4112 wxString PropertyName;
4113 wxString PropertyValue;
4114 wxString PropertyTokens;
4115 bool FirstToken = TRUE;
4116 int intPrevValue = 8;
4118 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4122 PropertyType PropType = PROPERTY_NONE;
4124 // Look for type before continuing.
4126 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4129 bool PropertyMatched = FALSE;
4131 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4132 intiter != SplitPoints.end(); ++intiter){
4134 SLiter = SplitLength.find(intiter->first);
4135 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4136 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4137 intPrevValue = intiter->second;
4139 // Process properties.
4141 size_t intPropertyValueLen = PropertyValue.Len();
4143 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4145 PropertyValue.Trim();
4146 PropertyValue.RemoveLast();
4150 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4152 PropertyValue.Remove(0, 1);
4156 CaptureString(&PropertyValue, FALSE);
4158 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4159 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4160 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4161 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4163 if (PropertyMatched == TRUE){
4165 PropertyMatched = FALSE;
4170 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4174 SplitPoints.clear();
4175 SplitLength.clear();
4178 CaptureString(&PropertySeg2, FALSE);
4180 // Add the data to the General/Home/Work address variables.
4186 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4189 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4193 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4195 if (!PropertyTokens.IsEmpty()){
4197 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4203 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4205 // Process the calendar address URI.
4207 std::map<int, int> SplitPoints;
4208 std::map<int, int> SplitLength;
4209 std::map<int, int>::iterator SLiter;
4210 wxString PropertyData;
4211 wxString PropertyName;
4212 wxString PropertyValue;
4213 wxString PropertyTokens;
4214 bool FirstToken = TRUE;
4215 int intPrevValue = 8;
4217 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4221 PropertyType PropType = PROPERTY_NONE;
4223 // Look for type before continuing.
4225 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4228 bool PropertyMatched = FALSE;
4230 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4231 intiter != SplitPoints.end(); ++intiter){
4233 SLiter = SplitLength.find(intiter->first);
4234 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4235 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4236 intPrevValue = intiter->second;
4238 // Process properties.
4240 size_t intPropertyValueLen = PropertyValue.Len();
4242 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4244 PropertyValue.Trim();
4245 PropertyValue.RemoveLast();
4249 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4251 PropertyValue.Remove(0, 1);
4255 CaptureString(&PropertyValue, FALSE);
4257 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4258 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4259 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4260 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4262 if (PropertyMatched == TRUE){
4264 PropertyMatched = FALSE;
4269 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4273 SplitPoints.clear();
4274 SplitLength.clear();
4277 CaptureString(&PropertySeg2, FALSE);
4279 // Add the data to the General/Home/Work address variables.
4285 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4288 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4292 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4294 if (!PropertyTokens.IsEmpty()){
4296 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4302 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4304 // Process the calendar free busy URL.
4306 size_t intPropertyLen = PropertySeg1.Len();
4307 std::map<int, int> SplitPoints;
4308 std::map<int, int> SplitLength;
4309 std::map<int, int>::iterator SLiter;
4310 wxString PropertyData;
4311 wxString PropertyName;
4312 wxString PropertyValue;
4313 wxString PropertyTokens;
4314 bool FirstToken = TRUE;
4315 int intPrevValue = 7;
4317 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4321 PropertyType PropType = PROPERTY_NONE;
4323 // Look for type before continuing.
4325 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4328 bool PropertyMatched = FALSE;
4330 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4331 intiter != SplitPoints.end(); ++intiter){
4333 SLiter = SplitLength.find(intiter->first);
4334 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4335 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4336 intPrevValue = intiter->second;
4338 // Process properties.
4340 size_t intPropertyValueLen = PropertyValue.Len();
4342 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4344 PropertyValue.Trim();
4345 PropertyValue.RemoveLast();
4349 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4351 PropertyValue.Remove(0, 1);
4355 CaptureString(&PropertyValue, FALSE);
4357 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4358 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4359 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4360 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4362 if (PropertyMatched == TRUE){
4364 PropertyMatched = FALSE;
4369 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4373 intPropertyLen = PropertySeg2.Len();
4374 SplitPoints.clear();
4375 SplitLength.clear();
4378 CaptureString(&PropertySeg2, FALSE);
4380 // Add the data to the General/Home/Work address variables.
4386 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4389 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4393 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4395 if (!PropertyTokens.IsEmpty()){
4397 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4403 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4407 std::map<int, int> SplitPoints;
4408 std::map<int, int> SplitLength;
4409 std::map<int, int>::iterator SLiter;
4410 wxString PropertyData;
4411 wxString PropertyName;
4412 wxString PropertyValue;
4413 wxString PropertyTokens;
4414 bool FirstToken = TRUE;
4415 int intSplitsFound = 0;
4416 int intSplitSize = 0;
4417 int intPrevValue = 5;
4419 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4423 PropertyType PropType = PROPERTY_NONE;
4425 // Look for type before continuing.
4427 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4430 bool PropertyMatched = FALSE;
4432 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4433 intiter != SplitPoints.end(); ++intiter){
4435 SLiter = SplitLength.find(intiter->first);
4436 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4437 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4438 intPrevValue = intiter->second;
4440 // Process properties.
4442 size_t intPropertyValueLen = PropertyValue.Len();
4444 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4446 PropertyValue.Trim();
4447 PropertyValue.RemoveLast();
4451 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4453 PropertyValue.Remove(0, 1);
4457 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4458 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4459 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4461 if (PropertyMatched == TRUE){
4463 PropertyMatched = FALSE;
4468 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4472 size_t intPropertyLen = PropertySeg2.Len();
4473 SplitPoints.clear();
4474 SplitLength.clear();
4479 for (int i = 0; i <= intPropertyLen; i++){
4483 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4486 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4488 if (intSplitsFound == 6){
4490 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4495 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4506 wxString wxSKeyMIME;
4507 wxString wxSKeyEncoding;
4508 wxString wxSKeyData;
4509 std::string base64enc;
4511 if (intSplitsFound == 0){
4515 std::map<int, int>::iterator striter;
4517 striter = SplitLength.find(1);
4519 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4521 while (wSTDataType.HasMoreTokens() == TRUE){
4523 wxSKeyURI = wSTDataType.GetNextToken();
4524 wxSKeyMIME = wSTDataType.GetNextToken();
4529 if (wxSKeyURI == wxT("data")){
4531 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4533 while (wSTDataInfo.HasMoreTokens() == TRUE){
4535 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4536 wxSKeyData = wSTDataInfo.GetNextToken();
4545 // Add the data to the General/Home/Work address variables.
4547 if (wxSKeyURI == wxT("data")){
4549 KeyListDataEncType.erase(*KeyCount);
4550 KeyListKeyType.erase(*KeyCount);
4551 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4552 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4554 KeyList.erase(*KeyCount);
4555 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4559 KeyList.erase(*KeyCount);
4560 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4564 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4570 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4573 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4577 if (!PropertyTokens.IsEmpty()){
4579 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4585 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4587 // Process the vendor information.
4589 // Split the Vendor three ways.
4591 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4594 wxString wxSVNDPropName;
4596 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4598 wSTVendorDetails.GetNextToken();
4599 wxSVNDID = wSTVendorDetails.GetNextToken();
4600 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4605 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4607 // Add the data to the vendor variables.
4609 VendorList.erase(*VendorCount);
4610 VendorListPEN.erase(*VendorCount);
4611 VendorListElement.erase(*VendorCount);
4613 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4614 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4615 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4621 void ContactDataObject::ClearData(){
4623 // Clear the contact information.
4626 NameForename.clear();
4627 NameSurname.clear();
4628 NameOtherNames.clear();
4630 NameNickname.clear();
4631 NameDisplayAs.clear();
4632 NameLanguage.clear();
4637 BirthdayAltID.clear();
4638 BirthdayCalScale.clear();
4639 BirthdayTokens.clear();
4640 Anniversary.clear();
4641 AnniversaryAltID.clear();
4642 AnniversaryCalScale.clear();
4643 AnniversaryTokens.clear();
4646 GenderDetails.clear();
4647 GenderTokens.clear();
4651 RevisionTokens.clear();
4654 SourceListAltID.clear();
4655 SourceListPID.clear();
4656 SourceListType.clear();
4657 SourceListTokens.clear();
4658 SourceListMediatype.clear();
4659 SourceListPref.clear();
4662 XMLListAltID.clear();
4664 ClientPIDList.clear();
4665 ClientPIDListTokens.clear();
4667 FullNamesList.clear();
4668 FullNamesListType.clear();
4669 FullNamesListLanguage.clear();
4670 FullNamesListAltID.clear();
4671 FullNamesListPID.clear();
4672 FullNamesListTokens.clear();
4673 FullNamesListPref.clear();
4675 GeneralNicknamesList.clear();
4676 GeneralNicknamesListType.clear();
4677 GeneralNicknamesListLanguage.clear();
4678 GeneralNicknamesListAltID.clear();
4679 GeneralNicknamesListPID.clear();
4680 GeneralNicknamesListTokens.clear();
4681 GeneralNicknamesListPref.clear();
4683 GeneralAddressList.clear();
4684 GeneralAddressListTown.clear();
4685 GeneralAddressListCounty.clear();
4686 GeneralAddressListPostCode.clear();
4687 GeneralAddressListCountry.clear();
4688 GeneralAddressListLabel.clear();
4689 GeneralAddressListLang.clear();
4690 GeneralAddressListAltID.clear();
4691 GeneralAddressListPID.clear();
4692 GeneralAddressListTokens.clear();
4693 GeneralAddressListGeo.clear();
4694 GeneralAddressListTimezone.clear();
4695 GeneralAddressListType.clear();
4696 GeneralAddressListMediatype.clear();
4697 GeneralAddressListPref.clear();
4699 GeneralEmailList.clear();
4700 GeneralEmailListAltID.clear();
4701 GeneralEmailListPID.clear();
4702 GeneralEmailListType.clear();
4703 GeneralEmailListTokens.clear();
4704 GeneralEmailListPref.clear();
4706 GeneralIMList.clear();
4707 GeneralIMListAltID.clear();
4708 GeneralIMListPID.clear();
4709 GeneralIMListType.clear();
4710 GeneralIMListTypeInfo.clear();
4711 GeneralIMListTokens.clear();
4712 GeneralIMListMediatype.clear();
4713 GeneralIMListPref.clear();
4715 GeneralTelephoneList.clear();
4716 GeneralTelephoneListAltID.clear();
4717 GeneralTelephoneListPID.clear();
4718 GeneralTelephoneListType.clear();
4719 GeneralTelephoneListTokens.clear();
4720 GeneralTelephoneListTypeInfo.clear();
4721 GeneralTelephoneListPref.clear();
4723 GeneralLanguageList.clear();
4724 GeneralLanguageListAltID.clear();
4725 GeneralLanguageListPID.clear();
4726 GeneralLanguageListType.clear();
4727 GeneralLanguageListTokens.clear();
4728 GeneralLanguageListPref.clear();
4730 GeneralTZList.clear();
4731 GeneralTZListAltID.clear();
4732 GeneralTZListPID.clear();
4733 GeneralTZListType.clear();
4734 GeneralTZListTokens.clear();
4735 GeneralTZListMediatype.clear();
4736 GeneralTZListPref.clear();
4738 GeneralGeographyList.clear();
4739 GeneralGeographyListAltID.clear();
4740 GeneralGeographyListPID.clear();
4741 GeneralGeographyListType.clear();
4742 GeneralGeographyListTokens.clear();
4743 GeneralGeographyListMediatype.clear();
4744 GeneralGeographyListPref.clear();
4746 GeneralRelatedList.clear();
4747 GeneralRelatedListRelType.clear();
4748 GeneralRelatedListLanguage.clear();
4749 GeneralRelatedListAltID.clear();
4750 GeneralRelatedListPID.clear();
4751 GeneralRelatedListType.clear();
4752 GeneralRelatedListTokens.clear();
4753 GeneralRelatedListPref.clear();
4755 GeneralWebsiteList.clear();
4756 GeneralWebsiteListAltID.clear();
4757 GeneralWebsiteListPID.clear();
4758 GeneralWebsiteListType.clear();
4759 GeneralWebsiteListTokens.clear();
4760 GeneralWebsiteListMediatype.clear();
4761 GeneralWebsiteListPref.clear();
4763 GeneralTitleList.clear();
4764 GeneralTitleListLanguage.clear();
4765 GeneralTitleListAltID.clear();
4766 GeneralTitleListPID.clear();
4767 GeneralTitleListType.clear();
4768 GeneralTitleListTokens.clear();
4769 GeneralTitleListPref.clear();
4771 GeneralRoleList.clear();
4772 GeneralRoleListLanguage.clear();
4773 GeneralRoleListAltID.clear();
4774 GeneralRoleListPID.clear();
4775 GeneralRoleListType.clear();
4776 GeneralRoleListTokens.clear();
4777 GeneralRoleListPref.clear();
4779 GeneralOrganisationsList.clear();
4780 GeneralOrganisationsListLanguage.clear();
4781 GeneralOrganisationsListAltID.clear();
4782 GeneralOrganisationsListPID.clear();
4783 GeneralOrganisationsListType.clear();
4784 GeneralOrganisationsListTokens.clear();
4785 GeneralOrganisationsListSortAs.clear();
4786 GeneralOrganisationsListPref.clear();
4788 GeneralNoteList.clear();
4789 GeneralNoteListLanguage.clear();
4790 GeneralNoteListAltID.clear();
4791 GeneralNoteListPID.clear();
4792 GeneralNoteListType.clear();
4793 GeneralNoteListTokens.clear();
4794 GeneralNoteListPref.clear();
4796 /* Items on Home Tab */
4798 HomeNicknamesList.clear();
4799 HomeNicknamesListType.clear();
4800 HomeNicknamesListLanguage.clear();
4801 HomeNicknamesListAltID.clear();
4802 HomeNicknamesListPID.clear();
4803 HomeNicknamesListTokens.clear();
4804 HomeNicknamesListPref.clear();
4806 HomeAddressList.clear();
4807 HomeAddressListTown.clear();
4808 HomeAddressListCounty.clear();
4809 HomeAddressListPostCode.clear();
4810 HomeAddressListCountry.clear();
4811 HomeAddressListLabel.clear();
4812 HomeAddressListLang.clear();
4813 HomeAddressListAltID.clear();
4814 HomeAddressListPID.clear();
4815 HomeAddressListTokens.clear();
4816 HomeAddressListGeo.clear();
4817 HomeAddressListTimezone.clear();
4818 HomeAddressListType.clear();
4819 HomeAddressListMediatype.clear();
4820 HomeAddressListPref.clear();
4822 HomeEmailList.clear();
4823 HomeEmailListAltID.clear();
4824 HomeEmailListPID.clear();
4825 HomeEmailListType.clear();
4826 HomeEmailListTokens.clear();
4827 HomeEmailListPref.clear();
4830 HomeIMListAltID.clear();
4831 HomeIMListPID.clear();
4832 HomeIMListType.clear();
4833 HomeIMListTypeInfo.clear();
4834 HomeIMListTokens.clear();
4835 HomeIMListMediatype.clear();
4836 HomeIMListPref.clear();
4838 HomeTelephoneList.clear();
4839 HomeTelephoneListAltID.clear();
4840 HomeTelephoneListPID.clear();
4841 HomeTelephoneListType.clear();
4842 HomeTelephoneListTokens.clear();
4843 HomeTelephoneListTypeInfo.clear();
4844 HomeTelephoneListPref.clear();
4846 HomeLanguageList.clear();
4847 HomeLanguageListAltID.clear();
4848 HomeLanguageListPID.clear();
4849 HomeLanguageListType.clear();
4850 HomeLanguageListTokens.clear();
4851 HomeLanguageListPref.clear();
4854 HomeTZListAltID.clear();
4855 HomeTZListPID.clear();
4856 HomeTZListType.clear();
4857 HomeTZListTokens.clear();
4858 HomeTZListMediatype.clear();
4859 HomeTZListPref.clear();
4861 HomeGeographyList.clear();
4862 HomeGeographyListAltID.clear();
4863 HomeGeographyListPID.clear();
4864 HomeGeographyListType.clear();
4865 HomeGeographyListTokens.clear();
4866 HomeGeographyListMediatype.clear();
4867 HomeGeographyListPref.clear();
4869 HomeWebsiteList.clear();
4870 HomeWebsiteListAltID.clear();
4871 HomeWebsiteListPID.clear();
4872 HomeWebsiteListType.clear();
4873 HomeWebsiteListTokens.clear();
4874 HomeWebsiteListMediatype.clear();
4875 HomeWebsiteListPref.clear();
4877 HomeTitleList.clear();
4878 HomeTitleListLanguage.clear();
4879 HomeTitleListAltID.clear();
4880 HomeTitleListPID.clear();
4881 HomeTitleListType.clear();
4882 HomeTitleListTokens.clear();
4883 HomeTitleListPref.clear();
4885 HomeRoleList.clear();
4886 HomeRoleListLanguage.clear();
4887 HomeRoleListAltID.clear();
4888 HomeRoleListPID.clear();
4889 HomeRoleListType.clear();
4890 HomeRoleListTokens.clear();
4891 HomeRoleListPref.clear();
4893 HomeOrganisationsList.clear();
4894 HomeOrganisationsListLanguage.clear();
4895 HomeOrganisationsListAltID.clear();
4896 HomeOrganisationsListPID.clear();
4897 HomeOrganisationsListType.clear();
4898 HomeOrganisationsListTokens.clear();
4899 HomeOrganisationsListSortAs.clear();
4900 HomeOrganisationsListPref.clear();
4902 HomeNoteList.clear();
4903 HomeNoteListLanguage.clear();
4904 HomeNoteListAltID.clear();
4905 HomeNoteListPID.clear();
4906 HomeNoteListType.clear();
4907 HomeNoteListTokens.clear();
4908 HomeNoteListPref.clear();
4910 /* Items on the Business tab */
4912 BusinessNicknamesList.clear();
4913 BusinessNicknamesListType.clear();
4914 BusinessNicknamesListLanguage.clear();
4915 BusinessNicknamesListAltID.clear();
4916 BusinessNicknamesListPID.clear();
4917 BusinessNicknamesListTokens.clear();
4918 BusinessNicknamesListPref.clear();
4920 BusinessAddressList.clear();
4921 BusinessAddressListTown.clear();
4922 BusinessAddressListCounty.clear();
4923 BusinessAddressListPostCode.clear();
4924 BusinessAddressListCountry.clear();
4925 BusinessAddressListLabel.clear();
4926 BusinessAddressListLang.clear();
4927 BusinessAddressListAltID.clear();
4928 BusinessAddressListPID.clear();
4929 BusinessAddressListTokens.clear();
4930 BusinessAddressListGeo.clear();
4931 BusinessAddressListTimezone.clear();
4932 BusinessAddressListType.clear();
4933 BusinessAddressListMediatype.clear();
4934 BusinessAddressListPref.clear();
4936 BusinessEmailList.clear();
4937 BusinessEmailListAltID.clear();
4938 BusinessEmailListPID.clear();
4939 BusinessEmailListType.clear();
4940 BusinessEmailListTokens.clear();
4941 BusinessEmailListPref.clear();
4943 BusinessIMList.clear();
4944 BusinessIMListAltID.clear();
4945 BusinessIMListPID.clear();
4946 BusinessIMListType.clear();
4947 BusinessIMListTokens.clear();
4948 BusinessIMListMediatype.clear();
4949 BusinessIMListPref.clear();
4951 BusinessTelephoneList.clear();
4952 BusinessTelephoneListAltID.clear();
4953 BusinessTelephoneListPID.clear();
4954 BusinessTelephoneListType.clear();
4955 BusinessTelephoneListTokens.clear();
4956 BusinessTelephoneListPref.clear();
4958 BusinessLanguageList.clear();
4959 BusinessLanguageListAltID.clear();
4960 BusinessLanguageListPID.clear();
4961 BusinessLanguageListType.clear();
4962 BusinessLanguageListTokens.clear();
4963 BusinessLanguageListPref.clear();
4965 BusinessTZList.clear();
4966 BusinessTZListAltID.clear();
4967 BusinessTZListPID.clear();
4968 BusinessTZListType.clear();
4969 BusinessTZListTokens.clear();
4970 BusinessTZListMediatype.clear();
4971 BusinessTZListPref.clear();
4973 BusinessGeographyList.clear();
4974 BusinessGeographyListAltID.clear();
4975 BusinessGeographyListPID.clear();
4976 BusinessGeographyListType.clear();
4977 BusinessGeographyListTokens.clear();
4978 BusinessGeographyListMediatype.clear();
4979 BusinessGeographyListPref.clear();
4981 BusinessWebsiteList.clear();
4982 BusinessWebsiteListAltID.clear();
4983 BusinessWebsiteListPID.clear();
4984 BusinessWebsiteListType.clear();
4985 BusinessWebsiteListTokens.clear();
4986 BusinessWebsiteListMediatype.clear();
4987 BusinessWebsiteListPref.clear();
4989 BusinessTitleList.clear();
4990 BusinessTitleListLanguage.clear();
4991 BusinessTitleListAltID.clear();
4992 BusinessTitleListPID.clear();
4993 BusinessTitleListType.clear();
4994 BusinessTitleListTokens.clear();
4995 BusinessTitleListPref.clear();
4997 BusinessRoleList.clear();
4998 BusinessRoleListLanguage.clear();
4999 BusinessRoleListAltID.clear();
5000 BusinessRoleListPID.clear();
5001 BusinessRoleListType.clear();
5002 BusinessRoleListTokens.clear();
5003 BusinessRoleListPref.clear();
5005 BusinessOrganisationsList.clear();
5006 BusinessOrganisationsListLanguage.clear();
5007 BusinessOrganisationsListAltID.clear();
5008 BusinessOrganisationsListPID.clear();
5009 BusinessOrganisationsListType.clear();
5010 BusinessOrganisationsListTokens.clear();
5011 BusinessOrganisationsListSortAs.clear();
5012 BusinessOrganisationsListPref.clear();
5014 BusinessNoteList.clear();
5015 BusinessNoteListLanguage.clear();
5016 BusinessNoteListAltID.clear();
5017 BusinessNoteListPID.clear();
5018 BusinessNoteListType.clear();
5019 BusinessNoteListTokens.clear();
5020 BusinessNoteListPref.clear();
5022 /* Items on the Categories tab */
5024 CategoriesList.clear();
5025 CategoriesListAltID.clear();
5026 CategoriesListPID.clear();
5027 CategoriesListType.clear();
5028 CategoriesListTokens.clear();
5029 CategoriesListLanguage.clear();
5030 CategoriesListPref.clear();
5032 /* Items on the Groups tab */
5035 GroupsListAltID.clear();
5036 GroupsListPID.clear();
5037 GroupsListType.clear();
5038 GroupsListMediaType.clear();
5039 GroupsListTokens.clear();
5040 GroupsListPref.clear();
5042 /* Items on the Pictures tab */
5044 PicturesList.clear();
5045 PicturesListAltID.clear();
5046 PicturesListPID.clear();
5047 PicturesListType.clear();
5048 PicturesListPicEncType.clear();
5049 PicturesListPictureType.clear();
5050 PicturesListTokens.clear();
5051 PicturesListMediatype.clear();
5052 PicturesListPref.clear();
5054 /* Items on the Logos tab */
5057 LogosListAltID.clear();
5058 LogosListPID.clear();
5059 LogosListType.clear();
5060 LogosListPicEncType.clear();
5061 LogosListPictureType.clear();
5062 LogosListTokens.clear();
5063 LogosListMediatype.clear();
5064 LogosListPref.clear();
5066 /* Items on the Sounds tab */
5069 SoundsListAltID.clear();
5070 SoundsListPID.clear();
5071 SoundsListType.clear();
5072 SoundsListAudioEncType.clear();
5073 SoundsListAudioType.clear();
5074 SoundsListTokens.clear();
5075 SoundsListMediatype.clear();
5076 SoundsListPref.clear();
5078 /* Items on the Calendaring tab */
5080 CalendarList.clear();
5081 CalendarListAltID.clear();
5082 CalendarListPID.clear();
5083 CalendarListType.clear();
5084 CalendarListTokens.clear();
5085 CalendarListMediatype.clear();
5086 CalendarListPref.clear();
5088 CalendarRequestList.clear();
5089 CalendarRequestListAltID.clear();
5090 CalendarRequestListPID.clear();
5091 CalendarRequestListType.clear();
5092 CalendarRequestListTokens.clear();
5093 CalendarRequestListMediatype.clear();
5094 CalendarRequestListPref.clear();
5096 FreeBusyList.clear();
5097 FreeBusyListAltID.clear();
5098 FreeBusyListPID.clear();
5099 FreeBusyListType.clear();
5100 FreeBusyListTokens.clear();
5101 FreeBusyListMediatype.clear();
5102 FreeBusyListPref.clear();
5104 /* Items on the Security tab */
5107 KeyListAltID.clear();
5109 KeyListKeyType.clear();
5110 KeyListDataType.clear();
5111 KeyListDataEncType.clear();
5112 KeyListType.clear();
5113 KeyListTokens.clear();
5114 KeyListPref.clear();
5116 /* Items on the Other tab */
5119 VendorListPEN.clear();
5120 VendorListElement.clear();
5123 XTokenListTokens.clear();
5127 void ProcessNameValue(wxString *PropertyData,
5128 wxString *PropertyName,
5129 wxString *PropertyValue){
5131 // Proces the name and value information.
5133 wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
5134 *PropertyName = PropertyElement.GetNextToken();
5135 *PropertyValue = PropertyElement.GetNextToken();
5139 void ProcessTokens(wxString *PropertyName,
5140 wxString *PropertyValue,
5141 wxString *PropertyTokens,
5144 // Process the tokens.
5146 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5148 if (*FirstToken == TRUE){
5150 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5151 *FirstToken = FALSE;
5155 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5163 void ProcessStringValue(wxString *PropertyName,
5164 wxString PropertyNameMatch,
5165 std::map<int,wxString> *MapPtr,
5166 wxString *PropertyValue,
5168 bool *PropertyMatched){
5170 // Process the string value.
5172 if (*PropertyName == PropertyNameMatch){
5173 MapPtr->erase(*ItemCount);
5174 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5175 *PropertyMatched = TRUE;
5180 void ProcessIntegerValue(wxString *PropertyName,
5181 wxString PropertyNameMatch,
5182 std::map<int,int> *PrefPtr,
5183 wxString *PropertyValue,
5185 bool *PropertyMatched){
5187 // Process the integer value.
5189 if (*PropertyName == PropertyNameMatch){
5190 *PropertyMatched = TRUE;
5195 int PriorityNumber = 0;
5196 bool ValidNumber = TRUE;
5199 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5202 catch(std::invalid_argument &e){
5203 ValidNumber = FALSE;
5206 if (ValidNumber == TRUE){
5208 PrefPtr->erase(*ItemCount);
5209 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5215 void SplitValues(wxString *PropertyLine,
5216 std::map<int,int> *SplitPoints,
5217 std::map<int,int> *SplitLength,
5220 // Split values from a string supplied by PropertyLine.
5222 size_t intPropertyLen = PropertyLine->Len();
5223 int intSplitsFound = 0;
5224 int intSplitSize = 0;
5225 int intSplitSeek = 0;
5227 for (int i = intSize; i <= intPropertyLen; i++){
5231 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5232 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5234 if (intSplitsFound == 0){
5236 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5240 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5244 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5254 if (intSplitsFound == 0){
5256 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5257 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5261 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5262 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5268 void CheckType(wxString *PropertySeg1,
5269 std::map<int,int> *SplitPoints,
5270 std::map<int,int> *SplitLength,
5272 PropertyType *PropType){
5274 // Check the information type.
5276 wxString PropertyData;
5277 wxString PropertyName;
5278 wxString PropertyValue;
5279 std::map<int,int>::iterator SLiter;
5281 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5282 intiter != SplitPoints->end(); ++intiter){
5284 SLiter = SplitLength->find(intiter->first);
5285 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5286 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
5287 *intPrevValue = intiter->second;
5289 if (PropertyName == wxT("TYPE")){
5291 if (PropertyValue == wxT("work")){
5293 *PropType = PROPERTY_WORK;
5295 } else if (PropertyValue == wxT("home")){
5297 *PropType = PROPERTY_HOME;
5301 *PropType = PROPERTY_NONE;