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