Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
1a6e6be5c79f30bd52815a66fb37bad1f7b0a925
[xestiaab/.git] / ContactDataObject.cpp
1 // ContactDataObject.cpp - Client Data Object.
2 //
3 // (c) 2012-2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
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.
10 //
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.
15 //
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){
22         
23         if (!wxFileExists(Filename)){
24         
25                 return CONTACTLOAD_FILEMISSING;
26         
27         }
28         
29         wxFile ContactFile;
30         
31         if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
32         
33                 return CONTACTLOAD_FILEERROR;
34         
35         }
36         
37         // Check that the vCard is a valid vCard 4.0 file.
39         vCard vCard4FormatCheck;
40         
41         vCard4FormatCheck.LoadFile(Filename);
42         
43         if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){
44         
45                 return CONTACTLOAD_FILEINVALIDFORMAT;
46         
47         }
49         // Check that the vCard meets the base specification.
50         
51         if (!vCard4FormatCheck.MeetBaseSpecification()){
52         
53                 return CONTACTLOAD_FILEBASESPECFAIL;
54         
55         }
56         
57         wxStringTokenizer wSTContactFileLines(vCard4FormatCheck.WriteString(), wxT("\r\n"));
58         
59         std::map<int, wxString> ContactFileLines;
61         int ContactLineSeek = 0;
63         while (wSTContactFileLines.HasMoreTokens() == TRUE){
65                 wxString ContactLine = wSTContactFileLines.GetNextToken();
66                 ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
67                 ContactLineSeek++;              
68         
69         }
70         
71         wxString wxSPropertyNextLine;
72         
73         bool ExtraLineSeek = TRUE;
74         bool QuoteMode = FALSE;
75         bool PropertyFind = TRUE;
76         bool KindProcessed = FALSE;
77         bool NameProcessed = FALSE;
78         bool GenderProcessed = FALSE;
79         bool BirthdayProcessed = FALSE;
80         bool AnniversaryProcessed = FALSE;
81         bool UIDProcessed = FALSE;
82         bool RevisionProcessed = FALSE;
83         int ContactLineLen = 0;
84         int QuoteBreakPoint = 0;
85         int SourceCount = 0;
86         int GroupCount = 0;
87         int FNCount = 0;
88         int NicknameCount = 0;
89         int TimeZoneCount = 0;
90         int AddressCount = 0;
91         int EmailCount = 0;
92         int IMCount = 0;
93         int TelephoneCount = 0;
94         int LanguageCount = 0;
95         int GeographicCount = 0;
96         int RelatedCount = 0;
97         int URLCount = 0;
98         int TitleCount = 0;
99         int RoleCount = 0;
100         int OrganisationCount = 0;
101         int NoteCount = 0;
102         int CategoryCount = 0;
103         int PhotoCount = 0;
104         int LogoCount = 0;
105         int SoundCount = 0;
106         int CalendarCount = 0;
107         int CalendarAddressCount = 0;
108         int FreeBusyAddressCount = 0;
109         int KeyCount = 0;
110         int VendorCount = 0;
111         int XTokenCount = 0;
112         int XMLCount = 0;
113         int ClientPIDCount = 0;
114         wxString ContactLine;
115         wxString PropertyLine;
116         wxString PropertySeg1;
117         wxString PropertySeg2;
118         wxString PropertyNextLine;
119         wxString Property;
120         
121         for (std::map<int,wxString>::iterator iter = ContactFileLines.begin(); 
122          iter != ContactFileLines.end(); ++iter){
124                 ExtraLineSeek = TRUE;
125                 QuoteMode = FALSE;
126                 PropertyFind = TRUE;
127                 ContactLineLen = 0;
128                 QuoteBreakPoint = 0;
129                 ContactLine.Clear();
130                 PropertyLine.Clear();
131                 PropertySeg1.Clear();
132                 PropertySeg2.Clear();
133                 Property.Clear();
134          
135                 ContactLine = iter->second;
136                 
137                 while (ExtraLineSeek == TRUE){
138                 
139                         // Check if there is extra data on the next line 
140                         // (indicated by space or tab at the start) and add data.
141                 
142                         iter++;
143                         
144                         if (iter == ContactFileLines.end()){
145                         
146                                 iter--;
147                                 break;
148                         
149                         }                       
150                 
151                         PropertyNextLine = iter->second;
152                 
153                         if (PropertyNextLine.Mid(0, 1) == wxT(" ") || PropertyNextLine.Mid(0, 1) == wxT("\t")){
154                 
155                                 PropertyNextLine.Remove(0, 1);
156                                 ContactLine.Append(PropertyNextLine);
157                 
158                         } else {
159                         
160                                 iter--;
161                                 ExtraLineSeek = FALSE;
162                         
163                         }
164                 
165                 }
167                 ContactLineLen = ContactLine.Len();
168                 
169                 // Make sure we are not in quotation mode.
170                 // Make sure colon does not have \ or \\ before it.
171                 
172                 for (int i = 0; i <= ContactLineLen; i++){
173                 
174                         if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
175                         
176                                 PropertyFind = FALSE;
177                         
178                         } else if (PropertyFind == TRUE){
179                         
180                                 Property.Append(ContactLine.Mid(i, 1));
181                         
182                         }               
183                 
184                         if (ContactLine.Mid(i, 1) == wxT("\"")){
185                         
186                                 if (QuoteMode == TRUE){
187                                 
188                                         QuoteMode = FALSE;
189                                 
190                                 } else {
191                         
192                                         QuoteMode = TRUE;
193                                         
194                                 }
195                         
196                         }
197                         
198                         if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
199                         
200                                 QuoteBreakPoint = i;
201                                 break;
202                         
203                         }
204                 
205                 }
206                 
207                 // Split that line at the point into two variables (ignore the colon).
208                 
209                 PropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
210                 PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
211                 
212                  if (Property == wxT("KIND") && KindProcessed == FALSE){
213                                 
214                         ProcessKind(PropertySeg2);
215                 
216                 } else if (Property == wxT("UID") && UIDProcessed == FALSE){
217                 
218                         UIDToken = PropertySeg2;
219                         UIDProcessed = TRUE;
220                 
221                 } else if (Property == wxT("SOURCE")){
222                 
223                         ProcessSource(PropertySeg1, PropertySeg2, &SourceCount);
224                         SourceCount++;
225                 
226                 } else if (Property == wxT("XML")){
227                 
228                         ProcessXML(PropertySeg1, PropertySeg2, &XMLCount);
229                         XMLCount++;
230                 
231                 } else if (Property == wxT("REV") && RevisionProcessed == FALSE){
232                 
233                         ProcessRevision(PropertySeg1, PropertySeg2);
234                         RevisionProcessed = TRUE;
235                 
236                 } else if (Property == wxT("MEMBER")){
238                         ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
239                         GroupCount++;   
240                 
241                 } else if (Property == wxT("FN")){
242                 
243                         ProcessFN(PropertySeg1, PropertySeg2, &FNCount);
244                         FNCount++;
245                 
246                 } else if (Property == wxT("N") && NameProcessed == FALSE){
247                 
248                         ProcessN(PropertySeg1, PropertySeg2);
249                         NameProcessed = TRUE;
250                 
251                 } else if (Property == wxT("CLIENTPIDMAP")){
252                 
253                         ProcessClientPIDMap(PropertySeg1, PropertySeg2, &ClientPIDCount);
254                         ClientPIDCount++;
255                 
256                 } else if (Property == wxT("NICKNAME")){
257                                                 
258                         ProcessNickname(PropertySeg1, PropertySeg2, &NicknameCount);
259                         NicknameCount++;
260                         
261                 } else if (Property == wxT("GENDER") && GenderProcessed == FALSE){
262                 
263                         ProcessGender(PropertySeg1, PropertySeg2);
264                         GenderProcessed = TRUE;
265                 
266                 } else if (Property == wxT("BDAY") && BirthdayProcessed == FALSE){
267                 
268                         ProcessBirthday(PropertySeg1, PropertySeg2);
269                         BirthdayProcessed = TRUE;
270                 
271                 } else if (Property == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
272                 
273                         ProcessAnniversary(PropertySeg1, PropertySeg2);
274                         AnniversaryProcessed = TRUE;
275                 
276                 } else if (Property == wxT("TZ")){
277                 
278                         ProcessTimeZone(PropertySeg1, PropertySeg2, &TimeZoneCount);
279                         TimeZoneCount++;
280                 
281                 } else if (Property == wxT("ADR")){
282                 
283                         ProcessAddress(PropertySeg1, PropertySeg2, &AddressCount);
284                         AddressCount++;
285                 
286                 } else if (Property == wxT("EMAIL")){
287                                         
288                         ProcessEmail(PropertySeg1, PropertySeg2, &EmailCount);  
289                         EmailCount++;
290                 
291                 } else if (Property == wxT("IMPP")){
292                 
293                         ProcessIM(PropertySeg1, PropertySeg2, &IMCount);
294                         IMCount++;
295                         
296                 } else if (Property == wxT("TEL")){
297                                 
298                         ProcessTelephone(PropertySeg1, PropertySeg2, &TelephoneCount);
299                         TelephoneCount++;
300                 
301                 } else if (Property == wxT("LANG")){
302                 
303                         // See frmContactEditor-LoadLanguage.cpp
304                         
305                         ProcessLanguage(PropertySeg1, PropertySeg2, &LanguageCount);
306                         LanguageCount++;
307                 
308                 } else if (Property == wxT("GEO")){
309                 
310                         // See frmContactEditor-LoadGeo.cpp
311                         
312                         ProcessGeographic(PropertySeg1, PropertySeg2, &GeographicCount);        
313                         GeographicCount++;
314                 
315                 } else if (Property == wxT("RELATED")){
316                         
317                         // See fromContactEditor-LoadRelated.cpp
318                         
319                         ProcessRelated(PropertySeg1, PropertySeg2, &RelatedCount);              
320                         RelatedCount++;
321                         
322                 } else if (Property == wxT("URL")){
324                         // See frmContactEditor-LoadURL.cpp
325                 
326                         ProcessURL(PropertySeg1, PropertySeg2, &URLCount);
327                         URLCount++;
328                 
329                 } else if (Property == wxT("TITLE")) {
330                 
331                         // See frmContactEditor-LoadTitle.cpp
332                         
333                         ProcessTitle(PropertySeg1, PropertySeg2, &TitleCount);
334                         TitleCount++;
335                         
336                 } else if (Property == wxT("ROLE")) {
337                 
338                         // See frmContactEditor-LoadTitle.cpp
339                         
340                         ProcessRole(PropertySeg1, PropertySeg2, &RoleCount);
341                         RoleCount++;
342                         
343                 } else if (Property == wxT("ORG")) {
344                 
345                         // See frmContactEditor-LoadOrg.cpp
346                         
347                         ProcessOrganisation(PropertySeg1, PropertySeg2, &OrganisationCount);
348                         OrganisationCount++;
349                         
350                 } else if (Property == wxT("NOTE")) {
352                         // See frmContactEditor-LoadNote.cpp
354                         ProcessNote(PropertySeg1, PropertySeg2, &NoteCount);
355                         NoteCount++;    
356                         
357                 } else if (Property == wxT("CATEGORIES")) {
358                 
359                         // See frmContactEditor-LoadCategory.cpp
360                 
361                         ProcessCategory(PropertySeg1, PropertySeg2, &CategoryCount);    
362                         CategoryCount++;
363                         
364                 } else if (Property == wxT("PHOTO")) {
365                 
366                         // See frmContactEditor-LoadPhoto.cpp
367                         
368                         ProcessPhoto(PropertySeg1, PropertySeg2, &PhotoCount);
369                         PhotoCount++;
371                 } else if (Property == wxT("LOGO")) {
372                 
373                         // See frmContactEditor-LoadPhoto.cpp
374                         
375                         ProcessLogo(PropertySeg1, PropertySeg2, &LogoCount);
376                         LogoCount++;
378                 } else if (Property == wxT("SOUND")) {
379                 
380                         // See frmContactEditor-LoadSound.cpp
381                         
382                         ProcessSound(PropertySeg1, PropertySeg2, &SoundCount);
383                         SoundCount++;
384                         
385                 } else if (Property == wxT("CALURI")){
387                         // See frmContactEditor-LoadCalendar.cpp
388                         
389                         ProcessCalendarURI(PropertySeg1, PropertySeg2, &CalendarCount);
390                         CalendarCount++;
391                 
392                 } else if (Property == wxT("CALADRURI")){
393                 
394                         ProcessCalendarAddressURI(PropertySeg1, PropertySeg2, &CalendarAddressCount);
395                         CalendarAddressCount++;
396                 
397                 } else if (Property == wxT("FBURL")){
399                         // See frmContactEditor-LoadCalendar.cpp
401                         ProcessCalendarFreeBusy(PropertySeg1, PropertySeg2, &FreeBusyAddressCount);
402                         FreeBusyAddressCount++;
404                 } else if (Property == wxT("KEY")){
405                 
406                         // See frmContactEditor-LoadKey.cpp
407                         
408                         ProcessKey(PropertySeg1, PropertySeg2, &KeyCount);
409                         KeyCount++;
410                 
411                 } else if (Property.Mid(0, 3) == wxT("VND")){
412                 
413                         ProcessVendor(PropertySeg1, PropertySeg2, &VendorCount);
414                         VendorCount++;
415                 
416                 } else if (Property.Mid(0, 2) == wxT("X-")){
417                         
418                         XTokenList.insert(std::make_pair(XTokenCount, PropertySeg2));
419                         XTokenListTokens.insert(std::make_pair(XTokenCount, PropertySeg1.Mid(2)));
420                         XTokenCount++;
421                 
422                 }
423                 
424         }
425         
426         return CONTACTLOAD_OK;
430 void ContactDataObject::ProcessKind(wxString KindType){
432         if (KindType == wxT("individual")){
433                         
434                 ContactKind = CONTACTKIND_INDIVIDUAL;
435                         
436         } else if (KindType == wxT("group")){
437                         
438                 ContactKind = CONTACTKIND_GROUP;
439                         
440         } else if (KindType == wxT("org")){
441                         
442                 ContactKind = CONTACTKIND_ORGANISATION;
443                         
444         } else if (KindType == wxT("location")){
445                         
446                 ContactKind = CONTACTKIND_LOCATION;
447                         
448         } else {
449                         
450                 ContactKind = CONTACTKIND_NONE;                 
451         }
455 void ContactDataObject::ProcessRevision(wxString PropertySeg1, wxString PropertySeg2){
457         size_t intPropertyLen = PropertySeg1.Len();
458         std::map<int, int> SplitPoints;
459         std::map<int, int> SplitLength;
460         std::map<int, int>::iterator SLiter;                    
461         wxString PropertyData;
462         wxString PropertyName;
463         wxString PropertyValue;
464         wxString PropertyTokens;
465         bool FirstToken = TRUE;
466         int intSplitsFound = 0;
467         int intSplitSize = 0;
468         int intPrevValue = 5;
469         
470         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
471         
472         intPrevValue = 4;
474         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
475         intiter != SplitPoints.end(); ++intiter){
476         
477                 SLiter = SplitLength.find(intiter->first);
478                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
479                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
480                 intPrevValue = intiter->second;
481                 
482                 // Process properties.
483                 
484                 size_t intPropertyValueLen = PropertyValue.Len();
485                 
486                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
487                         
488                         PropertyValue.Trim();
489                         PropertyValue.RemoveLast();
490                         
491                 }                               
492                 
493                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
494                         
495                         PropertyValue.Remove(0, 1);
496                         
497                 }                       
498                 
499                 CaptureString(&PropertyValue, FALSE);
500                 
501                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
502         
503         }       
504         
505         CaptureString(&PropertySeg2, FALSE);
506         
507         Revision = PropertySeg2;
508         
509         if (!PropertyTokens.IsEmpty()){
510         
511                 RevisionTokens = PropertyTokens;
512         
513         }
518 void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySeg2, int *SourceCount){
520         size_t intPropertyLen = PropertySeg1.Len();
521         std::map<int, int> SplitPoints;
522         std::map<int, int> SplitLength;
523         std::map<int, int>::iterator SLiter;                    
524         wxString PropertyData;
525         wxString PropertyName;
526         wxString PropertyValue;
527         wxString PropertyTokens;
528         bool FirstToken = TRUE;
529         bool PropertyMatched = FALSE;
530         int intSplitsFound = 0;
531         int intSplitSize = 0;
532         int intPrevValue = 8;
533         
534         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
535         
536         intPrevValue = 7;
537         
538         PropertyType PropType = PROPERTY_NONE;
539         
540         // Look for type before continuing.                     
542         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
544         intPrevValue = 7;
546         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
547         intiter != SplitPoints.end(); ++intiter){
548         
549                 SLiter = SplitLength.find(intiter->first);
550         
551                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
552                 
553                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
554                 
555                 intPrevValue = intiter->second;
556                 
557                 // Process properties.
558                 
559                 size_t intPropertyValueLen = PropertyValue.Len();
560                 
561                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
562                         
563                         PropertyValue.Trim();
564                         PropertyValue.RemoveLast();
565                         
566                 }                               
567                 
568                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
569                         
570                         PropertyValue.Remove(0, 1);
571                         
572                 }                       
573                 
574                 CaptureString(&PropertyValue, FALSE);
575                 
576                 ProcessStringValue(&PropertyName, "ALTID", &SourceListAltID, &PropertyValue, SourceCount, &PropertyMatched);
577                 ProcessStringValue(&PropertyName, "PID", &SourceListPID, &PropertyValue, SourceCount, &PropertyMatched);
578                 ProcessStringValue(&PropertyName, "MEDIATYPE", &SourceListMediatype, &PropertyValue, SourceCount, &PropertyMatched);
579                 ProcessIntegerValue(&PropertyName, "PREF", &SourceListPref, &PropertyValue, SourceCount, &PropertyMatched);
580                 
581                 if (PropertyMatched == TRUE){
582                 
583                         PropertyMatched = FALSE;
584                         continue;
585                 
586                 }
587                 
588                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
589         
590         }       
591         
592         intPropertyLen = PropertySeg2.Len();
593         SplitPoints.clear();
594         SplitLength.clear();
595         intSplitsFound = 0;
596         intSplitSize = 0;
597         intPrevValue = 0;
598         
599         CaptureString(&PropertySeg2, FALSE);
600         
601         // Add the data to the General/Home/Work address variables.
602                 
603         switch(PropType){
604                 case PROPERTY_NONE:
605                         break;
606                 case PROPERTY_HOME:
607                         SourceListType.insert(std::make_pair(*SourceCount, "home"));
608                         break;
609                 case PROPERTY_WORK:
610                         SourceListType.insert(std::make_pair(*SourceCount, "work"));
611                         break;
612         }
613         
614         SourceList.insert(std::make_pair(*SourceCount, PropertySeg2));
615         
616         if (!PropertyTokens.IsEmpty()){
617         
618                 SourceListTokens.insert(std::make_pair(*SourceCount, PropertyTokens));
619         
620         }
624 void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
626         std::map<int, int> SplitPoints;
627         std::map<int, int> SplitLength;
629         int intPrevValue = 5;
630         
631         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
633         intPrevValue = 4;
634         
635         wxString PropertyName;
636         wxString PropertyValue;
637         wxString PropertyData;
638         wxString PropertyTokens;
639         std::map<int,int>::iterator SLiter;
640         bool FirstToken = TRUE;
641         bool PropertyMatched = FALSE;
642         
643         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
644         intiter != SplitPoints.end(); ++intiter){
645         
646                 SLiter = SplitLength.find(intiter->first);
647                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
648                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
649                 intPrevValue = intiter->second;
650                 
651                 CaptureString(&PropertyValue, FALSE);
652         
653                 ProcessStringValue(&PropertyName, "ALTID", &XMLListAltID, &PropertyValue, XMLCount, &PropertyMatched);
654                 
655                 if (PropertyMatched == TRUE){
656                 
657                         PropertyMatched = FALSE;
658                         continue;
659                 
660                 }
661                 
662         }
664         XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
668 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
670         std::map<int, int> SplitPoints;
671         std::map<int, int> SplitLength;
673         int intPrevValue = 8;
674         
675         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
677         intPrevValue = 7;
678         
679         wxString PropertyName;
680         wxString PropertyValue;
681         wxString PropertyData;
682         wxString PropertyTokens;
683         std::map<int,int>::iterator SLiter;
684         bool FirstToken = TRUE;
685         bool PropertyMatched = FALSE;
686         
687         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
688         intiter != SplitPoints.end(); ++intiter){
689         
690                 SLiter = SplitLength.find(intiter->first);
691                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
692                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
693                 intPrevValue = intiter->second;
694                 
695                 CaptureString(&PropertyValue, FALSE);
696         
697                 ProcessStringValue(&PropertyName, "ALTID", &GroupsListAltID, &PropertyValue, GroupCount, &PropertyMatched);
698                 ProcessStringValue(&PropertyName, "PID", &GroupsListPID, &PropertyValue, GroupCount, &PropertyMatched);
699                 ProcessStringValue(&PropertyName, "MEDIATYPE", &GroupsListMediaType, &PropertyValue, GroupCount, &PropertyMatched);
700                 ProcessIntegerValue(&PropertyName, "PREF", &GroupsListPref, &PropertyValue, GroupCount, &PropertyMatched);
701                 
702                 if (PropertyMatched == TRUE){
703                 
704                         PropertyMatched = FALSE;
705                         continue;
706                 
707                 }
708                 
709                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
710                 
711         }
713         GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2));
715         if (!PropertyTokens.IsEmpty()){
716         
717                 GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens));
718         
719         }
724 void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
726         std::map<int, int> SplitPoints;
727         std::map<int, int> SplitLength;
729         int intPrevValue = 4;
730         
731         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
733         intPrevValue = 3;
734         
735         wxString PropertyName;
736         wxString PropertyValue;
737         wxString PropertyData;
738         wxString PropertyTokens;
739         std::map<int,int>::iterator SLiter;
740         bool FirstToken = TRUE;
741         bool PropertyMatched = FALSE;
742         
743         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
744         intiter != SplitPoints.end(); ++intiter){
745         
746                 SLiter = SplitLength.find(intiter->first);
747                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
748                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue); 
749                 intPrevValue = intiter->second;
750                 
751                 CaptureString(&PropertyValue, FALSE);
752                 
753                 if (PropertyName == wxT("TYPE")){
755                         if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
756                                 PropertyValue == wxT("work") ){
758                                 FullNamesListType.erase(*FNCount);
759                                 FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
760                 
761                         }
762                         
763                         PropertyMatched = TRUE;
764                 
765                 }
766                 
767                 ProcessStringValue(&PropertyName, "ALTID", &FullNamesListAltID, &PropertyValue, FNCount, &PropertyMatched);
768                 ProcessStringValue(&PropertyName, "PID", &FullNamesListPID, &PropertyValue, FNCount, &PropertyMatched);
769                 ProcessStringValue(&PropertyName, "LANGUAGE", &FullNamesListLanguage, &PropertyValue, FNCount, &PropertyMatched);
770                 ProcessIntegerValue(&PropertyName, "PREF", &FullNamesListPref, &PropertyValue, FNCount, &PropertyMatched);
771                 
772                 if (PropertyMatched == TRUE){
773                 
774                         PropertyMatched = FALSE;
775                         continue;
776                 
777                 }
778                 
779                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
780         
781         }
783         FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
785         if (!PropertyTokens.IsEmpty()){
786         
787                 FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
788         
789         }
793 void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
795         std::map<int, int> SplitPoints;
796         std::map<int, int> SplitLength;
798         int intPrevValue = 3;
799         
800         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
801         
802         intPrevValue = 2;
803         
804         wxString PropertyName;
805         wxString PropertyValue;
806         wxString PropertyData;
807         wxString PropertyTokens;
808         std::map<int,int>::iterator SLiter;
809         bool FirstToken = TRUE;
810         
811         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
812         intiter != SplitPoints.end(); ++intiter){
813         
814                 SLiter = SplitLength.find(intiter->first);
815                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
816                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
817                 intPrevValue = intiter->second;
818                 
819                 CaptureString(&PropertyValue, FALSE);
820                 
821                 if (PropertyName == wxT("ALTID")){
823                         NameAltID = PropertyValue;
824                 
825                 } else if (PropertyName == wxT("LANGUAGE")){
826                 
827                         NameLanguage = PropertyValue;
828                 
829                 } else if (PropertyName == wxT("SORT-AS")){
830                 
831                         if (PropertyValue.Left(1) == wxT("\"") && PropertyValue.Right(1) == wxT("\"") &&
832                                 PropertyValue.Len() >= 3){
833                                 NameDisplayAs = PropertyValue.Mid(1, (PropertyValue.Len() - 2));
834                         }
835                 
836                 } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
837                         
838                         ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
839                         
840                 }
841         
842         }
843         
844         // Split the name data.
845         
846         int intSplitSeek = 0;           
847         int intSplitsFound = 0;
848         int intSplitSize = 0;
849         int intPropertyLen = PropertySeg2.Len();
850         
851         std::map<int,wxString> NameValues;
852         intPrevValue = 0;                                       
853         
854         for (int i = 0; i <= intPropertyLen; i++){
855         
856                 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
857                         
858                         NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
859                         
860                         intSplitSeek = i;
861                         intSplitSeek++;
862                         
863                         if (intSplitsFound == 4){
864                         
865                                 NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
866                                 break;
867                         
868                         }
869                         
870                         intSplitSize = 0;
871                         continue;
872         
873                 }
874                 
875                 intSplitSize++;
877         }
878         
879         // Split the data into several parts.
880                         
881         for (std::map<int, wxString>::iterator iter = NameValues.begin(); 
882         iter != NameValues.end(); ++iter){
883         
884                 if (iter->first == 1){
885                 
886                         // Deal with family name.
887                         
888                         NameSurname = iter->second;
889                 
890                 } else if (iter->first == 2){
891                 
892                         // Deal with given names.
893                         
894                         NameForename = iter->second;
895                 
896                 } else if (iter->first == 3){
897                 
898                         // Deal with additional names.
899                         
900                         NameOtherNames = iter->second;
901                 
902                 } else if (iter->first == 4){
903                 
904                         // Deal with honorifix prefixes and suffixes.
906                         NameTitle = iter->second;
907                 
908                         iter++;
909                         
910                         if (iter == NameValues.end()){
911                         
912                                 break;
913                         
914                         }
915                 
916                         NameSuffix = iter->second;
917                 
918                 }
919         
920         }
921         
922         // Add the name token data.
923         
924         if (!PropertyTokens.IsEmpty()){
925         
926                 NameTokens = PropertyTokens;
927         
928         }
932 void ContactDataObject::ProcessClientPIDMap(wxString PropertySeg1, wxString PropertySeg2, int *ClientPIDCount){
934         size_t intPropertyLen = PropertySeg1.Len();
935         std::map<int, int> SplitPoints;
936         std::map<int, int> SplitLength;
937         std::map<int, int>::iterator SLiter;                    
938         wxString PropertyData;
939         wxString PropertyName;
940         wxString PropertyValue;
941         wxString PropertyTokens;
942         bool FirstToken = TRUE;
943         int intSplitsFound = 0;
944         int intSplitSize = 0;
945         int intPrevValue = 14;
946         
947         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
948         
949         intPrevValue = 13;
951         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
952         intiter != SplitPoints.end(); ++intiter){
953         
954                 SLiter = SplitLength.find(intiter->first);
955                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
956                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
957                 intPrevValue = intiter->second;
958                 
959                 // Process properties.
960                                 
961                 CaptureString(&PropertyValue, FALSE);
962                                         
963                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
964         
965         }       
966         
967         CaptureString(&PropertySeg2, FALSE);
968         
969         ClientPIDList.insert(std::make_pair(*ClientPIDCount, PropertySeg2));
970         
971         if (!PropertyTokens.IsEmpty()){
972         
973                 ClientPIDListTokens.insert(std::make_pair(*ClientPIDCount, PropertyTokens));
974         
975         }
979 void ContactDataObject::ProcessNickname(wxString PropertySeg1, wxString PropertySeg2, int *NicknameCount){
981         std::map<int, int> SplitPoints;
982         std::map<int, int> SplitLength;
984         int intPrevValue = 10;
985         
986         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
987         
988         intPrevValue = 9;
989         
990         PropertyType PropType = PROPERTY_NONE;
991         
992         // Look for type before continuing.
993         
994         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
995         
996         intPrevValue = 9;
997         
998         std::map<int, wxString> *NicknamesList = NULL;
999         std::map<int, wxString> *NicknamesListType = NULL;
1000         std::map<int, wxString> *NicknamesListLanguage = NULL;
1001         std::map<int, wxString> *NicknamesListAltID = NULL;
1002         std::map<int, wxString> *NicknamesListPID = NULL;
1003         std::map<int, wxString> *NicknamesListTokens = NULL;            
1004         std::map<int, int> *NicknamesListPref = NULL;
1005         
1006         switch(PropType){
1007                 case PROPERTY_NONE:
1008                         NicknamesList = &GeneralNicknamesList;
1009                         NicknamesListType = &GeneralNicknamesListType;
1010                         NicknamesListLanguage = &GeneralNicknamesListLanguage;
1011                         NicknamesListAltID = &GeneralNicknamesListAltID;
1012                         NicknamesListPID = &GeneralNicknamesListPID;
1013                         NicknamesListTokens = &GeneralNicknamesListTokens;
1014                         NicknamesListPref = &GeneralNicknamesListPref;
1015                         break;
1016                 case PROPERTY_HOME:
1017                         NicknamesList = &HomeNicknamesList;
1018                         NicknamesListType = &HomeNicknamesListType;
1019                         NicknamesListLanguage = &HomeNicknamesListLanguage;
1020                         NicknamesListAltID = &HomeNicknamesListAltID;
1021                         NicknamesListPID = &HomeNicknamesListPID;
1022                         NicknamesListTokens = &HomeNicknamesListTokens;
1023                         NicknamesListPref = &HomeNicknamesListPref;
1024                         break;
1025                 case PROPERTY_WORK:
1026                         NicknamesList = &BusinessNicknamesList;
1027                         NicknamesListType = &BusinessNicknamesListType;
1028                         NicknamesListLanguage = &BusinessNicknamesListLanguage;
1029                         NicknamesListAltID = &BusinessNicknamesListAltID;
1030                         NicknamesListPID = &BusinessNicknamesListPID;
1031                         NicknamesListTokens = &BusinessNicknamesListTokens;
1032                         NicknamesListPref = &BusinessNicknamesListPref;
1033                         break;
1034         }
1035         
1036         std::map<int, int>::iterator SLiter;    
1037         wxString PropertyData;
1038         wxString PropertyName;
1039         wxString PropertyValue;
1040         wxString PropertyTokens;
1041         bool FirstToken = TRUE;
1042         bool PropertyMatched = FALSE;
1043         
1044         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1045         intiter != SplitPoints.end(); ++intiter){
1046         
1047                 SLiter = SplitLength.find(intiter->first);
1048                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1049                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1050                 intPrevValue = intiter->second;
1051                 
1052                 CaptureString(&PropertyValue, FALSE);
1053                 
1054                 ProcessStringValue(&PropertyName, "ALTID", NicknamesListAltID, &PropertyValue, NicknameCount, &PropertyMatched);
1055                 ProcessStringValue(&PropertyName, "PID", NicknamesListPID, &PropertyValue, NicknameCount, &PropertyMatched);
1056                 ProcessStringValue(&PropertyName, "LANGUAGE", NicknamesListLanguage, &PropertyValue, NicknameCount, &PropertyMatched);
1057                 ProcessIntegerValue(&PropertyName, "PREF", NicknamesListPref, &PropertyValue, NicknameCount, &PropertyMatched);
1058                 
1059                 if (PropertyMatched == TRUE){
1060                 
1061                         PropertyMatched = FALSE;
1062                         continue;
1063                 
1064                 }
1065                 
1066                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1067                 
1068         }
1069         
1070         NicknamesList->insert(std::make_pair(*NicknameCount, PropertySeg2));
1071         
1072         // Add the name token data.
1073         
1074         if (!PropertyTokens.IsEmpty()){
1075         
1076                 NicknamesListTokens->insert(std::make_pair(*NicknameCount, PropertyTokens));
1077         
1078         }
1082 void ContactDataObject::ProcessGender(wxString PropertySeg1, wxString PropertySeg2){
1084         std::map<int, int> SplitPoints;
1085         std::map<int, int> SplitLength;
1086         std::map<int, int>::iterator SLiter;                    
1087         wxString PropertyData;
1088         wxString PropertyName;
1089         wxString PropertyValue;
1090         wxString PropertyTokens;
1091         bool FirstToken = TRUE;
1092         int intPrevValue = 8;
1094         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1096         intPrevValue = 7;                       
1097         
1098         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1099         intiter != SplitPoints.end(); ++intiter){
1100         
1101                 SLiter = SplitLength.find(intiter->first);
1102                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1103                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1104                 intPrevValue = intiter->second;
1105                 
1106                 // Process properties.
1107                 
1108                 size_t intPropertyValueLen = PropertyValue.Len();
1109                 
1110                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
1111                         
1112                         PropertyValue.Trim();
1113                         PropertyValue.RemoveLast();
1114                         
1115                 }                               
1116                 
1117                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1118                         
1119                         PropertyValue.Remove(0, 1);
1120                         
1121                 }                               
1122                 
1123                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1124         
1125         }       
1127         wxStringTokenizer GenderData (PropertySeg2, wxT(";"));
1128         
1129         wxString GenderComponent;
1130         
1131         if (GenderData.CountTokens() >= 2){
1132         
1133                 Gender = GenderData.GetNextToken();
1134                 GenderDetails = GenderData.GetString();
1135         
1136                 CaptureString(&GenderDetails, FALSE);
1137                                                 
1138         } else {
1139         
1140                 Gender = GenderData.GetNextToken();
1141         
1142         }
1143         
1144         if (!PropertyTokens.IsEmpty()){
1145         
1146                 GenderTokens = PropertyTokens;
1147         
1148         }
1152 void ContactDataObject::ProcessBirthday(wxString PropertySeg1, wxString PropertySeg2){
1154         // Process date. Preserve the remainder in the string.
1156         std::map<int, int> SplitPoints;
1157         std::map<int, int> SplitLength;
1158         std::map<int, int>::iterator SLiter;                    
1159         wxString PropertyData;
1160         wxString PropertyName;
1161         wxString PropertyValue;
1162         wxString PropertyTokens;
1163         int intPrevValue = 6;
1165         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1167         intPrevValue = 5;
1169         // Look for type before continuing.
1171         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1172         intiter != SplitPoints.end(); ++intiter){
1174                 SLiter = SplitLength.find(intiter->first);
1175                 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1176                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1177                 intPrevValue = intiter->second;
1178         
1179                 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
1180         
1181                         CaptureString(&PropertySeg2, FALSE);
1182                         Birthday = PropertySeg2;
1183                         BirthdayText = TRUE;
1184         
1185                 }
1187         }
1189         // Setup blank lines for later on.
1190         
1191         intPrevValue = 5;
1192         bool FirstToken = TRUE;
1194         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1195         intiter != SplitPoints.end(); ++intiter){
1197                 SLiter = SplitLength.find(intiter->first);
1198                 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1199                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1200                 intPrevValue = intiter->second;
1201         
1202                 // Process properties.
1203         
1204                 CaptureString(&PropertyValue, FALSE);
1205         
1206                 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1207                 
1208                         PropertyValue.Trim();
1209                         PropertyValue.RemoveLast();
1210                 
1211                 }                               
1212         
1213                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1214                 
1215                         PropertyValue.Remove(0, 1);
1216                 
1217                 }                               
1218         
1219                 if (PropertyName == wxT("ALTID")){
1221                         BirthdayAltID = PropertyValue;
1222         
1223                 } else if (PropertyName == wxT("CALSCALE")){
1224         
1225                         BirthdayCalScale = PropertyValue;
1226         
1227                 } else if (PropertyName != wxT("VALUE")) {
1228         
1229                         // Something else we don't know about so append
1230                         // to the tokens variable.
1231                 
1232                         ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1233                         
1234                 }
1236         }       
1238         // Add the data to the variables and form.
1239         
1240         if (BirthdayText == FALSE){
1241         
1242                 Birthday = PropertySeg2;
1244         }
1245         
1246         if (!PropertyTokens.IsEmpty()){
1247         
1248                 BirthdayTokens = PropertyTokens;
1250         }
1254 void ContactDataObject::ProcessAnniversary(wxString PropertySeg1, wxString PropertySeg2){
1256         // Process date. Preserve the remainder in the string.
1258         std::map<int, int> SplitPoints;
1259         std::map<int, int> SplitLength;
1260         std::map<int, int>::iterator SLiter;                    
1261         wxString PropertyData;
1262         wxString PropertyName;
1263         wxString PropertyValue;
1264         wxString PropertyTokens;
1265         int intPrevValue = 13;
1267         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1269         intPrevValue = 12;
1271         // Look for type before continuing.
1273         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1274         intiter != SplitPoints.end(); ++intiter){
1276                 SLiter = SplitLength.find(intiter->first);
1277                 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1278                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1279                 intPrevValue = intiter->second;
1280         
1281                 if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
1282         
1283                         CaptureString(&PropertySeg2, FALSE);
1284                         Anniversary = PropertySeg2;
1285                         AnniversaryText = TRUE;
1286         
1287                 }
1289         }
1291         // Setup blank lines for later on.
1292         
1293         intPrevValue = 12;
1294         bool FirstToken = TRUE;
1296         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1297         intiter != SplitPoints.end(); ++intiter){
1299                 SLiter = SplitLength.find(intiter->first);
1300                 PropertyData = PropertySeg1.Mid(intPrevValue, SLiter->second);
1301                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1302                 intPrevValue = intiter->second;
1303         
1304                 // Process properties.
1305         
1306                 CaptureString(&PropertyValue, FALSE);
1307         
1308                 if (PropertyValue.Mid((PropertyValue.Len() - 1), 1) == wxT("\"")){
1309                 
1310                         PropertyValue.Trim();
1311                         PropertyValue.RemoveLast();
1312                 
1313                 }                               
1314         
1315                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
1316                 
1317                         PropertyValue.Remove(0, 1);
1318                 
1319                 }                               
1320         
1321                 if (PropertyName == wxT("ALTID")){
1323                         AnniversaryAltID = PropertyValue;
1324         
1325                 } else if (PropertyName == wxT("CALSCALE")){
1326         
1327                         AnniversaryCalScale = PropertyValue;
1328         
1329                 } else if (PropertyName != wxT("VALUE")) {
1330         
1331                         // Something else we don't know about so append
1332                         // to the tokens variable.
1333                 
1334                         ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1335                         
1336                 }
1338         }       
1340         // Add the data to the variables and form.
1341         
1342         if (AnniversaryText == FALSE){
1343         
1344                 Anniversary = PropertySeg2;
1346         }
1347         
1348         if (!PropertyTokens.IsEmpty()){
1349         
1350                 AnniversaryTokens = PropertyTokens;
1352         }
1356 void ContactDataObject::ProcessTimeZone(wxString PropertySeg1, wxString PropertySeg2, int *TimeZoneCount){
1358         std::map<int, int> SplitPoints;
1359         std::map<int, int> SplitLength;
1361         int intPrevValue = 4;
1362         
1363         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1364         
1365         intPrevValue = 3;
1366         
1367         PropertyType PropType = PROPERTY_NONE;
1368         
1369         // Look for type before continuing.
1370         
1371         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1372         
1373         intPrevValue = 3;
1374         
1375         std::map<int, wxString> *TZList = NULL;
1376         std::map<int, wxString> *TZListType = NULL;
1377         std::map<int, wxString> *TZListMediatype = NULL;
1378         std::map<int, wxString> *TZListAltID = NULL;
1379         std::map<int, wxString> *TZListPID = NULL;
1380         std::map<int, wxString> *TZListTokens = NULL;           
1381         std::map<int, int> *TZListPref = NULL;
1382         
1383         switch(PropType){
1384                 case PROPERTY_NONE:
1385                         TZList = &GeneralTZList;
1386                         TZListType = &GeneralTZListType;
1387                         TZListMediatype = &GeneralTZListMediatype;
1388                         TZListAltID = &GeneralTZListAltID;
1389                         TZListPID = &GeneralTZListPID;
1390                         TZListTokens = &GeneralTZListTokens;
1391                         TZListPref = &GeneralTZListPref;
1392                         break;
1393                 case PROPERTY_HOME:
1394                         TZList = &HomeTZList;
1395                         TZListType = &HomeTZListType;
1396                         TZListMediatype = &HomeTZListMediatype;
1397                         TZListAltID = &HomeTZListAltID;
1398                         TZListPID = &HomeTZListPID;
1399                         TZListTokens = &HomeTZListTokens;
1400                         TZListPref = &HomeTZListPref;
1401                         break;
1402                 case PROPERTY_WORK:
1403                         TZList = &BusinessTZList;
1404                         TZListType = &BusinessTZListType;
1405                         TZListMediatype = &BusinessTZListMediatype;
1406                         TZListAltID = &BusinessTZListAltID;
1407                         TZListPID = &BusinessTZListPID;
1408                         TZListTokens = &BusinessTZListTokens;
1409                         TZListPref = &BusinessTZListPref;
1410                         break;
1411         }
1412         
1413         std::map<int, int>::iterator SLiter;    
1414         wxString PropertyData;
1415         wxString PropertyName;
1416         wxString PropertyValue;
1417         wxString PropertyTokens;
1418         bool FirstToken = TRUE;
1419         bool PropertyMatched = FALSE;
1420         
1421         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1422         intiter != SplitPoints.end(); ++intiter){
1423         
1424                 SLiter = SplitLength.find(intiter->first);      
1425                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1426                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1427                 intPrevValue = intiter->second;
1428                 
1429                 CaptureString(&PropertyValue, FALSE);
1431                 ProcessStringValue(&PropertyName, "ALTID", TZListAltID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1432                 ProcessStringValue(&PropertyName, "PID", TZListPID, &PropertyValue, TimeZoneCount, &PropertyMatched);
1433                 ProcessStringValue(&PropertyName, "MEDIATYPE", TZListMediatype, &PropertyValue, TimeZoneCount, &PropertyMatched);
1434                 ProcessIntegerValue(&PropertyName, "PREF", TZListPref, &PropertyValue, TimeZoneCount, &PropertyMatched);
1435                 
1436                 if (PropertyMatched == TRUE){
1437                 
1438                         PropertyMatched = FALSE;
1439                         continue;
1440                 
1441                 }
1443                 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
1444         
1445                         ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1446         
1447                 }
1448                 
1449         }
1450         
1451         TZList->insert(std::make_pair(*TimeZoneCount, PropertySeg2));
1452         
1453         // Add the name token data.
1454         
1455         if (!PropertyTokens.IsEmpty()){
1456         
1457                 TZListTokens->insert(std::make_pair(*TimeZoneCount, PropertyTokens));
1458         
1459         }
1464 void ContactDataObject::ProcessAddress(wxString PropertySeg1, wxString PropertySeg2, int *AddressCount){
1466         size_t intPropertyLen = PropertySeg1.Len();
1467         std::map<int, int> SplitPoints;
1468         std::map<int, int> SplitLength;
1469         std::map<int, int>::iterator SLiter;                    
1470         wxString PropertyData;
1471         wxString PropertyName;
1472         wxString PropertyValue;
1473         wxString PropertyTokens;
1474         wxString AddressLabel;
1475         wxString AddressLang;
1476         wxString AddressAltID;
1477         wxString AddressPID;
1478         wxString AddressTokens;
1479         wxString AddressGeo;
1480         wxString AddressTimezone;
1481         wxString AddressType;
1482         wxString AddressMediatype;
1483         wxString AddressPOBox;
1484         wxString AddressExtended;
1485         wxString AddressStreet;
1486         wxString AddressLocality;
1487         wxString AddressCity;
1488         wxString AddressRegion;
1489         wxString AddressPostalCode;
1490         wxString AddressCountry;
1491         bool FirstToken = TRUE;                 
1492         int intSplitsFound = 0;
1493         int intSplitSize = 0;
1494         int intPrevValue = 5;
1495         bool PropertyMatched = FALSE;
1496         
1497         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1498         
1499         intPrevValue = 4;
1500         
1501         PropertyType PropType = PROPERTY_NONE;
1502                 
1503         // Look for type before continuing.
1504         
1505         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1506         
1507         intPrevValue = 4;
1508         
1509         std::map<int, wxString> *AddressList = NULL;
1510         std::map<int, wxString> *AddressListTown = NULL;
1511         std::map<int, wxString> *AddressListCounty = NULL;
1512         std::map<int, wxString> *AddressListPostCode = NULL;
1513         std::map<int, wxString> *AddressListCountry = NULL;
1514         std::map<int, wxString> *AddressListLabel = NULL;
1515         std::map<int, wxString> *AddressListLang = NULL;                
1516         std::map<int, wxString> *AddressListAltID = NULL;
1517         std::map<int, wxString> *AddressListPID = NULL;
1518         std::map<int, wxString> *AddressListTokens = NULL;
1519         std::map<int, wxString> *AddressListGeo = NULL;
1520         std::map<int, wxString> *AddressListTimezone = NULL;            
1521         std::map<int, wxString> *AddressListType = NULL;
1522         std::map<int, wxString> *AddressListMediatype = NULL;
1523         std::map<int, int> *AddressListPref = NULL;
1525         switch(PropType){
1526                 case PROPERTY_NONE:
1527                         AddressList = &GeneralAddressList;
1528                         AddressListTown = &GeneralAddressListTown;
1529                         AddressListCounty = &GeneralAddressListCounty;
1530                         AddressListPostCode = &GeneralAddressListPostCode;
1531                         AddressListCountry = &GeneralAddressListCountry;
1532                         AddressListLabel = &GeneralAddressListLabel;
1533                         AddressListLang = &GeneralAddressListLang;              
1534                         AddressListAltID = &GeneralAddressListAltID;
1535                         AddressListPID = &GeneralAddressListPID;
1536                         AddressListTokens = &GeneralAddressListTokens;
1537                         AddressListGeo = &GeneralAddressListGeo;
1538                         AddressListTimezone = &GeneralAddressListTimezone;
1539                         AddressListType = &GeneralAddressListType;
1540                         AddressListMediatype = &GeneralAddressListMediatype;
1541                         AddressListPref = &GeneralAddressListPref;              
1542                         break;
1543                 case PROPERTY_HOME:
1544                         AddressList = &HomeAddressList;
1545                         AddressListTown = &HomeAddressListTown;
1546                         AddressListCounty = &HomeAddressListCounty;
1547                         AddressListPostCode = &HomeAddressListPostCode;
1548                         AddressListCountry = &HomeAddressListCountry;
1549                         AddressListLabel = &HomeAddressListLabel;
1550                         AddressListLang = &HomeAddressListLang;         
1551                         AddressListAltID = &HomeAddressListAltID;
1552                         AddressListPID = &HomeAddressListPID;
1553                         AddressListTokens = &HomeAddressListTokens;
1554                         AddressListGeo = &HomeAddressListGeo;
1555                         AddressListTimezone = &HomeAddressListTimezone;
1556                         AddressListType = &HomeAddressListType;
1557                         AddressListMediatype = &HomeAddressListMediatype;
1558                         AddressListPref = &HomeAddressListPref;
1559                         break;
1560                 case PROPERTY_WORK:
1561                         AddressList = &BusinessAddressList;
1562                         AddressListTown = &BusinessAddressListTown;
1563                         AddressListCounty = &BusinessAddressListCounty;
1564                         AddressListPostCode = &BusinessAddressListPostCode;
1565                         AddressListCountry = &BusinessAddressListCountry;
1566                         AddressListLabel = &BusinessAddressListLabel;
1567                         AddressListLang = &BusinessAddressListLang;             
1568                         AddressListAltID = &BusinessAddressListAltID;
1569                         AddressListPID = &BusinessAddressListPID;
1570                         AddressListTokens = &BusinessAddressListTokens;
1571                         AddressListGeo = &BusinessAddressListGeo;
1572                         AddressListTimezone = &BusinessAddressListTimezone;
1573                         AddressListType = &BusinessAddressListType;
1574                         AddressListMediatype = &BusinessAddressListMediatype;
1575                         AddressListPref = &BusinessAddressListPref;
1576                         break;
1577         }
1578         
1579         intPrevValue = 4;
1580         
1581         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1582         intiter != SplitPoints.end(); ++intiter){
1583         
1584                 SLiter = SplitLength.find(intiter->first);
1585                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1586                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1587                 intPrevValue = intiter->second;
1588                 
1589                 CaptureString(&PropertyValue, FALSE);
1590                 
1591                 // Process properties.
1592                 
1593                 ProcessStringValue(&PropertyName, "LABEL", AddressListLabel, &PropertyValue, AddressCount, &PropertyMatched);
1594                 ProcessStringValue(&PropertyName, "LANGUAGE", AddressListLang, &PropertyValue, AddressCount, &PropertyMatched);
1595                 ProcessStringValue(&PropertyName, "ALTID", AddressListAltID, &PropertyValue, AddressCount, &PropertyMatched);
1596                 ProcessStringValue(&PropertyName, "PID", AddressListPID, &PropertyValue, AddressCount, &PropertyMatched);
1597                 ProcessStringValue(&PropertyName, "GEO", AddressListGeo, &PropertyValue, AddressCount, &PropertyMatched);
1598                 ProcessStringValue(&PropertyName, "TZ", AddressListTimezone, &PropertyValue, AddressCount, &PropertyMatched);
1599                 ProcessStringValue(&PropertyName, "MEDIATYPE", AddressListMediatype, &PropertyValue, AddressCount, &PropertyMatched);
1600                 ProcessIntegerValue(&PropertyName, "PREF", AddressListPref, &PropertyValue, AddressCount, &PropertyMatched);
1601                 
1602                 if (PropertyMatched == TRUE){
1603                 
1604                         PropertyMatched = FALSE;
1605                         continue;
1606                 
1607                 }
1608                 
1609                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1610         
1611         }                       
1612         
1613         // Split the address. 
1615         //std::map<int, int>::iterator SLiter;
1616         intPropertyLen = PropertySeg2.Len();
1617         SplitPoints.clear();
1618         SplitLength.clear();
1619         intSplitsFound = 0;
1620         intSplitSize = 0;
1621         intPrevValue = 0;
1622         
1623         for (int i = 0; i <= intPropertyLen; i++){
1625                 intSplitSize++;
1626         
1627                 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
1628         
1629                         intSplitsFound++;
1630                         SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
1631                         
1632                         if (intSplitsFound == 6){ 
1633                         
1634                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1635                                 break; 
1636                                 
1637                         } else {
1638                         
1639                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
1640                         
1641                         }
1642                         
1643                         intSplitSize = 0;                                       
1644         
1645                 }
1647         }
1648         
1649         // Split the data into several parts.                   
1650         
1651         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1652         intiter != SplitPoints.end(); ++intiter){
1653                         
1654                 if (intiter->first == 1){
1655                 
1656                         // Deal with PO Box.
1657                         
1658                         SLiter = SplitLength.find(1);
1659                                                                 
1660                         AddressPOBox = PropertySeg2.Mid(0, SLiter->second);
1661                         intPrevValue = intiter->second;
1662                 
1663                 } else if (intiter->first == 2){
1664                 
1665                         // Deal with extended address.
1666                         
1667                         SLiter = SplitLength.find(2);
1668                         
1669                         AddressExtended = PropertySeg2.Mid(intPrevValue, SLiter->second);
1670                         intPrevValue = intiter->second;
1671                 
1672                 } else if (intiter->first == 3){
1673                 
1674                         // Deal with street address.
1675                         
1676                         SLiter = SplitLength.find(3);
1677                                                                 
1678                         AddressStreet = PropertySeg2.Mid(intPrevValue, SLiter->second);
1679                         intPrevValue = intiter->second;
1680                 
1681                 } else if (intiter->first == 4){
1682                 
1683                         // Deal with locality
1685                         SLiter = SplitLength.find(4);
1686                         
1687                         AddressLocality = PropertySeg2.Mid(intPrevValue, SLiter->second);
1688                         intPrevValue = intiter->second;
1689                 
1690                 } else if (intiter->first == 5){
1691                 
1692                         // Deal with region.
1694                         SLiter = SplitLength.find(5);
1695                         
1696                         AddressRegion = PropertySeg2.Mid(intPrevValue, SLiter->second);
1697                         intPrevValue = intiter->second;
1698                         
1699                 
1700                 } else if (intiter->first == 6){
1701                 
1702                         // Deal with post code.
1704                         SLiter = SplitLength.find(6);
1705                         
1706                         AddressPostalCode = PropertySeg2.Mid(intPrevValue, SLiter->second);
1707                         intPrevValue = intiter->second;
1708                         
1709                         // Deal with country.
1710                                                 
1711                         AddressCountry = PropertySeg2.Mid(intPrevValue, wxString::npos);
1713                         break;
1714                 
1715                 }
1716         
1717         }       
1718         
1719         // Add the data to the General/Home/Work address variables.
1720         
1721         CaptureString(&AddressStreet, FALSE); 
1722         CaptureString(&AddressLocality, FALSE);
1723         CaptureString(&AddressRegion, FALSE);
1724         CaptureString(&AddressPostalCode, FALSE);
1725         CaptureString(&AddressCountry, FALSE);
1726                 
1727         if (!PropertyTokens.IsEmpty()){
1728         
1729                 AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1730         
1731         }
1733         AddressListCountry->insert(std::make_pair(*AddressCount, AddressCountry));      
1734         AddressList->insert(std::make_pair(*AddressCount, AddressStreet));
1735         AddressListTown->insert(std::make_pair(*AddressCount, AddressLocality));
1736         AddressListCounty->insert(std::make_pair(*AddressCount, AddressRegion));
1737         AddressListPostCode->insert(std::make_pair(*AddressCount, AddressPostalCode));
1739         switch(PropType){
1740                 case PROPERTY_NONE:
1741                         AddressListType->insert(std::make_pair(*AddressCount, wxT("")));
1742                         break;
1743                 case PROPERTY_HOME:
1744                         AddressListType->insert(std::make_pair(*AddressCount, wxT("home")));
1745                         break;
1746                 case PROPERTY_WORK:
1747                         AddressListType->insert(std::make_pair(*AddressCount, wxT("work")));    
1748                         break;
1749         }
1750         
1751         AddressListTokens->insert(std::make_pair(*AddressCount, PropertyTokens));
1755 void ContactDataObject::ProcessEmail(wxString PropertySeg1, wxString PropertySeg2, int *EmailCount){
1757         std::map<int, int> SplitPoints;
1758         std::map<int, int> SplitLength;
1760         int intPrevValue = 7;
1761         
1762         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1763         
1764         intPrevValue = 6;
1765         
1766         PropertyType PropType = PROPERTY_NONE;
1767                 
1768         // Look for type before continuing.
1769         
1770         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1771         
1772         std::map<int, wxString> *EmailList = NULL;
1773         std::map<int, wxString> *EmailListType = NULL;
1774         std::map<int, wxString> *EmailListAltID = NULL;
1775         std::map<int, wxString> *EmailListPID = NULL;
1776         std::map<int, wxString> *EmailListTokens = NULL;                
1777         std::map<int, int> *EmailListPref = NULL;
1779         switch(PropType){
1780                 case PROPERTY_NONE:
1781                         EmailList = &GeneralEmailList;
1782                         EmailListType = &GeneralEmailListType;
1783                         EmailListAltID = &GeneralEmailListAltID;
1784                         EmailListPID = &GeneralEmailListPID;
1785                         EmailListTokens = &GeneralEmailListTokens;              
1786                         EmailListPref = &GeneralEmailListPref;  
1787                         break;
1788                 case PROPERTY_HOME:
1789                         EmailList = &HomeEmailList;
1790                         EmailListType = &HomeEmailListType;
1791                         EmailListAltID = &HomeEmailListAltID;
1792                         EmailListPID = &HomeEmailListPID;
1793                         EmailListTokens = &HomeEmailListTokens;         
1794                         EmailListPref = &HomeEmailListPref;     
1795                         break;
1796                 case PROPERTY_WORK:
1797                         EmailList = &BusinessEmailList;
1798                         EmailListType = &BusinessEmailListType;
1799                         EmailListAltID = &BusinessEmailListAltID;
1800                         EmailListPID = &BusinessEmailListPID;
1801                         EmailListTokens = &BusinessEmailListTokens;             
1802                         EmailListPref = &BusinessEmailListPref; 
1803                         break;
1804         }
1805         
1806         intPrevValue = 6;
1807         
1808         std::map<int,int>::iterator SLiter;
1809         wxString PropertyData;
1810         wxString PropertyName;
1811         wxString PropertyValue;
1812         wxString PropertyTokens;
1813         bool FirstToken = TRUE;
1814         bool PropertyMatched = FALSE;
1815         
1816         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1817         intiter != SplitPoints.end(); ++intiter){
1818         
1819                 SLiter = SplitLength.find(intiter->first);
1820                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1821                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1822                 intPrevValue = intiter->second;
1823                 
1824                 CaptureString(&PropertyValue, FALSE);
1825                 
1826                 // Process properties.
1827                 
1828                 ProcessStringValue(&PropertyName, "ALTID", EmailListAltID, &PropertyValue, EmailCount, &PropertyMatched);
1829                 ProcessStringValue(&PropertyName, "PID", EmailListPID, &PropertyValue, EmailCount, &PropertyMatched);
1830                 ProcessIntegerValue(&PropertyName, "PREF", EmailListPref, &PropertyValue, EmailCount, &PropertyMatched);
1831                 
1832                 if (PropertyMatched == TRUE){
1833                 
1834                         PropertyMatched = FALSE;
1835                         continue;
1836                 
1837                 }
1838                 
1839                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1840         
1841         }
1842         
1843         EmailList->insert(std::make_pair(*EmailCount, PropertySeg2));
1844         
1845         // Add the name token data.
1846         
1847         if (!PropertyTokens.IsEmpty()){
1848         
1849                 EmailListTokens->insert(std::make_pair(*EmailCount, PropertyTokens));
1850         
1851         }       
1856 void ContactDataObject::ProcessIM(wxString PropertySeg1, wxString PropertySeg2, int *IMCount){
1858         std::map<int, int> SplitPoints;
1859         std::map<int, int> SplitLength;
1861         int intPrevValue = 6;
1862         
1863         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1864         
1865         intPrevValue = 5;
1866         
1867         PropertyType PropType = PROPERTY_NONE;
1868                 
1869         // Look for type before continuing.
1870         
1871         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
1872         
1873         std::map<int, wxString> *IMList = NULL;
1874         std::map<int, wxString> *IMListType = NULL;
1875         std::map<int, wxString> *IMListAltID = NULL;
1876         std::map<int, wxString> *IMListPID = NULL;
1877         std::map<int, wxString> *IMListTokens = NULL;
1878         std::map<int, wxString> *IMListMediatype = NULL;        
1879         std::map<int, int> *IMListPref = NULL;
1881         switch(PropType){
1882                 case PROPERTY_NONE:
1883                         IMList = &GeneralIMList;
1884                         IMListType = &GeneralIMListType;
1885                         IMListAltID = &GeneralIMListAltID;
1886                         IMListPID = &GeneralIMListPID;
1887                         IMListTokens = &GeneralIMListTokens;
1888                         IMListMediatype = &GeneralIMListMediatype;
1889                         IMListPref = &GeneralIMListPref;        
1890                         break;
1891                 case PROPERTY_HOME:
1892                         IMList = &HomeIMList;
1893                         IMListType = &HomeIMListType;
1894                         IMListAltID = &HomeIMListAltID;
1895                         IMListPID = &HomeIMListPID;
1896                         IMListTokens = &HomeIMListTokens;
1897                         IMListMediatype = &HomeIMListMediatype;         
1898                         IMListPref = &HomeIMListPref;   
1899                         break;
1900                 case PROPERTY_WORK:
1901                         IMList = &BusinessIMList;
1902                         IMListType = &BusinessIMListType;
1903                         IMListAltID = &BusinessIMListAltID;
1904                         IMListPID = &BusinessIMListPID;
1905                         IMListTokens = &BusinessIMListTokens;   
1906                         IMListMediatype = &BusinessIMListMediatype;     
1907                         IMListPref = &BusinessIMListPref;       
1908                         break;
1909         }
1910         
1911         intPrevValue = 5;
1912         
1913         std::map<int,int>::iterator SLiter;
1914         wxString PropertyData;
1915         wxString PropertyName;
1916         wxString PropertyValue;
1917         wxString PropertyTokens;
1918         bool FirstToken = TRUE;
1919         bool PropertyMatched = FALSE;
1920         
1921         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1922         intiter != SplitPoints.end(); ++intiter){
1923         
1924                 SLiter = SplitLength.find(intiter->first);
1925                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1926                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
1927                 intPrevValue = intiter->second;
1928                 
1929                 CaptureString(&PropertyValue, FALSE);
1930                 
1931                 ProcessStringValue(&PropertyName, "ALTID", IMListAltID, &PropertyValue, IMCount, &PropertyMatched);
1932                 ProcessStringValue(&PropertyName, "PID", IMListPID, &PropertyValue, IMCount, &PropertyMatched);
1933                 ProcessStringValue(&PropertyName, "MEDIATYPE", IMListMediatype, &PropertyValue, IMCount, &PropertyMatched);
1934                 ProcessIntegerValue(&PropertyName, "PREF", IMListPref, &PropertyValue, IMCount, &PropertyMatched);
1935                 
1936                 // Process properties.
1937                 
1938                 if (PropertyMatched == TRUE){
1939                         
1940                         PropertyMatched = FALSE;
1941                         continue;
1942                 
1943                 }
1944                 
1945                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
1946         
1947         }
1948                 
1949         IMList->insert(std::make_pair(*IMCount, PropertySeg2));
1950         
1951         // Add the name token data.
1952         
1953         if (!PropertyTokens.IsEmpty()){
1954         
1955                 IMListTokens->insert(std::make_pair(*IMCount, PropertyTokens));
1956         
1957         }
1961 void ContactDataObject::ProcessTelephone(wxString PropertySeg1, wxString PropertySeg2, int *TelephoneCount){
1963         std::map<int, int> SplitPoints;
1964         std::map<int, int> SplitLength;
1965         std::map<int, int>::iterator SLiter;
1966         
1967         PropertyType PropType = PROPERTY_NONE;
1968                 
1969         // Look for type before continuing.
1970         
1971         wxString TelTypeUI;
1972         wxString TelTypeDetail;
1973         wxString PropertyData;
1974         wxString PropertyName;
1975         wxString PropertyValue;
1976         wxString PropertyTokens;
1977         
1978         std::map<int,int> TypeSplitPoints;
1979         std::map<int,int> TypeSplitLength;
1980         std::map<int,int>::iterator TSLiter;
1981         
1982         int intSplitSize = 0;
1983         int intSplitsFound = 0;
1984         int intSplitPoint = 0;
1985         int intType = 0;
1986         int intPrevValue = 5;
1987                 
1988         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
1989         
1990         intPrevValue = 4;
1991         
1992         // Look for type before continuing.
1993         
1994         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1995         intiter != SplitPoints.end(); ++intiter){
1996         
1997                 SLiter = SplitLength.find(intiter->first);
1998                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
1999                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2000                 intPrevValue = intiter->second;
2002                 if (PropertyName == wxT("TYPE")){
2003                 
2004                         // Process each value in type and translate each
2005                         // part.
2006                 
2007                         // Strip out the quotes if they are there.
2008                 
2009                         size_t intPropertyValueLen = PropertyValue.Len();
2010                 
2011                         if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2012                         
2013                                 PropertyValue.Trim();
2014                                 PropertyValue.RemoveLast();
2015                         
2016                         }                               
2017                 
2018                         if (PropertyValue.Mid(0, 1) == wxT("\"")){
2019                         
2020                                 PropertyValue.Remove(0, 1);
2021                         
2022                         }
2023                         
2024                         TelTypeDetail = PropertyValue;
2025                         
2026                         intSplitSize = 0;
2027                         intSplitsFound = 0;
2028                         intSplitPoint = 0;
2029                         
2030                         for (int i = 0; i <= intPropertyValueLen; i++){
2031         
2032                                 intSplitSize++;
2033         
2034                                 if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
2035         
2036                                         if (intSplitsFound == 0){
2038                                                 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2039                                                 TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
2040                         
2041                                         } else {
2042                         
2043                                                 TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2044                                                 TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
2045                         
2046                                         }                       
2048                                         intSplitsFound++;
2049                                         i++;
2050                                         intSplitPoint = i;
2051                                         intSplitSize = 0;
2052         
2053                                 }
2054         
2055                         }
2056                         
2057                         TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
2058                         TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));                                                           
2059                 
2060                         int intTypeSeek = 0;
2061                 
2062                         for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin(); 
2063                         typeiter != TypeSplitPoints.end(); ++typeiter){
2064                         
2065                                 wxString TypePropertyName;
2066                                 
2067                                 TSLiter = TypeSplitLength.find(typeiter->first);
2068                                 
2069                                 TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
2070                                 
2071                                 if (intTypeSeek == 0){
2072                                 
2073                                 
2074                                 } else {
2075                                                                                 
2076                                         TelTypeUI.Append(wxT(","));                                                     
2077                                 
2078                                 }
2079                         
2080                                 if (TypePropertyName == wxT("home")){
2081                                 
2082                                         PropType = PROPERTY_HOME;
2083                                 
2084                                 } else if (TypePropertyName == wxT("work")){
2085                                 
2086                                         PropType = PROPERTY_WORK;
2087                                                                         
2088                                 }
2089                                 
2090                                 
2091                                 if (TypePropertyName == wxT("text")){
2092                                 
2093                                         TelTypeUI.Append(_("text"));
2094                                         intTypeSeek++;
2095                                 
2096                                 } else if (TypePropertyName == wxT("voice")){
2097                                 
2098                                         TelTypeUI.Append(_("voice"));
2099                                         intTypeSeek++;
2100                                 
2101                                 } else if (TypePropertyName == wxT("fax")){
2102                                 
2103                                         TelTypeUI.Append(_("fax"));
2104                                         intTypeSeek++;
2105                                 
2106                                 } else if (TypePropertyName == wxT("cell")){
2107                                 
2108                                         TelTypeUI.Append(_("mobile"));
2109                                         intTypeSeek++;
2110                                 
2111                                 } else if (TypePropertyName == wxT("video")){
2112                                 
2113                                         TelTypeUI.Append(_("video"));
2114                                         intTypeSeek++;
2115                                 
2116                                 } else if (TypePropertyName == wxT("pager")){
2117                                 
2118                                         TelTypeUI.Append(_("pager"));
2119                                         intTypeSeek++;
2120                                 
2121                                 } else if (TypePropertyName == wxT("textphone")){
2122                                 
2123                                         TelTypeUI.Append(_("textphone"));
2124                                         intTypeSeek++;
2125                                 
2126                                 }
2127                         
2128                         }
2129                 
2130                 }
2131                 
2132         }
2133         
2134         std::map<int, wxString> *TelephoneList = NULL;
2135         std::map<int, wxString> *TelephoneListType = NULL;
2136         std::map<int, wxString> *TelephoneListAltID = NULL;
2137         std::map<int, wxString> *TelephoneListPID = NULL;
2138         std::map<int, wxString> *TelephoneListTokens = NULL;
2139         std::map<int, wxString> *TelephoneListTypeInfo = NULL;  
2140         std::map<int, int> *TelephoneListPref = NULL;
2142         switch(PropType){
2143                 case PROPERTY_NONE:
2144                         TelephoneList = &GeneralTelephoneList;
2145                         TelephoneListType = &GeneralTelephoneListType;
2146                         TelephoneListAltID = &GeneralTelephoneListAltID;
2147                         TelephoneListPID = &GeneralTelephoneListPID;
2148                         TelephoneListTokens = &GeneralTelephoneListTokens;
2149                         TelephoneListTypeInfo = &GeneralTelephoneListTypeInfo;
2150                         TelephoneListPref = &GeneralTelephoneListPref;  
2151                         break;
2152                 case PROPERTY_HOME:
2153                         TelephoneList = &HomeTelephoneList;
2154                         TelephoneListType = &HomeTelephoneListType;
2155                         TelephoneListAltID = &HomeTelephoneListAltID;
2156                         TelephoneListPID = &HomeTelephoneListPID;
2157                         TelephoneListTokens = &HomeTelephoneListTokens;
2158                         TelephoneListTypeInfo = &HomeTelephoneListTypeInfo;     
2159                         TelephoneListPref = &HomeTelephoneListPref;     
2160                         break;
2161                 case PROPERTY_WORK:
2162                         TelephoneList = &BusinessTelephoneList;
2163                         TelephoneListType = &BusinessTelephoneListType;
2164                         TelephoneListAltID = &BusinessTelephoneListAltID;
2165                         TelephoneListPID = &BusinessTelephoneListPID;
2166                         TelephoneListTokens = &BusinessTelephoneListTokens;     
2167                         TelephoneListTypeInfo = &BusinessTelephoneListTypeInfo; 
2168                         TelephoneListPref = &BusinessTelephoneListPref; 
2169                         break;
2170         }
2171                 
2172         // Process the properties.
2173         
2174         bool FirstToken = TRUE;
2175         
2176         intPrevValue = 5;
2177         SplitPoints.clear();
2178         SplitLength.clear();
2180         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2182         intPrevValue = 4;
2183         
2184         bool PropertyMatched = FALSE;
2185         
2186         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2187         intiter != SplitPoints.end(); ++intiter){
2188         
2189                 SLiter = SplitLength.find(intiter->first);
2190                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2191                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2192                 intPrevValue = intiter->second;
2193                 
2194                 CaptureString(&PropertyValue, FALSE);
2195                 
2196                 // Process properties.
2197                 
2198                 ProcessStringValue(&PropertyName, "ALTID", TelephoneListAltID, &PropertyValue, TelephoneCount, &PropertyMatched);
2199                 ProcessStringValue(&PropertyName, "PID", TelephoneListPID, &PropertyValue, TelephoneCount, &PropertyMatched);
2200                 ProcessIntegerValue(&PropertyName, "PREF", TelephoneListPref, &PropertyValue, TelephoneCount, &PropertyMatched);
2201                 
2202                 if (PropertyMatched == TRUE){
2203                 
2204                         PropertyMatched = FALSE;
2205                         continue;
2206                 
2207                 }
2209                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2210         
2211         }
2212                 
2213         TelephoneList->insert(std::make_pair(*TelephoneCount, PropertySeg2));
2214         TelephoneListTypeInfo->insert(std::make_pair(*TelephoneCount, TelTypeUI));
2215         
2216         // Add the name token data.
2217         
2218         if (!PropertyTokens.IsEmpty()){
2219         
2220                 TelephoneListTokens->insert(std::make_pair(*TelephoneCount, PropertyTokens));
2221         
2222         }
2226 void ContactDataObject::ProcessLanguage(wxString PropertySeg1, wxString PropertySeg2, int *LanguageCount){
2228         std::map<int, int> SplitPoints;
2229         std::map<int, int> SplitLength;
2231         int intPrevValue = 6;
2232         
2233         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2234         
2235         intPrevValue = 5;
2236         
2237         PropertyType PropType = PROPERTY_NONE;
2238                 
2239         // Look for type before continuing.
2240         
2241         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2242         
2243         std::map<int, wxString> *LanguageList = NULL;
2244         std::map<int, wxString> *LanguageListType = NULL;
2245         std::map<int, wxString> *LanguageListAltID = NULL;
2246         std::map<int, wxString> *LanguageListPID = NULL;
2247         std::map<int, wxString> *LanguageListTokens = NULL;
2248         std::map<int, int> *LanguageListPref = NULL;
2250         switch(PropType){
2251                 case PROPERTY_NONE:
2252                         LanguageList = &GeneralLanguageList;
2253                         LanguageListType = &GeneralLanguageListType;
2254                         LanguageListAltID = &GeneralLanguageListAltID;
2255                         LanguageListPID = &GeneralLanguageListPID;
2256                         LanguageListTokens = &GeneralLanguageListTokens;
2257                         LanguageListPref = &GeneralLanguageListPref;    
2258                         break;
2259                 case PROPERTY_HOME:
2260                         LanguageList = &HomeLanguageList;
2261                         LanguageListType = &HomeLanguageListType;
2262                         LanguageListAltID = &HomeLanguageListAltID;
2263                         LanguageListPID = &HomeLanguageListPID;
2264                         LanguageListTokens = &HomeLanguageListTokens;   
2265                         LanguageListPref = &HomeLanguageListPref;       
2266                         break;
2267                 case PROPERTY_WORK:
2268                         LanguageList = &BusinessLanguageList;
2269                         LanguageListType = &BusinessLanguageListType;
2270                         LanguageListAltID = &BusinessLanguageListAltID;
2271                         LanguageListPID = &BusinessLanguageListPID;
2272                         LanguageListTokens = &BusinessLanguageListTokens;       
2273                         LanguageListPref = &BusinessLanguageListPref;
2274                         break;
2275         }
2276         
2277         intPrevValue = 5;
2278         
2279         std::map<int,int>::iterator SLiter;
2280         wxString PropertyData;
2281         wxString PropertyName;
2282         wxString PropertyValue;
2283         wxString PropertyTokens;
2284         bool FirstToken = TRUE;
2285         bool PropertyMatched = FALSE;
2286         
2287         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2288         intiter != SplitPoints.end(); ++intiter){
2289         
2290                 SLiter = SplitLength.find(intiter->first);
2291                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2292                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2293                 intPrevValue = intiter->second;
2295                 CaptureString(&PropertyValue, FALSE);
2296                 
2297                 // Process properties.
2298                 
2299                 ProcessStringValue(&PropertyName, "ALTID", LanguageListAltID, &PropertyValue, LanguageCount, &PropertyMatched);
2300                 ProcessStringValue(&PropertyName, "PID", LanguageListPID, &PropertyValue, LanguageCount, &PropertyMatched);
2301                 ProcessIntegerValue(&PropertyName, "PREF", LanguageListPref, &PropertyValue, LanguageCount, &PropertyMatched);
2303                 if (PropertyMatched == TRUE){
2304                 
2305                         PropertyMatched = FALSE;
2306                         continue;
2307                 
2308                 }
2309                 
2310                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2311         
2312         }
2313                 
2314         LanguageList->insert(std::make_pair(*LanguageCount, PropertySeg2));
2315         
2316         // Add the name token data.
2317         
2318         if (!PropertyTokens.IsEmpty()){
2319         
2320                 LanguageListTokens->insert(std::make_pair(*LanguageCount, PropertyTokens));
2321         
2322         }
2326 void ContactDataObject::ProcessGeographic(wxString PropertySeg1, wxString PropertySeg2, int *GeographicCount){
2328         std::map<int, int> SplitPoints;
2329         std::map<int, int> SplitLength;
2331         int intPrevValue = 5;
2332         
2333         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2334         
2335         intPrevValue = 4;
2336         
2337         PropertyType PropType = PROPERTY_NONE;
2338                 
2339         // Look for type before continuing.
2340         
2341         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2342         
2343         std::map<int, wxString> *GeopositionList = NULL;
2344         std::map<int, wxString> *GeopositionListType = NULL;
2345         std::map<int, wxString> *GeopositionListAltID = NULL;
2346         std::map<int, wxString> *GeopositionListPID = NULL;
2347         std::map<int, wxString> *GeopositionListTokens = NULL;
2348         std::map<int, wxString> *GeopositionListMediatype = NULL;
2349         std::map<int, int> *GeopositionListPref = NULL;
2351         switch(PropType){
2352                 case PROPERTY_NONE:
2353                         GeopositionList = &GeneralGeographyList;
2354                         GeopositionListType = &GeneralGeographyListType;
2355                         GeopositionListAltID = &GeneralGeographyListAltID;
2356                         GeopositionListPID = &GeneralGeographyListPID;
2357                         GeopositionListTokens = &GeneralGeographyListTokens;
2358                         GeopositionListMediatype = &GeneralGeographyListMediatype;
2359                         GeopositionListPref = &GeneralGeographyListPref;        
2360                         break;
2361                 case PROPERTY_HOME:
2362                         GeopositionList = &HomeGeographyList;
2363                         GeopositionListType = &HomeGeographyListType;
2364                         GeopositionListAltID = &HomeGeographyListAltID;
2365                         GeopositionListPID = &HomeGeographyListPID;
2366                         GeopositionListTokens = &HomeGeographyListTokens;
2367                         GeopositionListMediatype = &HomeGeographyListMediatype;
2368                         GeopositionListPref = &HomeGeographyListPref;   
2369                         break;
2370                 case PROPERTY_WORK:
2371                         GeopositionList = &BusinessGeographyList;
2372                         GeopositionListType = &BusinessGeographyListType;
2373                         GeopositionListAltID = &BusinessGeographyListAltID;
2374                         GeopositionListPID = &BusinessGeographyListPID;
2375                         GeopositionListTokens = &BusinessGeographyListTokens;
2376                         GeopositionListMediatype = &BusinessGeographyListMediatype;     
2377                         GeopositionListPref = &BusinessGeographyListPref;
2378                         break;
2379         }
2380         
2381         intPrevValue = 4;
2382         
2383         std::map<int,int>::iterator SLiter;
2384         wxString PropertyData;
2385         wxString PropertyName;
2386         wxString PropertyValue;
2387         wxString PropertyTokens;
2388         bool FirstToken = TRUE;
2389         bool PropertyMatched = FALSE;
2390         
2391         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2392         intiter != SplitPoints.end(); ++intiter){
2393         
2394                 SLiter = SplitLength.find(intiter->first);
2395                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2396                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2397                 intPrevValue = intiter->second;
2398                 
2399                 CaptureString(&PropertyValue, FALSE);
2400                 
2401                 // Process properties.
2402                 
2403                 ProcessStringValue(&PropertyName, "ALTID", GeopositionListAltID, &PropertyValue, GeographicCount, &PropertyMatched);
2404                 ProcessStringValue(&PropertyName, "PID", GeopositionListPID, &PropertyValue, GeographicCount, &PropertyMatched);
2405                 ProcessStringValue(&PropertyName, "MEDIATYPE", GeopositionListMediatype, &PropertyValue, GeographicCount, &PropertyMatched);
2406                 ProcessIntegerValue(&PropertyName, "PREF", GeopositionListPref, &PropertyValue, GeographicCount, &PropertyMatched);
2407                 
2408                 if (PropertyMatched == TRUE){
2409                 
2410                         PropertyMatched = FALSE;
2411                         continue;
2412                 
2413                 }
2414                 
2415                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2416         
2417         }
2418                 
2419         GeopositionList->insert(std::make_pair(*GeographicCount, PropertySeg2));
2420         
2421         // Add the name token data.
2422         
2423         if (!PropertyTokens.IsEmpty()){
2424         
2425                 GeopositionListTokens->insert(std::make_pair(*GeographicCount, PropertyTokens));
2426         
2427         }
2431 void ContactDataObject::ProcessRelated(wxString PropertySeg1, wxString PropertySeg2, int *RelatedCount){
2433         size_t intPropertyLen = PropertySeg1.Len();
2434         std::map<int, int> SplitPoints;
2435         std::map<int, int> SplitLength;
2436         std::map<int, int>::iterator SLiter;                    
2437         wxString PropertyData;
2438         wxString PropertyName;
2439         wxString PropertyValue;
2440         wxString PropertyTokens;
2441         wxString RelatedType;
2442         wxString RelatedTypeOriginal;                   
2443         wxString RelatedName;
2444         bool FirstToken = TRUE;                 
2445         int intSplitsFound = 0;
2446         int intSplitSize = 0;
2447         int intPrevValue = 9;
2448         
2449         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2450         
2451         intPrevValue = 8;
2452         
2453         // Look for type before continuing.
2454         
2455         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2456         intiter != SplitPoints.end(); ++intiter){
2457         
2458                 SLiter = SplitLength.find(intiter->first);
2459                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2460                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2461                 intPrevValue = intiter->second;
2462                 
2463                 // Process these.
2464                 
2465                 RelatedTypeOriginal = PropertyValue;
2466                 
2467                 if (PropertyName == wxT("TYPE")){
2468                 
2469                         if (PropertyValue == wxT("contact")){
2471                                 RelatedType = _("Contact");
2473                         } else if (PropertyValue == wxT("acquaintance")){
2475                                 RelatedType = _("Acquaintance");
2477                         } else if (PropertyValue == wxT("friend")){
2479                                 RelatedType = _("Friend");
2481                         } else if (PropertyValue == wxT("met")){
2483                                 RelatedType = _("Met");
2485                         } else if (PropertyValue == wxT("co-worker")){
2487                                 RelatedType = _("Co-worker");
2489                         } else if (PropertyValue == wxT("colleague")){
2491                                 RelatedType = _("Colleague");
2493                         } else if (PropertyValue == wxT("co-resident")){
2495                                 RelatedType = _("Co-resident");
2497                         } else if (PropertyValue == wxT("neighbor")){
2499                                 RelatedType = _("Neighbour");
2501                         } else if (PropertyValue == wxT("child")){
2503                                 RelatedType = _("Child");
2505                         } else if (PropertyValue == wxT("parent")){
2507                                 RelatedType = _("Parent");
2509                         } else if (PropertyValue == wxT("sibling")){
2511                                 RelatedType = _("Sibling");
2513                         } else if (PropertyValue == wxT("spouse")){
2515                                 RelatedType = _("Spouse");
2517                         } else if (PropertyValue == wxT("kin")){
2519                                 RelatedType = _("Kin");
2521                         } else if (PropertyValue == wxT("muse")){
2523                                 RelatedType = _("Muse");
2525                         } else if (PropertyValue == wxT("crush")){
2527                                 RelatedType = _("Crush");
2529                         } else if (PropertyValue == wxT("date")){
2531                                 RelatedType = _("Date");
2533                         } else if (PropertyValue == wxT("sweetheart")){
2535                                 RelatedType = _("Sweetheart");
2537                         } else if (PropertyValue == wxT("me")){
2539                                 RelatedType = _("Me");
2541                         } else if (PropertyValue == wxT("agent")){
2543                                 RelatedType = _("Agent");
2545                         } else if (PropertyValue == wxT("emergency")){
2547                                 RelatedType = _("Emergency");
2549                         } else {
2551                                 RelatedType = PropertyValue;
2553                         }
2554                 
2555                 }
2556         
2557         }
2558         
2559         intPrevValue = 8;                       
2560         
2561         bool PropertyMatched = FALSE;
2562         
2563         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2564         intiter != SplitPoints.end(); ++intiter){
2565         
2566                 SLiter = SplitLength.find(intiter->first);
2567                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2568                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2569                 intPrevValue = intiter->second;
2570                 
2571                 // Process properties.
2572                 
2573                 size_t intPropertyValueLen = PropertyValue.Len();
2574                 
2575                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2576                         
2577                         PropertyValue.Trim();
2578                         PropertyValue.RemoveLast();
2579                         
2580                 }                               
2581                 
2582                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2583                         
2584                         PropertyValue.Remove(0, 1);
2585                         
2586                 }
2587                 
2588                 CaptureString(&PropertyValue, FALSE);
2589                         
2590                 ProcessStringValue(&PropertyName, "ALTID", &GeneralRelatedListAltID, &PropertyValue, RelatedCount, &PropertyMatched);
2591                 ProcessStringValue(&PropertyName, "PID", &GeneralRelatedListPID, &PropertyValue, RelatedCount, &PropertyMatched);
2592                 ProcessStringValue(&PropertyName, "LANGUAGE", &GeneralRelatedListLanguage, &PropertyValue, RelatedCount, &PropertyMatched);
2593                 ProcessIntegerValue(&PropertyName, "PREF", &GeneralRelatedListPref, &PropertyValue, RelatedCount, &PropertyMatched);
2595                 if (PropertyMatched == TRUE){
2596                 
2597                         PropertyMatched = FALSE;
2598                         continue;
2599                 
2600                 }
2602                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2603         
2604         }                                       
2605         
2606         // Add the data to the General/Home/Work address variables.
2607                                 
2608         GeneralRelatedList.erase(*RelatedCount);
2609         GeneralRelatedListRelType.erase(*RelatedCount);
2610         GeneralRelatedListType.erase(*RelatedCount);
2611         GeneralRelatedListTokens.erase(*RelatedCount);
2612         GeneralRelatedList.insert(std::make_pair(*RelatedCount, PropertySeg2));
2613         GeneralRelatedListRelType.insert(std::make_pair(*RelatedCount, RelatedType));                   
2614         GeneralRelatedListType.insert(std::make_pair(*RelatedCount, RelatedType));
2615         GeneralRelatedListTokens.insert(std::make_pair(*RelatedCount, PropertyTokens));
2619 void ContactDataObject::ProcessURL(wxString PropertySeg1, wxString PropertySeg2, int *URLCount){
2621         std::map<int, int> SplitPoints;
2622         std::map<int, int> SplitLength;
2623         std::map<int, int>::iterator SLiter;                    
2624         wxString PropertyData;
2625         wxString PropertyName;
2626         wxString PropertyValue;
2627         wxString PropertyTokens;
2628         bool FirstToken = TRUE;
2629         int intPrevValue = 5;
2630         
2631         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2632         
2633         intPrevValue = 4;
2634         
2635         PropertyType PropType = PROPERTY_NONE;
2636                 
2637         // Look for type before continuing.
2638         
2639         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2640         
2641         // Setup the pointers.
2642         
2643         std::map<int, wxString> *WebsiteList = NULL;
2644         std::map<int, wxString> *WebsiteListAltID = NULL;
2645         std::map<int, wxString> *WebsiteListPID = NULL;
2646         std::map<int, wxString> *WebsiteListType = NULL;
2647         std::map<int, wxString> *WebsiteListTokens = NULL;
2648         std::map<int, wxString> *WebsiteListMediatype = NULL;
2649         std::map<int, int> *WebsiteListPref = NULL;
2650         
2651         // Setup blank lines for later on.
2652         
2653         switch(PropType){
2654                 case PROPERTY_NONE:
2655                         WebsiteList = &GeneralWebsiteList;
2656                         WebsiteListType = &GeneralWebsiteListType;
2657                         WebsiteListAltID = &GeneralWebsiteListAltID;
2658                         WebsiteListPID = &GeneralWebsiteListPID;
2659                         WebsiteListTokens = &GeneralWebsiteListTokens;
2660                         WebsiteListMediatype = &GeneralWebsiteListMediatype;
2661                         WebsiteListPref = &GeneralWebsiteListPref;      
2662                         break;
2663                 case PROPERTY_HOME:
2664                         WebsiteList = &HomeWebsiteList;
2665                         WebsiteListType = &HomeWebsiteListType;
2666                         WebsiteListAltID = &HomeWebsiteListAltID;
2667                         WebsiteListPID = &HomeWebsiteListPID;
2668                         WebsiteListTokens = &HomeWebsiteListTokens;
2669                         WebsiteListMediatype = &HomeWebsiteListMediatype;
2670                         WebsiteListPref = &HomeWebsiteListPref; 
2671                         break;
2672                 case PROPERTY_WORK:
2673                         WebsiteList = &BusinessWebsiteList;
2674                         WebsiteListType = &BusinessWebsiteListType;
2675                         WebsiteListAltID = &BusinessWebsiteListAltID;
2676                         WebsiteListPID = &BusinessWebsiteListPID;
2677                         WebsiteListTokens = &BusinessWebsiteListTokens;
2678                         WebsiteListMediatype = &BusinessWebsiteListMediatype;   
2679                         WebsiteListPref = &BusinessWebsiteListPref;
2680                         break;
2681         }
2682         
2683         intPrevValue = 4;
2684         bool PropertyMatched = FALSE;
2685         
2686         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2687         intiter != SplitPoints.end(); ++intiter){
2688         
2689                 SLiter = SplitLength.find(intiter->first);
2690                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2691                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2692                 intPrevValue = intiter->second;
2693                 
2694                 // Process properties.
2695                 
2696                 size_t intPropertyValueLen = PropertyValue.Len();
2697                 
2698                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2699                         
2700                         PropertyValue.Trim();
2701                         PropertyValue.RemoveLast();
2702                         
2703                 }                               
2704                 
2705                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2706                         
2707                         PropertyValue.Remove(0, 1);
2708                         
2709                 }
2710                 
2711                 CaptureString(&PropertyValue, FALSE);
2712                 
2713                 ProcessStringValue(&PropertyName, "ALTID", WebsiteListAltID, &PropertyValue, URLCount, &PropertyMatched);
2714                 ProcessStringValue(&PropertyName, "PID", WebsiteListPID, &PropertyValue, URLCount, &PropertyMatched);
2715                 ProcessStringValue(&PropertyName, "MEDIATYPE", WebsiteListMediatype, &PropertyValue, URLCount, &PropertyMatched);
2716                 ProcessIntegerValue(&PropertyName, "PREF", WebsiteListPref, &PropertyValue, URLCount, &PropertyMatched);
2717                 
2718                 if (PropertyMatched == TRUE){
2719                 
2720                         PropertyMatched = FALSE;
2721                         continue;
2722                 
2723                 }
2724                 
2725                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2726         
2727         }
2728         
2729         // Add the data to the General/Home/Work address variables.
2730         
2731         CaptureString(&PropertySeg2, FALSE);
2732                         
2733         WebsiteList->insert(std::make_pair(*URLCount, PropertySeg2));
2734         
2735         if (!PropertyTokens.IsEmpty()){
2736         
2737                 WebsiteListTokens->insert(std::make_pair(*URLCount, PropertyTokens));
2738                         
2739         }
2740         
2743 void ContactDataObject::ProcessTitle(wxString PropertySeg1, wxString PropertySeg2, int *TitleCount){
2745         std::map<int, int> SplitPoints;
2746         std::map<int, int> SplitLength;
2747         std::map<int, int>::iterator SLiter;                    
2748         wxString PropertyData;
2749         wxString PropertyName;
2750         wxString PropertyValue;
2751         wxString PropertyTokens;
2752         bool FirstToken = TRUE;
2753         int intPrevValue = 7;
2754         
2755         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2756         
2757         intPrevValue = 6;
2758         
2759         PropertyType PropType = PROPERTY_NONE;
2760                 
2761         // Look for type before continuing.
2762         
2763         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2764         
2765         // Setup the pointers.
2766         
2767         std::map<int, wxString> *TitleList = NULL;
2768         std::map<int, wxString> *TitleListAltID = NULL;
2769         std::map<int, wxString> *TitleListPID = NULL;
2770         std::map<int, wxString> *TitleListType = NULL;
2771         std::map<int, wxString> *TitleListTokens = NULL;
2772         std::map<int, wxString> *TitleListLanguage = NULL;
2773         std::map<int, int> *TitleListPref = NULL;
2774         
2775         // Setup blank lines for later on.
2776         
2777         switch(PropType){
2778                 case PROPERTY_NONE:
2779                         TitleList = &GeneralTitleList;
2780                         TitleListType = &GeneralTitleListType;
2781                         TitleListAltID = &GeneralTitleListAltID;
2782                         TitleListPID = &GeneralTitleListPID;
2783                         TitleListTokens = &GeneralTitleListTokens;
2784                         TitleListLanguage = &GeneralTitleListLanguage;
2785                         TitleListPref = &GeneralTitleListPref;  
2786                         break;
2787                 case PROPERTY_HOME:
2788                         TitleList = &HomeTitleList;
2789                         TitleListType = &HomeTitleListType;
2790                         TitleListAltID = &HomeTitleListAltID;
2791                         TitleListPID = &HomeTitleListPID;
2792                         TitleListTokens = &HomeTitleListTokens;
2793                         TitleListLanguage = &HomeTitleListLanguage;
2794                         TitleListPref = &HomeTitleListPref;     
2795                         break;
2796                 case PROPERTY_WORK:
2797                         TitleList = &BusinessTitleList;
2798                         TitleListType = &BusinessTitleListType;
2799                         TitleListAltID = &BusinessTitleListAltID;
2800                         TitleListPID = &BusinessTitleListPID;
2801                         TitleListTokens = &BusinessTitleListTokens;
2802                         TitleListLanguage = &BusinessTitleListLanguage; 
2803                         TitleListPref = &BusinessTitleListPref;
2804                         break;
2805         }
2807         intPrevValue = 6;
2808         bool PropertyMatched = FALSE;
2809                 
2810         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2811         intiter != SplitPoints.end(); ++intiter){
2812         
2813                 SLiter = SplitLength.find(intiter->first);
2814                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2815                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2816                 intPrevValue = intiter->second;
2817                 
2818                 // Process properties.
2819                 
2820                 size_t intPropertyValueLen = PropertyValue.Len();
2821                 
2822                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2823                         
2824                         PropertyValue.Trim();
2825                         PropertyValue.RemoveLast();
2826                         
2827                 }                               
2828                 
2829                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2830                         
2831                         PropertyValue.Remove(0, 1);
2832                         
2833                 }                               
2834                 
2835                 CaptureString(&PropertyValue, FALSE);
2836                 
2837                 ProcessStringValue(&PropertyName, "ALTID", TitleListAltID, &PropertyValue, TitleCount, &PropertyMatched);
2838                 ProcessStringValue(&PropertyName, "PID", TitleListPID, &PropertyValue, TitleCount, &PropertyMatched);
2839                 ProcessStringValue(&PropertyName, "LANGUAGE", TitleListLanguage, &PropertyValue, TitleCount, &PropertyMatched);
2840                 ProcessIntegerValue(&PropertyName, "PREF", TitleListPref, &PropertyValue, TitleCount, &PropertyMatched);
2841                 
2842                 if (PropertyMatched == TRUE){
2843                 
2844                         PropertyMatched = FALSE;
2845                         continue;
2846                 
2847                 }
2849                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2850         
2851         }
2852         
2853         // Add the data to the General/Home/Work address variables.
2854         
2855         CaptureString(&PropertySeg2, FALSE);
2857         TitleList->insert(std::make_pair(*TitleCount, PropertySeg2));
2858         
2859         if (!PropertyTokens.IsEmpty()){
2860         
2861                 TitleListTokens->insert(std::make_pair(*TitleCount, PropertyTokens));
2862                         
2863         }
2867 void ContactDataObject::ProcessRole(wxString PropertySeg1, wxString PropertySeg2, int *RoleCount){
2869         std::map<int, int> SplitPoints;
2870         std::map<int, int> SplitLength;
2871         std::map<int, int>::iterator SLiter;                    
2872         wxString PropertyData;
2873         wxString PropertyName;
2874         wxString PropertyValue;
2875         wxString PropertyTokens;
2876         bool FirstToken = TRUE;
2877         int intPrevValue = 6;
2878         
2879         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
2880         
2881         intPrevValue = 5;
2882         
2883         PropertyType PropType = PROPERTY_NONE;
2884                 
2885         // Look for type before continuing.
2886         
2887         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
2888         
2889         // Setup the pointers.
2890         
2891         std::map<int, wxString> *RoleList = NULL;
2892         std::map<int, wxString> *RoleListAltID = NULL;
2893         std::map<int, wxString> *RoleListPID = NULL;
2894         std::map<int, wxString> *RoleListType = NULL;
2895         std::map<int, wxString> *RoleListTokens = NULL;
2896         std::map<int, wxString> *RoleListLanguage = NULL;
2897         std::map<int, int> *RoleListPref = NULL;
2898         
2899         // Setup blank lines for later on.
2900         
2901         switch(PropType){
2902                 case PROPERTY_NONE:
2903                         RoleList = &GeneralRoleList;
2904                         RoleListType = &GeneralRoleListType;
2905                         RoleListAltID = &GeneralRoleListAltID;
2906                         RoleListPID = &GeneralRoleListPID;
2907                         RoleListTokens = &GeneralRoleListTokens;
2908                         RoleListLanguage = &GeneralRoleListLanguage;
2909                         RoleListPref = &GeneralRoleListPref;    
2910                         break;
2911                 case PROPERTY_HOME:
2912                         RoleList = &HomeRoleList;
2913                         RoleListType = &HomeRoleListType;
2914                         RoleListAltID = &HomeRoleListAltID;
2915                         RoleListPID = &HomeRoleListPID;
2916                         RoleListTokens = &HomeRoleListTokens;
2917                         RoleListLanguage = &HomeRoleListLanguage;
2918                         RoleListPref = &HomeRoleListPref;       
2919                         break;
2920                 case PROPERTY_WORK:
2921                         RoleList = &BusinessRoleList;
2922                         RoleListType = &BusinessRoleListType;
2923                         RoleListAltID = &BusinessRoleListAltID;
2924                         RoleListPID = &BusinessRoleListPID;
2925                         RoleListTokens = &BusinessRoleListTokens;
2926                         RoleListLanguage = &BusinessRoleListLanguage;   
2927                         RoleListPref = &BusinessRoleListPref;
2928                         break;
2929         }
2931         intPrevValue = 5;
2932         bool PropertyMatched = FALSE;
2933                 
2934         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2935         intiter != SplitPoints.end(); ++intiter){
2936         
2937                 SLiter = SplitLength.find(intiter->first);
2938                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
2939                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
2940                 intPrevValue = intiter->second;
2941                 
2942                 // Process properties.
2943                 
2944                 size_t intPropertyValueLen = PropertyValue.Len();
2945                 
2946                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
2947                         
2948                         PropertyValue.Trim();
2949                         PropertyValue.RemoveLast();
2950                         
2951                 }                               
2952                 
2953                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
2954                         
2955                         PropertyValue.Remove(0, 1);
2956                         
2957                 }                               
2958                 
2959                 CaptureString(&PropertyValue, FALSE);
2960                 
2961                 ProcessStringValue(&PropertyName, "ALTID", RoleListAltID, &PropertyValue, RoleCount, &PropertyMatched);
2962                 ProcessStringValue(&PropertyName, "PID", RoleListPID, &PropertyValue, RoleCount, &PropertyMatched);
2963                 ProcessStringValue(&PropertyName, "LANGUAGE", RoleListLanguage, &PropertyValue, RoleCount, &PropertyMatched);
2964                 ProcessIntegerValue(&PropertyName, "PREF", RoleListPref, &PropertyValue, RoleCount, &PropertyMatched);
2965                 
2966                 if (PropertyMatched == TRUE){
2967                 
2968                         PropertyMatched = FALSE;
2969                         continue;
2970                 
2971                 }
2972                 
2973                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
2974                 
2975         }
2976         
2977         // Add the data to the General/Home/Work address variables.
2978         
2979         CaptureString(&PropertySeg2, FALSE);
2981         RoleList->insert(std::make_pair(*RoleCount, PropertySeg2));
2982         
2983         if (!PropertyTokens.IsEmpty()){
2984         
2985                 RoleListTokens->insert(std::make_pair(*RoleCount, PropertyTokens));
2986                         
2987         }
2991 void ContactDataObject::ProcessOrganisation(wxString PropertySeg1, wxString PropertySeg2, int *OrganisationCount){
2993         std::map<int, int> SplitPoints;
2994         std::map<int, int> SplitLength;
2995         std::map<int, int>::iterator SLiter;                    
2996         wxString PropertyData;
2997         wxString PropertyName;
2998         wxString PropertyValue;
2999         wxString PropertyTokens;
3000         bool FirstToken = TRUE;
3001         int intPrevValue = 5;
3002         
3003         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3004         
3005         intPrevValue = 4;
3006         
3007         PropertyType PropType = PROPERTY_NONE;
3008                 
3009         // Look for type before continuing.
3010         
3011         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3012         
3013         // Setup the pointers.
3014         
3015         std::map<int, wxString> *OrganisationsList = NULL;
3016         std::map<int, wxString> *OrganisationsListAltID = NULL;
3017         std::map<int, wxString> *OrganisationsListPID = NULL;
3018         std::map<int, wxString> *OrganisationsListType = NULL;
3019         std::map<int, wxString> *OrganisationsListTokens = NULL;
3020         std::map<int, wxString> *OrganisationsListLanguage = NULL;
3021         std::map<int, wxString> *OrganisationsListSortAs = NULL;
3022         std::map<int, int> *OrganisationsListPref = NULL;
3023         
3024         // Setup blank lines for later on.
3025         
3026         switch(PropType){
3027                 case PROPERTY_NONE:
3028                         OrganisationsList = &GeneralOrganisationsList;
3029                         OrganisationsListType = &GeneralOrganisationsListType;
3030                         OrganisationsListAltID = &GeneralOrganisationsListAltID;
3031                         OrganisationsListPID = &GeneralOrganisationsListPID;
3032                         OrganisationsListTokens = &GeneralOrganisationsListTokens;
3033                         OrganisationsListLanguage = &GeneralOrganisationsListLanguage;
3034                         OrganisationsListSortAs = &GeneralOrganisationsListSortAs;
3035                         OrganisationsListPref = &GeneralOrganisationsListPref;  
3036                         break;
3037                 case PROPERTY_HOME:
3038                         OrganisationsList = &HomeOrganisationsList;
3039                         OrganisationsListType = &HomeOrganisationsListType;
3040                         OrganisationsListAltID = &HomeOrganisationsListAltID;
3041                         OrganisationsListPID = &HomeOrganisationsListPID;
3042                         OrganisationsListTokens = &HomeOrganisationsListTokens;
3043                         OrganisationsListLanguage = &HomeOrganisationsListLanguage;
3044                         OrganisationsListSortAs = &HomeOrganisationsListSortAs;
3045                         OrganisationsListPref = &HomeOrganisationsListPref;     
3046                         break;
3047                 case PROPERTY_WORK:
3048                         OrganisationsList = &BusinessOrganisationsList;
3049                         OrganisationsListType = &BusinessOrganisationsListType;
3050                         OrganisationsListAltID = &BusinessOrganisationsListAltID;
3051                         OrganisationsListPID = &BusinessOrganisationsListPID;
3052                         OrganisationsListTokens = &BusinessOrganisationsListTokens;
3053                         OrganisationsListLanguage = &BusinessOrganisationsListLanguage;
3054                         OrganisationsListSortAs = &BusinessOrganisationsListSortAs;     
3055                         OrganisationsListPref = &BusinessOrganisationsListPref;
3056                         break;
3057         }
3059         intPrevValue = 4;
3060         bool PropertyMatched = FALSE;
3061                 
3062         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3063         intiter != SplitPoints.end(); ++intiter){
3064         
3065                 SLiter = SplitLength.find(intiter->first);
3066                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3067                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3068                 intPrevValue = intiter->second;
3069                 
3070                 // Process properties.
3071                 
3072                 size_t intPropertyValueLen = PropertyValue.Len();
3073                 
3074                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3075                         
3076                         PropertyValue.Trim();
3077                         PropertyValue.RemoveLast();
3078                         
3079                 }                               
3080                 
3081                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3082                         
3083                         PropertyValue.Remove(0, 1);
3084                         
3085                 }                               
3086                 
3087                 CaptureString(&PropertyValue, FALSE);
3088                 
3089                 ProcessStringValue(&PropertyName, "ALTID", OrganisationsListAltID, &PropertyValue, OrganisationCount, &PropertyMatched);
3090                 ProcessStringValue(&PropertyName, "PID", OrganisationsListPID, &PropertyValue, OrganisationCount, &PropertyMatched);
3091                 ProcessStringValue(&PropertyName, "LANGUAGE", OrganisationsListLanguage, &PropertyValue, OrganisationCount, &PropertyMatched);
3092                 ProcessStringValue(&PropertyName, "SORT-AS", OrganisationsListSortAs, &PropertyValue, OrganisationCount, &PropertyMatched);
3093                 ProcessIntegerValue(&PropertyName, "PREF", OrganisationsListPref, &PropertyValue, OrganisationCount, &PropertyMatched);
3094                 
3095                 if (PropertyMatched == TRUE){
3096                 
3097                         PropertyMatched = FALSE;
3098                         continue;
3099                 
3100                 }
3101                 
3102                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3104         }
3105         
3106         // Add the data to the General/Home/Work address variables.
3107         
3108         CaptureString(&PropertySeg2, FALSE);
3110         OrganisationsList->insert(std::make_pair(*OrganisationCount, PropertySeg2));
3111         
3112         if (!PropertyTokens.IsEmpty()){
3113         
3114                 OrganisationsListTokens->insert(std::make_pair(*OrganisationCount, PropertyTokens));
3115                         
3116         }
3120 void ContactDataObject::ProcessNote(wxString PropertySeg1, wxString PropertySeg2, int *NoteCount){
3122         std::map<int, int> SplitPoints;
3123         std::map<int, int> SplitLength;
3124         std::map<int, int>::iterator SLiter;                    
3125         wxString PropertyData;
3126         wxString PropertyName;
3127         wxString PropertyValue;
3128         wxString PropertyTokens;
3129         bool FirstToken = TRUE;
3130         int intPrevValue = 6;
3131         
3132         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3133         
3134         intPrevValue = 5;
3135         
3136         PropertyType PropType = PROPERTY_NONE;
3137                 
3138         // Look for type before continuing.
3139         
3140         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3141         
3142         // Setup the pointers.
3143         
3144         std::map<int, wxString> *NoteList = NULL;
3145         std::map<int, wxString> *NoteListAltID = NULL;
3146         std::map<int, wxString> *NoteListPID = NULL;
3147         std::map<int, wxString> *NoteListType = NULL;
3148         std::map<int, wxString> *NoteListTokens = NULL;
3149         std::map<int, wxString> *NoteListLanguage = NULL;
3150         std::map<int, int> *NoteListPref = NULL;
3151         
3152         // Setup blank lines for later on.
3153         
3154         switch(PropType){
3155                 case PROPERTY_NONE:
3156                         NoteList = &GeneralNoteList;
3157                         NoteListType = &GeneralNoteListType;
3158                         NoteListAltID = &GeneralNoteListAltID;
3159                         NoteListPID = &GeneralNoteListPID;
3160                         NoteListTokens = &GeneralNoteListTokens;
3161                         NoteListLanguage = &GeneralNoteListLanguage;
3162                         NoteListPref = &GeneralNoteListPref;    
3163                         break;
3164                 case PROPERTY_HOME:
3165                         NoteList = &HomeNoteList;
3166                         NoteListType = &HomeNoteListType;
3167                         NoteListAltID = &HomeNoteListAltID;
3168                         NoteListPID = &HomeNoteListPID;
3169                         NoteListTokens = &HomeNoteListTokens;
3170                         NoteListLanguage = &HomeNoteListLanguage;
3171                         NoteListPref = &HomeNoteListPref;       
3172                         break;
3173                 case PROPERTY_WORK:
3174                         NoteList = &BusinessNoteList;
3175                         NoteListType = &BusinessNoteListType;
3176                         NoteListAltID = &BusinessNoteListAltID;
3177                         NoteListPID = &BusinessNoteListPID;
3178                         NoteListTokens = &BusinessNoteListTokens;
3179                         NoteListLanguage = &BusinessNoteListLanguage;   
3180                         NoteListPref = &BusinessNoteListPref;
3181                         break;
3182         }
3184         intPrevValue = 5;
3185         bool PropertyMatched = FALSE;
3186                 
3187         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3188         intiter != SplitPoints.end(); ++intiter){
3189         
3190                 SLiter = SplitLength.find(intiter->first);
3191                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3192                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3193                 intPrevValue = intiter->second;
3194                 
3195                 // Process properties.
3196                 
3197                 size_t intPropertyValueLen = PropertyValue.Len();
3198                 
3199                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3200                         
3201                         PropertyValue.Trim();
3202                         PropertyValue.RemoveLast();
3203                         
3204                 }                               
3205                 
3206                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3207                         
3208                         PropertyValue.Remove(0, 1);
3209                         
3210                 }                               
3211                 
3212                 CaptureString(&PropertyValue, FALSE);
3213                 
3214                 ProcessStringValue(&PropertyName, "ALTID", NoteListAltID, &PropertyValue, NoteCount, &PropertyMatched);
3215                 ProcessStringValue(&PropertyName, "PID", NoteListPID, &PropertyValue, NoteCount, &PropertyMatched);
3216                 ProcessStringValue(&PropertyName, "LANGUAGE", NoteListLanguage, &PropertyValue, NoteCount, &PropertyMatched);
3217                 ProcessIntegerValue(&PropertyName, "PREF", NoteListPref, &PropertyValue, NoteCount, &PropertyMatched);
3218                 
3219                 if (PropertyMatched == TRUE){
3220                 
3221                         PropertyMatched = FALSE;
3222                         continue;
3223                 
3224                 }
3226                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3227         
3228         }
3229         
3230         // Add the data to the General/Home/Work address variables.
3231         
3232         CaptureString(&PropertySeg2, FALSE);
3234         NoteList->insert(std::make_pair(*NoteCount, PropertySeg2));
3235         
3236         if (!PropertyTokens.IsEmpty()){
3237         
3238                 NoteListTokens->insert(std::make_pair(*NoteCount, PropertyTokens));
3239                         
3240         }
3244 void ContactDataObject::ProcessCategory(wxString PropertySeg1, wxString PropertySeg2, int *CategoryCount){
3246         std::map<int, int> SplitPoints;
3247         std::map<int, int> SplitLength;
3248         std::map<int, int>::iterator SLiter;                    
3249         wxString PropertyData;
3250         wxString PropertyName;
3251         wxString PropertyValue;
3252         wxString PropertyTokens;
3253         bool FirstToken = TRUE;
3254         int intPrevValue = 12;
3255         
3256         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3257         
3258         intPrevValue = 11;
3259         
3260         PropertyType PropType = PROPERTY_NONE;
3261                 
3262         // Look for type before continuing.
3263         
3264         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3265         
3266         // Setup blank lines for later on.
3267         
3268         switch(PropType){
3269                 case PROPERTY_NONE:
3270                         break;
3271                 case PROPERTY_HOME:
3272                         CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3273                         break;
3274                 case PROPERTY_WORK:
3275                         CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3276                         break;
3277         }
3279         intPrevValue = 11;
3280         bool PropertyMatched = FALSE;
3281                 
3282         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3283         intiter != SplitPoints.end(); ++intiter){
3284         
3285                 SLiter = SplitLength.find(intiter->first);
3286                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3287                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3288                 intPrevValue = intiter->second;
3289                 
3290                 // Process properties.
3291                 
3292                 size_t intPropertyValueLen = PropertyValue.Len();
3293                 
3294                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3295                         
3296                         PropertyValue.Trim();
3297                         PropertyValue.RemoveLast();
3298                         
3299                 }                               
3300                 
3301                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3302                         
3303                         PropertyValue.Remove(0, 1);
3304                         
3305                 }                               
3306                 
3307                 CaptureString(&PropertyValue, FALSE);
3308                 
3309                 ProcessStringValue(&PropertyName, "ALTID", &CategoriesListAltID, &PropertyValue, CategoryCount, &PropertyMatched);
3310                 ProcessStringValue(&PropertyName, "PID", &CategoriesListPID, &PropertyValue, CategoryCount, &PropertyMatched);
3311                 ProcessStringValue(&PropertyName, "LANGUAGE", &CategoriesListLanguage, &PropertyValue, CategoryCount, &PropertyMatched);
3312                 ProcessIntegerValue(&PropertyName, "PREF", &CategoriesListPref, &PropertyValue, CategoryCount, &PropertyMatched);
3313                 
3314                 if (PropertyMatched == TRUE){
3315                 
3316                         PropertyMatched = FALSE;
3317                         continue;
3318                 
3319                 }
3321                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3322         
3323         }
3324         
3325         // Deal with multiple categories.
3326         
3327         int intOrigCatCount = *CategoryCount;
3328         bool FirstCategoryProcessed = TRUE;
3329         bool AfterFirstToken = FALSE;
3330         int intSplitSize = 0;
3331         int intSplitsFound = 0;
3332         int intSplitSeek = 0;
3333         int intPropertyLen = PropertySeg2.Len();
3334         
3335         SplitPoints.clear();
3336         SplitLength.clear();
3337         intPrevValue = 0;
3338         
3339         for (int i = 0; i <= intPropertyLen; i++){
3340         
3341                 if (intSplitSize == 0 && PropertySeg2.Mid(i, 1) == wxT(" ")){
3342         
3343                         continue;
3344                 
3345                 }
3346         
3347                 intSplitSize++;
3348         
3349                 if (PropertySeg2.Mid(i, 1) == wxT(",") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
3350         
3351                         if (AfterFirstToken == TRUE){
3352                 
3353                                 SplitPoints.insert(std::make_pair(intSplitsFound, (i - intSplitSize + 1)));
3354                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));
3355                         
3356                         } else {
3357                         
3358                                 SplitPoints.insert(std::make_pair(intSplitsFound, 0));
3359                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 2)));                                 
3360                                 AfterFirstToken = TRUE;
3362                         }
3364                         intSplitsFound++;
3365                         intSplitSeek = i;
3366                         intSplitSize = 0;                               
3367         
3368                 }                       
3369         
3370         }
3371         
3372         if (SplitPoints.size() > 0){
3373         
3374                 SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
3375                 SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
3376         
3377         }
3378         
3379         if (SplitPoints.size() == 0){
3380         
3381                 CategoriesList.insert(std::make_pair(*CategoryCount, PropertySeg2));
3382         
3383                 if (!PropertyTokens.IsEmpty()){
3384                 
3385                         CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3386                 
3387                 }
3388         
3389         }
3390         
3391         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3392         intiter != SplitPoints.end(); ++intiter){
3393         
3394                 SLiter = SplitLength.find(intiter->first);
3395         
3396                 intPrevValue = intiter->second;
3397         
3398                 PropertyData = PropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
3399                 
3400                 // Add the data to the General/Home/Work address variables.
3401         
3402                 // Trim any whitespace from the start and end.
3403         
3404                 PropertyData = PropertyData.Trim(FALSE);
3405                 PropertyData = PropertyData.Trim(TRUE); 
3406         
3407                 CaptureString(&PropertyData, FALSE);
3408                 
3409                 if (FirstCategoryProcessed == TRUE){
3410                 
3411                         FirstCategoryProcessed = FALSE;
3412                         
3413                         CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3414         
3415                         if (!PropertyTokens.IsEmpty()){
3416                 
3417                                 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3418                 
3419                         }
3420                         
3421                         continue;
3422                 
3423                 } else {
3425                         (*CategoryCount)++;
3426                         
3427                         CategoriesList.insert(std::make_pair(*CategoryCount, PropertyData));
3428                 
3429                         if (!PropertyTokens.IsEmpty()){
3430                 
3431                                 CategoriesListTokens.insert(std::make_pair(*CategoryCount, PropertyTokens));
3432                 
3433                         }
3434                 
3435                 }
3436                 
3437                 // Copy the properties to each of the categories (if it exists).
3438                 
3439                 if (!PropertyTokens.IsEmpty()){
3440                 
3441                         CategoriesListTokens.insert(std::make_pair(*CategoryCount, CategoriesListTokens.find(intOrigCatCount)->second));
3442                 
3443                 }
3444                 
3445                 // Check if ALTID was used.
3446                 
3447                 if (CategoriesListAltID.find(intOrigCatCount) != CategoriesListAltID.end()){
3448                 
3449                         CategoriesListAltID.insert(std::make_pair(*CategoryCount, CategoriesListAltID.find(intOrigCatCount)->second));
3450                 
3451                 }
3452                 
3453                 // Check if PID was used.
3454                 
3455                 if (CategoriesListPID.find(intOrigCatCount) != CategoriesListPID.end()){
3456                 
3457                         CategoriesListPID.insert(std::make_pair(*CategoryCount, CategoriesListPID.find(intOrigCatCount)->second));
3458                 
3459                 }
3460         
3461                 // Check if PREF was used.
3462         
3463                 if (CategoriesListPref.find(intOrigCatCount) != CategoriesListPref.end()){
3464                 
3465                         CategoriesListPref.insert(std::make_pair(*CategoryCount, CategoriesListPref.find(intOrigCatCount)->second));
3466                 
3467                 }
3468                 
3469                 // Check if LANGUAGE was used.
3470                 
3471                 if (CategoriesListLanguage.find(intOrigCatCount) != CategoriesListLanguage.end()){
3472                 
3473                         CategoriesListLanguage.insert(std::make_pair(*CategoryCount, CategoriesListLanguage.find(intOrigCatCount)->second));
3474                 
3475                 }
3476                 
3477                 // Check if TYPE was used.
3478                 
3479                 switch(PropType){
3480                         case PROPERTY_NONE:
3481                                 break;
3482                         case PROPERTY_HOME:
3483                                 CategoriesListType.insert(std::make_pair(*CategoryCount, "home"));
3484                                 break;
3485                         case PROPERTY_WORK:
3486                                 CategoriesListType.insert(std::make_pair(*CategoryCount, "work"));
3487                                 break;
3488                 }
3489         
3490         }
3494 void ContactDataObject::ProcessPhoto(wxString PropertySeg1, wxString PropertySeg2, int *PhotoCount){
3496         size_t intPropertyLen = PropertySeg1.Len();
3497         std::map<int, int> SplitPoints;
3498         std::map<int, int> SplitLength;
3499         std::map<int, int>::iterator SLiter;                    
3500         wxString PropertyData;
3501         wxString PropertyName;
3502         wxString PropertyValue;
3503         wxString PropertyTokens;
3504         bool FirstToken = TRUE;
3505         int intSplitsFound = 0;
3506         int intSplitSize = 0;
3507         int intPrevValue = 7;
3508         
3509         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3510         
3511         intPrevValue = 6;
3512         
3513         PropertyType PropType = PROPERTY_NONE;
3514                 
3515         // Look for type before continuing.
3516         
3517         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3519         intPrevValue = 6;
3520         bool PropertyMatched = FALSE;
3522         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3523         intiter != SplitPoints.end(); ++intiter){
3524         
3525                 SLiter = SplitLength.find(intiter->first);
3526                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3527                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3528                 intPrevValue = intiter->second;
3529                 
3530                 // Process properties.
3531                 
3532                 size_t intPropertyValueLen = PropertyValue.Len();
3533                 
3534                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3535                         
3536                         PropertyValue.Trim();
3537                         PropertyValue.RemoveLast();
3538                         
3539                 }                               
3540                 
3541                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3542                         
3543                         PropertyValue.Remove(0, 1);
3544                         
3545                 }
3546                 
3547                 CaptureString(&PropertyValue, FALSE);
3548                 
3549                 ProcessStringValue(&PropertyName, "ALTID", &PicturesListAltID, &PropertyValue, PhotoCount, &PropertyMatched);
3550                 ProcessStringValue(&PropertyName, "PID", &PicturesListPID, &PropertyValue, PhotoCount, &PropertyMatched);
3551                 ProcessStringValue(&PropertyName, "MEDIATYPE", &PicturesListMediatype, &PropertyValue, PhotoCount, &PropertyMatched);
3552                 ProcessIntegerValue(&PropertyName, "PREF", &PicturesListPref, &PropertyValue, PhotoCount, &PropertyMatched);
3553                 
3554                 if (PropertyMatched == TRUE){
3555                 
3556                         PropertyMatched = FALSE;
3557                         continue;
3558                 
3559                 }
3561                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3562                         
3563         }       
3564         
3565         intPropertyLen = PropertySeg2.Len();
3566         SplitPoints.clear();
3567         SplitLength.clear();
3568         intSplitsFound = 0;
3569         intSplitSize = 0;
3570         intPrevValue = 0;                       
3571         
3572         CaptureString(&PropertySeg2, FALSE);
3573         
3574         for (int i = 0; i <= intPropertyLen; i++){
3576                 intSplitSize++;
3577         
3578                 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3579         
3580                         intSplitsFound++;
3581                         SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3582                         
3583                         if (intSplitsFound == 6){ 
3584                         
3585                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3586                                 break; 
3587                                 
3588                         } else {
3589                         
3590                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3591                         
3592                         }
3593                         
3594                         intSplitSize = 0;                                       
3595         
3596                 }
3598         }
3599         
3600         wxString wxSPhotoURI;
3601         wxString wxSPhotoMIME;
3602         wxString wxSPhotoEncoding;
3603         wxString wxSPhotoData;
3604         std::string base64enc;
3605         
3606         if (intSplitsFound == 0){
3607         
3608         } else {
3609         
3610                 std::map<int, int>::iterator striter;
3611         
3612                 striter = SplitLength.find(1);
3613         
3614                 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3615         
3616                 while (wSTDataType.HasMoreTokens() == TRUE){
3617                 
3618                         wxSPhotoURI = wSTDataType.GetNextToken();
3619                         wxSPhotoMIME = wSTDataType.GetNextToken();
3620                         break;
3621                 
3622                 }                       
3623         
3624                 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));                       
3625         
3626                 while (wSTDataInfo.HasMoreTokens() == TRUE){
3627                 
3628                         wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3629                         wxSPhotoData = wSTDataInfo.GetNextToken();
3630                         base64enc = wxSPhotoData.mb_str();
3631                         break;
3632                 
3633                 }
3634         
3635         }
3636         
3637         // Add the data to the General/Home/Work address variables.
3638         
3639         PicturesList.insert(std::make_pair(*PhotoCount, base64enc));
3640         PicturesListPictureType.insert(std::make_pair(*PhotoCount, wxSPhotoMIME));
3641         PicturesListPicEncType.insert(std::make_pair(*PhotoCount, wxSPhotoEncoding));
3642         
3643         switch(PropType){
3644                 case PROPERTY_NONE:
3645                         break;
3646                 case PROPERTY_HOME:
3647                         PicturesListType.insert(std::make_pair(*PhotoCount, "home"));
3648                         break;
3649                 case PROPERTY_WORK:
3650                         PicturesListType.insert(std::make_pair(*PhotoCount, "work"));
3651                         break;
3652         }
3653         
3654         if (!PropertyTokens.IsEmpty()){
3656                 PicturesListTokens.insert(std::make_pair(*PhotoCount, PropertyTokens));
3657         
3658         }
3662 void ContactDataObject::ProcessLogo(wxString PropertySeg1, wxString PropertySeg2, int *LogoCount){
3664         size_t intPropertyLen = PropertySeg1.Len();
3665         std::map<int, int> SplitPoints;
3666         std::map<int, int> SplitLength;
3667         std::map<int, int>::iterator SLiter;                    
3668         wxString PropertyData;
3669         wxString PropertyName;
3670         wxString PropertyValue;
3671         wxString PropertyTokens;
3672         bool FirstToken = TRUE;
3673         int intSplitsFound = 0;
3674         int intSplitSize = 0;
3675         int intPrevValue = 6;
3676         
3677         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3678         
3679         intPrevValue = 5;
3680         
3681         PropertyType PropType = PROPERTY_NONE;
3682                 
3683         // Look for type before continuing.
3684         
3685         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3687         intPrevValue = 5;
3688         bool PropertyMatched = FALSE;
3690         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3691         intiter != SplitPoints.end(); ++intiter){
3692         
3693                 SLiter = SplitLength.find(intiter->first);
3694                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3695                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3696                 intPrevValue = intiter->second;
3697                 
3698                 // Process properties.
3699                 
3700                 size_t intPropertyValueLen = PropertyValue.Len();
3701                 
3702                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3703                         
3704                         PropertyValue.Trim();
3705                         PropertyValue.RemoveLast();
3706                         
3707                 }                               
3708                 
3709                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3710                         
3711                         PropertyValue.Remove(0, 1);
3712                         
3713                 }
3714                 
3715                 CaptureString(&PropertyValue, FALSE);
3716                 
3717                 ProcessStringValue(&PropertyName, "ALTID", &LogosListAltID, &PropertyValue, LogoCount, &PropertyMatched);
3718                 ProcessStringValue(&PropertyName, "PID", &LogosListPID, &PropertyValue, LogoCount, &PropertyMatched);
3719                 ProcessStringValue(&PropertyName, "MEDIATYPE", &LogosListMediatype, &PropertyValue, LogoCount, &PropertyMatched);
3720                 ProcessIntegerValue(&PropertyName, "PREF", &LogosListPref, &PropertyValue, LogoCount, &PropertyMatched);
3721                 
3722                 if (PropertyMatched == TRUE){
3723                 
3724                         PropertyMatched = FALSE;
3725                         continue;
3726                 
3727                 }
3729                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3730         
3731         }       
3732         
3733         intPropertyLen = PropertySeg2.Len();
3734         SplitPoints.clear();
3735         SplitLength.clear();
3736         intSplitsFound = 0;
3737         intSplitSize = 0;
3738         intPrevValue = 0;                       
3739         
3740         CaptureString(&PropertySeg2, FALSE);
3741         
3742         for (int i = 0; i <= intPropertyLen; i++){
3744                 intSplitSize++;
3745         
3746                 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3747         
3748                         intSplitsFound++;
3749                         SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3750                         
3751                         if (intSplitsFound == 6){ 
3752                         
3753                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3754                                 break; 
3755                                 
3756                         } else {
3757                         
3758                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3759                         
3760                         }
3761                         
3762                         intSplitSize = 0;                                       
3763         
3764                 }
3766         }
3767         
3768         wxString wxSPhotoURI;
3769         wxString wxSPhotoMIME;
3770         wxString wxSPhotoEncoding;
3771         wxString wxSPhotoData;
3772         std::string base64enc;
3773         
3774         if (intSplitsFound == 0){
3775         
3776         } else {
3777         
3778                 std::map<int, int>::iterator striter;
3779         
3780                 striter = SplitLength.find(1);
3781         
3782                 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3783         
3784                 while (wSTDataType.HasMoreTokens() == TRUE){
3785                 
3786                         wxSPhotoURI = wSTDataType.GetNextToken();
3787                         wxSPhotoMIME = wSTDataType.GetNextToken();
3788                         break;
3789                 
3790                 }                       
3791         
3792                 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));                       
3793         
3794                 while (wSTDataInfo.HasMoreTokens() == TRUE){
3795                 
3796                         wxSPhotoEncoding = wSTDataInfo.GetNextToken();
3797                         wxSPhotoData = wSTDataInfo.GetNextToken();
3798                         base64enc = wxSPhotoData.mb_str();
3799                         break;
3800                 
3801                 }
3802         
3803         }
3804         
3805         // Add the data to the General/Home/Work address variables.
3806                 
3807         LogosList.insert(std::make_pair(*LogoCount, base64enc));
3808         LogosListPictureType.insert(std::make_pair(*LogoCount, wxSPhotoMIME));
3809         LogosListPicEncType.insert(std::make_pair(*LogoCount, wxSPhotoEncoding));
3810         
3811         switch(PropType){
3812                 case PROPERTY_NONE:
3813                         break;
3814                 case PROPERTY_HOME:
3815                         LogosListType.insert(std::make_pair(*LogoCount, "home"));
3816                         break;
3817                 case PROPERTY_WORK:
3818                         LogosListType.insert(std::make_pair(*LogoCount, "work"));
3819                         break;
3820         }
3821         
3822         if (!PropertyTokens.IsEmpty()){
3824                 LogosListTokens.insert(std::make_pair(*LogoCount, PropertyTokens));
3825         
3826         }
3830 void ContactDataObject::ProcessSound(wxString PropertySeg1, wxString PropertySeg2, int *SoundCount){
3832         size_t intPropertyLen = PropertySeg1.Len();
3833         std::map<int, int> SplitPoints;
3834         std::map<int, int> SplitLength;
3835         std::map<int, int>::iterator SLiter;                    
3836         wxString PropertyData;
3837         wxString PropertyName;
3838         wxString PropertyValue;
3839         wxString PropertyTokens;
3840         bool FirstToken = TRUE;
3841         int intSplitsFound = 0;
3842         int intSplitSize = 0;
3843         int intPrevValue = 7;
3844         
3845         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
3846         
3847         intPrevValue = 6;
3848         
3849         PropertyType PropType = PROPERTY_NONE;
3850         
3851         // Look for type before continuing.                     
3853         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
3855         intPrevValue = 6;
3856         bool PropertyMatched = FALSE;
3858         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3859         intiter != SplitPoints.end(); ++intiter){
3860         
3861                 SLiter = SplitLength.find(intiter->first);
3862                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
3863                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
3864                 intPrevValue = intiter->second;
3865                 
3866                 // Process properties.
3867                 
3868                 size_t intPropertyValueLen = PropertyValue.Len();
3869                 
3870                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
3871                         
3872                         PropertyValue.Trim();
3873                         PropertyValue.RemoveLast();
3874                         
3875                 }                               
3876                 
3877                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
3878                         
3879                         PropertyValue.Remove(0, 1);
3880                         
3881                 }                       
3882                 
3883                 CaptureString(&PropertyValue, FALSE);
3884                 
3885                 ProcessStringValue(&PropertyName, "ALTID", &SoundsListAltID, &PropertyValue, SoundCount, &PropertyMatched);
3886                 ProcessStringValue(&PropertyName, "PID", &SoundsListPID, &PropertyValue, SoundCount, &PropertyMatched);
3887                 ProcessStringValue(&PropertyName, "MEDIATYPE", &SoundsListMediatype, &PropertyValue, SoundCount, &PropertyMatched);
3888                 ProcessStringValue(&PropertyName, "LANGUAGE", &SoundsListLanguage, &PropertyValue, SoundCount, &PropertyMatched);
3889                 ProcessIntegerValue(&PropertyName, "PREF", &SoundsListPref, &PropertyValue, SoundCount, &PropertyMatched);
3890                 
3891                 if (PropertyMatched == TRUE){
3892                 
3893                         PropertyMatched = FALSE;
3894                         continue;
3895                 
3896                 }
3898                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
3899         
3900         }       
3901         
3902         intPropertyLen = PropertySeg2.Len();
3903         SplitPoints.clear();
3904         SplitLength.clear();
3905         intSplitsFound = 0;
3906         intSplitSize = 0;
3907         intPrevValue = 0;
3908         
3909         CaptureString(&PropertySeg2, FALSE);
3910         
3911         for (int i = 0; i <= intPropertyLen; i++){
3913                 intSplitSize++;
3914         
3915                 if (PropertySeg2.Mid(i, 1) == wxT(";")){
3916         
3917                         intSplitsFound++;
3918                         SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
3919                         
3920                         if (intSplitsFound == 6){ 
3921                         
3922                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3923                                 break; 
3924                                 
3925                         } else {
3926                         
3927                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
3928                         
3929                         }
3930                         
3931                         intSplitSize = 0;                                       
3932         
3933                 }
3935         }
3936         
3937         wxString wxSSoundURI;
3938         wxString wxSSoundMIME;
3939         wxString wxSSoundEncoding;
3940         wxString wxSSoundData;
3941         std::string base64enc;
3942         
3943         if (intSplitsFound == 0){
3944         
3945         } else {
3946         
3947                 std::map<int, int>::iterator striter;
3948         
3949                 striter = SplitLength.find(1);
3950         
3951                 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
3952         
3953                 while (wSTDataType.HasMoreTokens() == TRUE){
3954                 
3955                         wxSSoundURI = wSTDataType.GetNextToken();
3956                         wxSSoundMIME = wSTDataType.GetNextToken();
3957                         break;
3958                 
3959                 }                       
3960         
3961                 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));                       
3962         
3963                 while (wSTDataInfo.HasMoreTokens() == TRUE){
3964                 
3965                         wxSSoundEncoding = wSTDataInfo.GetNextToken();
3966                         wxSSoundData = wSTDataInfo.GetNextToken();                                      
3967                         base64enc = wxSSoundData.mb_str();
3968                         break;
3969                 
3970                 }
3971         
3972         }
3973         
3974         // Add the data to the General/Home/Work address variables.
3975                 
3976         switch(PropType){
3977                 case PROPERTY_NONE:
3978                         break;
3979                 case PROPERTY_HOME:
3980                         SoundsListType.insert(std::make_pair(*SoundCount, "home"));
3981                         break;
3982                 case PROPERTY_WORK:
3983                         SoundsListType.insert(std::make_pair(*SoundCount, "work"));
3984                         break;
3985         }
3986         
3987         SoundsList.insert(std::make_pair(*SoundCount, base64enc));
3988         SoundsListAudioEncType.insert(std::make_pair(*SoundCount, wxSSoundEncoding));
3989         SoundsListAudioType.insert(std::make_pair(*SoundCount, wxSSoundMIME));
3990         
3991         if (!PropertyTokens.IsEmpty()){
3992         
3993                 SoundsListTokens.insert(std::make_pair(*SoundCount, PropertyTokens));
3994         
3995         }
3996         
3999 void ContactDataObject::ProcessCalendarURI(wxString PropertySeg1, wxString PropertySeg2, int *CalURICount){
4001         size_t intPropertyLen = PropertySeg1.Len();
4002         std::map<int, int> SplitPoints;
4003         std::map<int, int> SplitLength;
4004         std::map<int, int>::iterator SLiter;                    
4005         wxString PropertyData;
4006         wxString PropertyName;
4007         wxString PropertyValue;
4008         wxString PropertyTokens;
4009         bool FirstToken = TRUE;
4010         int intSplitsFound = 0;
4011         int intSplitSize = 0;
4012         int intPrevValue = 8;
4013         
4014         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4015         
4016         intPrevValue = 7;
4017         
4018         PropertyType PropType = PROPERTY_NONE;
4019         
4020         // Look for type before continuing.                     
4022         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4024         intPrevValue = 7;
4025         bool PropertyMatched = FALSE;
4027         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4028         intiter != SplitPoints.end(); ++intiter){
4029         
4030                 SLiter = SplitLength.find(intiter->first);
4031                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4032                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4033                 intPrevValue = intiter->second;
4034                 
4035                 // Process properties.
4036                 
4037                 size_t intPropertyValueLen = PropertyValue.Len();
4038                 
4039                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4040                         
4041                         PropertyValue.Trim();
4042                         PropertyValue.RemoveLast();
4043                         
4044                 }                               
4045                 
4046                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4047                         
4048                         PropertyValue.Remove(0, 1);
4049                         
4050                 }                       
4051                 
4052                 CaptureString(&PropertyValue, FALSE);
4053                 
4054                 ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
4055                 ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
4056                 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
4057                 ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
4058                 
4059                 if (PropertyMatched == TRUE){
4060                 
4061                         PropertyMatched = FALSE;
4062                         continue;
4063                 
4064                 }
4066                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4067         
4068         }       
4069         
4070         intPropertyLen = PropertySeg2.Len();
4071         SplitPoints.clear();
4072         SplitLength.clear();
4073         intSplitsFound = 0;
4074         intSplitSize = 0;
4075         intPrevValue = 0;
4076         
4077         CaptureString(&PropertySeg2, FALSE);
4078         
4079         // Add the data to the General/Home/Work address variables.
4080                 
4081         switch(PropType){
4082                 case PROPERTY_NONE:
4083                         break;
4084                 case PROPERTY_HOME:
4085                         CalendarListType.insert(std::make_pair(*CalURICount, "home"));
4086                         break;
4087                 case PROPERTY_WORK:
4088                         CalendarListType.insert(std::make_pair(*CalURICount, "work"));
4089                         break;
4090         }
4091         
4092         CalendarList.insert(std::make_pair(*CalURICount, PropertySeg2));
4093         
4094         if (!PropertyTokens.IsEmpty()){
4095         
4096                 CalendarListTokens.insert(std::make_pair(*CalURICount, PropertyTokens));
4097         
4098         }
4102 void ContactDataObject::ProcessCalendarAddressURI(wxString PropertySeg1, wxString PropertySeg2, int *CalAdrURICount){
4104         size_t intPropertyLen = PropertySeg1.Len();
4105         std::map<int, int> SplitPoints;
4106         std::map<int, int> SplitLength;
4107         std::map<int, int>::iterator SLiter;                    
4108         wxString PropertyData;
4109         wxString PropertyName;
4110         wxString PropertyValue;
4111         wxString PropertyTokens;
4112         bool FirstToken = TRUE;
4113         int intSplitsFound = 0;
4114         int intSplitSize = 0;
4115         int intPrevValue = 8;
4116         
4117         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4118         
4119         intPrevValue = 7;
4120         
4121         PropertyType PropType = PROPERTY_NONE;
4122         
4123         // Look for type before continuing.                     
4125         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4127         intPrevValue = 7;
4128         bool PropertyMatched = FALSE;
4130         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4131         intiter != SplitPoints.end(); ++intiter){
4132         
4133                 SLiter = SplitLength.find(intiter->first);
4134                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4135                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4136                 intPrevValue = intiter->second;
4137                 
4138                 // Process properties.
4139                 
4140                 size_t intPropertyValueLen = PropertyValue.Len();
4141                 
4142                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4143                         
4144                         PropertyValue.Trim();
4145                         PropertyValue.RemoveLast();
4146                         
4147                 }                               
4148                 
4149                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4150                         
4151                         PropertyValue.Remove(0, 1);
4152                         
4153                 }                       
4154                 
4155                 CaptureString(&PropertyValue, FALSE);
4156                 
4157                 ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4158                 ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
4159                 ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
4160                 ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
4161                 
4162                 if (PropertyMatched == TRUE){
4163                 
4164                         PropertyMatched = FALSE;
4165                         continue;
4166                 
4167                 }
4169                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4170         
4171         }       
4172         
4173         intPropertyLen = PropertySeg2.Len();
4174         SplitPoints.clear();
4175         SplitLength.clear();
4176         intSplitsFound = 0;
4177         intSplitSize = 0;
4178         intPrevValue = 0;
4179         
4180         CaptureString(&PropertySeg2, FALSE);
4181         
4182         // Add the data to the General/Home/Work address variables.
4183                 
4184         switch(PropType){
4185                 case PROPERTY_NONE:
4186                         break;
4187                 case PROPERTY_HOME:
4188                         CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "home"));
4189                         break;
4190                 case PROPERTY_WORK:
4191                         CalendarRequestListType.insert(std::make_pair(*CalAdrURICount, "work"));
4192                         break;
4193         }
4194         
4195         CalendarRequestList.insert(std::make_pair(*CalAdrURICount, PropertySeg2));
4196         
4197         if (!PropertyTokens.IsEmpty()){
4198         
4199                 CalendarRequestListTokens.insert(std::make_pair(*CalAdrURICount, PropertyTokens));
4200         
4201         }       
4202         
4205 void ContactDataObject::ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount){
4207         size_t intPropertyLen = PropertySeg1.Len();
4208         std::map<int, int> SplitPoints;
4209         std::map<int, int> SplitLength;
4210         std::map<int, int>::iterator SLiter;                    
4211         wxString PropertyData;
4212         wxString PropertyName;
4213         wxString PropertyValue;
4214         wxString PropertyTokens;
4215         bool FirstToken = TRUE;
4216         int intSplitsFound = 0;
4217         int intSplitSize = 0;
4218         int intPrevValue = 7;
4219         
4220         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4221         
4222         intPrevValue = 6;
4223         
4224         PropertyType PropType = PROPERTY_NONE;
4225         
4226         // Look for type before continuing.                     
4228         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4230         intPrevValue = 6;
4231         bool PropertyMatched = FALSE;
4233         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4234         intiter != SplitPoints.end(); ++intiter){
4235         
4236                 SLiter = SplitLength.find(intiter->first);
4237                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4238                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4239                 intPrevValue = intiter->second;
4240                 
4241                 // Process properties.
4242                 
4243                 size_t intPropertyValueLen = PropertyValue.Len();
4244                 
4245                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4246                         
4247                         PropertyValue.Trim();
4248                         PropertyValue.RemoveLast();
4249                         
4250                 }                               
4251                 
4252                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4253                         
4254                         PropertyValue.Remove(0, 1);
4255                         
4256                 }                       
4257                 
4258                 CaptureString(&PropertyValue, FALSE);
4259                 
4260                 ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4261                 ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4262                 ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4263                 ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
4264                 
4265                 if (PropertyMatched == TRUE){
4266                 
4267                         PropertyMatched = FALSE;
4268                         continue;
4269                 
4270                 }
4272                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4273         
4274         }       
4275         
4276         intPropertyLen = PropertySeg2.Len();
4277         SplitPoints.clear();
4278         SplitLength.clear();
4279         intSplitsFound = 0;
4280         intSplitSize = 0;
4281         intPrevValue = 0;
4282         
4283         CaptureString(&PropertySeg2, FALSE);
4284         
4285         // Add the data to the General/Home/Work address variables.
4286                 
4287         switch(PropType){
4288                 case PROPERTY_NONE:
4289                         break;
4290                 case PROPERTY_HOME:
4291                         FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "home"));
4292                         break;
4293                 case PROPERTY_WORK:
4294                         FreeBusyListType.insert(std::make_pair(*FreeBusyAddressCount, "work"));
4295                         break;
4296         }
4297         
4298         FreeBusyList.insert(std::make_pair(*FreeBusyAddressCount, PropertySeg2));
4299         
4300         if (!PropertyTokens.IsEmpty()){
4301         
4302                 FreeBusyListTokens.insert(std::make_pair(*FreeBusyAddressCount, PropertyTokens));
4303         
4304         }
4308 void ContactDataObject::ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount){
4310         size_t intPropertyLen = PropertySeg1.Len();
4311         std::map<int, int> SplitPoints;
4312         std::map<int, int> SplitLength;
4313         std::map<int, int>::iterator SLiter;                    
4314         wxString PropertyData;
4315         wxString PropertyName;
4316         wxString PropertyValue;
4317         wxString PropertyTokens;
4318         bool FirstToken = TRUE;
4319         int intSplitsFound = 0;
4320         int intSplitSize = 0;
4321         int intPrevValue = 5;
4322         
4323         SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
4324         
4325         intPrevValue = 4;
4326         
4327         PropertyType PropType = PROPERTY_NONE;
4328         
4329         // Look for type before continuing.
4331         CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
4333         intPrevValue = 4;
4334         bool PropertyMatched = FALSE;
4336         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4337         intiter != SplitPoints.end(); ++intiter){
4338         
4339                 SLiter = SplitLength.find(intiter->first);
4340                 PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
4341                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);
4342                 intPrevValue = intiter->second;
4343                 
4344                 // Process properties.
4345                 
4346                 size_t intPropertyValueLen = PropertyValue.Len();
4347                 
4348                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
4349                         
4350                         PropertyValue.Trim();
4351                         PropertyValue.RemoveLast();
4352                         
4353                 }                               
4354                 
4355                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
4356                         
4357                         PropertyValue.Remove(0, 1);
4358                         
4359                 }
4360                 
4361                 ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
4362                 ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
4363                 ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
4364                 
4365                 if (PropertyMatched == TRUE){
4366                 
4367                         PropertyMatched = FALSE;
4368                         continue;
4369                 
4370                 }
4372                 ProcessTokens(&PropertyName, &PropertyValue, &PropertyTokens, &FirstToken);
4373         
4374         }                               
4375         
4376         intPropertyLen = PropertySeg2.Len();
4377         SplitPoints.clear();
4378         SplitLength.clear();
4379         intSplitsFound = 0;
4380         intSplitSize = 0;
4381         intPrevValue = 0;                       
4382         
4383         for (int i = 0; i <= intPropertyLen; i++){
4385                 intSplitSize++;
4386         
4387                 if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
4388         
4389                         intSplitsFound++;
4390                         SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
4391                         
4392                         if (intSplitsFound == 6){ 
4393                         
4394                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4395                                 break; 
4396                                 
4397                         } else {
4398                         
4399                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
4400                         
4401                         }
4402                         
4403                         intSplitSize = 0;                                       
4404         
4405                 }
4407         }
4408         
4409         wxString wxSKeyURI;
4410         wxString wxSKeyMIME;
4411         wxString wxSKeyEncoding;
4412         wxString wxSKeyData;
4413         std::string base64enc;
4414         
4415         if (intSplitsFound == 0){
4416         
4417         } else {
4418         
4419                 std::map<int, int>::iterator striter;
4420         
4421                 striter = SplitLength.find(1);
4422         
4423                 wxStringTokenizer wSTDataType(PropertySeg2.Mid(0, striter->second), wxT(":"));
4424         
4425                 while (wSTDataType.HasMoreTokens() == TRUE){
4426                 
4427                         wxSKeyURI = wSTDataType.GetNextToken();
4428                         wxSKeyMIME = wSTDataType.GetNextToken();
4429                         break;
4430                 
4431                 }                       
4432         
4433                 if (wxSKeyURI == wxT("data")){
4434                 
4435                                 wxStringTokenizer wSTDataInfo(PropertySeg2.Mid((striter->second + 1)), wxT(","));                       
4436         
4437                                 while (wSTDataInfo.HasMoreTokens() == TRUE){
4438                 
4439                                 wxSKeyEncoding = wSTDataInfo.GetNextToken();
4440                                 wxSKeyData = wSTDataInfo.GetNextToken();
4441                                 break;
4442                 
4443                         }
4444                 
4445                 }
4446         
4447         }
4448         
4449         // Add the data to the General/Home/Work address variables.
4450         
4451         if (wxSKeyURI == wxT("data")){
4452                 
4453                 KeyListDataEncType.erase(*KeyCount);
4454                 KeyListKeyType.erase(*KeyCount);
4455                 KeyListDataEncType.insert(std::make_pair(*KeyCount, wxSKeyEncoding));
4456                 KeyListKeyType.insert(std::make_pair(*KeyCount, TRUE));
4457                 
4458                 KeyList.erase(*KeyCount);
4459                 KeyList.insert(std::make_pair(*KeyCount, wxSKeyData));
4460         
4461         } else {
4462                 
4463                 KeyList.erase(*KeyCount);
4464                 KeyList.insert(std::make_pair(*KeyCount, PropertySeg2));
4465         
4466         }
4467         
4468         KeyListDataType.insert(std::make_pair(*KeyCount, wxSKeyMIME));
4469                 
4470         switch (PropType){
4471                 case PROPERTY_NONE:
4472                         break;
4473                 case PROPERTY_HOME: 
4474                         KeyListType.insert(std::make_pair(*KeyCount, wxT("home")));
4475                         break;
4476                 case PROPERTY_WORK: 
4477                         KeyListType.insert(std::make_pair(*KeyCount, wxT("work")));
4478                         break;
4479         }
4481         if (!PropertyTokens.IsEmpty()){
4483                 KeyListTokens.insert(std::make_pair(*KeyCount, PropertyTokens));
4485         }
4489 void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount){
4491         // Split the Vendor three ways.
4492         
4493         wxStringTokenizer wSTVendorDetails(PropertySeg1, wxT("-"));
4494         
4495         wxString wxSVNDID;
4496         wxString wxSVNDPropName;
4498         while (wSTVendorDetails.HasMoreTokens() == TRUE){
4499         
4500                 wSTVendorDetails.GetNextToken();
4501                 wxSVNDID = wSTVendorDetails.GetNextToken();
4502                 wxSVNDPropName = wSTVendorDetails.GetNextToken();
4503                 break;
4504         
4505         }
4506         
4507         if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
4508         
4509                 // Add the data to the vendor variables.
4510         
4511                 VendorList.erase(*VendorCount);
4512                 VendorListPEN.erase(*VendorCount);
4513                 VendorListElement.erase(*VendorCount);
4514         
4515                 VendorList.insert(std::make_pair(*VendorCount, PropertySeg2));
4516                 VendorListPEN.insert(std::make_pair(*VendorCount, wxSVNDID));
4517                 VendorListElement.insert(std::make_pair(*VendorCount, wxSVNDPropName));
4518         
4519         }
4523 void ContactDataObject::ClearData(){
4525     NameTitle.clear();
4526     NameForename.clear();
4527     NameSurname.clear();
4528     NameOtherNames.clear();
4529     NameSuffix.clear();
4530     NameNickname.clear();
4531     NameDisplayAs.clear();
4532     NameLanguage.clear();
4533     NameAltID.clear();
4534     NameTokens.clear();
4535     
4536     Birthday.clear();
4537     BirthdayAltID.clear();
4538     BirthdayCalScale.clear();
4539     BirthdayTokens.clear();
4540     Anniversary.clear();
4541     AnniversaryAltID.clear();
4542     AnniversaryCalScale.clear();
4543     AnniversaryTokens.clear();
4544     
4545     Gender.clear();
4546     GenderDetails.clear();
4547     GenderTokens.clear();
4548     
4549     UIDToken.clear();
4550     Revision.clear();
4551     RevisionTokens.clear();
4552     
4553     SourceList.clear();
4554     SourceListAltID.clear();
4555     SourceListPID.clear();
4556     SourceListType.clear();
4557     SourceListTokens.clear();
4558     SourceListMediatype.clear();
4559     SourceListPref.clear();
4560     
4561     XMLList.clear();
4562     XMLListAltID.clear();
4563     
4564     ClientPIDList.clear();
4565     ClientPIDListTokens.clear();
4566     
4567     FullNamesList.clear();    
4568     FullNamesListType.clear();
4569     FullNamesListLanguage.clear();
4570     FullNamesListAltID.clear();
4571     FullNamesListPID.clear();
4572     FullNamesListTokens.clear();
4573     FullNamesListPref.clear();
4574     
4575     GeneralNicknamesList.clear();
4576     GeneralNicknamesListType.clear();
4577     GeneralNicknamesListLanguage.clear();
4578     GeneralNicknamesListAltID.clear();
4579     GeneralNicknamesListPID.clear();
4580     GeneralNicknamesListTokens.clear();        
4581     GeneralNicknamesListPref.clear();        
4582     
4583     GeneralAddressList.clear();
4584     GeneralAddressListTown.clear();
4585     GeneralAddressListCounty.clear();
4586     GeneralAddressListPostCode.clear();
4587     GeneralAddressListCountry.clear();
4588     GeneralAddressListLabel.clear();
4589     GeneralAddressListLang.clear();        
4590     GeneralAddressListAltID.clear();
4591     GeneralAddressListPID.clear();
4592     GeneralAddressListTokens.clear();
4593     GeneralAddressListGeo.clear();
4594     GeneralAddressListTimezone.clear();        
4595     GeneralAddressListType.clear();
4596     GeneralAddressListMediatype.clear();
4597     GeneralAddressListPref.clear();
4598     
4599     GeneralEmailList.clear();
4600     GeneralEmailListAltID.clear();
4601     GeneralEmailListPID.clear();
4602     GeneralEmailListType.clear();
4603     GeneralEmailListTokens.clear();
4604     GeneralEmailListPref.clear();
4605     
4606     GeneralIMList.clear();
4607     GeneralIMListAltID.clear();
4608     GeneralIMListPID.clear();
4609     GeneralIMListType.clear();
4610     GeneralIMListTypeInfo.clear();
4611     GeneralIMListTokens.clear();
4612     GeneralIMListMediatype.clear();
4613     GeneralIMListPref.clear();
4614     
4615     GeneralTelephoneList.clear();
4616     GeneralTelephoneListAltID.clear();
4617     GeneralTelephoneListPID.clear();
4618     GeneralTelephoneListType.clear();
4619     GeneralTelephoneListTokens.clear();
4620     GeneralTelephoneListTypeInfo.clear();
4621     GeneralTelephoneListPref.clear();
4622     
4623     GeneralLanguageList.clear();
4624     GeneralLanguageListAltID.clear();
4625     GeneralLanguageListPID.clear();
4626     GeneralLanguageListType.clear();
4627     GeneralLanguageListTokens.clear();
4628     GeneralLanguageListPref.clear();
4629     
4630     GeneralTZList.clear();
4631     GeneralTZListAltID.clear();
4632     GeneralTZListPID.clear();
4633     GeneralTZListType.clear();
4634     GeneralTZListTokens.clear();
4635     GeneralTZListMediatype.clear();
4636     GeneralTZListPref.clear();
4637     
4638     GeneralGeographyList.clear();
4639     GeneralGeographyListAltID.clear();
4640     GeneralGeographyListPID.clear();
4641     GeneralGeographyListType.clear();
4642     GeneralGeographyListTokens.clear();
4643     GeneralGeographyListMediatype.clear();
4644     GeneralGeographyListPref.clear();
4645     
4646     GeneralRelatedList.clear();
4647     GeneralRelatedListRelType.clear();
4648     GeneralRelatedListLanguage.clear();
4649     GeneralRelatedListAltID.clear();
4650     GeneralRelatedListPID.clear();
4651     GeneralRelatedListType.clear();
4652     GeneralRelatedListTokens.clear();
4653     GeneralRelatedListPref.clear();
4654     
4655     GeneralWebsiteList.clear();
4656     GeneralWebsiteListAltID.clear();
4657     GeneralWebsiteListPID.clear();
4658     GeneralWebsiteListType.clear();
4659     GeneralWebsiteListTokens.clear();
4660     GeneralWebsiteListMediatype.clear();
4661     GeneralWebsiteListPref.clear();
4662     
4663     GeneralTitleList.clear();
4664     GeneralTitleListLanguage.clear();        
4665     GeneralTitleListAltID.clear();
4666     GeneralTitleListPID.clear();
4667     GeneralTitleListType.clear();
4668     GeneralTitleListTokens.clear();
4669     GeneralTitleListPref.clear();
4670     
4671     GeneralRoleList.clear();
4672     GeneralRoleListLanguage.clear();        
4673     GeneralRoleListAltID.clear();
4674     GeneralRoleListPID.clear();
4675     GeneralRoleListType.clear();
4676     GeneralRoleListTokens.clear();
4677     GeneralRoleListPref.clear();
4678     
4679     GeneralOrganisationsList.clear();
4680     GeneralOrganisationsListLanguage.clear();        
4681     GeneralOrganisationsListAltID.clear();
4682     GeneralOrganisationsListPID.clear();
4683     GeneralOrganisationsListType.clear();
4684     GeneralOrganisationsListTokens.clear();
4685     GeneralOrganisationsListSortAs.clear();
4686     GeneralOrganisationsListPref.clear();
4687     
4688     GeneralNoteList.clear();
4689     GeneralNoteListLanguage.clear();        
4690     GeneralNoteListAltID.clear();
4691     GeneralNoteListPID.clear();
4692     GeneralNoteListType.clear();
4693     GeneralNoteListTokens.clear();
4694     GeneralNoteListPref.clear();
4695     
4696     /* Items on Home Tab */        
4697     
4698     HomeNicknamesList.clear();
4699     HomeNicknamesListType.clear();
4700     HomeNicknamesListLanguage.clear();
4701     HomeNicknamesListAltID.clear();
4702     HomeNicknamesListPID.clear();
4703     HomeNicknamesListTokens.clear();        
4704     HomeNicknamesListPref.clear();        
4705     
4706     HomeAddressList.clear();
4707     HomeAddressListTown.clear();
4708     HomeAddressListCounty.clear();
4709     HomeAddressListPostCode.clear();
4710     HomeAddressListCountry.clear();
4711     HomeAddressListLabel.clear();
4712     HomeAddressListLang.clear();        
4713     HomeAddressListAltID.clear();
4714     HomeAddressListPID.clear();
4715     HomeAddressListTokens.clear();
4716     HomeAddressListGeo.clear();
4717     HomeAddressListTimezone.clear();        
4718     HomeAddressListType.clear();
4719     HomeAddressListMediatype.clear();
4720     HomeAddressListPref.clear();
4721     
4722     HomeEmailList.clear();
4723     HomeEmailListAltID.clear();
4724     HomeEmailListPID.clear();
4725     HomeEmailListType.clear();
4726     HomeEmailListTokens.clear();
4727     HomeEmailListPref.clear();
4728     
4729     HomeIMList.clear();
4730     HomeIMListAltID.clear();
4731     HomeIMListPID.clear();
4732     HomeIMListType.clear();
4733     HomeIMListTypeInfo.clear();
4734     HomeIMListTokens.clear();
4735     HomeIMListMediatype.clear();
4736     HomeIMListPref.clear();
4737     
4738     HomeTelephoneList.clear();
4739     HomeTelephoneListAltID.clear();
4740     HomeTelephoneListPID.clear();
4741     HomeTelephoneListType.clear();
4742     HomeTelephoneListTokens.clear();
4743     HomeTelephoneListTypeInfo.clear();
4744     HomeTelephoneListPref.clear();
4745     
4746     HomeLanguageList.clear();
4747     HomeLanguageListAltID.clear();
4748     HomeLanguageListPID.clear();
4749     HomeLanguageListType.clear();
4750     HomeLanguageListTokens.clear();
4751     HomeLanguageListPref.clear();
4752     
4753     HomeTZList.clear();
4754     HomeTZListAltID.clear();
4755     HomeTZListPID.clear();
4756     HomeTZListType.clear();
4757     HomeTZListTokens.clear();
4758     HomeTZListMediatype.clear();
4759     HomeTZListPref.clear();
4760     
4761     HomeGeographyList.clear();
4762     HomeGeographyListAltID.clear();
4763     HomeGeographyListPID.clear();
4764     HomeGeographyListType.clear();
4765     HomeGeographyListTokens.clear();
4766     HomeGeographyListMediatype.clear();
4767     HomeGeographyListPref.clear();       
4768     
4769     HomeWebsiteList.clear();
4770     HomeWebsiteListAltID.clear();
4771     HomeWebsiteListPID.clear();
4772     HomeWebsiteListType.clear();
4773     HomeWebsiteListTokens.clear();
4774     HomeWebsiteListMediatype.clear();
4775     HomeWebsiteListPref.clear();
4776     
4777     HomeTitleList.clear();
4778     HomeTitleListLanguage.clear();
4779     HomeTitleListAltID.clear();
4780     HomeTitleListPID.clear();
4781     HomeTitleListType.clear();
4782     HomeTitleListTokens.clear();
4783     HomeTitleListPref.clear();
4784     
4785     HomeRoleList.clear();
4786     HomeRoleListLanguage.clear();        
4787     HomeRoleListAltID.clear();
4788     HomeRoleListPID.clear();
4789     HomeRoleListType.clear();
4790     HomeRoleListTokens.clear();
4791     HomeRoleListPref.clear();
4792     
4793     HomeOrganisationsList.clear();
4794     HomeOrganisationsListLanguage.clear();        
4795     HomeOrganisationsListAltID.clear();
4796     HomeOrganisationsListPID.clear();
4797     HomeOrganisationsListType.clear();
4798     HomeOrganisationsListTokens.clear();
4799     HomeOrganisationsListSortAs.clear();
4800     HomeOrganisationsListPref.clear();
4801     
4802     HomeNoteList.clear();
4803     HomeNoteListLanguage.clear();        
4804     HomeNoteListAltID.clear();
4805     HomeNoteListPID.clear();
4806     HomeNoteListType.clear();
4807     HomeNoteListTokens.clear();
4808     HomeNoteListPref.clear();        
4809     
4810     /* Items on the Business tab */
4811     
4812     BusinessNicknamesList.clear();
4813     BusinessNicknamesListType.clear();
4814     BusinessNicknamesListLanguage.clear();
4815     BusinessNicknamesListAltID.clear();
4816     BusinessNicknamesListPID.clear();
4817     BusinessNicknamesListTokens.clear();        
4818     BusinessNicknamesListPref.clear();        
4819     
4820     BusinessAddressList.clear();
4821     BusinessAddressListTown.clear();
4822     BusinessAddressListCounty.clear();
4823     BusinessAddressListPostCode.clear();
4824     BusinessAddressListCountry.clear();
4825     BusinessAddressListLabel.clear();
4826     BusinessAddressListLang.clear();        
4827     BusinessAddressListAltID.clear();
4828     BusinessAddressListPID.clear();
4829     BusinessAddressListTokens.clear();
4830     BusinessAddressListGeo.clear();
4831     BusinessAddressListTimezone.clear();        
4832     BusinessAddressListType.clear();
4833     BusinessAddressListMediatype.clear();
4834     BusinessAddressListPref.clear();
4835     
4836     BusinessEmailList.clear();
4837     BusinessEmailListAltID.clear();
4838     BusinessEmailListPID.clear();
4839     BusinessEmailListType.clear();
4840     BusinessEmailListTokens.clear();
4841     BusinessEmailListPref.clear();
4842     
4843     BusinessIMList.clear();
4844     BusinessIMListAltID.clear();
4845     BusinessIMListPID.clear();
4846     BusinessIMListType.clear();
4847     BusinessIMListTokens.clear();
4848     BusinessIMListMediatype.clear();
4849     BusinessIMListPref.clear();
4850     
4851     BusinessTelephoneList.clear();
4852     BusinessTelephoneListAltID.clear();
4853     BusinessTelephoneListPID.clear();
4854     BusinessTelephoneListType.clear();
4855     BusinessTelephoneListTokens.clear();
4856     BusinessTelephoneListPref.clear();
4857     
4858     BusinessLanguageList.clear();
4859     BusinessLanguageListAltID.clear();
4860     BusinessLanguageListPID.clear();
4861     BusinessLanguageListType.clear();
4862     BusinessLanguageListTokens.clear();
4863     BusinessLanguageListPref.clear();
4864     
4865     BusinessTZList.clear();
4866     BusinessTZListAltID.clear();
4867     BusinessTZListPID.clear();
4868     BusinessTZListType.clear();
4869     BusinessTZListTokens.clear();
4870     BusinessTZListMediatype.clear();
4871     BusinessTZListPref.clear();
4872     
4873     BusinessGeographyList.clear();
4874     BusinessGeographyListAltID.clear();
4875     BusinessGeographyListPID.clear();
4876     BusinessGeographyListType.clear();
4877     BusinessGeographyListTokens.clear();
4878     BusinessGeographyListMediatype.clear();
4879     BusinessGeographyListPref.clear();          
4880     
4881     BusinessWebsiteList.clear();
4882     BusinessWebsiteListAltID.clear();
4883     BusinessWebsiteListPID.clear();
4884     BusinessWebsiteListType.clear();
4885     BusinessWebsiteListTokens.clear();
4886     BusinessWebsiteListMediatype.clear();
4887     BusinessWebsiteListPref.clear();
4888     
4889     BusinessTitleList.clear();
4890     BusinessTitleListLanguage.clear();        
4891     BusinessTitleListAltID.clear();
4892     BusinessTitleListPID.clear();
4893     BusinessTitleListType.clear();
4894     BusinessTitleListTokens.clear();
4895     BusinessTitleListPref.clear();
4896     
4897     BusinessRoleList.clear();
4898     BusinessRoleListLanguage.clear();        
4899     BusinessRoleListAltID.clear();
4900     BusinessRoleListPID.clear();
4901     BusinessRoleListType.clear();
4902     BusinessRoleListTokens.clear();
4903     BusinessRoleListPref.clear();
4904     
4905     BusinessOrganisationsList.clear();
4906     BusinessOrganisationsListLanguage.clear();        
4907     BusinessOrganisationsListAltID.clear();
4908     BusinessOrganisationsListPID.clear();
4909     BusinessOrganisationsListType.clear();
4910     BusinessOrganisationsListTokens.clear();
4911     BusinessOrganisationsListSortAs.clear();        
4912     BusinessOrganisationsListPref.clear();
4913     
4914     BusinessNoteList.clear();
4915     BusinessNoteListLanguage.clear();        
4916     BusinessNoteListAltID.clear();
4917     BusinessNoteListPID.clear();
4918     BusinessNoteListType.clear();
4919     BusinessNoteListTokens.clear();
4920     BusinessNoteListPref.clear();        
4921     
4922     /* Items on the Categories tab */
4923     
4924     CategoriesList.clear();
4925     CategoriesListAltID.clear();
4926     CategoriesListPID.clear();
4927     CategoriesListType.clear();
4928     CategoriesListTokens.clear();
4929     CategoriesListLanguage.clear();
4930     CategoriesListPref.clear();    
4931     
4932     /* Items on the Groups tab */
4933     
4934     GroupsList.clear();
4935     GroupsListAltID.clear();
4936     GroupsListPID.clear();
4937     GroupsListType.clear();
4938     GroupsListMediaType.clear();
4939     GroupsListTokens.clear();
4940     GroupsListPref.clear();
4941     
4942     /* Items on the Pictures tab */
4943     
4944     PicturesList.clear();
4945     PicturesListAltID.clear();
4946     PicturesListPID.clear();
4947     PicturesListType.clear();
4948     PicturesListPicEncType.clear();
4949     PicturesListPictureType.clear();
4950     PicturesListTokens.clear();
4951     PicturesListMediatype.clear();        
4952     PicturesListPref.clear();
4953     
4954     /* Items on the Logos tab */
4955     
4956     LogosList.clear();
4957     LogosListAltID.clear();
4958     LogosListPID.clear();
4959     LogosListType.clear();
4960     LogosListPicEncType.clear();        
4961     LogosListPictureType.clear();
4962     LogosListTokens.clear();
4963     LogosListMediatype.clear();        
4964     LogosListPref.clear();
4965     
4966     /* Items on the Sounds tab */
4967     
4968     SoundsList.clear();
4969     SoundsListAltID.clear();
4970     SoundsListPID.clear();
4971     SoundsListType.clear();
4972     SoundsListAudioEncType.clear();        
4973     SoundsListAudioType.clear();        
4974     SoundsListTokens.clear();
4975     SoundsListMediatype.clear();        
4976     SoundsListPref.clear();    
4977     
4978     /* Items on the Calendaring tab */
4979     
4980     CalendarList.clear();
4981     CalendarListAltID.clear();
4982     CalendarListPID.clear();
4983     CalendarListType.clear();
4984     CalendarListTokens.clear();
4985     CalendarListMediatype.clear();        
4986     CalendarListPref.clear();
4987     
4988     CalendarRequestList.clear();
4989     CalendarRequestListAltID.clear();
4990     CalendarRequestListPID.clear();
4991     CalendarRequestListType.clear();
4992     CalendarRequestListTokens.clear();
4993     CalendarRequestListMediatype.clear();        
4994     CalendarRequestListPref.clear();        
4995     
4996     FreeBusyList.clear();
4997     FreeBusyListAltID.clear();
4998     FreeBusyListPID.clear();
4999     FreeBusyListType.clear();
5000     FreeBusyListTokens.clear();
5001     FreeBusyListMediatype.clear();        
5002     FreeBusyListPref.clear();
5003     
5004     /* Items on the Security tab */
5005     
5006     KeyList.clear();
5007     KeyListAltID.clear();
5008     KeyListPID.clear();
5009     KeyListKeyType.clear();        
5010     KeyListDataType.clear();        
5011     KeyListDataEncType.clear();
5012     KeyListType.clear();
5013     KeyListTokens.clear();
5014     KeyListPref.clear();
5015     
5016     /* Items on the Other tab */
5017     
5018     VendorList.clear();
5019     VendorListPEN.clear();
5020     VendorListElement.clear();
5021     
5022     XTokenList.clear();
5023     XTokenListTokens.clear();
5027 void ProcessNameValue(wxString *PropertyData, 
5028         wxString *PropertyName, 
5029         wxString *PropertyValue){
5031         wxStringTokenizer PropertyElement (*PropertyData, wxT("="));
5032         *PropertyName = PropertyElement.GetNextToken();                         
5033         *PropertyValue = PropertyElement.GetNextToken();
5037 void ProcessTokens(wxString *PropertyName,
5038         wxString *PropertyValue,
5039         wxString *PropertyTokens,
5040         bool *FirstToken){
5041         
5042         if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
5043                 
5044                 if (*FirstToken == TRUE){
5045                         
5046                         PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
5047                         *FirstToken = FALSE;
5048                         
5049                 } else {
5050                         
5051                         PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
5052                         
5053                 }
5054                 
5055         }
5056         
5059 void ProcessStringValue(wxString *PropertyName,
5060         wxString PropertyNameMatch,
5061         std::map<int,wxString> *MapPtr,
5062         wxString *PropertyValue,
5063         int *ItemCount,
5064         bool *PropertyMatched){
5065         
5066         if (*PropertyName == PropertyNameMatch){
5067                 MapPtr->erase(*ItemCount);
5068                 MapPtr->insert(std::make_pair(*ItemCount, *PropertyValue));
5069                 *PropertyMatched = TRUE;
5070         }
5071         
5074 void ProcessIntegerValue(wxString *PropertyName,
5075         wxString PropertyNameMatch,
5076         std::map<int,int> *PrefPtr, 
5077         wxString *PropertyValue, 
5078         int *ItemCount,
5079         bool *PropertyMatched){
5081         if (*PropertyName == PropertyNameMatch){
5082                 *PropertyMatched = TRUE;
5083         } else {
5084                 return;
5085         }
5087         int PriorityNumber = 0; 
5088         bool ValidNumber = TRUE;
5089                         
5090         try{
5091                 PriorityNumber = std::stoi(PropertyValue->ToStdString());
5092         }
5093                         
5094         catch(std::invalid_argument &e){
5095                 ValidNumber = FALSE;
5096         }
5098         if (ValidNumber == TRUE){
5100                 PrefPtr->erase(*ItemCount);
5101                 PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
5103         }
5107 void SplitValues(wxString *PropertyLine, 
5108         std::map<int,int> *SplitPoints, 
5109         std::map<int,int> *SplitLength, 
5110         int intSize){
5111         
5112         size_t intPropertyLen = PropertyLine->Len();
5113         int intSplitsFound = 0;
5114         int intSplitSize = 0;
5115         int intSplitSeek = 0;
5116         
5117         for (int i = intSize; i <= intPropertyLen; i++){
5119                 intSplitSize++;
5120         
5121                 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5122                     PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5123            
5124                     if (intSplitsFound == 0){
5125             
5126                         SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5127           
5128                     } else {
5129            
5130                         SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5131             
5132                     }
5133             
5134                     SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5135             
5136                     intSplitsFound++;
5137                     intSplitSeek = i;
5138                     intSplitSize = 0;
5139             
5140                 }
5142         }
5144         if (intSplitsFound == 0){
5146                 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5147                 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5149         } else {
5151                 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5152                 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5154         }
5158 void CheckType(wxString *PropertySeg1, 
5159         std::map<int,int> *SplitPoints, 
5160         std::map<int,int> *SplitLength, 
5161         int *intPrevValue, 
5162         PropertyType *PropType){
5163         
5164         wxString PropertyData;
5165         wxString PropertyName;
5166         wxString PropertyValue;
5167         std::map<int,int>::iterator SLiter;
5168         
5169         for (std::map<int, int>::iterator intiter = SplitPoints->begin(); 
5170         intiter != SplitPoints->end(); ++intiter){
5171         
5172                 SLiter = SplitLength->find(intiter->first);     
5173                 PropertyData = PropertySeg1->Mid(*intPrevValue, (SLiter->second));
5174                 ProcessNameValue(&PropertyData, &PropertyName, &PropertyValue);         
5175                 *intPrevValue = intiter->second;
5176                 
5177                 if (PropertyName == wxT("TYPE")){
5178                                 
5179                         if (PropertyValue == wxT("work")){
5180                         
5181                                 *PropType = PROPERTY_WORK;
5182                                                         
5183                         } else if (PropertyValue == wxT("home")){
5185                                 *PropType = PROPERTY_HOME;
5186                                                         
5187                         } else {
5188                         
5189                                 *PropType = PROPERTY_NONE;
5190                         
5191                         }
5192                 
5193                         return;
5194                 
5195                 }
5196         
5197         }
5198         
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy