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;
2128 } else if (TypePropertyName == wxT("work") && TypeFound == FALSE){
2130 PropType = PROPERTY_WORK;
2135 if (TypePropertyName == wxT("text")){
2137 TelTypeUI.Append(_("text"));
2140 } else if (TypePropertyName == wxT("voice")){
2142 TelTypeUI.Append(_("voice"));
2145 } else if (TypePropertyName == wxT("fax")){
2147 TelTypeUI.Append(_("fax"));
2150 } else if (TypePropertyName == wxT("cell")){
2152 TelTypeUI.Append(_("cell"));
2155 } else if (TypePropertyName == wxT("video")){
2157 TelTypeUI.Append(_("video"));
2160 } else if (TypePropertyName == wxT("pager")){
2162 TelTypeUI.Append(_("pager"));
2165 } else if (TypePropertyName == wxT("textphone")){
2167 TelTypeUI.Append(_("textphone"));
2178 std::map<int, wxString> *TelephoneList = NULL;
2179 std::map<int, wxString> *TelephoneListType = NULL;
2180 std::map<int, wxString> *TelephoneListAltID = NULL;
2181 std::map<int, wxString> *TelephoneListPID = NULL;
2182 std::map<int, wxString> *TelephoneListTokens = NULL;
2183 std::map<int, wxString> *TelephoneListTypeInfo = NULL;
2184 std::map<int, wxString> *TelephoneListDataType = NULL;
2185 std::map<int, int> *TelephoneListPref = NULL;
2189 TelephoneList = &GeneralTelephoneList;
2190 TelephoneListType = &GeneralTelephoneListType;
2191 TelephoneListAltID = &GeneralTelephoneListAltID;
2192 TelephoneListPID = &GeneralTelephoneListPID;
2193 TelephoneListTokens = &GeneralTelephoneListTokens;
2194 TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2195 TelephoneListDataType = &GeneralTelephoneListDataType;
2196 TelephoneListPref = &GeneralTelephoneListPref;
2199 TelephoneList = &HomeTelephoneList;
2200 TelephoneListType = &HomeTelephoneListType;
2201 TelephoneListAltID = &HomeTelephoneListAltID;
2202 TelephoneListPID = &HomeTelephoneListPID;
2203 TelephoneListTokens = &HomeTelephoneListTokens;
2204 TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;
2205 TelephoneListDataType = &HomeTelephoneListDataType;
2206 TelephoneListPref = &HomeTelephoneListPref;
2209 TelephoneList = &BusinessTelephoneList;
2210 TelephoneListType = &BusinessTelephoneListType;
2211 TelephoneListAltID = &BusinessTelephoneListAltID;
2212 TelephoneListPID = &BusinessTelephoneListPID;
2213 TelephoneListTokens = &BusinessTelephoneListTokens;
2214 TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo;
2215 TelephoneListDataType = &BusinessTelephoneListDataType;
2216 TelephoneListPref = &BusinessTelephoneListPref;
2220 // Process the properties.
2222 bool FirstToken = TRUE;
2225 SplitPoints.clear();
2226 SplitLength.clear();
2228 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2232 bool PropertyMatched = FALSE;
2234 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2235 intiter != SplitPoints.end(); ++intiter){
2237 SLiter = SplitLength.find(intiter->first);
2238 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2239 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2240 intPrevValue = intiter->second;
2242 CaptureString(&PropertyValue, FALSE);
2244 // Process properties.
2246 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2247 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2248 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2250 if (PropertyMatched == TRUE){
2252 PropertyMatched = FALSE;
2257 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2261 // Check for the type information and split it down.
2263 wxStringTokenizer TelSplitData(PropertySeg2, wxT(":"));
2265 if (TelSplitData.CountTokens() > 1){
2267 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, TelSplitData.GetNextToken()));
2268 TelephoneList->insert(std::make_pair(*TelephoneCount, TelSplitData.GetString()));
2272 TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2273 TelephoneListDataType->insert(std::make_pair(*TelephoneCount, "tel"));
2277 TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2279 // Add the name token data.
2281 if (!PropertyTokens.IsEmpty()){
2283 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2289 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2291 // Process the language.
2293 std::map<int, int> SplitPoints;
2294 std::map<int, int> SplitLength;
2296 int intPrevValue = 6;
2298 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2302 PropertyType PropType = PROPERTY_NONE;
2304 // Look for type before continuing.
2306 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2308 std::map<int, wxString> *LanguageList = NULL;
2309 std::map<int, wxString> *LanguageListType = NULL;
2310 std::map<int, wxString> *LanguageListAltID = NULL;
2311 std::map<int, wxString> *LanguageListPID = NULL;
2312 std::map<int, wxString> *LanguageListTokens = NULL;
2313 std::map<int, int> *LanguageListPref = NULL;
2317 LanguageList = &GeneralLanguageList;
2318 LanguageListType = &GeneralLanguageListType;
2319 LanguageListAltID = &GeneralLanguageListAltID;
2320 LanguageListPID = &GeneralLanguageListPID;
2321 LanguageListTokens = &GeneralLanguageListTokens;
2322 LanguageListPref = &GeneralLanguageListPref;
2325 LanguageList = &HomeLanguageList;
2326 LanguageListType = &HomeLanguageListType;
2327 LanguageListAltID = &HomeLanguageListAltID;
2328 LanguageListPID = &HomeLanguageListPID;
2329 LanguageListTokens = &HomeLanguageListTokens;
2330 LanguageListPref = &HomeLanguageListPref;
2333 LanguageList = &BusinessLanguageList;
2334 LanguageListType = &BusinessLanguageListType;
2335 LanguageListAltID = &BusinessLanguageListAltID;
2336 LanguageListPID = &BusinessLanguageListPID;
2337 LanguageListTokens = &BusinessLanguageListTokens;
2338 LanguageListPref = &BusinessLanguageListPref;
2344 std::map<int,int>::iterator SLiter;
2345 wxString PropertyData;
2346 wxString PropertyName;
2347 wxString PropertyValue;
2348 wxString PropertyTokens;
2349 bool FirstToken = TRUE;
2350 bool PropertyMatched = FALSE;
2352 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2353 intiter != SplitPoints.end(); ++intiter){
2355 SLiter = SplitLength.find(intiter->first);
2356 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2357 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2358 intPrevValue = intiter->second;
2360 CaptureString(&PropertyValue, FALSE);
2362 // Process properties.
2364 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2365 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2366 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2368 if (PropertyMatched == TRUE){
2370 PropertyMatched = FALSE;
2375 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2379 LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2381 // Add the name token data.
2383 if (!PropertyTokens.IsEmpty()){
2385 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2391 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2393 // Process the geographic location.
2395 std::map<int, int> SplitPoints;
2396 std::map<int, int> SplitLength;
2398 int intPrevValue = 5;
2400 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2404 PropertyType PropType = PROPERTY_NONE;
2406 // Look for type before continuing.
2408 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2410 std::map<int, wxString> *GeopositionList = NULL;
2411 std::map<int, wxString> *GeopositionListType = NULL;
2412 std::map<int, wxString> *GeopositionListAltID = NULL;
2413 std::map<int, wxString> *GeopositionListPID = NULL;
2414 std::map<int, wxString> *GeopositionListTokens = NULL;
2415 std::map<int, wxString> *GeopositionListMediatype = NULL;
2416 std::map<int, wxString> *GeopositionListDataType = NULL;
2417 std::map<int, int> *GeopositionListPref = NULL;
2421 GeopositionList = &GeneralGeographyList;
2422 GeopositionListType = &GeneralGeographyListType;
2423 GeopositionListAltID = &GeneralGeographyListAltID;
2424 GeopositionListPID = &GeneralGeographyListPID;
2425 GeopositionListTokens = &GeneralGeographyListTokens;
2426 GeopositionListMediatype = &GeneralGeographyListMediatype;
2427 GeopositionListDataType = &GeneralGeographyListDataType;
2428 GeopositionListPref = &GeneralGeographyListPref;
2431 GeopositionList = &HomeGeographyList;
2432 GeopositionListType = &HomeGeographyListType;
2433 GeopositionListAltID = &HomeGeographyListAltID;
2434 GeopositionListPID = &HomeGeographyListPID;
2435 GeopositionListTokens = &HomeGeographyListTokens;
2436 GeopositionListMediatype = &HomeGeographyListMediatype;
2437 GeopositionListDataType = &HomeGeographyListDataType;
2438 GeopositionListPref = &HomeGeographyListPref;
2441 GeopositionList = &BusinessGeographyList;
2442 GeopositionListType = &BusinessGeographyListType;
2443 GeopositionListAltID = &BusinessGeographyListAltID;
2444 GeopositionListPID = &BusinessGeographyListPID;
2445 GeopositionListTokens = &BusinessGeographyListTokens;
2446 GeopositionListMediatype = &BusinessGeographyListMediatype;
2447 GeopositionListDataType = &BusinessGeographyListDataType;
2448 GeopositionListPref = &BusinessGeographyListPref;
2454 std::map<int,int>::iterator SLiter;
2455 wxString PropertyData;
2456 wxString PropertyName;
2457 wxString PropertyValue;
2458 wxString PropertyTokens;
2459 bool FirstToken = TRUE;
2460 bool PropertyMatched = FALSE;
2462 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2463 intiter != SplitPoints.end(); ++intiter){
2465 SLiter = SplitLength.find(intiter->first);
2466 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2467 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2468 intPrevValue = intiter->second;
2470 CaptureString(&PropertyValue, FALSE);
2472 // Process properties.
2474 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2475 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2476 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2477 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2479 if (PropertyMatched == TRUE){
2481 PropertyMatched = FALSE;
2486 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2490 wxStringTokenizer GeoSplitData(PropertySeg2, wxT(":"));
2492 if (GeoSplitData.CountTokens() > 1){
2494 GeopositionListDataType->insert(std::make_pair(*GeographicCount, GeoSplitData.GetNextToken()));
2495 GeopositionList->insert(std::make_pair(*GeographicCount, GeoSplitData.GetString()));
2499 GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2500 GeopositionListDataType->insert(std::make_pair(*GeographicCount, "tel"));
2504 // Add the name token data.
2506 if (!PropertyTokens.IsEmpty()){
2508 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2514 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2516 // Process the relation.
2518 std::map<int, int> SplitPoints;
2519 std::map<int, int> SplitLength;
2520 std::map<int, int>::iterator SLiter;
2521 wxString PropertyData;
2522 wxString PropertyName;
2523 wxString PropertyValue;
2524 wxString PropertyTokens;
2525 wxString RelatedType;
2526 wxString RelatedTypeOriginal;
2527 wxString RelatedName;
2528 bool FirstToken = TRUE;
2529 int intPrevValue = 9;
2531 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2535 // Look for type before continuing.
2537 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2538 intiter != SplitPoints.end(); ++intiter){
2540 SLiter = SplitLength.find(intiter->first);
2541 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2542 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2543 intPrevValue = intiter->second;
2547 RelatedTypeOriginal = PropertyValue;
2549 if (PropertyName == wxT("TYPE")){
2551 if (PropertyValue == wxT("contact")){
2553 RelatedType = _("Contact");
2555 } else if (PropertyValue == wxT("acquaintance")){
2557 RelatedType = _("Acquaintance");
2559 } else if (PropertyValue == wxT("friend")){
2561 RelatedType = _("Friend");
2563 } else if (PropertyValue == wxT("met")){
2565 RelatedType = _("Met");
2567 } else if (PropertyValue == wxT("co-worker")){
2569 RelatedType = _("Co-worker");
2571 } else if (PropertyValue == wxT("colleague")){
2573 RelatedType = _("Colleague");
2575 } else if (PropertyValue == wxT("co-resident")){
2577 RelatedType = _("Co-resident");
2579 } else if (PropertyValue == wxT("neighbor")){
2581 RelatedType = _("Neighbour");
2583 } else if (PropertyValue == wxT("child")){
2585 RelatedType = _("Child");
2587 } else if (PropertyValue == wxT("parent")){
2589 RelatedType = _("Parent");
2591 } else if (PropertyValue == wxT("sibling")){
2593 RelatedType = _("Sibling");
2595 } else if (PropertyValue == wxT("spouse")){
2597 RelatedType = _("Spouse");
2599 } else if (PropertyValue == wxT("kin")){
2601 RelatedType = _("Kin");
2603 } else if (PropertyValue == wxT("muse")){
2605 RelatedType = _("Muse");
2607 } else if (PropertyValue == wxT("crush")){
2609 RelatedType = _("Crush");
2611 } else if (PropertyValue == wxT("date")){
2613 RelatedType = _("Date");
2615 } else if (PropertyValue == wxT("sweetheart")){
2617 RelatedType = _("Sweetheart");
2619 } else if (PropertyValue == wxT("me")){
2621 RelatedType = _("Me");
2623 } else if (PropertyValue == wxT("agent")){
2625 RelatedType = _("Agent");
2627 } else if (PropertyValue == wxT("emergency")){
2629 RelatedType = _("Emergency");
2633 RelatedType = PropertyValue;
2643 bool PropertyMatched = FALSE;
2645 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2646 intiter != SplitPoints.end(); ++intiter){
2648 SLiter = SplitLength.find(intiter->first);
2649 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2650 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2651 intPrevValue = intiter->second;
2653 // Process properties.
2655 size_t intPropertyValueLen = PropertyValue.Len();
2657 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2659 PropertyValue.Trim();
2660 PropertyValue.RemoveLast();
2664 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2666 PropertyValue.Remove(0, 1);
2670 CaptureString(&PropertyValue, FALSE);
2672 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2673 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2674 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2675 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2677 if (PropertyMatched == TRUE){
2679 PropertyMatched = FALSE;
2684 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2688 // Add the data to the General/Home/Work address variables.
2690 GeneralRelatedList.erase(*RelatedCount);
2691 GeneralRelatedListRelType.erase(*RelatedCount);
2692 GeneralRelatedListType.erase(*RelatedCount);
2693 GeneralRelatedListTokens.erase(*RelatedCount);
2694 GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2695 GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));
2696 GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2697 GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2701 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2705 std::map<int, int> SplitPoints;
2706 std::map<int, int> SplitLength;
2707 std::map<int, int>::iterator SLiter;
2708 wxString PropertyData;
2709 wxString PropertyName;
2710 wxString PropertyValue;
2711 wxString PropertyTokens;
2712 bool FirstToken = TRUE;
2713 int intPrevValue = 5;
2715 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2719 PropertyType PropType = PROPERTY_NONE;
2721 // Look for type before continuing.
2723 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2725 // Setup the pointers.
2727 std::map<int, wxString> *WebsiteList = NULL;
2728 std::map<int, wxString> *WebsiteListAltID = NULL;
2729 std::map<int, wxString> *WebsiteListPID = NULL;
2730 std::map<int, wxString> *WebsiteListType = NULL;
2731 std::map<int, wxString> *WebsiteListTokens = NULL;
2732 std::map<int, wxString> *WebsiteListMediatype = NULL;
2733 std::map<int, int> *WebsiteListPref = NULL;
2735 // Setup blank lines for later on.
2739 WebsiteList = &GeneralWebsiteList;
2740 WebsiteListType = &GeneralWebsiteListType;
2741 WebsiteListAltID = &GeneralWebsiteListAltID;
2742 WebsiteListPID = &GeneralWebsiteListPID;
2743 WebsiteListTokens = &GeneralWebsiteListTokens;
2744 WebsiteListMediatype = &GeneralWebsiteListMediatype;
2745 WebsiteListPref = &GeneralWebsiteListPref;
2748 WebsiteList = &HomeWebsiteList;
2749 WebsiteListType = &HomeWebsiteListType;
2750 WebsiteListAltID = &HomeWebsiteListAltID;
2751 WebsiteListPID = &HomeWebsiteListPID;
2752 WebsiteListTokens = &HomeWebsiteListTokens;
2753 WebsiteListMediatype = &HomeWebsiteListMediatype;
2754 WebsiteListPref = &HomeWebsiteListPref;
2757 WebsiteList = &BusinessWebsiteList;
2758 WebsiteListType = &BusinessWebsiteListType;
2759 WebsiteListAltID = &BusinessWebsiteListAltID;
2760 WebsiteListPID = &BusinessWebsiteListPID;
2761 WebsiteListTokens = &BusinessWebsiteListTokens;
2762 WebsiteListMediatype = &BusinessWebsiteListMediatype;
2763 WebsiteListPref = &BusinessWebsiteListPref;
2768 bool PropertyMatched = FALSE;
2770 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2771 intiter != SplitPoints.end(); ++intiter){
2773 SLiter = SplitLength.find(intiter->first);
2774 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2775 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2776 intPrevValue = intiter->second;
2778 // Process properties.
2780 size_t intPropertyValueLen = PropertyValue.Len();
2782 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2784 PropertyValue.Trim();
2785 PropertyValue.RemoveLast();
2789 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2791 PropertyValue.Remove(0, 1);
2795 CaptureString(&PropertyValue, FALSE);
2797 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2798 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2799 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2800 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2802 if (PropertyMatched == TRUE){
2804 PropertyMatched = FALSE;
2809 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2813 // Add the data to the General/Home/Work address variables.
2815 CaptureString(&PropertySeg2, FALSE);
2817 WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2819 if (!PropertyTokens.IsEmpty()){
2821 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2827 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2829 // Process the title.
2831 std::map<int, int> SplitPoints;
2832 std::map<int, int> SplitLength;
2833 std::map<int, int>::iterator SLiter;
2834 wxString PropertyData;
2835 wxString PropertyName;
2836 wxString PropertyValue;
2837 wxString PropertyTokens;
2838 bool FirstToken = TRUE;
2839 int intPrevValue = 7;
2841 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2845 PropertyType PropType = PROPERTY_NONE;
2847 // Look for type before continuing.
2849 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2851 // Setup the pointers.
2853 std::map<int, wxString> *TitleList = NULL;
2854 std::map<int, wxString> *TitleListAltID = NULL;
2855 std::map<int, wxString> *TitleListPID = NULL;
2856 std::map<int, wxString> *TitleListType = NULL;
2857 std::map<int, wxString> *TitleListTokens = NULL;
2858 std::map<int, wxString> *TitleListLanguage = NULL;
2859 std::map<int, int> *TitleListPref = NULL;
2861 // Setup blank lines for later on.
2865 TitleList = &GeneralTitleList;
2866 TitleListType = &GeneralTitleListType;
2867 TitleListAltID = &GeneralTitleListAltID;
2868 TitleListPID = &GeneralTitleListPID;
2869 TitleListTokens = &GeneralTitleListTokens;
2870 TitleListLanguage = &GeneralTitleListLanguage;
2871 TitleListPref = &GeneralTitleListPref;
2874 TitleList = &HomeTitleList;
2875 TitleListType = &HomeTitleListType;
2876 TitleListAltID = &HomeTitleListAltID;
2877 TitleListPID = &HomeTitleListPID;
2878 TitleListTokens = &HomeTitleListTokens;
2879 TitleListLanguage = &HomeTitleListLanguage;
2880 TitleListPref = &HomeTitleListPref;
2883 TitleList = &BusinessTitleList;
2884 TitleListType = &BusinessTitleListType;
2885 TitleListAltID = &BusinessTitleListAltID;
2886 TitleListPID = &BusinessTitleListPID;
2887 TitleListTokens = &BusinessTitleListTokens;
2888 TitleListLanguage = &BusinessTitleListLanguage;
2889 TitleListPref = &BusinessTitleListPref;
2894 bool PropertyMatched = FALSE;
2896 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
2897 intiter != SplitPoints.end(); ++intiter){
2899 SLiter = SplitLength.find(intiter->first);
2900 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2901 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2902 intPrevValue = intiter->second;
2904 // Process properties.
2906 size_t intPropertyValueLen = PropertyValue.Len();
2908 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2910 PropertyValue.Trim();
2911 PropertyValue.RemoveLast();
2915 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2917 PropertyValue.Remove(0, 1);
2921 CaptureString(&PropertyValue, FALSE);
2923 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2924 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2925 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2926 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2928 if (PropertyMatched == TRUE){
2930 PropertyMatched = FALSE;
2935 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2939 // Add the data to the General/Home/Work address variables.
2941 CaptureString(&PropertySeg2, FALSE);
2943 TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2945 if (!PropertyTokens.IsEmpty()){
2947 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2953 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2955 // Process the role.
2957 std::map<int, int> SplitPoints;
2958 std::map<int, int> SplitLength;
2959 std::map<int, int>::iterator SLiter;
2960 wxString PropertyData;
2961 wxString PropertyName;
2962 wxString PropertyValue;
2963 wxString PropertyTokens;
2964 bool FirstToken = TRUE;
2965 int intPrevValue = 6;
2967 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2971 PropertyType PropType = PROPERTY_NONE;
2973 // Look for type before continuing.
2975 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2977 // Setup the pointers.
2979 std::map<int, wxString> *RoleList = NULL;
2980 std::map<int, wxString> *RoleListAltID = NULL;
2981 std::map<int, wxString> *RoleListPID = NULL;
2982 std::map<int, wxString> *RoleListType = NULL;
2983 std::map<int, wxString> *RoleListTokens = NULL;
2984 std::map<int, wxString> *RoleListLanguage = NULL;
2985 std::map<int, int> *RoleListPref = NULL;
2987 // Setup blank lines for later on.
2991 RoleList = &GeneralRoleList;
2992 RoleListType = &GeneralRoleListType;
2993 RoleListAltID = &GeneralRoleListAltID;
2994 RoleListPID = &GeneralRoleListPID;
2995 RoleListTokens = &GeneralRoleListTokens;
2996 RoleListLanguage = &GeneralRoleListLanguage;
2997 RoleListPref = &GeneralRoleListPref;
3000 RoleList = &HomeRoleList;
3001 RoleListType = &HomeRoleListType;
3002 RoleListAltID = &HomeRoleListAltID;
3003 RoleListPID = &HomeRoleListPID;
3004 RoleListTokens = &HomeRoleListTokens;
3005 RoleListLanguage = &HomeRoleListLanguage;
3006 RoleListPref = &HomeRoleListPref;
3009 RoleList = &BusinessRoleList;
3010 RoleListType = &BusinessRoleListType;
3011 RoleListAltID = &BusinessRoleListAltID;
3012 RoleListPID = &BusinessRoleListPID;
3013 RoleListTokens = &BusinessRoleListTokens;
3014 RoleListLanguage = &BusinessRoleListLanguage;
3015 RoleListPref = &BusinessRoleListPref;
3020 bool PropertyMatched = FALSE;
3022 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3023 intiter != SplitPoints.end(); ++intiter){
3025 SLiter = SplitLength.find(intiter->first);
3026 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3027 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3028 intPrevValue = intiter->second;
3030 // Process properties.
3032 size_t intPropertyValueLen = PropertyValue.Len();
3034 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3036 PropertyValue.Trim();
3037 PropertyValue.RemoveLast();
3041 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3043 PropertyValue.Remove(0, 1);
3047 CaptureString(&PropertyValue, FALSE);
3049 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
3050 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
3051 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
3052 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
3054 if (PropertyMatched == TRUE){
3056 PropertyMatched = FALSE;
3061 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3065 // Add the data to the General/Home/Work address variables.
3067 CaptureString(&PropertySeg2, FALSE);
3069 RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
3071 if (!PropertyTokens.IsEmpty()){
3073 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
3079 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
3081 // Process the organisation.
3083 std::map<int, int> SplitPoints;
3084 std::map<int, int> SplitLength;
3085 std::map<int, int>::iterator SLiter;
3086 wxString PropertyData;
3087 wxString PropertyName;
3088 wxString PropertyValue;
3089 wxString PropertyTokens;
3090 bool FirstToken = TRUE;
3091 int intPrevValue = 5;
3093 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3097 PropertyType PropType = PROPERTY_NONE;
3099 // Look for type before continuing.
3101 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3103 // Setup the pointers.
3105 std::map<int, wxString> *OrganisationsList = NULL;
3106 std::map<int, wxString> *OrganisationsListAltID = NULL;
3107 std::map<int, wxString> *OrganisationsListPID = NULL;
3108 std::map<int, wxString> *OrganisationsListType = NULL;
3109 std::map<int, wxString> *OrganisationsListTokens = NULL;
3110 std::map<int, wxString> *OrganisationsListLanguage = NULL;
3111 std::map<int, wxString> *OrganisationsListSortAs = NULL;
3112 std::map<int, int> *OrganisationsListPref = NULL;
3114 // Setup blank lines for later on.
3118 OrganisationsList = &GeneralOrganisationsList;
3119 OrganisationsListType = &GeneralOrganisationsListType;
3120 OrganisationsListAltID = &GeneralOrganisationsListAltID;
3121 OrganisationsListPID = &GeneralOrganisationsListPID;
3122 OrganisationsListTokens = &GeneralOrganisationsListTokens;
3123 OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3124 OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3125 OrganisationsListPref = &GeneralOrganisationsListPref;
3128 OrganisationsList = &HomeOrganisationsList;
3129 OrganisationsListType = &HomeOrganisationsListType;
3130 OrganisationsListAltID = &HomeOrganisationsListAltID;
3131 OrganisationsListPID = &HomeOrganisationsListPID;
3132 OrganisationsListTokens = &HomeOrganisationsListTokens;
3133 OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3134 OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3135 OrganisationsListPref = &HomeOrganisationsListPref;
3138 OrganisationsList = &BusinessOrganisationsList;
3139 OrganisationsListType = &BusinessOrganisationsListType;
3140 OrganisationsListAltID = &BusinessOrganisationsListAltID;
3141 OrganisationsListPID = &BusinessOrganisationsListPID;
3142 OrganisationsListTokens = &BusinessOrganisationsListTokens;
3143 OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3144 OrganisationsListSortAs = &BusinessOrganisationsListSortAs;
3145 OrganisationsListPref = &BusinessOrganisationsListPref;
3150 bool PropertyMatched = FALSE;
3152 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3153 intiter != SplitPoints.end(); ++intiter){
3155 SLiter = SplitLength.find(intiter->first);
3156 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3157 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3158 intPrevValue = intiter->second;
3160 // Process properties.
3162 size_t intPropertyValueLen = PropertyValue.Len();
3164 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3166 PropertyValue.Trim();
3167 PropertyValue.RemoveLast();
3171 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3173 PropertyValue.Remove(0, 1);
3177 CaptureString(&PropertyValue, FALSE);
3179 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3180 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3181 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3182 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3183 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3185 if (PropertyMatched == TRUE){
3187 PropertyMatched = FALSE;
3192 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3196 // Add the data to the General/Home/Work address variables.
3198 CaptureString(&PropertySeg2, FALSE);
3200 OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3202 if (!PropertyTokens.IsEmpty()){
3204 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3210 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3212 // Process the note.
3214 std::map<int, int> SplitPoints;
3215 std::map<int, int> SplitLength;
3216 std::map<int, int>::iterator SLiter;
3217 wxString PropertyData;
3218 wxString PropertyName;
3219 wxString PropertyValue;
3220 wxString PropertyTokens;
3221 bool FirstToken = TRUE;
3222 int intPrevValue = 6;
3224 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3228 PropertyType PropType = PROPERTY_NONE;
3230 // Look for type before continuing.
3232 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3234 // Setup the pointers.
3236 std::map<int, wxString> *NoteList = NULL;
3237 std::map<int, wxString> *NoteListAltID = NULL;
3238 std::map<int, wxString> *NoteListPID = NULL;
3239 std::map<int, wxString> *NoteListType = NULL;
3240 std::map<int, wxString> *NoteListTokens = NULL;
3241 std::map<int, wxString> *NoteListLanguage = NULL;
3242 std::map<int, int> *NoteListPref = NULL;
3244 // Setup blank lines for later on.
3248 NoteList = &GeneralNoteList;
3249 NoteListType = &GeneralNoteListType;
3250 NoteListAltID = &GeneralNoteListAltID;
3251 NoteListPID = &GeneralNoteListPID;
3252 NoteListTokens = &GeneralNoteListTokens;
3253 NoteListLanguage = &GeneralNoteListLanguage;
3254 NoteListPref = &GeneralNoteListPref;
3257 NoteList = &HomeNoteList;
3258 NoteListType = &HomeNoteListType;
3259 NoteListAltID = &HomeNoteListAltID;
3260 NoteListPID = &HomeNoteListPID;
3261 NoteListTokens = &HomeNoteListTokens;
3262 NoteListLanguage = &HomeNoteListLanguage;
3263 NoteListPref = &HomeNoteListPref;
3266 NoteList = &BusinessNoteList;
3267 NoteListType = &BusinessNoteListType;
3268 NoteListAltID = &BusinessNoteListAltID;
3269 NoteListPID = &BusinessNoteListPID;
3270 NoteListTokens = &BusinessNoteListTokens;
3271 NoteListLanguage = &BusinessNoteListLanguage;
3272 NoteListPref = &BusinessNoteListPref;
3277 bool PropertyMatched = FALSE;
3279 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3280 intiter != SplitPoints.end(); ++intiter){
3282 SLiter = SplitLength.find(intiter->first);
3283 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3284 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3285 intPrevValue = intiter->second;
3287 // Process properties.
3289 size_t intPropertyValueLen = PropertyValue.Len();
3291 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3293 PropertyValue.Trim();
3294 PropertyValue.RemoveLast();
3298 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3300 PropertyValue.Remove(0, 1);
3304 CaptureString(&PropertyValue, FALSE);
3306 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3307 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3308 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3309 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3311 if (PropertyMatched == TRUE){
3313 PropertyMatched = FALSE;
3318 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3322 // Add the data to the General/Home/Work address variables.
3324 CaptureString(&PropertySeg2, FALSE);
3326 NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3328 if (!PropertyTokens.IsEmpty()){
3330 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3336 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3338 // Process the category.
3340 std::map<int, int> SplitPoints;
3341 std::map<int, int> SplitLength;
3342 std::map<int, int>::iterator SLiter;
3343 wxString PropertyData;
3344 wxString PropertyName;
3345 wxString PropertyValue;
3346 wxString PropertyTokens;
3347 bool FirstToken = TRUE;
3348 int intPrevValue = 12;
3350 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3354 PropertyType PropType = PROPERTY_NONE;
3356 // Look for type before continuing.
3358 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3360 // Setup blank lines for later on.
3366 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3369 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3374 bool PropertyMatched = FALSE;
3376 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3377 intiter != SplitPoints.end(); ++intiter){
3379 SLiter = SplitLength.find(intiter->first);
3380 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3381 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3382 intPrevValue = intiter->second;
3384 // Process properties.
3386 size_t intPropertyValueLen = PropertyValue.Len();
3388 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3390 PropertyValue.Trim();
3391 PropertyValue.RemoveLast();
3395 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3397 PropertyValue.Remove(0, 1);
3401 CaptureString(&PropertyValue, FALSE);
3403 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3404 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3405 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3406 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3408 if (PropertyMatched == TRUE){
3410 PropertyMatched = FALSE;
3415 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3419 // Deal with multiple categories.
3421 int intOrigCatCount = *CategoryCount;
3422 bool FirstCategoryProcessed = TRUE;
3423 bool AfterFirstToken = FALSE;
3424 int intSplitSize = 0;
3425 int intSplitsFound = 0;
3426 int intSplitSeek = 0;
3427 int intPropertyLen = PropertySeg2.Len();
3429 SplitPoints.clear();
3430 SplitLength.clear();
3433 for (int i = 0; i <= intPropertyLen; i++){
3435 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3443 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3445 if (AfterFirstToken == TRUE){
3447 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3448 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3452 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3453 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3454 AfterFirstToken = TRUE;
3466 if (SplitPoints.size() > 0){
3468 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3469 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3473 if (SplitPoints.size() == 0){
3475 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3477 if (!PropertyTokens.IsEmpty()){
3479 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3485 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3486 intiter != SplitPoints.end(); ++intiter){
3488 SLiter = SplitLength.find(intiter->first);
3490 intPrevValue = intiter->second;
3492 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3494 // Add the data to the General/Home/Work address variables.
3496 // Trim any whitespace from the start and end.
3498 PropertyData = PropertyData.Trim(FALSE);
3499 PropertyData = PropertyData.Trim(TRUE);
3501 CaptureString(&PropertyData, FALSE);
3503 if (FirstCategoryProcessed == TRUE){
3505 FirstCategoryProcessed = FALSE;
3507 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3509 if (!PropertyTokens.IsEmpty()){
3511 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3521 CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3523 if (!PropertyTokens.IsEmpty()){
3525 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3531 // Copy the properties to each of the categories (if it exists).
3533 if (!PropertyTokens.IsEmpty()){
3535 CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3539 // Check if ALTID was used.
3541 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3543 CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3547 // Check if PID was used.
3549 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3551 CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3555 // Check if PREF was used.
3557 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3559 CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3563 // Check if LANGUAGE was used.
3565 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3567 CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3571 // Check if TYPE was used.
3577 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3580 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3588 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3590 // Process the photo.
3592 size_t intPropertyLen = PropertySeg1.Len();
3593 std::map<int, int> SplitPoints;
3594 std::map<int, int> SplitLength;
3595 std::map<int, int>::iterator SLiter;
3596 wxString PropertyData;
3597 wxString PropertyName;
3598 wxString PropertyValue;
3599 wxString PropertyTokens;
3600 bool FirstToken = TRUE;
3601 int intSplitsFound = 0;
3602 int intSplitSize = 0;
3603 int intPrevValue = 7;
3605 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3609 PropertyType PropType = PROPERTY_NONE;
3611 // Look for type before continuing.
3613 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3616 bool PropertyMatched = FALSE;
3618 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3619 intiter != SplitPoints.end(); ++intiter){
3621 SLiter = SplitLength.find(intiter->first);
3622 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3623 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3624 intPrevValue = intiter->second;
3626 // Process properties.
3628 size_t intPropertyValueLen = PropertyValue.Len();
3630 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3632 PropertyValue.Trim();
3633 PropertyValue.RemoveLast();
3637 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3639 PropertyValue.Remove(0, 1);
3643 CaptureString(&PropertyValue, FALSE);
3645 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3646 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3647 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3648 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3650 if (PropertyMatched == TRUE){
3652 PropertyMatched = FALSE;
3657 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3661 intPropertyLen = PropertySeg2.Len();
3662 SplitPoints.clear();
3663 SplitLength.clear();
3668 CaptureString(&PropertySeg2, FALSE);
3670 for (int i = 0; i <= intPropertyLen; i++){
3674 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3677 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3679 if (intSplitsFound == 6){
3681 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3686 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3696 wxString wxSPhotoURI;
3697 wxString wxSPhotoMIME;
3698 wxString wxSPhotoEncoding;
3699 wxString wxSPhotoData;
3700 std::string base64enc;
3702 if (intSplitsFound == 0){
3706 std::map<int, int>::iterator striter;
3708 striter = SplitLength.find(1);
3710 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3712 while (wSTDataType.HasMoreTokens() == TRUE){
3714 wxSPhotoURI = wSTDataType.GetNextToken();
3715 wxSPhotoMIME = wSTDataType.GetNextToken();
3720 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3722 while (wSTDataInfo.HasMoreTokens() == TRUE){
3724 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3725 wxSPhotoData = wSTDataInfo.GetNextToken();
3726 base64enc = wxSPhotoData.mb_str();
3733 // Add the data to the General/Home/Work address variables.
3735 PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3736 PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3737 PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3743 PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3746 PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3750 if (!PropertyTokens.IsEmpty()){
3752 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3758 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3760 // Process the logo.
3762 size_t intPropertyLen = PropertySeg1.Len();
3763 std::map<int, int> SplitPoints;
3764 std::map<int, int> SplitLength;
3765 std::map<int, int>::iterator SLiter;
3766 wxString PropertyData;
3767 wxString PropertyName;
3768 wxString PropertyValue;
3769 wxString PropertyTokens;
3770 bool FirstToken = TRUE;
3771 int intSplitsFound = 0;
3772 int intSplitSize = 0;
3773 int intPrevValue = 6;
3775 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3779 PropertyType PropType = PROPERTY_NONE;
3781 // Look for type before continuing.
3783 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3786 bool PropertyMatched = FALSE;
3788 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3789 intiter != SplitPoints.end(); ++intiter){
3791 SLiter = SplitLength.find(intiter->first);
3792 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3793 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3794 intPrevValue = intiter->second;
3796 // Process properties.
3798 size_t intPropertyValueLen = PropertyValue.Len();
3800 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3802 PropertyValue.Trim();
3803 PropertyValue.RemoveLast();
3807 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3809 PropertyValue.Remove(0, 1);
3813 CaptureString(&PropertyValue, FALSE);
3815 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3816 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3817 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3818 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3820 if (PropertyMatched == TRUE){
3822 PropertyMatched = FALSE;
3827 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3831 intPropertyLen = PropertySeg2.Len();
3832 SplitPoints.clear();
3833 SplitLength.clear();
3838 CaptureString(&PropertySeg2, FALSE);
3840 for (int i = 0; i <= intPropertyLen; i++){
3844 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3847 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3849 if (intSplitsFound == 6){
3851 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3856 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3866 wxString wxSPhotoURI;
3867 wxString wxSPhotoMIME;
3868 wxString wxSPhotoEncoding;
3869 wxString wxSPhotoData;
3870 std::string base64enc;
3872 if (intSplitsFound == 0){
3876 std::map<int, int>::iterator striter;
3878 striter = SplitLength.find(1);
3880 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3882 while (wSTDataType.HasMoreTokens() == TRUE){
3884 wxSPhotoURI = wSTDataType.GetNextToken();
3885 wxSPhotoMIME = wSTDataType.GetNextToken();
3890 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
3892 while (wSTDataInfo.HasMoreTokens() == TRUE){
3894 wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3895 wxSPhotoData = wSTDataInfo.GetNextToken();
3896 base64enc = wxSPhotoData.mb_str();
3903 // Add the data to the General/Home/Work address variables.
3905 LogosList.insert(std::make_pair(*LogoCount, base64enc));
3906 LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3907 LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3913 LogosListType.insert(std::make_pair(*LogoCount, "home"));
3916 LogosListType.insert(std::make_pair(*LogoCount, "work"));
3920 if (!PropertyTokens.IsEmpty()){
3922 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3928 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3930 // Process the sound.
3932 size_t intPropertyLen = PropertySeg1.Len();
3933 std::map<int, int> SplitPoints;
3934 std::map<int, int> SplitLength;
3935 std::map<int, int>::iterator SLiter;
3936 wxString PropertyData;
3937 wxString PropertyName;
3938 wxString PropertyValue;
3939 wxString PropertyTokens;
3940 bool FirstToken = TRUE;
3941 int intSplitsFound = 0;
3942 int intSplitSize = 0;
3943 int intPrevValue = 7;
3945 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3949 PropertyType PropType = PROPERTY_NONE;
3951 // Look for type before continuing.
3953 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3956 bool PropertyMatched = FALSE;
3958 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
3959 intiter != SplitPoints.end(); ++intiter){
3961 SLiter = SplitLength.find(intiter->first);
3962 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3963 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3964 intPrevValue = intiter->second;
3966 // Process properties.
3968 size_t intPropertyValueLen = PropertyValue.Len();
3970 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3972 PropertyValue.Trim();
3973 PropertyValue.RemoveLast();
3977 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3979 PropertyValue.Remove(0, 1);
3983 CaptureString(&PropertyValue, FALSE);
3985 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
3986 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
3987 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
3988 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
3989 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
3991 if (PropertyMatched == TRUE){
3993 PropertyMatched = FALSE;
3998 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4002 intPropertyLen = PropertySeg2.Len();
4003 SplitPoints.clear();
4004 SplitLength.clear();
4009 CaptureString(&PropertySeg2, FALSE);
4011 for (int i = 0; i <= intPropertyLen; i++){
4015 if (PropertySeg2.Mid(i, 1) == wxT(";")){
4018 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4020 if (intSplitsFound == 6){
4022 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4027 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4037 wxString wxSSoundURI;
4038 wxString wxSSoundMIME;
4039 wxString wxSSoundEncoding;
4040 wxString wxSSoundData;
4041 std::string base64enc;
4043 if (intSplitsFound == 0){
4047 std::map<int, int>::iterator striter;
4049 striter = SplitLength.find(1);
4051 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4053 while (wSTDataType.HasMoreTokens() == TRUE){
4055 wxSSoundURI = wSTDataType.GetNextToken();
4056 wxSSoundMIME = wSTDataType.GetNextToken();
4061 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4063 while (wSTDataInfo.HasMoreTokens() == TRUE){
4065 wxSSoundEncoding = wSTDataInfo.GetNextToken();
4066 wxSSoundData = wSTDataInfo.GetNextToken();
4067 base64enc = wxSSoundData.mb_str();
4074 // Add the data to the General/Home/Work address variables.
4080 SoundsListType.insert(std::make_pair(*SoundCount, "home"));
4083 SoundsListType.insert(std::make_pair(*SoundCount, "work"));
4087 SoundsList.insert(std::make_pair(*SoundCount, base64enc));
4088 SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
4089 SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
4091 if (!PropertyTokens.IsEmpty()){
4093 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
4099 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4101 // Process the calendar URI.
4103 size_t intPropertyLen = PropertySeg1.Len();
4104 std::map<int, int> SplitPoints;
4105 std::map<int, int> SplitLength;
4106 std::map<int, int>::iterator SLiter;
4107 wxString PropertyData;
4108 wxString PropertyName;
4109 wxString PropertyValue;
4110 wxString PropertyTokens;
4111 bool FirstToken = TRUE;
4112 int intPrevValue = 8;
4114 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4118 PropertyType PropType = PROPERTY_NONE;
4120 // Look for type before continuing.
4122 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4125 bool PropertyMatched = FALSE;
4127 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4128 intiter != SplitPoints.end(); ++intiter){
4130 SLiter = SplitLength.find(intiter->first);
4131 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4132 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4133 intPrevValue = intiter->second;
4135 // Process properties.
4137 size_t intPropertyValueLen = PropertyValue.Len();
4139 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4141 PropertyValue.Trim();
4142 PropertyValue.RemoveLast();
4146 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4148 PropertyValue.Remove(0, 1);
4152 CaptureString(&PropertyValue, FALSE);
4154 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4155 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4156 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4157 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4159 if (PropertyMatched == TRUE){
4161 PropertyMatched = FALSE;
4166 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4170 SplitPoints.clear();
4171 SplitLength.clear();
4174 CaptureString(&PropertySeg2, FALSE);
4176 // Add the data to the General/Home/Work address variables.
4182 CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4185 CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4189 CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4191 if (!PropertyTokens.IsEmpty()){
4193 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4199 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4201 // Process the calendar address URI.
4203 std::map<int, int> SplitPoints;
4204 std::map<int, int> SplitLength;
4205 std::map<int, int>::iterator SLiter;
4206 wxString PropertyData;
4207 wxString PropertyName;
4208 wxString PropertyValue;
4209 wxString PropertyTokens;
4210 bool FirstToken = TRUE;
4211 int intPrevValue = 8;
4213 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4217 PropertyType PropType = PROPERTY_NONE;
4219 // Look for type before continuing.
4221 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4224 bool PropertyMatched = FALSE;
4226 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4227 intiter != SplitPoints.end(); ++intiter){
4229 SLiter = SplitLength.find(intiter->first);
4230 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4231 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4232 intPrevValue = intiter->second;
4234 // Process properties.
4236 size_t intPropertyValueLen = PropertyValue.Len();
4238 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4240 PropertyValue.Trim();
4241 PropertyValue.RemoveLast();
4245 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4247 PropertyValue.Remove(0, 1);
4251 CaptureString(&PropertyValue, FALSE);
4253 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4254 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4255 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4256 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4258 if (PropertyMatched == TRUE){
4260 PropertyMatched = FALSE;
4265 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4269 SplitPoints.clear();
4270 SplitLength.clear();
4273 CaptureString(&PropertySeg2, FALSE);
4275 // Add the data to the General/Home/Work address variables.
4281 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4284 CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4288 CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4290 if (!PropertyTokens.IsEmpty()){
4292 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4298 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4300 // Process the calendar free busy URL.
4302 size_t intPropertyLen = PropertySeg1.Len();
4303 std::map<int, int> SplitPoints;
4304 std::map<int, int> SplitLength;
4305 std::map<int, int>::iterator SLiter;
4306 wxString PropertyData;
4307 wxString PropertyName;
4308 wxString PropertyValue;
4309 wxString PropertyTokens;
4310 bool FirstToken = TRUE;
4311 int intPrevValue = 7;
4313 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4317 PropertyType PropType = PROPERTY_NONE;
4319 // Look for type before continuing.
4321 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4324 bool PropertyMatched = FALSE;
4326 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4327 intiter != SplitPoints.end(); ++intiter){
4329 SLiter = SplitLength.find(intiter->first);
4330 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4331 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4332 intPrevValue = intiter->second;
4334 // Process properties.
4336 size_t intPropertyValueLen = PropertyValue.Len();
4338 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4340 PropertyValue.Trim();
4341 PropertyValue.RemoveLast();
4345 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4347 PropertyValue.Remove(0, 1);
4351 CaptureString(&PropertyValue, FALSE);
4353 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4354 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4355 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4356 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4358 if (PropertyMatched == TRUE){
4360 PropertyMatched = FALSE;
4365 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4369 intPropertyLen = PropertySeg2.Len();
4370 SplitPoints.clear();
4371 SplitLength.clear();
4374 CaptureString(&PropertySeg2, FALSE);
4376 // Add the data to the General/Home/Work address variables.
4382 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4385 FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4389 FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4391 if (!PropertyTokens.IsEmpty()){
4393 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4399 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4403 std::map<int, int> SplitPoints;
4404 std::map<int, int> SplitLength;
4405 std::map<int, int>::iterator SLiter;
4406 wxString PropertyData;
4407 wxString PropertyName;
4408 wxString PropertyValue;
4409 wxString PropertyTokens;
4410 bool FirstToken = TRUE;
4411 int intSplitsFound = 0;
4412 int intSplitSize = 0;
4413 int intPrevValue = 5;
4415 SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4419 PropertyType PropType = PROPERTY_NONE;
4421 // Look for type before continuing.
4423 CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4426 bool PropertyMatched = FALSE;
4428 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
4429 intiter != SplitPoints.end(); ++intiter){
4431 SLiter = SplitLength.find(intiter->first);
4432 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4433 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4434 intPrevValue = intiter->second;
4436 // Process properties.
4438 size_t intPropertyValueLen = PropertyValue.Len();
4440 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4442 PropertyValue.Trim();
4443 PropertyValue.RemoveLast();
4447 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4449 PropertyValue.Remove(0, 1);
4453 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4454 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4455 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4457 if (PropertyMatched == TRUE){
4459 PropertyMatched = FALSE;
4464 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4468 size_t intPropertyLen = PropertySeg2.Len();
4469 SplitPoints.clear();
4470 SplitLength.clear();
4475 for (int i = 0; i <= intPropertyLen; i++){
4479 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4482 SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4484 if (intSplitsFound == 6){
4486 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4491 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4502 wxString wxSKeyMIME;
4503 wxString wxSKeyEncoding;
4504 wxString wxSKeyData;
4505 std::string base64enc;
4507 if (intSplitsFound == 0){
4511 std::map<int, int>::iterator striter;
4513 striter = SplitLength.find(1);
4515 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4517 while (wSTDataType.HasMoreTokens() == TRUE){
4519 wxSKeyURI = wSTDataType.GetNextToken();
4520 wxSKeyMIME = wSTDataType.GetNextToken();
4525 if (wxSKeyURI == wxT("data")){
4527 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));
4529 while (wSTDataInfo.HasMoreTokens() == TRUE){
4531 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4532 wxSKeyData = wSTDataInfo.GetNextToken();
4541 // Add the data to the General/Home/Work address variables.
4543 if (wxSKeyURI == wxT("data")){
4545 KeyListDataEncType.erase(*KeyCount);
4546 KeyListKeyType.erase(*KeyCount);
4547 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4548 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4550 KeyList.erase(*KeyCount);
4551 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4555 KeyList.erase(*KeyCount);
4556 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4560 KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4566 KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4569 KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4573 if (!PropertyTokens.IsEmpty()){
4575 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4581 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4583 // Process the vendor information.
4585 // Split the Vendor three ways.
4587 wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4590 wxString wxSVNDPropName;
4592 while (wSTVendorDetails.HasMoreTokens() == TRUE){
4594 wSTVendorDetails.GetNextToken();
4595 wxSVNDID = wSTVendorDetails.GetNextToken();
4596 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4601 if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4603 // Add the data to the vendor variables.
4605 VendorList.erase(*VendorCount);
4606 VendorListPEN.erase(*VendorCount);
4607 VendorListElement.erase(*VendorCount);
4609 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4610 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4611 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4617 void ContactDataObject::ClearData(){
4619 // Clear the contact information.
4622 NameForename.clear();
4623 NameSurname.clear();
4624 NameOtherNames.clear();
4626 NameNickname.clear();
4627 NameDisplayAs.clear();
4628 NameLanguage.clear();
4633 BirthdayAltID.clear();
4634 BirthdayCalScale.clear();
4635 BirthdayTokens.clear();
4636 Anniversary.clear();
4637 AnniversaryAltID.clear();
4638 AnniversaryCalScale.clear();
4639 AnniversaryTokens.clear();
4642 GenderDetails.clear();
4643 GenderTokens.clear();
4647 RevisionTokens.clear();
4650 SourceListAltID.clear();
4651 SourceListPID.clear();
4652 SourceListType.clear();
4653 SourceListTokens.clear();
4654 SourceListMediatype.clear();
4655 SourceListPref.clear();
4658 XMLListAltID.clear();
4660 ClientPIDList.clear();
4661 ClientPIDListTokens.clear();
4663 FullNamesList.clear();
4664 FullNamesListType.clear();
4665 FullNamesListLanguage.clear();
4666 FullNamesListAltID.clear();
4667 FullNamesListPID.clear();
4668 FullNamesListTokens.clear();
4669 FullNamesListPref.clear();
4671 GeneralNicknamesList.clear();
4672 GeneralNicknamesListType.clear();
4673 GeneralNicknamesListLanguage.clear();
4674 GeneralNicknamesListAltID.clear();
4675 GeneralNicknamesListPID.clear();
4676 GeneralNicknamesListTokens.clear();
4677 GeneralNicknamesListPref.clear();
4679 GeneralAddressList.clear();
4680 GeneralAddressListTown.clear();
4681 GeneralAddressListCounty.clear();
4682 GeneralAddressListPostCode.clear();
4683 GeneralAddressListCountry.clear();
4684 GeneralAddressListLabel.clear();
4685 GeneralAddressListLang.clear();
4686 GeneralAddressListAltID.clear();
4687 GeneralAddressListPID.clear();
4688 GeneralAddressListTokens.clear();
4689 GeneralAddressListGeo.clear();
4690 GeneralAddressListTimezone.clear();
4691 GeneralAddressListType.clear();
4692 GeneralAddressListMediatype.clear();
4693 GeneralAddressListPref.clear();
4695 GeneralEmailList.clear();
4696 GeneralEmailListAltID.clear();
4697 GeneralEmailListPID.clear();
4698 GeneralEmailListType.clear();
4699 GeneralEmailListTokens.clear();
4700 GeneralEmailListPref.clear();
4702 GeneralIMList.clear();
4703 GeneralIMListAltID.clear();
4704 GeneralIMListPID.clear();
4705 GeneralIMListType.clear();
4706 GeneralIMListTypeInfo.clear();
4707 GeneralIMListTokens.clear();
4708 GeneralIMListMediatype.clear();
4709 GeneralIMListPref.clear();
4711 GeneralTelephoneList.clear();
4712 GeneralTelephoneListAltID.clear();
4713 GeneralTelephoneListPID.clear();
4714 GeneralTelephoneListType.clear();
4715 GeneralTelephoneListTokens.clear();
4716 GeneralTelephoneListTypeInfo.clear();
4717 GeneralTelephoneListPref.clear();
4719 GeneralLanguageList.clear();
4720 GeneralLanguageListAltID.clear();
4721 GeneralLanguageListPID.clear();
4722 GeneralLanguageListType.clear();
4723 GeneralLanguageListTokens.clear();
4724 GeneralLanguageListPref.clear();
4726 GeneralTZList.clear();
4727 GeneralTZListAltID.clear();
4728 GeneralTZListPID.clear();
4729 GeneralTZListType.clear();
4730 GeneralTZListTokens.clear();
4731 GeneralTZListMediatype.clear();
4732 GeneralTZListPref.clear();
4734 GeneralGeographyList.clear();
4735 GeneralGeographyListAltID.clear();
4736 GeneralGeographyListPID.clear();
4737 GeneralGeographyListType.clear();
4738 GeneralGeographyListTokens.clear();
4739 GeneralGeographyListMediatype.clear();
4740 GeneralGeographyListPref.clear();
4742 GeneralRelatedList.clear();
4743 GeneralRelatedListRelType.clear();
4744 GeneralRelatedListLanguage.clear();
4745 GeneralRelatedListAltID.clear();
4746 GeneralRelatedListPID.clear();
4747 GeneralRelatedListType.clear();
4748 GeneralRelatedListTokens.clear();
4749 GeneralRelatedListPref.clear();
4751 GeneralWebsiteList.clear();
4752 GeneralWebsiteListAltID.clear();
4753 GeneralWebsiteListPID.clear();
4754 GeneralWebsiteListType.clear();
4755 GeneralWebsiteListTokens.clear();
4756 GeneralWebsiteListMediatype.clear();
4757 GeneralWebsiteListPref.clear();
4759 GeneralTitleList.clear();
4760 GeneralTitleListLanguage.clear();
4761 GeneralTitleListAltID.clear();
4762 GeneralTitleListPID.clear();
4763 GeneralTitleListType.clear();
4764 GeneralTitleListTokens.clear();
4765 GeneralTitleListPref.clear();
4767 GeneralRoleList.clear();
4768 GeneralRoleListLanguage.clear();
4769 GeneralRoleListAltID.clear();
4770 GeneralRoleListPID.clear();
4771 GeneralRoleListType.clear();
4772 GeneralRoleListTokens.clear();
4773 GeneralRoleListPref.clear();
4775 GeneralOrganisationsList.clear();
4776 GeneralOrganisationsListLanguage.clear();
4777 GeneralOrganisationsListAltID.clear();
4778 GeneralOrganisationsListPID.clear();
4779 GeneralOrganisationsListType.clear();
4780 GeneralOrganisationsListTokens.clear();
4781 GeneralOrganisationsListSortAs.clear();
4782 GeneralOrganisationsListPref.clear();
4784 GeneralNoteList.clear();
4785 GeneralNoteListLanguage.clear();
4786 GeneralNoteListAltID.clear();
4787 GeneralNoteListPID.clear();
4788 GeneralNoteListType.clear();
4789 GeneralNoteListTokens.clear();
4790 GeneralNoteListPref.clear();
4792 /* Items on Home Tab */
4794 HomeNicknamesList.clear();
4795 HomeNicknamesListType.clear();
4796 HomeNicknamesListLanguage.clear();
4797 HomeNicknamesListAltID.clear();
4798 HomeNicknamesListPID.clear();
4799 HomeNicknamesListTokens.clear();
4800 HomeNicknamesListPref.clear();
4802 HomeAddressList.clear();
4803 HomeAddressListTown.clear();
4804 HomeAddressListCounty.clear();
4805 HomeAddressListPostCode.clear();
4806 HomeAddressListCountry.clear();
4807 HomeAddressListLabel.clear();
4808 HomeAddressListLang.clear();
4809 HomeAddressListAltID.clear();
4810 HomeAddressListPID.clear();
4811 HomeAddressListTokens.clear();
4812 HomeAddressListGeo.clear();
4813 HomeAddressListTimezone.clear();
4814 HomeAddressListType.clear();
4815 HomeAddressListMediatype.clear();
4816 HomeAddressListPref.clear();
4818 HomeEmailList.clear();
4819 HomeEmailListAltID.clear();
4820 HomeEmailListPID.clear();
4821 HomeEmailListType.clear();
4822 HomeEmailListTokens.clear();
4823 HomeEmailListPref.clear();
4826 HomeIMListAltID.clear();
4827 HomeIMListPID.clear();
4828 HomeIMListType.clear();
4829 HomeIMListTypeInfo.clear();
4830 HomeIMListTokens.clear();
4831 HomeIMListMediatype.clear();
4832 HomeIMListPref.clear();
4834 HomeTelephoneList.clear();
4835 HomeTelephoneListAltID.clear();
4836 HomeTelephoneListPID.clear();
4837 HomeTelephoneListType.clear();
4838 HomeTelephoneListTokens.clear();
4839 HomeTelephoneListTypeInfo.clear();
4840 HomeTelephoneListPref.clear();
4842 HomeLanguageList.clear();
4843 HomeLanguageListAltID.clear();
4844 HomeLanguageListPID.clear();
4845 HomeLanguageListType.clear();
4846 HomeLanguageListTokens.clear();
4847 HomeLanguageListPref.clear();
4850 HomeTZListAltID.clear();
4851 HomeTZListPID.clear();
4852 HomeTZListType.clear();
4853 HomeTZListTokens.clear();
4854 HomeTZListMediatype.clear();
4855 HomeTZListPref.clear();
4857 HomeGeographyList.clear();
4858 HomeGeographyListAltID.clear();
4859 HomeGeographyListPID.clear();
4860 HomeGeographyListType.clear();
4861 HomeGeographyListTokens.clear();
4862 HomeGeographyListMediatype.clear();
4863 HomeGeographyListPref.clear();
4865 HomeWebsiteList.clear();
4866 HomeWebsiteListAltID.clear();
4867 HomeWebsiteListPID.clear();
4868 HomeWebsiteListType.clear();
4869 HomeWebsiteListTokens.clear();
4870 HomeWebsiteListMediatype.clear();
4871 HomeWebsiteListPref.clear();
4873 HomeTitleList.clear();
4874 HomeTitleListLanguage.clear();
4875 HomeTitleListAltID.clear();
4876 HomeTitleListPID.clear();
4877 HomeTitleListType.clear();
4878 HomeTitleListTokens.clear();
4879 HomeTitleListPref.clear();
4881 HomeRoleList.clear();
4882 HomeRoleListLanguage.clear();
4883 HomeRoleListAltID.clear();
4884 HomeRoleListPID.clear();
4885 HomeRoleListType.clear();
4886 HomeRoleListTokens.clear();
4887 HomeRoleListPref.clear();
4889 HomeOrganisationsList.clear();
4890 HomeOrganisationsListLanguage.clear();
4891 HomeOrganisationsListAltID.clear();
4892 HomeOrganisationsListPID.clear();
4893 HomeOrganisationsListType.clear();
4894 HomeOrganisationsListTokens.clear();
4895 HomeOrganisationsListSortAs.clear();
4896 HomeOrganisationsListPref.clear();
4898 HomeNoteList.clear();
4899 HomeNoteListLanguage.clear();
4900 HomeNoteListAltID.clear();
4901 HomeNoteListPID.clear();
4902 HomeNoteListType.clear();
4903 HomeNoteListTokens.clear();
4904 HomeNoteListPref.clear();
4906 /* Items on the Business tab */
4908 BusinessNicknamesList.clear();
4909 BusinessNicknamesListType.clear();
4910 BusinessNicknamesListLanguage.clear();
4911 BusinessNicknamesListAltID.clear();
4912 BusinessNicknamesListPID.clear();
4913 BusinessNicknamesListTokens.clear();
4914 BusinessNicknamesListPref.clear();
4916 BusinessAddressList.clear();
4917 BusinessAddressListTown.clear();
4918 BusinessAddressListCounty.clear();
4919 BusinessAddressListPostCode.clear();
4920 BusinessAddressListCountry.clear();
4921 BusinessAddressListLabel.clear();
4922 BusinessAddressListLang.clear();
4923 BusinessAddressListAltID.clear();
4924 BusinessAddressListPID.clear();
4925 BusinessAddressListTokens.clear();
4926 BusinessAddressListGeo.clear();
4927 BusinessAddressListTimezone.clear();
4928 BusinessAddressListType.clear();
4929 BusinessAddressListMediatype.clear();
4930 BusinessAddressListPref.clear();
4932 BusinessEmailList.clear();
4933 BusinessEmailListAltID.clear();
4934 BusinessEmailListPID.clear();
4935 BusinessEmailListType.clear();
4936 BusinessEmailListTokens.clear();
4937 BusinessEmailListPref.clear();
4939 BusinessIMList.clear();
4940 BusinessIMListAltID.clear();
4941 BusinessIMListPID.clear();
4942 BusinessIMListType.clear();
4943 BusinessIMListTokens.clear();
4944 BusinessIMListMediatype.clear();
4945 BusinessIMListPref.clear();
4947 BusinessTelephoneList.clear();
4948 BusinessTelephoneListAltID.clear();
4949 BusinessTelephoneListPID.clear();
4950 BusinessTelephoneListType.clear();
4951 BusinessTelephoneListTokens.clear();
4952 BusinessTelephoneListPref.clear();
4954 BusinessLanguageList.clear();
4955 BusinessLanguageListAltID.clear();
4956 BusinessLanguageListPID.clear();
4957 BusinessLanguageListType.clear();
4958 BusinessLanguageListTokens.clear();
4959 BusinessLanguageListPref.clear();
4961 BusinessTZList.clear();
4962 BusinessTZListAltID.clear();
4963 BusinessTZListPID.clear();
4964 BusinessTZListType.clear();
4965 BusinessTZListTokens.clear();
4966 BusinessTZListMediatype.clear();
4967 BusinessTZListPref.clear();
4969 BusinessGeographyList.clear();
4970 BusinessGeographyListAltID.clear();
4971 BusinessGeographyListPID.clear();
4972 BusinessGeographyListType.clear();
4973 BusinessGeographyListTokens.clear();
4974 BusinessGeographyListMediatype.clear();
4975 BusinessGeographyListPref.clear();
4977 BusinessWebsiteList.clear();
4978 BusinessWebsiteListAltID.clear();
4979 BusinessWebsiteListPID.clear();
4980 BusinessWebsiteListType.clear();
4981 BusinessWebsiteListTokens.clear();
4982 BusinessWebsiteListMediatype.clear();
4983 BusinessWebsiteListPref.clear();
4985 BusinessTitleList.clear();
4986 BusinessTitleListLanguage.clear();
4987 BusinessTitleListAltID.clear();
4988 BusinessTitleListPID.clear();
4989 BusinessTitleListType.clear();
4990 BusinessTitleListTokens.clear();
4991 BusinessTitleListPref.clear();
4993 BusinessRoleList.clear();
4994 BusinessRoleListLanguage.clear();
4995 BusinessRoleListAltID.clear();
4996 BusinessRoleListPID.clear();
4997 BusinessRoleListType.clear();
4998 BusinessRoleListTokens.clear();
4999 BusinessRoleListPref.clear();
5001 BusinessOrganisationsList.clear();
5002 BusinessOrganisationsListLanguage.clear();
5003 BusinessOrganisationsListAltID.clear();
5004 BusinessOrganisationsListPID.clear();
5005 BusinessOrganisationsListType.clear();
5006 BusinessOrganisationsListTokens.clear();
5007 BusinessOrganisationsListSortAs.clear();
5008 BusinessOrganisationsListPref.clear();
5010 BusinessNoteList.clear();
5011 BusinessNoteListLanguage.clear();
5012 BusinessNoteListAltID.clear();
5013 BusinessNoteListPID.clear();
5014 BusinessNoteListType.clear();
5015 BusinessNoteListTokens.clear();
5016 BusinessNoteListPref.clear();
5018 /* Items on the Categories tab */
5020 CategoriesList.clear();
5021 CategoriesListAltID.clear();
5022 CategoriesListPID.clear();
5023 CategoriesListType.clear();
5024 CategoriesListTokens.clear();
5025 CategoriesListLanguage.clear();
5026 CategoriesListPref.clear();
5028 /* Items on the Groups tab */
5031 GroupsListAltID.clear();
5032 GroupsListPID.clear();
5033 GroupsListType.clear();
5034 GroupsListMediaType.clear();
5035 GroupsListTokens.clear();
5036 GroupsListPref.clear();
5038 /* Items on the Pictures tab */
5040 PicturesList.clear();
5041 PicturesListAltID.clear();
5042 PicturesListPID.clear();
5043 PicturesListType.clear();
5044 PicturesListPicEncType.clear();
5045 PicturesListPictureType.clear();
5046 PicturesListTokens.clear();
5047 PicturesListMediatype.clear();
5048 PicturesListPref.clear();
5050 /* Items on the Logos tab */
5053 LogosListAltID.clear();
5054 LogosListPID.clear();
5055 LogosListType.clear();
5056 LogosListPicEncType.clear();
5057 LogosListPictureType.clear();
5058 LogosListTokens.clear();
5059 LogosListMediatype.clear();
5060 LogosListPref.clear();
5062 /* Items on the Sounds tab */
5065 SoundsListAltID.clear();
5066 SoundsListPID.clear();
5067 SoundsListType.clear();
5068 SoundsListAudioEncType.clear();
5069 SoundsListAudioType.clear();
5070 SoundsListTokens.clear();
5071 SoundsListMediatype.clear();
5072 SoundsListPref.clear();
5074 /* Items on the Calendaring tab */
5076 CalendarList.clear();
5077 CalendarListAltID.clear();
5078 CalendarListPID.clear();
5079 CalendarListType.clear();
5080 CalendarListTokens.clear();
5081 CalendarListMediatype.clear();
5082 CalendarListPref.clear();
5084 CalendarRequestList.clear();
5085 CalendarRequestListAltID.clear();
5086 CalendarRequestListPID.clear();
5087 CalendarRequestListType.clear();
5088 CalendarRequestListTokens.clear();
5089 CalendarRequestListMediatype.clear();
5090 CalendarRequestListPref.clear();
5092 FreeBusyList.clear();
5093 FreeBusyListAltID.clear();
5094 FreeBusyListPID.clear();
5095 FreeBusyListType.clear();
5096 FreeBusyListTokens.clear();
5097 FreeBusyListMediatype.clear();
5098 FreeBusyListPref.clear();
5100 /* Items on the Security tab */
5103 KeyListAltID.clear();
5105 KeyListKeyType.clear();
5106 KeyListDataType.clear();
5107 KeyListDataEncType.clear();
5108 KeyListType.clear();
5109 KeyListTokens.clear();
5110 KeyListPref.clear();
5112 /* Items on the Other tab */
5115 VendorListPEN.clear();
5116 VendorListElement.clear();
5119 XTokenListTokens.clear();
5123 void ProcessNameValue(wxString *PropertyData,
5124 wxString *PropertyName,
5125 wxString *PropertyValue){
5127 // Proces the name and value information.
5129 wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
5130 *PropertyName = PropertyElement.GetNextToken();
5131 *PropertyValue = PropertyElement.GetNextToken();
5135 void ProcessTokens(wxString *PropertyName,
5136 wxString *PropertyValue,
5137 wxString *PropertyTokens,
5140 // Process the tokens.
5142 if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5144 if (*FirstToken == TRUE){
5146 PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5147 *FirstToken = FALSE;
5151 PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5159 void ProcessStringValue(wxString *PropertyName,
5160 wxString PropertyNameMatch,
5161 std::map<int,wxString> *MapPtr,
5162 wxString *PropertyValue,
5164 bool *PropertyMatched){
5166 // Process the string value.
5168 if (*PropertyName == PropertyNameMatch){
5169 MapPtr->erase(*ItemCount);
5170 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5171 *PropertyMatched = TRUE;
5176 void ProcessIntegerValue(wxString *PropertyName,
5177 wxString PropertyNameMatch,
5178 std::map<int,int> *PrefPtr,
5179 wxString *PropertyValue,
5181 bool *PropertyMatched){
5183 // Process the integer value.
5185 if (*PropertyName == PropertyNameMatch){
5186 *PropertyMatched = TRUE;
5191 int PriorityNumber = 0;
5192 bool ValidNumber = TRUE;
5195 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5198 catch(std::invalid_argument &e){
5199 ValidNumber = FALSE;
5202 if (ValidNumber == TRUE){
5204 PrefPtr->erase(*ItemCount);
5205 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5211 void SplitValues(wxString *PropertyLine,
5212 std::map<int,int> *SplitPoints,
5213 std::map<int,int> *SplitLength,
5216 // Split values from a string supplied by PropertyLine.
5218 size_t intPropertyLen = PropertyLine->Len();
5219 int intSplitsFound = 0;
5220 int intSplitSize = 0;
5221 int intSplitSeek = 0;
5223 for (int i = intSize; i <= intPropertyLen; i++){
5227 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5228 PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5230 if (intSplitsFound == 0){
5232 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5236 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5240 SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5250 if (intSplitsFound == 0){
5252 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5253 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5257 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5258 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5264 void CheckType(wxString *PropertySeg1,
5265 std::map<int,int> *SplitPoints,
5266 std::map<int,int> *SplitLength,
5268 PropertyType *PropType){
5270 // Check the information type.
5272 wxString PropertyData;
5273 wxString PropertyName;
5274 wxString PropertyValue;
5275 std::map<int,int>::iterator SLiter;
5277 for (std::map<int, int>::iterator intiter = SplitPoints->begin();
5278 intiter != SplitPoints->end(); ++intiter){
5280 SLiter = SplitLength->find(intiter->first);
5281 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5282 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
5283 *intPrevValue = intiter->second;
5285 if (PropertyName == wxT("TYPE")){
5287 if (PropertyValue == wxT("work")){
5289 *PropType = PROPERTY_WORK;
5291 } else if (PropertyValue == wxT("home")){
5293 *PropType = PROPERTY_HOME;
5297 *PropType = PROPERTY_NONE;