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