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