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