Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
103d7ae9be768c299b5a401aaf221e0ef00dc06b
[xestiaab/.git] / source / vcard / vcard34conv.cpp
1 #include "vcard34conv.h"
2 #include "vcard.h"
3 #include "../version.h"
4 #include "../common/textprocessing.h"
5 #include <wx/file.h>
6 #include <cmath>
7 #include <map>
9 #include <wx/ffile.h>
10 #include <wx/tokenzr.h>
11 #include <wx/datetime.h>
12 #include <wx/wx.h>
14 // vcard.cpp - Deals with vCard 4.0 formatted files meeting the
15 // RFC 6350 specification.
17 vCard34Conv::vCard34Conv(){
18     vCardBegin = FALSE;
19     vCardEnd = FALSE;
20     vCardFN = FALSE;
21     vCardVersion = 0.0;
22     SettingCount = 0;
23 }
25 void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, 
26         wxString *wxSPropertySeg1Ptr, wxString *wxSPropertySeg2Ptr, 
27         wxString *wxSPropertyPropValuesOut, wxString *wxSPropertyDataOut, 
28         wxString *wxSPropertyXVCard4Value, wxString *wxSPropertyDataNameOut,
29         std::map<wxString,wxString> *PropertyDataMap, 
30         std::map<wxString,bool> *PropertyLockMap,
31         bool ProcessItemData, bool *VCardV3Value, bool *XVCardV4Value){
33         wxString wxSProperty;
34         wxString wxSPropertySeg1Chopped;
35     size_t intPropertyLen;
36     
37         if (ProcessItemData == TRUE){
38                 
39                 wxStringTokenizer wxSPropertySplit(*wxSPropertyName, wxT("."));
40         
41                 wxSPropertySplit.GetNextToken();
42                 wxSProperty = wxSPropertySplit.GetNextToken();
43         
44                 // Look for . in wxSPropertySeg1Ptr and remove all data before
45                 // the .
46         
47                 int ItemSeek = wxSPropertySeg1Ptr->Find(wxT("."));
48                 wxSPropertySeg1Chopped = wxSPropertySeg1Ptr->Mid((ItemSeek + 1));
49                 
50         
51         } else {
52         
53                 wxSProperty = *wxSPropertyName;
54         
55         }
57         
58         // Go through each of the vCard 3.0 properties.
59         
60         // EMAIL
61         
62         if (wxSProperty == wxT("EMAIL")){
64                 if (ProcessItemData == TRUE){
65         
66                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
67                 
68                 } else {
69                 
70                         intPropertyLen = wxSPropertySeg1Ptr->Len();
71                 
72                 }
73                 
74                 std::map<int, int> SplitPoints;
75                 std::map<int, int> SplitLength;
76                 std::map<int, int>::iterator SLiter;                    
77                 wxString PropertyData;
78                 wxString PropertyName;
79                 wxString PropertyValue;
80                 wxString PropertyTokens;
81                 bool FirstToken = TRUE;
82                 int intPrevValue = 7;
83                 
84                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
85                 *wxSPropertyDataNameOut = wxT("EMAIL");
86                 *VCardV3Value = TRUE;
87                 
88                 if (ProcessItemData == TRUE){
89                 
90                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
91                         
92                 } else {
93                         
94                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
95                         
96                 }
97                 
98                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
99                 intiter != SplitPoints.end(); ++intiter){
100                 
101                         SLiter = SplitLength.find(intiter->first);
102                 
103                         if (ProcessItemData == TRUE){
104                 
105                                 if (FirstToken == TRUE){
106                         
107                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
108                                         FirstToken = FALSE;
109                         
110                                 } else {
111                                 
112                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
113                                 
114                                 }
115                         
116                         } else {                        
117                                 
118                                 if (FirstToken == TRUE){
119                         
120                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
121                                         FirstToken = FALSE;
122                         
123                                 } else {
124                                 
125                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
126                                 
127                                 }
128                         
129                         }
130                         
131                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
132                         PropertyName = PropertyElement.GetNextToken();                          
133                         PropertyValue = PropertyElement.GetNextToken();
134                         
135                         //ProcessCaptureStrings(&PropertyValue);
136                         
137                         intPrevValue = intiter->second;
138                         
139                         if (PropertyName == wxT("type") && PropertyValue == wxT("INTERNET")){
140                                 continue;
141                         }
142                                 
143                         if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){
144                                 
145                                 if (ProcessItemData == FALSE){
146                                         PropertyName = wxT("PREF");
147                                         PropertyValue = wxT("50");
148                                 } else {
149                                         continue;
150                                 }
151                                 
152                         }
153                         
154                         if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){
155                                 PropertyValue = wxT("home");
156                         }
157                         
158                         if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){
159                                 PropertyValue = wxT("work");
160                         }
162                         if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){
163                                 PropertyName = wxT("X-TYPE");
164                                 PropertyValue = wxT("other");
165                         }
166                         
167                         // Process properties.
168                         
169                         if (PropertyName.IsEmpty()){
170                         
171                                 continue;
172                         
173                         }
174                         
175                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
177                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
178                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
179         
180                         } else {
181                         
182                                 PropertyDataMap->erase(PropertyName);
183                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
184                                 PropertyLockMap->erase(PropertyName);
185                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
186                         
187                         }
188                 
189                 }
190         
191         }
192         
193         // ADR
194         
195         if (wxSProperty == wxT("ADR")){
197                 if (ProcessItemData == TRUE){
198         
199                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
200                 
201                 } else {
202                 
203                         intPropertyLen = wxSPropertySeg1Ptr->Len();
204                 
205                 }
206                 
207                 std::map<int, int> SplitPoints;
208                 std::map<int, int> SplitLength;
209                 std::map<int, int>::iterator SLiter;                    
210                 wxString PropertyData;
211                 wxString PropertyName;
212                 wxString PropertyValue;
213                 wxString PropertyTokens;
214                 bool FirstToken = TRUE;
215                 int intPrevValue = 5;
216                 
217                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
218                 *wxSPropertyDataNameOut = wxT("ADR");
219                 *VCardV3Value = TRUE;
220                 
221                 if (ProcessItemData == TRUE){
222                 
223                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
224                         
225                 } else {
226                         
227                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
228                         
229                 }
230                 
231                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
232                 intiter != SplitPoints.end(); ++intiter){
233                 
234                         SLiter = SplitLength.find(intiter->first);
235                 
236                         if (ProcessItemData == TRUE){
237                 
238                                 if (FirstToken == TRUE){
239                         
240                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
241                                         FirstToken = FALSE;
242                         
243                                 } else {
244                                 
245                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
246                                 
247                                 }
248                         
249                         } else {                        
250                                 
251                                 if (FirstToken == TRUE){
252                         
253                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
254                                         FirstToken = FALSE;
255                         
256                                 } else {
257                                 
258                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
259                                 
260                                 }
261                         
262                         }
263                         
264                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
265                         PropertyName = PropertyElement.GetNextToken();                          
266                         PropertyValue = PropertyElement.GetNextToken();
267                         
268                         intPrevValue = intiter->second;
269                                 
270                         if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){
271                                 
272                                 if (ProcessItemData == FALSE){
273                                         PropertyName = wxT("PREF");
274                                         PropertyValue = wxT("50");
275                                 } else {
276                                         continue;
277                                 }
278                                 
279                         }
280                         
281                         if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){
282                                 PropertyValue = wxT("home");
283                         }
284                         
285                         if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){
286                                 PropertyValue = wxT("work");
287                         }
289                         if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){
290                                 PropertyName = wxT("X-TYPE");
291                                 PropertyValue = wxT("other");
292                         }
293                         
294                         // Process properties.
295                         
296                         if (PropertyName.IsEmpty()){
297                         
298                                 continue;
299                         
300                         }
301                         
302                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
304                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
305                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
306         
307                         } else {
308                         
309                                 PropertyDataMap->erase(PropertyName);
310                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
311                                 PropertyLockMap->erase(PropertyName);
312                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
313                         
314                         }
315                 
316                 }
317         
318         }
319         
320         // LABEL
321         
322         if (wxSProperty == wxT("LABEL")){
324                 if (ProcessItemData == TRUE){
325         
326                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
327                 
328                 } else {
329                 
330                         intPropertyLen = wxSPropertySeg1Ptr->Len();
331                 
332                 }
333                 
334                 std::map<int, int> SplitPoints;
335                 std::map<int, int> SplitLength;
336                 std::map<int, int>::iterator SLiter;                    
337                 wxString PropertyData;
338                 wxString PropertyName;
339                 wxString PropertyValue;
340                 wxString PropertyTokens;
341                 bool FirstToken = TRUE;
342                 int intPrevValue = 7;
343                 
344                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
345                 *wxSPropertyDataNameOut = wxT("ADR");
346                 *VCardV3Value = TRUE;
347                 
348                 if (ProcessItemData == TRUE){
349                 
350                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
351                         
352                 } else {
353                         
354                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
355                         
356                 }
357                 
358                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
359                 intiter != SplitPoints.end(); ++intiter){
360                 
361                         SLiter = SplitLength.find(intiter->first);
362                 
363                         if (ProcessItemData == TRUE){
364                 
365                                 if (FirstToken == TRUE){
366                         
367                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
368                                         FirstToken = FALSE;
369                         
370                                 } else {
371                                 
372                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
373                                 
374                                 }
375                         
376                         } else {                        
377                                 
378                                 if (FirstToken == TRUE){
379                         
380                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
381                                         FirstToken = FALSE;
382                         
383                                 } else {
384                                 
385                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
386                                 
387                                 }
388                         
389                         }
390                         
391                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
392                         PropertyName = PropertyElement.GetNextToken();                          
393                         PropertyValue = PropertyElement.GetNextToken();
394                         
395                         intPrevValue = intiter->second;
396                                 
397                         if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){
398                                 continue;
399                         }
400                         
401                         if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){
402                                 PropertyValue = wxT("home");
403                         }
404                         
405                         if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){
406                                 PropertyValue = wxT("work");
407                         }
409                         if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){
410                                 PropertyName = wxT("X-TYPE");
411                                 PropertyValue = wxT("other");
412                         }
413                         
414                         // Process properties.
415                         
416                         if (PropertyName.IsEmpty()){
417                         
418                                 continue;
419                         
420                         }
421                         
422                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
424                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
425                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
426         
427                         } else {
428                         
429                                 PropertyDataMap->erase(PropertyName);
430                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
431                                 PropertyLockMap->erase(PropertyName);
432                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
433                         
434                         }
435                 
436                 }
437                 
438                 PropertyDataMap->insert(std::make_pair(wxT("X-LABEL"), wxT("TRUE")));
439         
440         }
441         
442         // IMPP
443         
444         if (wxSProperty == wxT("IMPP")){
446                 if (ProcessItemData == TRUE){
447         
448                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
449                 
450                 } else {
451                 
452                         intPropertyLen = wxSPropertySeg1Ptr->Len();
453                 
454                 }
455                 
456                 std::map<int, int> SplitPoints;
457                 std::map<int, int> SplitLength;
458                 std::map<int, int>::iterator SLiter;                    
459                 wxString PropertyData;
460                 wxString PropertyName;
461                 wxString PropertyValue;
462                 wxString PropertyTokens;
463                 bool FirstToken = TRUE;
464                 int intPrevValue = 6;
465                 
466                 wxStringTokenizer IMPPSplit(*wxSPropertySeg2Ptr, wxT(":"));
467                 wxString IMPPType;
468                 wxString IMPPData;
469                 
470                 IMPPType = IMPPSplit.GetNextToken();
471                 
472                 if (IMPPSplit.HasMoreTokens()){
473                 
474                         IMPPData = IMPPSplit.GetNextToken();
475                 
476                         if (IMPPType == wxT("ymsgr")){
477                         
478                                 IMPPType = wxT("yahoo");
479                         
480                         }
481                         
482                         *wxSPropertySeg2Ptr = IMPPType + wxT(":") + IMPPData;
483                 
484                 }
485                 
486                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
487                 *wxSPropertyDataNameOut = wxT("IMPP");
488                 *VCardV3Value = TRUE;
489                 
490                 if (ProcessItemData == TRUE){
491                 
492                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
493                         
494                 } else {
495                         
496                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
497                         
498                 }
499                 
500                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
501                 intiter != SplitPoints.end(); ++intiter){
502                 
503                         SLiter = SplitLength.find(intiter->first);
504                 
505                         if (ProcessItemData == TRUE){
506                 
507                                 if (FirstToken == TRUE){
508                         
509                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
510                                         FirstToken = FALSE;
511                         
512                                 } else {
513                                 
514                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
515                                 
516                                 }
517                         
518                         } else {                        
519                                 
520                                 if (FirstToken == TRUE){
521                         
522                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
523                                         FirstToken = FALSE;
524                         
525                                 } else {
526                                 
527                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
528                                 
529                                 }
530                         
531                         }
532                         
533                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
534                         PropertyName = PropertyElement.GetNextToken();                          
535                         PropertyValue = PropertyElement.GetNextToken();
536                         
537                         intPrevValue = intiter->second;
538                                 
539                         if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){
540                                 continue;
541                         }
542                         
543                         if (PropertyName == wxT("X-SERVICE-TYPE")){
544                                 continue;
545                         }
546                         
547                         if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){
548                                 PropertyValue = wxT("home");
549                         }
550                         
551                         if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){
552                                 PropertyValue = wxT("work");
553                         }
555                         if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){
556                                 PropertyName = wxT("X-TYPE");
557                                 PropertyValue = wxT("other");
558                         }
559                         
560                         // Process properties.
561                         
562                         if (PropertyName.IsEmpty()){
563                         
564                                 continue;
565                         
566                         }
567                         
568                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
570                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
571                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
572         
573                         } else {
574                         
575                                 PropertyDataMap->erase(PropertyName);
576                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
577                                 PropertyLockMap->erase(PropertyName);
578                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
579                         
580                         }
581                 
582                 }
583         
584         }
585         
586         // TEL
587         
588         if (wxSProperty == wxT("TEL")){
590                 if (ProcessItemData == TRUE){
591         
592                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
593                 
594                 } else {
595                 
596                         intPropertyLen = wxSPropertySeg1Ptr->Len();
597                 
598                 }
599                 
600                 std::map<int, int> SplitPoints;
601                 std::map<int, int> SplitLength;
602                 std::map<int, int>::iterator SLiter;
603                 std::map<wxString, wxString> TelType;                   
604                 wxString PropertyData;
605                 wxString PropertyName;
606                 wxString PropertyValue;
607                 wxString PropertyTokens;
608                 bool FirstToken = TRUE;
609                 int intPrevValue = 5;
610                 
611                 wxSPropertyDataOut->Append(wxT("tel:"));
612                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
613                 *wxSPropertyDataNameOut = wxT("TEL");
614                 *VCardV3Value = TRUE;
615                 
616                 if (ProcessItemData == TRUE){
617                 
618                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
619                         
620                 } else {
621                         
622                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
623                         
624                 }
625                 
626                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
627                 intiter != SplitPoints.end(); ++intiter){
628                 
629                         SLiter = SplitLength.find(intiter->first);
630                 
631                         if (ProcessItemData == TRUE){
632                 
633                                 if (FirstToken == TRUE){
634                         
635                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
636                                         FirstToken = FALSE;
637                         
638                                 } else {
639                                 
640                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
641                                 
642                                 }
643                         
644                         } else {                        
645                                 
646                                 if (FirstToken == TRUE){
647                         
648                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
649                                         FirstToken = FALSE;
650                         
651                                 } else {
652                                 
653                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
654                                 
655                                 }
656                         
657                         }
658                         
659                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
660                         PropertyName = PropertyElement.GetNextToken();                          
661                         PropertyValue = PropertyElement.GetNextToken();
662                         
663                         intPrevValue = intiter->second;
664                                 
665                         if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){
666                                 continue;
667                         }
668                         
669                         if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){
670                                 TelType.insert(std::make_pair(wxT("home"), wxT("home")));
671                                 continue;
672                         }
673                         
674                         if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){
675                                 TelType.insert(std::make_pair(wxT("work"), wxT("work")));
676                                 continue;
677                         }
679                         if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){
680                                 PropertyName = wxT("X-TYPE");
681                                 PropertyValue = wxT("other");
682                         }
683                         
684                         // Process the telephone type options.
685                         
686                         // text
687                         
688                         if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXT") || PropertyValue == wxT("text"))){
689                                 TelType.insert(std::make_pair(wxT("text"), wxT("text")));
690                                 continue;
691                         }
692                         
693                         // voice
694                         
695                         if (PropertyName == wxT("type") && (PropertyValue == wxT("VOICE") || PropertyValue == wxT("voice"))){
696                                 TelType.insert(std::make_pair(wxT("voice"), wxT("voice")));
697                                 continue;
698                         }
699                         
700                         // fax
701                         
702                         if (PropertyName == wxT("type") && (PropertyValue == wxT("FAX") || PropertyValue == wxT("fax"))){
703                                 TelType.insert(std::make_pair(wxT("fax"), wxT("fax")));
704                                 continue;
705                         }
706                         
707                         // cell
708                         
709                         if (PropertyName == wxT("type") && (PropertyValue == wxT("CELL") || PropertyValue == wxT("cell"))){
710                                 TelType.insert(std::make_pair(wxT("cell"), wxT("cell")));
711                                 continue;
712                         }
713                         
714                         // video
715                         
716                         if (PropertyName == wxT("type") && (PropertyValue == wxT("VIDEO") || PropertyValue == wxT("video"))){
717                                 TelType.insert(std::make_pair(wxT("video"), wxT("video")));
718                                 continue;
719                         }
720                         
721                         // pager
722                         
723                         if (PropertyName == wxT("type") && (PropertyValue == wxT("PAGER") || PropertyValue == wxT("pager"))){
724                                 TelType.insert(std::make_pair(wxT("pager"), wxT("pager")));
725                                 continue;
726                         }
727                         
728                         // textphone
729                         
730                         if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXTPHONE") || PropertyValue == wxT("textphone"))){
731                                 TelType.insert(std::make_pair(wxT("textphone"), wxT("textphone")));
732                                 continue;
733                         }
734                         
735                         if (PropertyName == wxT("type") && PropertyValue.Find(wxT(",")) != wxNOT_FOUND){
736                                 wxStringTokenizer TypeSplit(PropertyValue, wxT(","));
737                                 wxString TypeSplitData;
738                                 while (TypeSplit.HasMoreTokens()){
739                                 
740                                         TypeSplitData = TypeSplit.GetNextToken();
741                                         TelType.insert(std::make_pair(TypeSplitData, TypeSplitData));
742                                         TypeSplitData.clear();
743                                 
744                                 }
745                                 
746                         }
747                         
748                         // Process properties.
749                         
750                         if (PropertyName.IsEmpty()){
751                         
752                                 continue;
753                         
754                         }
755                         
756                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
758                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
759                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
760         
761                         } else {
762                         
763                                 PropertyDataMap->erase(PropertyName);
764                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
765                                 PropertyLockMap->erase(PropertyName);
766                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
767                         
768                         }
769                 
770                 }
771                 
772                 wxString TelFinalString;
773                 bool TelFirstToken = TRUE;
774                 
775                 for (std::map<wxString, wxString>::iterator intiter = TelType.begin(); 
776                 intiter != TelType.end(); ++intiter){
777                 
778                         // Process the type data into a single value. (e.g. TYPE="work,voice,cell").
779                         
780                         if (TelFirstToken == TRUE){
781                         
782                                 TelFinalString.Append(wxT("\""));
783                                 TelFinalString.Append(intiter->first);
784                                 TelFirstToken = FALSE;
785                         
786                         } else {
787                         
788                                 TelFinalString.Append(wxT(","));
789                                 TelFinalString.Append(intiter->first);
790                         
791                         }
792                 
793                 }
794                 
795                 if (TelFirstToken == FALSE){
796                 
797                         TelFinalString.Append(wxT("\""));
798                 
799                 }
800                 
801                 if (!TelFinalString.IsEmpty()){
802                 
803                         if (PropertyDataMap->find(wxT("TYPE")) == PropertyDataMap->end()){
805                                 PropertyDataMap->insert(std::make_pair(wxT("type"), TelFinalString));
806                                 PropertyLockMap->insert(std::make_pair(wxT("type"), TRUE));
807         
808                         } else {
809                         
810                                 PropertyDataMap->erase(PropertyName);
811                                 PropertyDataMap->insert(std::make_pair(wxT("type"), TelFinalString));
812                                 PropertyLockMap->erase(PropertyName);
813                                 PropertyLockMap->insert(std::make_pair(wxT("type"), TRUE));
814                         
815                         }
816                 
817                 }
818         
819         }
820         
821         // RELATED
822         
823         if (wxSProperty == wxT("X-ABRELATEDNAMES")){
825                 if (ProcessItemData == TRUE){
826         
827                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
828                 
829                 } else {
830                 
831                         intPropertyLen = wxSPropertySeg1Ptr->Len();
832                 
833                 }
834                 
835                 std::map<int, int> SplitPoints;
836                 std::map<int, int> SplitLength;
837                 std::map<int, int>::iterator SLiter;                    
838                 wxString PropertyData;
839                 wxString PropertyName;
840                 wxString PropertyValue;
841                 wxString PropertyTokens;
842                 bool FirstToken = TRUE;
843                 int intPrevValue = 18;
844                 
845                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
846                 *wxSPropertyDataNameOut = wxT("RELATED");
847                 *VCardV3Value = TRUE;
848                 
849                 if (ProcessItemData == TRUE){
850                 
851                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
852                         
853                 } else {
854                         
855                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
856                         
857                 }
858                 
859                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
860                 intiter != SplitPoints.end(); ++intiter){
861                 
862                         SLiter = SplitLength.find(intiter->first);
863                 
864                         if (ProcessItemData == TRUE){
865                 
866                                 if (FirstToken == TRUE){
867                         
868                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
869                                         FirstToken = FALSE;
870                         
871                                 } else {
872                                 
873                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
874                                 
875                                 }
876                         
877                         } else {                        
878                                 
879                                 if (FirstToken == TRUE){
880                         
881                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
882                                         FirstToken = FALSE;
883                         
884                                 } else {
885                                 
886                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
887                                 
888                                 }
889                         
890                         }
891                         
892                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
893                         PropertyName = PropertyElement.GetNextToken();                          
894                         PropertyValue = PropertyElement.GetNextToken();
895                         
896                         //ProcessCaptureStrings(&PropertyValue);
897                         
898                         intPrevValue = intiter->second;
899                                 
900                         if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){
901                                 continue;
902                         }
903                         
904                         // Process properties.
905                         
906                         if (PropertyName.IsEmpty()){
907                         
908                                 continue;
909                         
910                         }
911                         
912                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
914                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
915                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
916         
917                         } else {
918                         
919                                 PropertyDataMap->erase(PropertyName);
920                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
921                                 PropertyLockMap->erase(PropertyName);
922                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
923                         
924                         }
925                 
926                 }
927         
928         }
929         
930         // URL
931         
932         if (wxSProperty == wxT("URL")){
934                 if (ProcessItemData == TRUE){
935         
936                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
937                 
938                 } else {
939                 
940                         intPropertyLen = wxSPropertySeg1Ptr->Len();
941                 
942                 }
943                 
944                 std::map<int, int> SplitPoints;
945                 std::map<int, int> SplitLength;
946                 std::map<int, int>::iterator SLiter;                    
947                 wxString PropertyData;
948                 wxString PropertyName;
949                 wxString PropertyValue;
950                 wxString PropertyTokens;
951                 bool FirstToken = TRUE;
952                 int intPrevValue = 5;
953                 
954                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
955                 *wxSPropertyDataNameOut = wxT("URL");
956                 *VCardV3Value = TRUE;
957                 
958                 if (ProcessItemData == TRUE){
959                 
960                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
961                         
962                 } else {
963                         
964                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
965                         
966                 }
967                 
968                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
969                 intiter != SplitPoints.end(); ++intiter){
970                 
971                         SLiter = SplitLength.find(intiter->first);
972                 
973                         if (ProcessItemData == TRUE){
974                 
975                                 if (FirstToken == TRUE){
976                         
977                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
978                                         FirstToken = FALSE;
979                         
980                                 } else {
981                                 
982                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
983                                 
984                                 }
985                         
986                         } else {                        
987                                 
988                                 if (FirstToken == TRUE){
989                         
990                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
991                                         FirstToken = FALSE;
992                         
993                                 } else {
994                                 
995                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
996                                 
997                                 }
998                         
999                         }
1000                         
1001                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1002                         PropertyName = PropertyElement.GetNextToken();                          
1003                         PropertyValue = PropertyElement.GetNextToken();
1004                         
1005                         intPrevValue = intiter->second;
1006                                 
1007                         if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){
1008                                 continue;
1009                         }
1010                         
1011                         if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){
1012                                 PropertyValue = wxT("home");
1013                         }
1014                         
1015                         if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){
1016                                 PropertyValue = wxT("work");
1017                         }
1019                         if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){
1020                                 PropertyName = wxT("X-TYPE");
1021                                 PropertyValue = wxT("other");
1022                         }
1023                         
1024                         // Process properties.
1025                         
1026                         if (PropertyName.IsEmpty()){
1027                         
1028                                 continue;
1029                         
1030                         }
1031                         
1032                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
1034                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1035                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1036         
1037                         } else {
1038                         
1039                                 PropertyDataMap->erase(PropertyName);
1040                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1041                                 PropertyLockMap->erase(PropertyName);
1042                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1043                         
1044                         }
1045                 
1046                 }
1047         
1048         }
1049         
1050         // TITLE
1051         
1052         if (wxSProperty == wxT("TITLE")){
1053                 
1054                 if (ProcessItemData == TRUE){
1055         
1056                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
1057                 
1058                 } else {
1059                 
1060                         intPropertyLen = wxSPropertySeg1Ptr->Len();
1061                 
1062                 }
1063                 
1064                 std::map<int, int> SplitPoints;
1065                 std::map<int, int> SplitLength;
1066                 std::map<int, int>::iterator SLiter;                    
1067                 wxString PropertyData;
1068                 wxString PropertyName;
1069                 wxString PropertyValue;
1070                 wxString PropertyTokens;
1071                 bool FirstToken = TRUE;
1072                 int intPrevValue = 7;
1073                 
1074                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
1075                 *wxSPropertyDataNameOut = wxT("TITLE");
1076                 *VCardV3Value = TRUE;
1077                 
1078                 if (ProcessItemData == TRUE){
1079                 
1080                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
1081                         
1082                 } else {
1083                         
1084                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
1085                         
1086                 }
1087                 
1088                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1089                 intiter != SplitPoints.end(); ++intiter){
1090                 
1091                         SLiter = SplitLength.find(intiter->first);
1092                 
1093                         if (ProcessItemData == TRUE){
1094                 
1095                                 if (FirstToken == TRUE){
1096                         
1097                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
1098                                         FirstToken = FALSE;
1099                         
1100                                 } else {
1101                                 
1102                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
1103                                 
1104                                 }
1105                         
1106                         } else {                        
1107                                 
1108                                 if (FirstToken == TRUE){
1109                         
1110                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
1111                                         FirstToken = FALSE;
1112                         
1113                                 } else {
1114                                 
1115                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
1116                                 
1117                                 }
1118                         
1119                         }
1120                         
1121                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1122                         PropertyName = PropertyElement.GetNextToken();                          
1123                         PropertyValue = PropertyElement.GetNextToken();
1125                         intPrevValue = intiter->second;
1126                         
1127                         // Process properties.
1128                         
1129                         if (PropertyName.IsEmpty()){
1130                         
1131                                 continue;
1132                         
1133                         }
1134                         
1135                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
1137                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1138                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1139         
1140                         } else {
1141                         
1142                                 PropertyDataMap->erase(PropertyName);
1143                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1144                                 PropertyLockMap->erase(PropertyName);
1145                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1146                         
1147                         }
1148                 
1149                 }
1150         
1151         }
1152         
1153         // FN
1154         
1155         if (wxSProperty == wxT("FN")){
1157                 if (ProcessItemData == TRUE){
1158         
1159                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
1160                 
1161                 } else {
1162                 
1163                         intPropertyLen = wxSPropertySeg1Ptr->Len();
1164                 
1165                 }
1166                 
1167                 std::map<int, int> SplitPoints;
1168                 std::map<int, int> SplitLength;
1169                 std::map<int, int>::iterator SLiter;                    
1170                 wxString PropertyData;
1171                 wxString PropertyName;
1172                 wxString PropertyValue;
1173                 wxString PropertyTokens;
1174                 bool FirstToken = TRUE;
1175                 int intPrevValue = 4;
1176                 
1177                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
1178                 *wxSPropertyDataNameOut = wxT("FN");
1179                 *VCardV3Value = TRUE;
1180                 
1181                 if (ProcessItemData == TRUE){
1182                 
1183                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
1184                         
1185                 } else {
1186                         
1187                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
1188                         
1189                 }
1190                 
1191                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1192                 intiter != SplitPoints.end(); ++intiter){
1193                 
1194                         SLiter = SplitLength.find(intiter->first);
1195                 
1196                         if (ProcessItemData == TRUE){
1197                 
1198                                 if (FirstToken == TRUE){
1199                         
1200                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
1201                                         FirstToken = FALSE;
1202                         
1203                                 } else {
1204                                 
1205                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
1206                                 
1207                                 }
1208                         
1209                         } else {                        
1210                                 
1211                                 if (FirstToken == TRUE){
1212                         
1213                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
1214                                         FirstToken = FALSE;
1215                         
1216                                 } else {
1217                                 
1218                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
1219                                 
1220                                 }
1221                         
1222                         }
1223                         
1224                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1225                         PropertyName = PropertyElement.GetNextToken();                          
1226                         PropertyValue = PropertyElement.GetNextToken();
1227                         
1228                         intPrevValue = intiter->second;
1229                         
1230                         // Process properties.
1231                         
1232                         if (PropertyName.IsEmpty()){
1233                         
1234                                 continue;
1235                         
1236                         }
1237                         
1238                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
1240                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1241                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1242         
1243                         } else {
1244                         
1245                                 PropertyDataMap->erase(PropertyName);
1246                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1247                                 PropertyLockMap->erase(PropertyName);
1248                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1249                         
1250                         }
1251                 
1252                 }
1253         
1254         }
1255         
1256         // N
1257         
1258         if (wxSProperty == wxT("N")){
1260                 if (ProcessItemData == TRUE){
1261         
1262                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
1263                 
1264                 } else {
1265                 
1266                         intPropertyLen = wxSPropertySeg1Ptr->Len();
1267                 
1268                 }
1269                 
1270                 std::map<int, int> SplitPoints;
1271                 std::map<int, int> SplitLength;
1272                 std::map<int, int>::iterator SLiter;                    
1273                 wxString PropertyData;
1274                 wxString PropertyName;
1275                 wxString PropertyValue;
1276                 wxString PropertyTokens;
1277                 bool FirstToken = TRUE;
1278         int intPrevValue = 3;
1279         
1280                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
1281                 *wxSPropertyDataNameOut = wxT("N");
1282                 *VCardV3Value = TRUE;
1283                 
1284                 if (ProcessItemData == TRUE){
1285                 
1286                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
1287                         
1288                 } else {
1289                         
1290                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
1291                         
1292                 }
1293                 
1294                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1295                 intiter != SplitPoints.end(); ++intiter){
1296                 
1297                         SLiter = SplitLength.find(intiter->first);
1298                 
1299                         if (ProcessItemData == TRUE){
1300                 
1301                                 if (FirstToken == TRUE){
1302                         
1303                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
1304                                         FirstToken = FALSE;
1305                         
1306                                 } else {
1307                                 
1308                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
1309                                 
1310                                 }
1311                         
1312                         } else {                        
1313                                 
1314                                 if (FirstToken == TRUE){
1315                         
1316                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
1317                                         FirstToken = FALSE;
1318                         
1319                                 } else {
1320                                 
1321                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
1322                                 
1323                                 }
1324                         
1325                         }
1326                         
1327                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1328                         PropertyName = PropertyElement.GetNextToken();                          
1329                         PropertyValue = PropertyElement.GetNextToken();
1330                         
1331                         intPrevValue = intiter->second;
1332                         
1333                         // Process properties.
1334                         
1335                         if (PropertyName.IsEmpty()){
1336                         
1337                                 continue;
1338                         
1339                         }
1340                         
1341                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
1343                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1344                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1345         
1346                         } else {
1347                         
1348                                 PropertyDataMap->erase(PropertyName);
1349                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1350                                 PropertyLockMap->erase(PropertyName);
1351                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1352                         
1353                         }
1354                 
1355                 }
1356         
1357         }
1358         
1359         // UID
1361         if (wxSProperty == wxT("UID")){
1363                 if (ProcessItemData == TRUE){
1364         
1365                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
1366                 
1367                 } else {
1368                 
1369                         intPropertyLen = wxSPropertySeg1Ptr->Len();
1370                 
1371                 }
1372                 
1373                 std::map<int, int> SplitPoints;
1374                 std::map<int, int> SplitLength;
1375                 std::map<int, int>::iterator SLiter;                    
1376                 wxString PropertyData;
1377                 wxString PropertyName;
1378                 wxString PropertyValue;
1379                 wxString PropertyTokens;
1380                 bool FirstToken = TRUE;
1381                 int intPrevValue = 5;
1382                 
1383                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
1384                 *wxSPropertyDataNameOut = wxT("UID");
1385                 *VCardV3Value = TRUE;
1386                 
1387                 if (ProcessItemData == TRUE){
1388                 
1389                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
1390                         
1391                 } else {
1392                         
1393                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
1394                         
1395                 }
1396                 
1397                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1398                 intiter != SplitPoints.end(); ++intiter){
1399                 
1400                         SLiter = SplitLength.find(intiter->first);
1401                 
1402                         if (ProcessItemData == TRUE){
1403                 
1404                                 if (FirstToken == TRUE){
1405                         
1406                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
1407                                         FirstToken = FALSE;
1408                         
1409                                 } else {
1410                                 
1411                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
1412                                 
1413                                 }
1414                         
1415                         } else {                        
1416                                 
1417                                 if (FirstToken == TRUE){
1418                         
1419                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
1420                                         FirstToken = FALSE;
1421                         
1422                                 } else {
1423                                 
1424                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
1425                                 
1426                                 }
1427                         
1428                         }
1429                         
1430                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1431                         PropertyName = PropertyElement.GetNextToken();                          
1432                         PropertyValue = PropertyElement.GetNextToken();
1433                         
1434                         intPrevValue = intiter->second;
1435                         
1436                         // Process properties.
1438                         if (PropertyName.IsEmpty()){
1439                         
1440                                 continue;
1441                         
1442                         }
1443                                                 
1444                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
1446                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1447                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1448         
1449                         } else {
1450                         
1451                                 PropertyDataMap->erase(PropertyName);
1452                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1453                                 PropertyLockMap->erase(PropertyName);
1454                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1455                         
1456                         }
1457                 
1458                 }
1459         
1460         }
1461         
1462         // NICKNAME
1463         
1464         if (wxSProperty == wxT("NICKNAME")){
1466                 if (ProcessItemData == TRUE){
1467         
1468                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
1469                 
1470                 } else {
1471                 
1472                         intPropertyLen = wxSPropertySeg1Ptr->Len();
1473                 
1474                 }
1475                 
1476                 std::map<int, int> SplitPoints;
1477                 std::map<int, int> SplitLength;
1478                 std::map<int, int>::iterator SLiter;                    
1479                 wxString PropertyData;
1480                 wxString PropertyName;
1481                 wxString PropertyValue;
1482                 wxString PropertyTokens;
1483                 bool FirstToken = TRUE;
1484                 int intPrevValue = 10;
1485                 
1486                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
1487                 *wxSPropertyDataNameOut = wxT("NICKNAME");
1488                 *VCardV3Value = TRUE;
1489                 
1490                 if (ProcessItemData == TRUE){
1491                 
1492                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
1493                         
1494                 } else {
1495                         
1496                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
1497                         
1498                 }
1499                 
1500                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1501                 intiter != SplitPoints.end(); ++intiter){
1502                 
1503                         SLiter = SplitLength.find(intiter->first);
1504                 
1505                         if (ProcessItemData == TRUE){
1506                 
1507                                 if (FirstToken == TRUE){
1508                         
1509                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
1510                                         FirstToken = FALSE;
1511                         
1512                                 } else {
1513                                 
1514                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
1515                                 
1516                                 }
1517                         
1518                         } else {                        
1519                                 
1520                                 if (FirstToken == TRUE){
1521                         
1522                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
1523                                         FirstToken = FALSE;
1524                         
1525                                 } else {
1526                                 
1527                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
1528                                 
1529                                 }
1530                         
1531                         }
1532                         
1533                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1534                         PropertyName = PropertyElement.GetNextToken();                          
1535                         PropertyValue = PropertyElement.GetNextToken();
1536                         
1537                         intPrevValue = intiter->second;
1538                         
1539                         // Process properties.
1541                         if (PropertyName.IsEmpty()){
1542                         
1543                                 continue;
1544                         
1545                         }
1546                                                 
1547                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
1549                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1550                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1551         
1552                         } else {
1553                         
1554                                 PropertyDataMap->erase(PropertyName);
1555                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1556                                 PropertyLockMap->erase(PropertyName);
1557                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1558                         
1559                         }
1560                 
1561                 }
1562         
1563         }
1564         
1565         // GENDER
1566         
1567         if (wxSProperty == wxT("GENDER")){
1569                 if (ProcessItemData == TRUE){
1570         
1571                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
1572                 
1573                 } else {
1574                 
1575                         intPropertyLen = wxSPropertySeg1Ptr->Len();
1576                 
1577                 }
1578                 
1579                 std::map<int, int> SplitPoints;
1580                 std::map<int, int> SplitLength;
1581                 std::map<int, int>::iterator SLiter;                    
1582                 wxString PropertyData;
1583                 wxString PropertyName;
1584                 wxString PropertyValue;
1585                 wxString PropertyTokens;
1586                 bool FirstToken = TRUE;
1587                 int intPrevValue = 8;
1588                 
1589                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
1590                 *wxSPropertyDataNameOut = wxT("GENDER");
1591                 *VCardV3Value = TRUE;
1592                 
1593                 if (ProcessItemData == TRUE){
1594                 
1595                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
1596                         
1597                 } else {
1598                         
1599                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
1600                         
1601                 }
1602                 
1603                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1604                 intiter != SplitPoints.end(); ++intiter){
1605                 
1606                         SLiter = SplitLength.find(intiter->first);
1607                 
1608                         if (ProcessItemData == TRUE){
1609                 
1610                                 if (FirstToken == TRUE){
1611                         
1612                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
1613                                         FirstToken = FALSE;
1614                         
1615                                 } else {
1616                                 
1617                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
1618                                 
1619                                 }
1620                         
1621                         } else {                        
1622                                 
1623                                 if (FirstToken == TRUE){
1624                         
1625                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
1626                                         FirstToken = FALSE;
1627                         
1628                                 } else {
1629                                 
1630                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
1631                                 
1632                                 }
1633                         
1634                         }
1635                         
1636                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1637                         PropertyName = PropertyElement.GetNextToken();                          
1638                         PropertyValue = PropertyElement.GetNextToken();
1640                         intPrevValue = intiter->second;
1641                         
1642                         // Process properties.
1643                         
1644                         if (PropertyName.IsEmpty()){
1645                         
1646                                 continue;
1647                         
1648                         }
1649                         
1650                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
1652                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1653                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1654         
1655                         } else {
1656                         
1657                                 PropertyDataMap->erase(PropertyName);
1658                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1659                                 PropertyLockMap->erase(PropertyName);
1660                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1661                         
1662                         }
1663                 
1664                 }
1665         
1666         }
1667         
1668         // BDAY
1669         
1670         if (wxSProperty == wxT("BDAY")){
1672                 if (ProcessItemData == TRUE){
1673         
1674                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
1675                 
1676                 } else {
1677                 
1678                         intPropertyLen = wxSPropertySeg1Ptr->Len();
1679                 
1680                 }
1681                 
1682                 std::map<int, int> SplitPoints;
1683                 std::map<int, int> SplitLength;
1684                 std::map<int, int>::iterator SLiter;                    
1685                 wxString PropertyData;
1686                 wxString PropertyName;
1687                 wxString PropertyValue;
1688                 wxString PropertyTokens;
1689                 wxString PropertyXOmitYear;
1690                 bool FirstToken = TRUE;
1691                 int intPrevValue = 6;
1692                 
1693                 *wxSPropertyDataNameOut = wxT("BDAY");
1694                 *VCardV3Value = TRUE;
1695                 
1696                 if (ProcessItemData == TRUE){
1697                 
1698                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
1699                         
1700                 } else {
1701                         
1702                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
1703                         
1704                 }
1705                 
1706                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1707                 intiter != SplitPoints.end(); ++intiter){
1708                 
1709                         SLiter = SplitLength.find(intiter->first);
1710                 
1711                         if (ProcessItemData == TRUE){
1712                 
1713                                 if (FirstToken == TRUE){
1714                         
1715                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
1716                                         FirstToken = FALSE;
1717                         
1718                                 } else {
1719                                 
1720                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
1721                                 
1722                                 }
1723                         
1724                         } else {                        
1725                                 
1726                                 if (FirstToken == TRUE){
1727                         
1728                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
1729                                         FirstToken = FALSE;
1730                         
1731                                 } else {
1732                                 
1733                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
1734                                 
1735                                 }
1736                         
1737                         }
1738                         
1739                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1740                         PropertyName = PropertyElement.GetNextToken();                          
1741                         PropertyValue = PropertyElement.GetNextToken();
1743                         intPrevValue = intiter->second;
1744                         
1745                         if (PropertyName == wxT("X-APPLE-OMIT-YEAR")){
1746                                 PropertyXOmitYear = PropertyValue;
1747                         }
1748                         
1749                         // Process properties.
1750                         
1751                         if (PropertyName.IsEmpty()){
1752                         
1753                                 continue;
1754                         
1755                         }
1756                         
1757                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
1759                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1760                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1761         
1762                         } else {
1763                         
1764                                 PropertyDataMap->erase(PropertyName);
1765                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1766                                 PropertyLockMap->erase(PropertyName);
1767                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1768                         
1769                         }
1770                 
1771                 }
1772                 
1773                 // Convert the date from YYYY-MM-DD to YYYYMMDD or --MMDD depending on if the
1774                 // year matches the X-APPLE-OMIT-YEAR value.
1775                 
1776                 wxStringTokenizer DateSplit(*wxSPropertySeg2Ptr, wxT("-"));
1777                 
1778                 wxString DateProc;
1779                 wxString FinalDate;
1780                 
1781                 DateProc = DateSplit.GetNextToken();
1782                 
1783                 if (DateProc == PropertyXOmitYear){
1784                 
1785                         FinalDate.Append(wxT("--"));
1786                 
1787                 } else {
1788                 
1789                         FinalDate.Append(DateProc);
1790                 
1791                 }
1792                 
1793                 DateProc.clear();
1794                 DateProc = DateSplit.GetNextToken();
1795                 
1796                 FinalDate.Append(DateProc);
1798                 DateProc.clear();
1799                 DateProc = DateSplit.GetNextToken();            
1800                 
1801                 FinalDate.Append(DateProc);
1802                 
1803                 wxSPropertyDataOut->Append(FinalDate);
1804         
1805         }
1806         
1807         // ANNIVERSARY
1808         
1809         if (wxSProperty == wxT("ANNIVERSARY")){
1811                 if (ProcessItemData == TRUE){
1812         
1813                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
1814                 
1815                 } else {
1816                 
1817                         intPropertyLen = wxSPropertySeg1Ptr->Len();
1818                 
1819                 }
1820                 
1821                 std::map<int, int> SplitPoints;
1822                 std::map<int, int> SplitLength;
1823                 std::map<int, int>::iterator SLiter;                    
1824                 wxString PropertyData;
1825                 wxString PropertyName;
1826                 wxString PropertyValue;
1827                 wxString PropertyTokens;
1828                 wxString PropertyXOmitYear;
1829                 bool FirstToken = TRUE;
1830                 int intPrevValue = 13;
1831                 
1832                 *wxSPropertyDataNameOut = wxT("ANNIVERSARY");
1833                 *VCardV3Value = TRUE;
1834                 
1835                 if (ProcessItemData == TRUE){
1836                 
1837                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
1838                         
1839                 } else {
1840                         
1841                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
1842                         
1843                 }
1844                 
1845                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1846                 intiter != SplitPoints.end(); ++intiter){
1847                 
1848                         SLiter = SplitLength.find(intiter->first);
1849                 
1850                         if (ProcessItemData == TRUE){
1851                 
1852                                 if (FirstToken == TRUE){
1853                         
1854                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
1855                                         FirstToken = FALSE;
1856                         
1857                                 } else {
1858                                 
1859                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
1860                                 
1861                                 }
1862                         
1863                         } else {                        
1864                                 
1865                                 if (FirstToken == TRUE){
1866                         
1867                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
1868                                         FirstToken = FALSE;
1869                         
1870                                 } else {
1871                                 
1872                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
1873                                 
1874                                 }
1875                         
1876                         }
1877                         
1878                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
1879                         PropertyName = PropertyElement.GetNextToken();                          
1880                         PropertyValue = PropertyElement.GetNextToken();
1881                         
1882                         intPrevValue = intiter->second;
1883                         
1884                         if (PropertyName == wxT("X-APPLE-OMIT-YEAR")){
1885                                 PropertyXOmitYear = PropertyValue;
1886                         }
1887                         
1888                         // Process properties.
1889                         
1890                         if (PropertyName.IsEmpty()){
1891                         
1892                                 continue;
1893                         
1894                         }
1895                         
1896                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
1898                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1899                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1900         
1901                         } else {
1902                         
1903                                 PropertyDataMap->erase(PropertyName);
1904                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
1905                                 PropertyLockMap->erase(PropertyName);
1906                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
1907                         
1908                         }
1909                 
1910                 }
1911                 
1912                 // Convert the date from YYYY-MM-DD to YYYYMMDD or --MMDD depending on if the
1913                 // year matches the X-APPLE-OMIT-YEAR value.
1914                 
1915                 wxStringTokenizer DateSplit(*wxSPropertySeg2Ptr, wxT("-"));
1916                 
1917                 wxString DateProc;
1918                 wxString FinalDate;
1919                 
1920                 DateProc = DateSplit.GetNextToken();
1921                 
1922                 if (DateProc == PropertyXOmitYear){
1923                 
1924                         FinalDate.Append(wxT("--"));
1925                 
1926                 } else {
1927                 
1928                         FinalDate.Append(DateProc);
1929                 
1930                 }
1931                 
1932                 DateProc.clear();
1933                 DateProc = DateSplit.GetNextToken();
1934                 
1935                 FinalDate.Append(DateProc);
1937                 DateProc.clear();
1938                 DateProc = DateSplit.GetNextToken();            
1939                 
1940                 FinalDate.Append(DateProc);
1941                 
1942                 wxSPropertyDataOut->Append(FinalDate);
1943         
1944         }
1945         
1946         // TZ - Not sure how to process this correctly. So data
1947         // is kept as X-VCARD3-TZ for the time being.
1948         
1949         if (wxSProperty == wxT("TZ")){
1951                 if (ProcessItemData == TRUE){
1952         
1953                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
1954                 
1955                 } else {
1956                 
1957                         intPropertyLen = wxSPropertySeg1Ptr->Len();
1958                 
1959                 }
1960                 
1961                 std::map<int, int> SplitPoints;
1962                 std::map<int, int> SplitLength;
1963                 std::map<int, int>::iterator SLiter;                    
1964                 wxString PropertyData;
1965                 wxString PropertyName;
1966                 wxString PropertyValue;
1967                 wxString PropertyTokens;
1968                 wxString PropertyXOmitYear;
1969                 bool FirstToken = TRUE;
1970                 int intPrevValue = 4;
1971                 
1972                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
1973                 *wxSPropertyDataNameOut = wxT("X-VCARD3-TZ");
1974                 *VCardV3Value = TRUE;
1975                 
1976                 if (ProcessItemData == TRUE){
1977                 
1978                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
1979                         
1980                 } else {
1981                         
1982                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
1983                         
1984                 }
1985                 
1986                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
1987                 intiter != SplitPoints.end(); ++intiter){
1988                 
1989                         SLiter = SplitLength.find(intiter->first);
1990                 
1991                         if (ProcessItemData == TRUE){
1992                 
1993                                 if (FirstToken == TRUE){
1994                         
1995                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
1996                                         FirstToken = FALSE;
1997                         
1998                                 } else {
1999                                 
2000                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
2001                                 
2002                                 }
2003                         
2004                         } else {                        
2005                                 
2006                                 if (FirstToken == TRUE){
2007                         
2008                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
2009                                         FirstToken = FALSE;
2010                         
2011                                 } else {
2012                                 
2013                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
2014                                 
2015                                 }
2016                         
2017                         }
2018                         
2019                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2020                         PropertyName = PropertyElement.GetNextToken();                          
2021                         PropertyValue = PropertyElement.GetNextToken();
2023                         intPrevValue = intiter->second;
2024                         
2025                         // Process properties.
2026                         
2027                         if (PropertyName.IsEmpty()){
2028                         
2029                                 continue;
2030                         
2031                         }
2032                         
2033                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
2035                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2036                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2037         
2038                         } else {
2039                         
2040                                 PropertyDataMap->erase(PropertyName);
2041                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2042                                 PropertyLockMap->erase(PropertyName);
2043                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2044                         
2045                         }
2046                 
2047                 }
2048         
2049         }
2050         
2051         // ROLE
2052         
2053         if (wxSProperty == wxT("ROLE")){
2055                 if (ProcessItemData == TRUE){
2056         
2057                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
2058                 
2059                 } else {
2060                 
2061                         intPropertyLen = wxSPropertySeg1Ptr->Len();
2062                 
2063                 }
2064                 
2065                 std::map<int, int> SplitPoints;
2066                 std::map<int, int> SplitLength;
2067                 std::map<int, int>::iterator SLiter;                    
2068                 wxString PropertyData;
2069                 wxString PropertyName;
2070                 wxString PropertyValue;
2071                 wxString PropertyTokens;
2072                 wxString PropertyXOmitYear;
2073                 bool FirstToken = TRUE;
2074                 int intPrevValue = 6;
2075                 
2076                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
2077                 *wxSPropertyDataNameOut = wxT("ROLE");
2078                 *VCardV3Value = TRUE;
2079                 
2080                 if (ProcessItemData == TRUE){
2081                 
2082                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
2083                         
2084                 } else {
2085                         
2086                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
2087                         
2088                 }
2089                 
2090                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2091                 intiter != SplitPoints.end(); ++intiter){
2092                 
2093                         SLiter = SplitLength.find(intiter->first);
2094                 
2095                         if (ProcessItemData == TRUE){
2096                 
2097                                 if (FirstToken == TRUE){
2098                         
2099                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
2100                                         FirstToken = FALSE;
2101                         
2102                                 } else {
2103                                 
2104                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
2105                                 
2106                                 }
2107                         
2108                         } else {                        
2109                                 
2110                                 if (FirstToken == TRUE){
2111                         
2112                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
2113                                         FirstToken = FALSE;
2114                         
2115                                 } else {
2116                                 
2117                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
2118                                 
2119                                 }
2120                         
2121                         }
2122                         
2123                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2124                         PropertyName = PropertyElement.GetNextToken();                          
2125                         PropertyValue = PropertyElement.GetNextToken();
2127                         intPrevValue = intiter->second;
2128                         
2129                         // Process properties.
2130                         
2131                         if (PropertyName.IsEmpty()){
2132                         
2133                                 continue;
2134                         
2135                         }
2136                         
2137                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
2139                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2140                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2141         
2142                         } else {
2143                         
2144                                 PropertyDataMap->erase(PropertyName);
2145                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2146                                 PropertyLockMap->erase(PropertyName);
2147                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2148                         
2149                         }
2150                 
2151                 }
2152         
2153         }
2154         
2155         // ORG
2156         
2157         if (wxSProperty == wxT("ORG")){
2159                 if (ProcessItemData == TRUE){
2160         
2161                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
2162                 
2163                 } else {
2164                 
2165                         intPropertyLen = wxSPropertySeg1Ptr->Len();
2166                 
2167                 }
2168                 
2169                 std::map<int, int> SplitPoints;
2170                 std::map<int, int> SplitLength;
2171                 std::map<int, int>::iterator SLiter;                    
2172                 wxString PropertyData;
2173                 wxString PropertyName;
2174                 wxString PropertyValue;
2175                 wxString PropertyTokens;
2176                 wxString PropertyXOmitYear;
2177                 bool FirstToken = TRUE;
2178                 int intPrevValue = 5;
2179                 
2180                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
2181                 *wxSPropertyDataNameOut = wxT("ORG");
2182                 *VCardV3Value = TRUE;
2183                 
2184                 if (ProcessItemData == TRUE){
2185                 
2186                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
2187                         
2188                 } else {
2189                         
2190                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
2191                         
2192                 }
2193                 
2194                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2195                 intiter != SplitPoints.end(); ++intiter){
2196                 
2197                         SLiter = SplitLength.find(intiter->first);
2198                 
2199                         if (ProcessItemData == TRUE){
2200                 
2201                                 if (FirstToken == TRUE){
2202                         
2203                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
2204                                         FirstToken = FALSE;
2205                         
2206                                 } else {
2207                                 
2208                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
2209                                 
2210                                 }
2211                         
2212                         } else {                        
2213                                 
2214                                 if (FirstToken == TRUE){
2215                         
2216                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
2217                                         FirstToken = FALSE;
2218                         
2219                                 } else {
2220                                 
2221                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
2222                                 
2223                                 }
2224                         
2225                         }
2226                         
2227                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2228                         PropertyName = PropertyElement.GetNextToken();                          
2229                         PropertyValue = PropertyElement.GetNextToken();
2231                         intPrevValue = intiter->second;
2232                         
2233                         // Process properties.
2234                         
2235                         if (PropertyName.IsEmpty()){
2236                         
2237                                 continue;
2238                         
2239                         }
2240                         
2241                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
2243                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2244                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2245         
2246                         } else {
2247                         
2248                                 PropertyDataMap->erase(PropertyName);
2249                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2250                                 PropertyLockMap->erase(PropertyName);
2251                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2252                         
2253                         }
2254                 
2255                 }
2256         
2257         }
2258         
2259         // NOTE
2260         
2261         if (wxSProperty == wxT("NOTE")){
2263                 if (ProcessItemData == TRUE){
2264         
2265                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
2266                 
2267                 } else {
2268                 
2269                         intPropertyLen = wxSPropertySeg1Ptr->Len();
2270                 
2271                 }
2272                 
2273                 std::map<int, int> SplitPoints;
2274                 std::map<int, int> SplitLength;
2275                 std::map<int, int>::iterator SLiter;                    
2276                 wxString PropertyData;
2277                 wxString PropertyName;
2278                 wxString PropertyValue;
2279                 wxString PropertyTokens;
2280                 wxString PropertyXOmitYear;
2281                 bool FirstToken = TRUE;
2282                 int intPrevValue = 6;
2283                 
2284                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
2285                 *wxSPropertyDataNameOut = wxT("NOTE");
2286                 *VCardV3Value = TRUE;
2287                 
2288                 if (ProcessItemData == TRUE){
2289                 
2290                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
2291                         
2292                 } else {
2293                         
2294                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
2295                         
2296                 }
2297                 
2298                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2299                 intiter != SplitPoints.end(); ++intiter){
2300                 
2301                         SLiter = SplitLength.find(intiter->first);
2302                 
2303                         if (ProcessItemData == TRUE){
2304                 
2305                                 if (FirstToken == TRUE){
2306                         
2307                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
2308                                         FirstToken = FALSE;
2309                         
2310                                 } else {
2311                                 
2312                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
2313                                 
2314                                 }
2315                         
2316                         } else {                        
2317                                 
2318                                 if (FirstToken == TRUE){
2319                         
2320                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
2321                                         FirstToken = FALSE;
2322                         
2323                                 } else {
2324                                 
2325                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
2326                                 
2327                                 }
2328                         
2329                         }
2330                         
2331                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2332                         PropertyName = PropertyElement.GetNextToken();                          
2333                         PropertyValue = PropertyElement.GetNextToken();
2335                         intPrevValue = intiter->second;
2336                         
2337                         // Process properties.
2338                         
2339                         if (PropertyName.IsEmpty()){
2340                         
2341                                 continue;
2342                         
2343                         }
2344                         
2345                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
2347                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2348                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2349         
2350                         } else {
2351                         
2352                                 PropertyDataMap->erase(PropertyName);
2353                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2354                                 PropertyLockMap->erase(PropertyName);
2355                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2356                         
2357                         }
2358                 
2359                 }
2360         
2361         }
2362         
2363         // PHOTO
2364         
2365         if (wxSProperty == wxT("PHOTO")){
2366                 
2367                 if (ProcessItemData == TRUE){
2368         
2369                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
2370                 
2371                 } else {
2372                 
2373                         intPropertyLen = wxSPropertySeg1Ptr->Len();
2374                 
2375                 }
2376                 
2377                 std::map<int, int> SplitPoints;
2378                 std::map<int, int> SplitLength;
2379                 std::map<int, int>::iterator SLiter;
2380                 std::map<wxString, wxString> SplitData;                         
2381                 wxString PropertyData;
2382                 wxString PropertyName;
2383                 wxString PropertyValue;
2384                 wxString PropertyTokens;
2385                 wxString PropertyXOmitYear;
2386                 int intPrevValue = 7;
2387                 
2388                 *wxSPropertyDataNameOut = wxT("PHOTO");
2389                 *VCardV3Value = TRUE;
2390                 
2391                 if (ProcessItemData == TRUE){
2392                 
2393                         SplitValuesData(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue, &SplitData);
2394                         
2395                 } else {
2396                         
2397                         SplitValuesData(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue, &SplitData);
2398                         
2399                 }
2400                 
2401                 wxString wxSMIMEType;
2402                 wxString wxSEncType;
2403                 
2404                 for (std::map<wxString, wxString>::iterator intiter = SplitData.begin();
2405                 intiter != SplitData.end(); ++intiter){
2406                 
2407                         PropertyName = intiter->first;                          
2408                         PropertyValue = intiter->second;
2410                         if (PropertyName == wxT("ENCODING") && PropertyValue == wxT("b")){
2411                                 wxSEncType = wxT("base64");
2412                                 continue;
2413                         }
2414                         
2415                         if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("PNG")){
2416                                 wxSMIMEType = wxT("image/png");
2417                                 continue;
2418                         } else if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("JPEG")){
2419                                 wxSMIMEType = wxT("image/jpeg");
2420                                 continue;
2421                         } else if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("GIF")){
2422                                 wxSMIMEType = wxT("image/gif");
2423                                 continue;
2424                         } else if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("BMP")){
2425                                 wxSMIMEType = wxT("image/bmp");
2426                                 continue;
2427                         } else if (PropertyName == wxT("TYPE") || PropertyName == wxT("type")) {
2428                                 wxSMIMEType = wxT("image/unknown");
2429                                 continue;
2430                         }
2432                         // Process properties.
2433                         
2434                         if (PropertyName.IsEmpty()){
2435                         
2436                                 continue;
2437                         
2438                         }
2439                         
2440                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
2442                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2443                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2444         
2445                         } else {
2446                         
2447                                 PropertyDataMap->erase(PropertyName);
2448                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2449                                 PropertyLockMap->erase(PropertyName);
2450                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2451                         
2452                         }
2453                 
2454                 }
2455                 
2456                 wxSPropertyDataOut->Append(wxT("data:"));
2457                 wxSPropertyDataOut->Append(wxSMIMEType);
2458                 wxSPropertyDataOut->Append(wxT(";"));
2459                 wxSPropertyDataOut->Append(wxSEncType);
2460                 wxSPropertyDataOut->Append(wxT(","));
2461                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
2462         
2463         }
2464         
2465         // SOUND
2466         
2467         if (wxSProperty == wxT("SOUND")){
2468         
2469                 if (ProcessItemData == TRUE){
2470         
2471                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
2472                 
2473                 } else {
2474                 
2475                         intPropertyLen = wxSPropertySeg1Ptr->Len();
2476                 
2477                 }
2478                 
2479                 std::map<int, int> SplitPoints;
2480                 std::map<int, int> SplitLength;
2481                 std::map<int, int>::iterator SLiter;                    
2482                 wxString PropertyData;
2483                 wxString PropertyName;
2484                 wxString PropertyValue;
2485                 wxString PropertyTokens;
2486                 wxString PropertyXOmitYear;
2487                 bool FirstToken = TRUE;
2488                 int intPrevValue = 7;
2489                 
2490                 *wxSPropertyDataNameOut = wxT("SOUND");
2491                 *VCardV3Value = TRUE;
2492                 
2493                 if (ProcessItemData == TRUE){
2494                 
2495                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
2496                         
2497                 } else {
2498                         
2499                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
2500                         
2501                 }
2502                 
2503                 wxString wxSMIMEType;
2504                 wxString wxSEncType;
2505                 
2506                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2507                 intiter != SplitPoints.end(); ++intiter){
2508                 
2509                         SLiter = SplitLength.find(intiter->first);
2510                 
2511                         if (ProcessItemData == TRUE){
2512                 
2513                                 if (FirstToken == TRUE){
2514                         
2515                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
2516                                         FirstToken = FALSE;
2517                         
2518                                 } else {
2519                                 
2520                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
2521                                 
2522                                 }
2523                         
2524                         } else {                        
2525                                 
2526                                 if (FirstToken == TRUE){
2527                         
2528                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
2529                                         FirstToken = FALSE;
2530                         
2531                                 } else {
2532                                 
2533                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
2534                                 
2535                                 }
2536                         
2537                         }
2538                         
2539                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2540                         PropertyName = PropertyElement.GetNextToken();                          
2541                         PropertyValue = PropertyElement.GetNextToken();
2543                         if (PropertyName == wxT("ENCODING") && PropertyValue == wxT("b")){
2544                                 wxSEncType = wxT("base64");
2545                                 continue;
2546                         }
2547                         
2548                         if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type"))){
2549                                 wxSMIMEType = PropertyValue;
2550                                 continue;
2551                         }
2552                         
2553                         intPrevValue = intiter->second;
2554                         
2555                         // Process properties.
2556                         
2557                         if (PropertyName.IsEmpty()){
2558                         
2559                                 continue;
2560                         
2561                         }
2562                         
2563                         if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
2565                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2566                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2567         
2568                         } else {
2569                         
2570                                 PropertyDataMap->erase(PropertyName);
2571                                 PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2572                                 PropertyLockMap->erase(PropertyName);
2573                                 PropertyLockMap->insert(std::make_pair(PropertyName, TRUE));
2574                         
2575                         }
2576                 
2577                 }
2578                 
2579                 wxSPropertyDataOut->Append(wxT("data:"));
2580                 wxSPropertyDataOut->Append(wxSMIMEType);
2581                 wxSPropertyDataOut->Append(wxT(";"));
2582                 wxSPropertyDataOut->Append(wxSEncType);
2583                 wxSPropertyDataOut->Append(wxT(","));
2584                 wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr);
2585         
2586         }
2587         
2588         // Look for backward compatability vCard 4.0 properties.
2589         
2590         // X-VCARD4-FN
2591         
2592         if (wxSProperty == wxT("X-VCARD4-FN")){
2593         
2594                 if (ProcessItemData == TRUE){
2595         
2596                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
2597                 
2598                 } else {
2599                 
2600                         intPropertyLen = wxSPropertySeg1Ptr->Len();
2601                                 *wxSPropertyDataNameOut = wxT("FN");
2602                 
2603                 }
2604                 
2605                 std::map<int, int> SplitPoints;
2606                 std::map<int, int> SplitLength;
2607                 std::map<int, int>::iterator SLiter;
2608                 std::map<wxString, bool>::iterator BIter;;                      
2609                 wxString PropertyData;
2610                 wxString PropertyName;
2611                 wxString PropertyValue;
2612                 wxString PropertyTokens;
2613                 bool FirstToken = TRUE;
2614                 int intPrevValue = 13;
2616                 if (ProcessItemData == TRUE){
2617                 
2618                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
2619                         
2620                 } else {
2621                         
2622                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
2623                         
2624                 }
2625                 
2626                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2627                 intiter != SplitPoints.end(); ++intiter){
2628                 
2629                         SLiter = SplitLength.find(intiter->first);
2630                 
2631                         if (ProcessItemData == TRUE){
2633                                 if (FirstToken == TRUE){
2634                 
2635                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
2636                                         FirstToken = FALSE;
2637                                 
2638                                 } else {
2639                                 
2640                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
2641                                 
2642                                 }
2643                         
2644                         } else {
2645                         
2646                                 if (FirstToken == TRUE){
2647                         
2648                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
2649                                         FirstToken = FALSE;
2650                                                                 
2651                                 } else {
2652                                 
2653                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
2654                                         
2655                                 }
2656                         
2657                         }
2658                         
2659                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2660                         PropertyName = PropertyElement.GetNextToken();                          
2661                         PropertyValue = PropertyElement.GetNextToken();
2662                         
2663                         intPrevValue = intiter->second;
2664                         
2665                         // Process properties.
2666                         
2667                         // Check if there is a lock on the property value. If there is a lock then
2668                         // the property value cannot be changed.
2669                         
2670                         if (PropertyName.IsEmpty()){
2671                         
2672                                 continue;
2673                         
2674                         }
2675                         
2676                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
2677                         
2678                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
2679                         
2680                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2681                         
2682                                 } else {
2683                         
2684                                         PropertyDataMap->erase(PropertyName);
2685                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2686                         
2687                                 }
2688                                 
2689                         }
2691                 }
2692                 
2693                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
2694                 *XVCardV4Value = TRUE;
2695                                 
2696         }
2697         
2698         // X-VCARD4-N
2699         
2700         if (wxSProperty == wxT("X-VCARD4-N")){
2702                 if (ProcessItemData == TRUE){
2703         
2704                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
2705                 
2706                 } else {
2707                 
2708                         intPropertyLen = wxSPropertySeg1Ptr->Len();
2709                 
2710                 }
2711                 
2712                 std::map<int, int> SplitPoints;
2713                 std::map<int, int> SplitLength;
2714                 std::map<int, int>::iterator SLiter;
2715                 std::map<wxString, bool>::iterator BIter;;                      
2716                 wxString PropertyData;
2717                 wxString PropertyName;
2718                 wxString PropertyValue;
2719                 wxString PropertyTokens;
2720         bool FirstToken = TRUE;
2721                 int intPrevValue = 12;
2723                 if (ProcessItemData == TRUE){
2724                 
2725                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
2726                         
2727                 } else {
2728                         
2729                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
2730                         *wxSPropertyDataNameOut = wxT("N");
2731                         
2732                 }
2733                 
2734                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2735                 intiter != SplitPoints.end(); ++intiter){
2736                 
2737                         SLiter = SplitLength.find(intiter->first);
2738                 
2739                         if (ProcessItemData == TRUE){
2741                                 if (FirstToken == TRUE){
2742                 
2743                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
2744                                         FirstToken = FALSE;
2745                                 
2746                                 } else {
2747                                 
2748                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
2749                                 
2750                                 }
2751                         
2752                         } else {
2753                         
2754                                 if (FirstToken == TRUE){
2755                         
2756                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
2757                                         FirstToken = FALSE;
2758                                                                 
2759                                 } else {
2760                                 
2761                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
2762                                         
2763                                 }
2764                         
2765                         }
2766                         
2767                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2768                         PropertyName = PropertyElement.GetNextToken();                          
2769                         PropertyValue = PropertyElement.GetNextToken();
2771                         intPrevValue = intiter->second;
2772                         
2773                         // Process properties.
2774                         
2775                         // Check if there is a lock on the property value. If there is a lock then
2776                         // the property value cannot be changed.
2777                         
2778                         if (PropertyName.IsEmpty()){
2779                         
2780                                 continue;
2781                         
2782                         }
2783                         
2784                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
2785                         
2786                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
2787                         
2788                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2789                         
2790                                 } else {
2791                         
2792                                         PropertyDataMap->erase(PropertyName);
2793                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2794                         
2795                                 }
2796                                 
2797                         }
2798                         
2799                 }
2800                 
2801                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
2802                 *XVCardV4Value = TRUE;
2803                                 
2804         }
2805         
2806         // X-VCARD4-NICKNAME
2807         
2808         if (wxSProperty == wxT("X-VCARD4-NICKNAME")){
2810                 if (ProcessItemData == TRUE){
2811         
2812                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
2813                 
2814                 } else {
2815                 
2816                         intPropertyLen = wxSPropertySeg1Ptr->Len();
2817                 
2818                 }
2819                 
2820                 std::map<int, int> SplitPoints;
2821                 std::map<int, int> SplitLength;
2822                 std::map<int, int>::iterator SLiter;
2823                 std::map<wxString, bool>::iterator BIter;;                      
2824                 wxString PropertyData;
2825                 wxString PropertyName;
2826                 wxString PropertyValue;
2827                 wxString PropertyTokens;
2828                 bool FirstToken = TRUE;
2829                 int intPrevValue = 19;
2831                 if (ProcessItemData == TRUE){
2832                 
2833                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
2834                         
2835                 } else {
2836                         
2837                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
2838                         *wxSPropertyDataNameOut = wxT("NICKNAME");
2839                         
2840                 }
2841                 
2842                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2843                 intiter != SplitPoints.end(); ++intiter){
2844                 
2845                         SLiter = SplitLength.find(intiter->first);
2846                 
2847                         if (ProcessItemData == TRUE){
2849                                 if (FirstToken == TRUE){
2850                 
2851                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
2852                                         FirstToken = FALSE;
2853                                 
2854                                 } else {
2855                                 
2856                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
2857                                 
2858                                 }
2859                         
2860                         } else {
2861                         
2862                                 if (FirstToken == TRUE){
2863                         
2864                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
2865                                         FirstToken = FALSE;
2866                                                                 
2867                                 } else {
2868                                 
2869                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
2870                                         
2871                                 }
2872                         
2873                         }
2874                         
2875                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2876                         PropertyName = PropertyElement.GetNextToken();                          
2877                         PropertyValue = PropertyElement.GetNextToken();
2878                         
2879                         intPrevValue = intiter->second;
2880                         
2881                         // Process properties.
2882                         
2883                         // Check if there is a lock on the property value. If there is a lock then
2884                         // the property value cannot be changed.
2885                         
2886                         if (PropertyName.IsEmpty()){
2887                         
2888                                 continue;
2889                         
2890                         }
2891                         
2892                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
2893                         
2894                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
2895                         
2896                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2897                         
2898                                 } else {
2899                         
2900                                         PropertyDataMap->erase(PropertyName);
2901                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
2902                         
2903                                 }
2904                                 
2905                         }
2906                 
2907                 }
2908                 
2909                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
2910                 *XVCardV4Value = TRUE;
2911                                 
2912         }
2913         
2914         // X-VCARD4-GENDER
2915         
2916         if (wxSProperty == wxT("X-VCARD4-GENDER")){
2918                 if (ProcessItemData == TRUE){
2919         
2920                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
2921                 
2922                 } else {
2923                 
2924                         intPropertyLen = wxSPropertySeg1Ptr->Len();
2925                 
2926                 }
2927                 
2928                 std::map<int, int> SplitPoints;
2929                 std::map<int, int> SplitLength;
2930                 std::map<int, int>::iterator SLiter;
2931                 std::map<wxString, bool>::iterator BIter;;                      
2932                 wxString PropertyData;
2933                 wxString PropertyName;
2934                 wxString PropertyValue;
2935                 wxString PropertyTokens;
2936                 bool FirstToken = TRUE;
2937                 int intPrevValue = 17;
2939                 if (ProcessItemData == TRUE){
2940                 
2941                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
2942                         
2943                 } else {
2944                         
2945                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
2946                         *wxSPropertyDataNameOut = wxT("GENDER");
2947                         
2948                 }
2949                 
2950                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
2951                 intiter != SplitPoints.end(); ++intiter){
2952                 
2953                         SLiter = SplitLength.find(intiter->first);
2954                 
2955                         if (ProcessItemData == TRUE){
2957                                 if (FirstToken == TRUE){
2958                 
2959                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
2960                                         FirstToken = FALSE;
2961                                 
2962                                 } else {
2963                                 
2964                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
2965                                 
2966                                 }
2967                         
2968                         } else {
2969                         
2970                                 if (FirstToken == TRUE){
2971                         
2972                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
2973                                         FirstToken = FALSE;
2974                                                                 
2975                                 } else {
2976                                 
2977                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
2978                                         
2979                                 }
2980                         
2981                         }
2982                         
2983                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
2984                         PropertyName = PropertyElement.GetNextToken();                          
2985                         PropertyValue = PropertyElement.GetNextToken();
2986                         
2987                         //ProcessCaptureStrings(&PropertyValue);
2988                         
2989                         intPrevValue = intiter->second;
2990                         
2991                         // Process properties.
2992                         
2993                         // Check if there is a lock on the property value. If there is a lock then
2994                         // the property value cannot be changed.
2995                         
2996                         if (PropertyName.IsEmpty()){
2997                         
2998                                 continue;
2999                         
3000                         }
3001                         
3002                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3003                         
3004                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3005                         
3006                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3007                         
3008                                 } else {
3009                         
3010                                         PropertyDataMap->erase(PropertyName);
3011                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3012                         
3013                                 }
3014                                 
3015                         }
3016                 
3017                 }
3018                 
3019                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3020                 *XVCardV4Value = TRUE;
3021                                 
3022         }
3023         
3024         // X-VCARD4-BDAY
3025         
3026         if (wxSProperty == wxT("X-VCARD4-BDAY")){
3028                 if (ProcessItemData == TRUE){
3029         
3030                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
3031                 
3032                 } else {
3033                 
3034                         intPropertyLen = wxSPropertySeg1Ptr->Len();
3035                 
3036                 }
3037                 
3038                 std::map<int, int> SplitPoints;
3039                 std::map<int, int> SplitLength;
3040                 std::map<int, int>::iterator SLiter;
3041                 std::map<wxString, bool>::iterator BIter;;                      
3042                 wxString PropertyData;
3043                 wxString PropertyName;
3044                 wxString PropertyValue;
3045                 wxString PropertyTokens;
3046                 bool FirstToken = TRUE;
3047                 int intPrevValue = 15;
3049                 if (ProcessItemData == TRUE){
3050                 
3051                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
3052                         
3053                 } else {
3054                         
3055                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
3056                         *wxSPropertyDataNameOut = wxT("BDAY");
3057                         
3058                 }
3059                 
3060                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3061                 intiter != SplitPoints.end(); ++intiter){
3062                 
3063                         SLiter = SplitLength.find(intiter->first);
3064                 
3065                         if (ProcessItemData == TRUE){
3067                                 if (FirstToken == TRUE){
3068                 
3069                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
3070                                         FirstToken = FALSE;
3071                                 
3072                                 } else {
3073                                 
3074                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
3075                                 
3076                                 }
3077                         
3078                         } else {
3079                         
3080                                 if (FirstToken == TRUE){
3081                         
3082                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
3083                                         FirstToken = FALSE;
3084                                                                 
3085                                 } else {
3086                                 
3087                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
3088                                         
3089                                 }
3090                         
3091                         }
3092                         
3093                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3094                         PropertyName = PropertyElement.GetNextToken();                          
3095                         PropertyValue = PropertyElement.GetNextToken();
3097                         intPrevValue = intiter->second;
3098                         
3099                         // Process properties.
3100                         
3101                         // Check if there is a lock on the property value. If there is a lock then
3102                         // the property value cannot be changed.
3103                         
3104                         if (PropertyName.IsEmpty()){
3105                         
3106                                 continue;
3107                         
3108                         }
3109                         
3110                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3111                         
3112                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3113                         
3114                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3115                         
3116                                 } else {
3117                         
3118                                         PropertyDataMap->erase(PropertyName);
3119                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3120                         
3121                                 }
3122                                 
3123                         }
3125                 }
3126                 
3127                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3128                 *XVCardV4Value = TRUE;
3129                                 
3130         }
3132         // X-VCARD4-ANNIVERSARY
3133         
3134         if (wxSProperty == wxT("X-VCARD4-ANNIVERSARY")){
3136                 if (ProcessItemData == TRUE){
3137         
3138                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
3139                 
3140                 } else {
3141                 
3142                         intPropertyLen = wxSPropertySeg1Ptr->Len();
3143                 
3144                 }
3145                 
3146                 std::map<int, int> SplitPoints;
3147                 std::map<int, int> SplitLength;
3148                 std::map<int, int>::iterator SLiter;
3149                 std::map<wxString, bool>::iterator BIter;;                      
3150                 wxString PropertyData;
3151                 wxString PropertyName;
3152                 wxString PropertyValue;
3153                 wxString PropertyTokens;
3154                 bool FirstToken = TRUE;
3155                 int intPrevValue = 22;
3157                 if (ProcessItemData == TRUE){
3158                 
3159                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
3160                         
3161                 } else {
3162                         
3163                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
3164                         *wxSPropertyDataNameOut = wxT("ANNIVERSARY");
3165                         
3166                 }
3167                 
3168                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3169                 intiter != SplitPoints.end(); ++intiter){
3170                 
3171                         SLiter = SplitLength.find(intiter->first);
3172                 
3173                         if (ProcessItemData == TRUE){
3175                                 if (FirstToken == TRUE){
3176                 
3177                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
3178                                         FirstToken = FALSE;
3179                                 
3180                                 } else {
3181                                 
3182                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
3183                                 
3184                                 }
3185                         
3186                         } else {
3187                         
3188                                 if (FirstToken == TRUE){
3189                         
3190                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
3191                                         FirstToken = FALSE;
3192                                                                 
3193                                 } else {
3194                                 
3195                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
3196                                         
3197                                 }
3198                         
3199                         }
3200                         
3201                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3202                         PropertyName = PropertyElement.GetNextToken();                          
3203                         PropertyValue = PropertyElement.GetNextToken();
3205                         intPrevValue = intiter->second;
3206                         
3207                         // Process properties.
3208                         
3209                         // Check if there is a lock on the property value. If there is a lock then
3210                         // the property value cannot be changed.
3211                         
3212                         if (PropertyName.IsEmpty()){
3213                         
3214                                 continue;
3215                         
3216                         }
3217                         
3218                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3219                         
3220                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3221                         
3222                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3223                         
3224                                 } else {
3225                         
3226                                         PropertyDataMap->erase(PropertyName);
3227                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3228                         
3229                                 }
3230                                 
3231                         }
3233                 }
3234                 
3235                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3236                 *XVCardV4Value = TRUE;
3237                                 
3238         }
3240         // X-VCARD4-TZ
3241         
3242         if (wxSProperty == wxT("X-VCARD4-TZ")){
3244                 if (ProcessItemData == TRUE){
3245         
3246                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
3247                 
3248                 } else {
3249                 
3250                         intPropertyLen = wxSPropertySeg1Ptr->Len();
3251                 
3252                 }
3253                 
3254                 std::map<int, int> SplitPoints;
3255                 std::map<int, int> SplitLength;
3256                 std::map<int, int>::iterator SLiter;
3257                 std::map<wxString, bool>::iterator BIter;;                      
3258                 wxString PropertyData;
3259                 wxString PropertyName;
3260                 wxString PropertyValue;
3261                 wxString PropertyTokens;
3262                 bool FirstToken = TRUE;
3263                 int intPrevValue = 13;
3265                 if (ProcessItemData == TRUE){
3266                 
3267                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
3268                         
3269                 } else {
3270                         
3271                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
3272                         *wxSPropertyDataNameOut = wxT("TZ");
3273                         
3274                 }
3275                 
3276                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3277                 intiter != SplitPoints.end(); ++intiter){
3278                 
3279                         SLiter = SplitLength.find(intiter->first);
3280                 
3281                         if (ProcessItemData == TRUE){
3283                                 if (FirstToken == TRUE){
3284                 
3285                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
3286                                         FirstToken = FALSE;
3287                                 
3288                                 } else {
3289                                 
3290                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
3291                                 
3292                                 }
3293                         
3294                         } else {
3295                         
3296                                 if (FirstToken == TRUE){
3297                         
3298                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
3299                                         FirstToken = FALSE;
3300                                                                 
3301                                 } else {
3302                                 
3303                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
3304                                         
3305                                 }
3306                         
3307                         }
3308                         
3309                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3310                         PropertyName = PropertyElement.GetNextToken();                          
3311                         PropertyValue = PropertyElement.GetNextToken();
3312                         
3313                         intPrevValue = intiter->second;
3314                         
3315                         // Process properties.
3316                         
3317                         // Check if there is a lock on the property value. If there is a lock then
3318                         // the property value cannot be changed.
3319                         
3320                         if (PropertyName.IsEmpty()){
3321                         
3322                                 continue;
3323                         
3324                         }
3325                         
3326                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3327                         
3328                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3329                         
3330                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3331                         
3332                                 } else {
3333                         
3334                                         PropertyDataMap->erase(PropertyName);
3335                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3336                         
3337                                 }
3338                                 
3339                         }
3340                 
3341                 }
3342                 
3343                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3344                 *XVCardV4Value = TRUE;
3345                                 
3346         }
3347         
3348         // X-VCARD4-ADR
3349         
3350         if (wxSProperty == wxT("X-VCARD4-ADR")){
3352                 if (ProcessItemData == TRUE){
3353         
3354                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
3355                 
3356                 } else {
3357                 
3358                         intPropertyLen = wxSPropertySeg1Ptr->Len();
3359                 
3360                 }
3361                 
3362                 std::map<int, int> SplitPoints;
3363                 std::map<int, int> SplitLength;
3364                 std::map<int, int>::iterator SLiter;
3365                 std::map<wxString, bool>::iterator BIter;;                      
3366                 wxString PropertyData;
3367                 wxString PropertyName;
3368                 wxString PropertyValue;
3369                 wxString PropertyTokens;
3370                 bool FirstToken = TRUE;
3371                 int intPrevValue = 14;
3373                 if (ProcessItemData == TRUE){
3374                 
3375                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
3376                         
3377                 } else {
3378                         
3379                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
3380                         *wxSPropertyDataNameOut = wxT("ADR");
3381                         
3382                 }
3383                 
3384                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3385                 intiter != SplitPoints.end(); ++intiter){
3386                 
3387                         SLiter = SplitLength.find(intiter->first);
3388                 
3389                         if (ProcessItemData == TRUE){
3391                                 if (FirstToken == TRUE){
3392                 
3393                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
3394                                         FirstToken = FALSE;
3395                                 
3396                                 } else {
3397                                 
3398                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
3399                                 
3400                                 }
3401                         
3402                         } else {
3403                         
3404                                 if (FirstToken == TRUE){
3405                         
3406                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
3407                                         FirstToken = FALSE;
3408                                                                 
3409                                 } else {
3410                                 
3411                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
3412                                         
3413                                 }
3414                         
3415                         }
3416                         
3417                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3418                         PropertyName = PropertyElement.GetNextToken();                          
3419                         PropertyValue = PropertyElement.GetNextToken();
3421                         intPrevValue = intiter->second;
3422                         
3423                         // Process properties.
3424                         
3425                         // Check if there is a lock on the property value. If there is a lock then
3426                         // the property value cannot be changed.
3427                         
3428                         if (PropertyName.IsEmpty()){
3429                         
3430                                 continue;
3431                         
3432                         }
3433                         
3434                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3435                         
3436                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3437                         
3438                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3439                         
3440                                 } else {
3441                         
3442                                         PropertyDataMap->erase(PropertyName);
3443                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3444                         
3445                                 }
3446                                 
3447                         }
3448                 
3449                 }
3450                 
3451                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3452                 *XVCardV4Value = TRUE;
3453                                 
3454         }
3455         
3456         // X-VCARD4-EMAIL
3457         
3458         if (wxSProperty == wxT("X-VCARD4-EMAIL")){
3460                 if (ProcessItemData == TRUE){
3461         
3462                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
3463                 
3464                 } else {
3465                 
3466                         intPropertyLen = wxSPropertySeg1Ptr->Len();
3467                 
3468                 }
3469                 
3470                 std::map<int, int> SplitPoints;
3471                 std::map<int, int> SplitLength;
3472                 std::map<int, int>::iterator SLiter;
3473                 std::map<wxString, bool>::iterator BIter;;                      
3474                 wxString PropertyData;
3475                 wxString PropertyName;
3476                 wxString PropertyValue;
3477                 wxString PropertyTokens;
3478                 bool FirstToken = TRUE;
3479                 int intPrevValue = 16;
3481                 if (ProcessItemData == TRUE){
3482                 
3483                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
3484                         
3485                 } else {
3486                         
3487                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
3488                         *wxSPropertyDataNameOut = wxT("EMAIL");
3489                         
3490                 }
3491                 
3492                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3493                 intiter != SplitPoints.end(); ++intiter){
3494                 
3495                         SLiter = SplitLength.find(intiter->first);
3496                 
3497                         if (ProcessItemData == TRUE){
3499                                 if (FirstToken == TRUE){
3500                 
3501                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
3502                                         FirstToken = FALSE;
3503                                 
3504                                 } else {
3505                                 
3506                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
3507                                 
3508                                 }
3509                         
3510                         } else {
3511                         
3512                                 if (FirstToken == TRUE){
3513                         
3514                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
3515                                         FirstToken = FALSE;
3516                                                                 
3517                                 } else {
3518                                 
3519                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
3520                                         
3521                                 }
3522                         
3523                         }
3524                         
3525                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3526                         PropertyName = PropertyElement.GetNextToken();                          
3527                         PropertyValue = PropertyElement.GetNextToken();
3528                         
3529                         intPrevValue = intiter->second;
3530                         
3531                         // Process properties.
3532                         
3533                         // Check if there is a lock on the property value. If there is a lock then
3534                         // the property value cannot be changed.
3535                         
3536                         if (PropertyName.IsEmpty()){
3537                         
3538                                 continue;
3539                         
3540                         }
3541                         
3542                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3543                         
3544                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3545                         
3546                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3547                         
3548                                 } else {
3549                         
3550                                         PropertyDataMap->erase(PropertyName);
3551                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3552                         
3553                                 }
3554                                 
3555                         }
3557                 }
3558                 
3559                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3560                 *XVCardV4Value = TRUE;
3561                                 
3562         }
3563         
3564         // X-VCARD4-IMPP
3565         
3566         if (wxSProperty == wxT("X-VCARD4-IMPP")){
3568                 if (ProcessItemData == TRUE){
3569         
3570                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
3571                 
3572                 } else {
3573                 
3574                         intPropertyLen = wxSPropertySeg1Ptr->Len();
3575                 
3576                 }
3577                 
3578                 std::map<int, int> SplitPoints;
3579                 std::map<int, int> SplitLength;
3580                 std::map<int, int>::iterator SLiter;
3581                 std::map<wxString, bool>::iterator BIter;;                      
3582                 wxString PropertyData;
3583                 wxString PropertyName;
3584                 wxString PropertyValue;
3585                 wxString PropertyTokens;
3586                 bool FirstToken = TRUE;
3587                 int intPrevValue = 15;
3589                 if (ProcessItemData == TRUE){
3590                 
3591                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
3592                         
3593                 } else {
3594                         
3595                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
3596                         *wxSPropertyDataNameOut = wxT("IMPP");
3597                         
3598                 }
3599                 
3600                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3601                 intiter != SplitPoints.end(); ++intiter){
3602                 
3603                         SLiter = SplitLength.find(intiter->first);
3604                 
3605                         if (ProcessItemData == TRUE){
3607                                 if (FirstToken == TRUE){
3608                 
3609                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
3610                                         FirstToken = FALSE;
3611                                 
3612                                 } else {
3613                                 
3614                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
3615                                 
3616                                 }
3617                         
3618                         } else {
3619                         
3620                                 if (FirstToken == TRUE){
3621                         
3622                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
3623                                         FirstToken = FALSE;
3624                                                                 
3625                                 } else {
3626                                 
3627                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
3628                                         
3629                                 }
3630                         
3631                         }
3632                         
3633                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3634                         PropertyName = PropertyElement.GetNextToken();                          
3635                         PropertyValue = PropertyElement.GetNextToken();
3637                         intPrevValue = intiter->second;
3638                         
3639                         // Process properties.
3640                         
3641                         // Check if there is a lock on the property value. If there is a lock then
3642                         // the property value cannot be changed.
3643                         
3644                         if (PropertyName.IsEmpty()){
3645                         
3646                                 continue;
3647                         
3648                         }
3649                         
3650                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3651                         
3652                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3653                         
3654                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3655                         
3656                                 } else {
3657                         
3658                                         PropertyDataMap->erase(PropertyName);
3659                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3660                         
3661                                 }
3662                                 
3663                         }
3664                 
3665                 }
3666                 
3667                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3668                 *XVCardV4Value = TRUE;
3669                                 
3670         }
3671         
3672         // X-VCARD4-TEL
3673         
3674         if (wxSProperty == wxT("X-VCARD4-TEL")){
3676                 if (ProcessItemData == TRUE){
3677         
3678                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
3679                 
3680                 } else {
3681                 
3682                         intPropertyLen = wxSPropertySeg1Ptr->Len();
3683                 
3684                 }
3685                 
3686                 std::map<int, int> SplitPoints;
3687                 std::map<int, int> SplitLength;
3688                 std::map<int, int>::iterator SLiter;
3689                 std::map<wxString, bool>::iterator BIter;;                      
3690                 wxString PropertyData;
3691                 wxString PropertyName;
3692                 wxString PropertyValue;
3693                 wxString PropertyTokens;
3694                 bool FirstToken = TRUE;
3695                 int intPrevValue = 14;
3697                 if (ProcessItemData == TRUE){
3698                 
3699                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
3700                         
3701                 } else {
3702                         
3703                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
3704                         *wxSPropertyDataNameOut = wxT("TEL");
3705                         
3706                 }
3707                 
3708                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3709                 intiter != SplitPoints.end(); ++intiter){
3710                 
3711                         SLiter = SplitLength.find(intiter->first);
3712                 
3713                         if (ProcessItemData == TRUE){
3715                                 if (FirstToken == TRUE){
3716                 
3717                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
3718                                         FirstToken = FALSE;
3719                                 
3720                                 } else {
3721                                 
3722                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
3723                                 
3724                                 }
3725                         
3726                         } else {
3727                         
3728                                 if (FirstToken == TRUE){
3729                         
3730                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
3731                                         FirstToken = FALSE;
3732                                                                 
3733                                 } else {
3734                                 
3735                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
3736                                         
3737                                 }
3738                         
3739                         }
3740                         
3741                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3742                         PropertyName = PropertyElement.GetNextToken();                          
3743                         PropertyValue = PropertyElement.GetNextToken();
3744                         
3745                         intPrevValue = intiter->second;
3746                         
3747                         // Process properties.
3748                         
3749                         // Check if there is a lock on the property value. If there is a lock then
3750                         // the property value cannot be changed.
3751                         
3752                         if (PropertyName.IsEmpty()){
3753                         
3754                                 continue;
3755                         
3756                         }
3757                         
3758                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3759                         
3760                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3761                         
3762                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3763                         
3764                                 } else {
3765                         
3766                                         PropertyDataMap->erase(PropertyName);
3767                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3768                         
3769                                 }
3770                                 
3771                         }
3772                 
3773                 }
3774                 
3775                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3776                 *XVCardV4Value = TRUE;
3777                                 
3778         }
3779         
3780         // X-VCARD4-LANG
3781         
3782         if (wxSProperty == wxT("X-VCARD4-LANG")){
3784                 if (ProcessItemData == TRUE){
3785         
3786                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
3787                 
3788                 } else {
3789                 
3790                         intPropertyLen = wxSPropertySeg1Ptr->Len();
3791                 
3792                 }
3793                 
3794                 std::map<int, int> SplitPoints;
3795                 std::map<int, int> SplitLength;
3796                 std::map<int, int>::iterator SLiter;
3797                 std::map<wxString, bool>::iterator BIter;;                      
3798                 wxString PropertyData;
3799                 wxString PropertyName;
3800                 wxString PropertyValue;
3801                 wxString PropertyTokens;
3802                 bool FirstToken = TRUE;
3803                 int intPrevValue = 15;
3805                 if (ProcessItemData == TRUE){
3806                 
3807                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
3808                         
3809                 } else {
3810                         
3811                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
3812                         *wxSPropertyDataNameOut = wxT("LANG");
3813                         
3814                 }
3815                 
3816                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3817                 intiter != SplitPoints.end(); ++intiter){
3818                 
3819                         SLiter = SplitLength.find(intiter->first);
3820                 
3821                         if (ProcessItemData == TRUE){
3823                                 if (FirstToken == TRUE){
3824                 
3825                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
3826                                         FirstToken = FALSE;
3827                                 
3828                                 } else {
3829                                 
3830                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
3831                                 
3832                                 }
3833                         
3834                         } else {
3835                         
3836                                 if (FirstToken == TRUE){
3837                         
3838                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
3839                                         FirstToken = FALSE;
3840                                                                 
3841                                 } else {
3842                                 
3843                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
3844                                         
3845                                 }
3846                         
3847                         }
3848                         
3849                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3850                         PropertyName = PropertyElement.GetNextToken();                          
3851                         PropertyValue = PropertyElement.GetNextToken();
3852                         
3853                         intPrevValue = intiter->second;
3854                         
3855                         // Process properties.
3856                         
3857                         // Check if there is a lock on the property value. If there is a lock then
3858                         // the property value cannot be changed.
3859                         
3860                         if (PropertyName.IsEmpty()){
3861                         
3862                                 continue;
3863                         
3864                         }
3865                         
3866                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3867                         
3868                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3869                         
3870                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3871                         
3872                                 } else {
3873                         
3874                                         PropertyDataMap->erase(PropertyName);
3875                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3876                         
3877                                 }
3878                                 
3879                         }
3880                 
3881                 }
3882                 
3883                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3884                 *XVCardV4Value = TRUE;
3885                                 
3886         }
3887         
3888         // X-VCARD4-GEO
3889         
3890         if (wxSProperty == wxT("X-VCARD4-GEO")){
3892                 if (ProcessItemData == TRUE){
3893         
3894                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
3895                 
3896                 } else {
3897                 
3898                         intPropertyLen = wxSPropertySeg1Ptr->Len();
3899                 
3900                 }
3901                 
3902                 std::map<int, int> SplitPoints;
3903                 std::map<int, int> SplitLength;
3904                 std::map<int, int>::iterator SLiter;
3905                 std::map<wxString, bool>::iterator BIter;;                      
3906                 wxString PropertyData;
3907                 wxString PropertyName;
3908                 wxString PropertyValue;
3909                 wxString PropertyTokens;
3910                 bool FirstToken = TRUE;
3911                 int intPrevValue = 14;
3913                 if (ProcessItemData == TRUE){
3914                 
3915                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
3916                         
3917                 } else {
3918                         
3919                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
3920                         *wxSPropertyDataNameOut = wxT("GEO");
3921                         
3922                 }
3923                 
3924                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
3925                 intiter != SplitPoints.end(); ++intiter){
3926                 
3927                         SLiter = SplitLength.find(intiter->first);
3928                 
3929                         if (ProcessItemData == TRUE){
3931                                 if (FirstToken == TRUE){
3932                 
3933                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
3934                                         FirstToken = FALSE;
3935                                 
3936                                 } else {
3937                                 
3938                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
3939                                 
3940                                 }
3941                         
3942                         } else {
3943                         
3944                                 if (FirstToken == TRUE){
3945                         
3946                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
3947                                         FirstToken = FALSE;
3948                                                                 
3949                                 } else {
3950                                 
3951                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
3952                                         
3953                                 }
3954                         
3955                         }
3956                         
3957                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
3958                         PropertyName = PropertyElement.GetNextToken();                          
3959                         PropertyValue = PropertyElement.GetNextToken();
3960                         
3961                         intPrevValue = intiter->second;
3962                         
3963                         // Process properties.
3964                         
3965                         // Check if there is a lock on the property value. If there is a lock then
3966                         // the property value cannot be changed.
3967                         
3968                         if (PropertyName.IsEmpty()){
3969                         
3970                                 continue;
3971                         
3972                         }
3973                         
3974                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
3975                         
3976                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
3977                         
3978                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3979                         
3980                                 } else {
3981                         
3982                                         PropertyDataMap->erase(PropertyName);
3983                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
3984                         
3985                                 }
3986                                 
3987                         }
3988                 
3989                 }
3990                 
3991                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
3992                 *XVCardV4Value = TRUE;
3993                                 
3994         }
3995         
3996         // X-VCARD4-RELATED
3997         
3998         if (wxSProperty == wxT("X-VCARD4-RELATED")){
4000                 if (ProcessItemData == TRUE){
4001         
4002                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4003                 
4004                 } else {
4005                 
4006                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4007                 
4008                 }
4009                 
4010                 std::map<int, int> SplitPoints;
4011                 std::map<int, int> SplitLength;
4012                 std::map<int, int>::iterator SLiter;
4013                 std::map<wxString, bool>::iterator BIter;;                      
4014                 wxString PropertyData;
4015                 wxString PropertyName;
4016                 wxString PropertyValue;
4017                 wxString PropertyTokens;
4018                 bool FirstToken = TRUE;
4019                 int intPrevValue = 18;
4021                 if (ProcessItemData == TRUE){
4022                 
4023                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4024                         
4025                 } else {
4026                         
4027                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
4028                         *wxSPropertyDataNameOut = wxT("RELATED");
4029                         
4030                 }
4031                 
4032                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4033                 intiter != SplitPoints.end(); ++intiter){
4034                 
4035                         SLiter = SplitLength.find(intiter->first);
4036                 
4037                         if (ProcessItemData == TRUE){
4039                                 if (FirstToken == TRUE){
4040                 
4041                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
4042                                         FirstToken = FALSE;
4043                                 
4044                                 } else {
4045                                 
4046                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
4047                                 
4048                                 }
4049                         
4050                         } else {
4051                         
4052                                 if (FirstToken == TRUE){
4053                         
4054                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
4055                                         FirstToken = FALSE;
4056                                                                 
4057                                 } else {
4058                                 
4059                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
4060                                         
4061                                 }
4062                         
4063                         }
4064                         
4065                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4066                         PropertyName = PropertyElement.GetNextToken();                          
4067                         PropertyValue = PropertyElement.GetNextToken();
4068                         
4069                         intPrevValue = intiter->second;
4070                         
4071                         // Process properties.
4072                         
4073                         // Check if there is a lock on the property value. If there is a lock then
4074                         // the property value cannot be changed.
4075                         
4076                         if (PropertyName.IsEmpty()){
4077                         
4078                                 continue;
4079                         
4080                         }
4081                         
4082                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
4083                         
4084                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
4085                         
4086                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4087                         
4088                                 } else {
4089                         
4090                                         PropertyDataMap->erase(PropertyName);
4091                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4092                         
4093                                 }
4094                                 
4095                         }
4096                 
4097                 }
4098                 
4099                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
4100                 *XVCardV4Value = TRUE;
4101                                 
4102         }
4103         
4104         // X-VCARD4-URL
4105         
4106         if (wxSProperty == wxT("X-VCARD4-URL")){
4108                 if (ProcessItemData == TRUE){
4109         
4110                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4111                 
4112                 } else {
4113                 
4114                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4115                 
4116                 }
4117                 
4118                 std::map<int, int> SplitPoints;
4119                 std::map<int, int> SplitLength;
4120                 std::map<int, int>::iterator SLiter;
4121                 std::map<wxString, bool>::iterator BIter;;                      
4122                 wxString PropertyData;
4123                 wxString PropertyName;
4124                 wxString PropertyValue;
4125                 wxString PropertyTokens;
4126                 bool FirstToken = TRUE;
4127                 int intPrevValue = 14;
4129                 if (ProcessItemData == TRUE){
4130                 
4131                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4132                         
4133                 } else {
4134                         
4135                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
4136                         *wxSPropertyDataNameOut = wxT("URL");
4137                         
4138                 }
4139                 
4140                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4141                 intiter != SplitPoints.end(); ++intiter){
4142                 
4143                         SLiter = SplitLength.find(intiter->first);
4144                 
4145                         if (ProcessItemData == TRUE){
4147                                 if (FirstToken == TRUE){
4148                 
4149                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
4150                                         FirstToken = FALSE;
4151                                 
4152                                 } else {
4153                                 
4154                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
4155                                 
4156                                 }
4157                         
4158                         } else {
4159                         
4160                                 if (FirstToken == TRUE){
4161                         
4162                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
4163                                         FirstToken = FALSE;
4164                                                                 
4165                                 } else {
4166                                 
4167                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
4168                                         
4169                                 }
4170                         
4171                         }
4172                         
4173                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4174                         PropertyName = PropertyElement.GetNextToken();                          
4175                         PropertyValue = PropertyElement.GetNextToken();
4176                         
4177                         intPrevValue = intiter->second;
4178                         
4179                         // Process properties.
4180                         
4181                         // Check if there is a lock on the property value. If there is a lock then
4182                         // the property value cannot be changed.
4183                         
4184                         if (PropertyName.IsEmpty()){
4185                         
4186                                 continue;
4187                         
4188                         }
4189                         
4190                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
4191                         
4192                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
4193                         
4194                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4195                         
4196                                 } else {
4197                         
4198                                         PropertyDataMap->erase(PropertyName);
4199                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4200                         
4201                                 }
4202                                 
4203                         }
4204                 
4205                 }
4206                 
4207                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
4208                 *XVCardV4Value = TRUE;
4209                                 
4210         }
4211         
4212         // X-VCARD4-TITLE
4213         
4214         if (wxSProperty == wxT("X-VCARD4-TITLE")){
4216                 if (ProcessItemData == TRUE){
4217         
4218                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4219                 
4220                 } else {
4221                 
4222                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4223                 
4224                 }
4225                 
4226                 std::map<int, int> SplitPoints;
4227                 std::map<int, int> SplitLength;
4228                 std::map<int, int>::iterator SLiter;
4229                 std::map<wxString, bool>::iterator BIter;;                      
4230                 wxString PropertyData;
4231                 wxString PropertyName;
4232                 wxString PropertyValue;
4233                 wxString PropertyTokens;
4234                 bool FirstToken = TRUE;
4235                 int intPrevValue = 16;
4237                 if (ProcessItemData == TRUE){
4238                 
4239                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4240                         
4241                 } else {
4242                         
4243                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
4244                         *wxSPropertyDataNameOut = wxT("TITLE");
4245                         
4246                 }
4247                 
4248                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4249                 intiter != SplitPoints.end(); ++intiter){
4250                 
4251                         SLiter = SplitLength.find(intiter->first);
4252                 
4253                         if (ProcessItemData == TRUE){
4255                                 if (FirstToken == TRUE){
4256                 
4257                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
4258                                         FirstToken = FALSE;
4259                                 
4260                                 } else {
4261                                 
4262                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
4263                                 
4264                                 }
4265                         
4266                         } else {
4267                         
4268                                 if (FirstToken == TRUE){
4269                         
4270                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
4271                                         FirstToken = FALSE;
4272                                                                 
4273                                 } else {
4274                                 
4275                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
4276                                         
4277                                 }
4278                         
4279                         }
4280                         
4281                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4282                         PropertyName = PropertyElement.GetNextToken();                          
4283                         PropertyValue = PropertyElement.GetNextToken();
4284                         
4285                         intPrevValue = intiter->second;
4286                         
4287                         // Process properties.
4288                         
4289                         // Check if there is a lock on the property value. If there is a lock then
4290                         // the property value cannot be changed.
4291                         
4292                         if (PropertyName.IsEmpty()){
4293                         
4294                                 continue;
4295                         
4296                         }
4297                         
4298                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
4299                         
4300                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
4301                         
4302                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4303                         
4304                                 } else {
4305                         
4306                                         PropertyDataMap->erase(PropertyName);
4307                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4308                         
4309                                 }
4310                                 
4311                         }
4312                 
4313                 }
4314                 
4315                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
4316                 *XVCardV4Value = TRUE;
4317                                 
4318         }
4319         
4320         // X-VCARD4-ROLE
4321         
4322         if (wxSProperty == wxT("X-VCARD4-ROLE")){
4324                 if (ProcessItemData == TRUE){
4325         
4326                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4327                 
4328                 } else {
4329                 
4330                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4331                 
4332                 }
4333                 
4334                 std::map<int, int> SplitPoints;
4335                 std::map<int, int> SplitLength;
4336                 std::map<int, int>::iterator SLiter;
4337                 std::map<wxString, bool>::iterator BIter;;                      
4338                 wxString PropertyData;
4339                 wxString PropertyName;
4340                 wxString PropertyValue;
4341                 wxString PropertyTokens;
4342                 bool FirstToken = TRUE;
4343                 int intPrevValue = 15;
4345                 if (ProcessItemData == TRUE){
4346                 
4347                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4348                         
4349                 } else {
4350                         
4351                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
4352                         *wxSPropertyDataNameOut = wxT("ROLE");
4353                         
4354                 }
4355                 
4356                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4357                 intiter != SplitPoints.end(); ++intiter){
4358                 
4359                         SLiter = SplitLength.find(intiter->first);
4360                 
4361                         if (ProcessItemData == TRUE){
4363                                 if (FirstToken == TRUE){
4364                 
4365                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
4366                                         FirstToken = FALSE;
4367                                 
4368                                 } else {
4369                                 
4370                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
4371                                 
4372                                 }
4373                         
4374                         } else {
4375                         
4376                                 if (FirstToken == TRUE){
4377                         
4378                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
4379                                         FirstToken = FALSE;
4380                                                                 
4381                                 } else {
4382                                 
4383                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
4384                                         
4385                                 }
4386                         
4387                         }
4388                         
4389                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4390                         PropertyName = PropertyElement.GetNextToken();                          
4391                         PropertyValue = PropertyElement.GetNextToken();
4392                         
4393                         intPrevValue = intiter->second;
4394                         
4395                         // Process properties.
4396                         
4397                         // Check if there is a lock on the property value. If there is a lock then
4398                         // the property value cannot be changed.
4399                         
4400                         if (PropertyName.IsEmpty()){
4401                         
4402                                 continue;
4403                         
4404                         }
4405                         
4406                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
4407                         
4408                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
4409                         
4410                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4411                         
4412                                 } else {
4413                         
4414                                         PropertyDataMap->erase(PropertyName);
4415                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4416                         
4417                                 }
4418                                 
4419                         }
4420                 
4421                 }
4422                 
4423                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
4424                 *XVCardV4Value = TRUE;
4425                                 
4426         }
4427         
4428         // X-VCARD4-ORG
4429         
4430         if (wxSProperty == wxT("X-VCARD4-ORG")){
4432                 if (ProcessItemData == TRUE){
4433         
4434                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4435                 
4436                 } else {
4437                 
4438                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4439                 
4440                 }
4441                 
4442                 std::map<int, int> SplitPoints;
4443                 std::map<int, int> SplitLength;
4444                 std::map<int, int>::iterator SLiter;
4445                 std::map<wxString, bool>::iterator BIter;;                      
4446                 wxString PropertyData;
4447                 wxString PropertyName;
4448                 wxString PropertyValue;
4449                 wxString PropertyTokens;
4450                 bool FirstToken = TRUE;
4451                 int intPrevValue = 14;
4453                 if (ProcessItemData == TRUE){
4454                 
4455                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4456                         
4457                 } else {
4458                         
4459                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
4460                         *wxSPropertyDataNameOut = wxT("ORG");
4461                         
4462                 }
4463                 
4464                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4465                 intiter != SplitPoints.end(); ++intiter){
4466                 
4467                         SLiter = SplitLength.find(intiter->first);
4468                 
4469                         if (ProcessItemData == TRUE){
4471                                 if (FirstToken == TRUE){
4472                 
4473                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
4474                                         FirstToken = FALSE;
4475                                 
4476                                 } else {
4477                                 
4478                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
4479                                 
4480                                 }
4481                         
4482                         } else {
4483                         
4484                                 if (FirstToken == TRUE){
4485                         
4486                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
4487                                         FirstToken = FALSE;
4488                                                                 
4489                                 } else {
4490                                 
4491                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
4492                                         
4493                                 }
4494                         
4495                         }
4496                         
4497                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4498                         PropertyName = PropertyElement.GetNextToken();                          
4499                         PropertyValue = PropertyElement.GetNextToken();
4500                         
4501                         intPrevValue = intiter->second;
4502                         
4503                         // Process properties.
4504                         
4505                         // Check if there is a lock on the property value. If there is a lock then
4506                         // the property value cannot be changed.
4507                         
4508                         if (PropertyName.IsEmpty()){
4509                         
4510                                 continue;
4511                         
4512                         }
4513                         
4514                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
4515                         
4516                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
4517                         
4518                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4519                         
4520                                 } else {
4521                         
4522                                         PropertyDataMap->erase(PropertyName);
4523                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4524                         
4525                                 }
4526                                 
4527                         }
4528                 
4529                 }
4530                 
4531                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
4532                 *XVCardV4Value = TRUE;
4533                                 
4534         }
4535         
4536         // X-VCARD4-NOTE
4537         
4538         if (wxSProperty == wxT("X-VCARD4-NOTE")){
4540                 if (ProcessItemData == TRUE){
4541         
4542                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4543                 
4544                 } else {
4545                 
4546                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4547                 
4548                 }
4549                 
4550                 std::map<int, int> SplitPoints;
4551                 std::map<int, int> SplitLength;
4552                 std::map<int, int>::iterator SLiter;
4553                 std::map<wxString, bool>::iterator BIter;;                      
4554                 wxString PropertyData;
4555                 wxString PropertyName;
4556                 wxString PropertyValue;
4557                 wxString PropertyTokens;
4558                 bool FirstToken = TRUE;
4559                 int intPrevValue = 15;
4561                 if (ProcessItemData == TRUE){
4562                 
4563                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4564                         
4565                 } else {
4566                         
4567                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
4568                         *wxSPropertyDataNameOut = wxT("NOTE");
4569                         
4570                 }
4571                 
4572                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4573                 intiter != SplitPoints.end(); ++intiter){
4574                 
4575                         SLiter = SplitLength.find(intiter->first);
4576                 
4577                         if (ProcessItemData == TRUE){
4579                                 if (FirstToken == TRUE){
4580                 
4581                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
4582                                         FirstToken = FALSE;
4583                                 
4584                                 } else {
4585                                 
4586                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
4587                                 
4588                                 }
4589                         
4590                         } else {
4591                         
4592                                 if (FirstToken == TRUE){
4593                         
4594                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
4595                                         FirstToken = FALSE;
4596                                                                 
4597                                 } else {
4598                                 
4599                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
4600                                         
4601                                 }
4602                         
4603                         }
4604                         
4605                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4606                         PropertyName = PropertyElement.GetNextToken();                          
4607                         PropertyValue = PropertyElement.GetNextToken();
4608                         
4609                         intPrevValue = intiter->second;
4610                         
4611                         // Process properties.
4612                         
4613                         // Check if there is a lock on the property value. If there is a lock then
4614                         // the property value cannot be changed.
4615                         
4616                         if (PropertyName.IsEmpty()){
4617                         
4618                                 continue;
4619                         
4620                         }
4621                         
4622                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
4623                         
4624                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
4625                         
4626                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4627                         
4628                                 } else {
4629                         
4630                                         PropertyDataMap->erase(PropertyName);
4631                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4632                         
4633                                 }
4634                                 
4635                         }
4636                 
4637                 }
4638                 
4639                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
4640                 *XVCardV4Value = TRUE;
4641                                 
4642         }
4643         
4644         // X-VCARD4-CATEGORIES
4645         
4646         if (wxSProperty == wxT("X-VCARD4-CATEGORIES")){
4648                 if (ProcessItemData == TRUE){
4649         
4650                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4651                 
4652                 } else {
4653                 
4654                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4655                 
4656                 }
4657                 
4658                 std::map<int, int> SplitPoints;
4659                 std::map<int, int> SplitLength;
4660                 std::map<int, int>::iterator SLiter;
4661                 std::map<wxString, bool>::iterator BIter;;                      
4662                 wxString PropertyData;
4663                 wxString PropertyName;
4664                 wxString PropertyValue;
4665                 wxString PropertyTokens;
4666                 bool FirstToken = TRUE;
4667                 int intPrevValue = 21;
4669                 if (ProcessItemData == TRUE){
4670                 
4671                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4672                         
4673                 } else {
4674                         
4675                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
4676                         *wxSPropertyDataNameOut = wxT("CATEGORIES");
4677                         
4678                 }
4679                 
4680                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4681                 intiter != SplitPoints.end(); ++intiter){
4682                 
4683                         SLiter = SplitLength.find(intiter->first);
4684                 
4685                         if (ProcessItemData == TRUE){
4687                                 if (FirstToken == TRUE){
4688                 
4689                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
4690                                         FirstToken = FALSE;
4691                                 
4692                                 } else {
4693                                 
4694                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
4695                                 
4696                                 }
4697                         
4698                         } else {
4699                         
4700                                 if (FirstToken == TRUE){
4701                         
4702                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
4703                                         FirstToken = FALSE;
4704                                                                 
4705                                 } else {
4706                                 
4707                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
4708                                         
4709                                 }
4710                         
4711                         }
4712                         
4713                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4714                         PropertyName = PropertyElement.GetNextToken();                          
4715                         PropertyValue = PropertyElement.GetNextToken();
4716                         
4717                         intPrevValue = intiter->second;
4718                         
4719                         // Process properties.
4720                         
4721                         // Check if there is a lock on the property value. If there is a lock then
4722                         // the property value cannot be changed.
4723                         
4724                         if (PropertyName.IsEmpty()){
4725                         
4726                                 continue;
4727                         
4728                         }
4729                         
4730                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
4731                         
4732                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
4733                         
4734                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4735                         
4736                                 } else {
4737                         
4738                                         PropertyDataMap->erase(PropertyName);
4739                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4740                         
4741                                 }
4742                                 
4743                         }
4744                 
4745                 }
4746                 
4747                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
4748                 *XVCardV4Value = TRUE;
4749                                 
4750         }
4751         
4752         // X-VCARD4-PHOTO
4753         
4754         if (wxSProperty == wxT("X-VCARD4-PHOTO")){
4756                 if (ProcessItemData == TRUE){
4757         
4758                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4759                 
4760                 } else {
4761                 
4762                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4763                 
4764                 }
4765                 
4766                 std::map<int, int> SplitPoints;
4767                 std::map<int, int> SplitLength;
4768                 std::map<int, int>::iterator SLiter;
4769                 std::map<wxString, bool>::iterator BIter;;                      
4770                 wxString PropertyData;
4771                 wxString PropertyName;
4772                 wxString PropertyValue;
4773                 wxString PropertyTokens;
4774                 bool FirstToken = TRUE;
4775                 int intPrevValue = 16;
4777                 if (ProcessItemData == TRUE){
4778                 
4779                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4780                         
4781                 } else {
4782                         
4783                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
4784                         *wxSPropertyDataNameOut = wxT("PHOTO");
4785                         
4786                 }
4787                 
4788                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4789                 intiter != SplitPoints.end(); ++intiter){
4790                 
4791                         SLiter = SplitLength.find(intiter->first);
4792                 
4793                         if (ProcessItemData == TRUE){
4795                                 if (FirstToken == TRUE){
4796                 
4797                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
4798                                         FirstToken = FALSE;
4799                                 
4800                                 } else {
4801                                 
4802                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
4803                                 
4804                                 }
4805                         
4806                         } else {
4807                         
4808                                 if (FirstToken == TRUE){
4809                         
4810                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
4811                                         FirstToken = FALSE;
4812                                                                 
4813                                 } else {
4814                                 
4815                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
4816                                         
4817                                 }
4818                         
4819                         }
4820                         
4821                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4822                         PropertyName = PropertyElement.GetNextToken();                          
4823                         PropertyValue = PropertyElement.GetNextToken();
4824                         
4825                         intPrevValue = intiter->second;
4826                         
4827                         // Process properties.
4828                         
4829                         // Check if there is a lock on the property value. If there is a lock then
4830                         // the property value cannot be changed.
4831                         
4832                         if (PropertyName.IsEmpty()){
4833                         
4834                                 continue;
4835                         
4836                         }
4837                         
4838                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
4839                         
4840                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
4841                         
4842                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4843                         
4844                                 } else {
4845                         
4846                                         PropertyDataMap->erase(PropertyName);
4847                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4848                         
4849                                 }
4850                                 
4851                         }
4852                 
4853                 }
4854                 
4855                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
4856                 *XVCardV4Value = TRUE;
4857                                 
4858         }
4859         
4860         // X-VCARD4-LOGO
4861         
4862         if (wxSProperty == wxT("X-VCARD4-LOGO")){
4864                 if (ProcessItemData == TRUE){
4865         
4866                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4867                 
4868                 } else {
4869                 
4870                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4871                 
4872                 }
4873                 
4874                 std::map<int, int> SplitPoints;
4875                 std::map<int, int> SplitLength;
4876                 std::map<int, int>::iterator SLiter;
4877                 std::map<wxString, bool>::iterator BIter;;                      
4878                 wxString PropertyData;
4879                 wxString PropertyName;
4880                 wxString PropertyValue;
4881                 wxString PropertyTokens;
4882                 bool FirstToken = TRUE;
4883                 int intPrevValue = 15;
4885                 if (ProcessItemData == TRUE){
4886                 
4887                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4888                         
4889                 } else {
4890                         
4891                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
4892                         *wxSPropertyDataNameOut = wxT("LOGO");
4893                         
4894                 }
4895                 
4896                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
4897                 intiter != SplitPoints.end(); ++intiter){
4898                 
4899                         SLiter = SplitLength.find(intiter->first);
4900                 
4901                         if (ProcessItemData == TRUE){
4903                                 if (FirstToken == TRUE){
4904                 
4905                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
4906                                         FirstToken = FALSE;
4907                                 
4908                                 } else {
4909                                 
4910                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
4911                                 
4912                                 }
4913                         
4914                         } else {
4915                         
4916                                 if (FirstToken == TRUE){
4917                         
4918                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
4919                                         FirstToken = FALSE;
4920                                                                 
4921                                 } else {
4922                                 
4923                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
4924                                         
4925                                 }
4926                         
4927                         }
4928                         
4929                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
4930                         PropertyName = PropertyElement.GetNextToken();                          
4931                         PropertyValue = PropertyElement.GetNextToken();
4932                         
4933                         intPrevValue = intiter->second;
4934                         
4935                         // Process properties.
4936                         
4937                         // Check if there is a lock on the property value. If there is a lock then
4938                         // the property value cannot be changed.
4939                         
4940                         if (PropertyName.IsEmpty()){
4941                         
4942                                 continue;
4943                         
4944                         }
4945                         
4946                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
4947                         
4948                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
4949                         
4950                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4951                         
4952                                 } else {
4953                         
4954                                         PropertyDataMap->erase(PropertyName);
4955                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
4956                         
4957                                 }
4958                                 
4959                         }
4960                 
4961                 }
4962                 
4963                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
4964                 *XVCardV4Value = TRUE;
4965                                 
4966         }
4967         
4968         // X-VCARD4-SOUND
4969         
4970         if (wxSProperty == wxT("X-VCARD4-SOUND")){
4972                 if (ProcessItemData == TRUE){
4973         
4974                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
4975                 
4976                 } else {
4977                 
4978                         intPropertyLen = wxSPropertySeg1Ptr->Len();
4979                 
4980                 }
4981                 
4982                 std::map<int, int> SplitPoints;
4983                 std::map<int, int> SplitLength;
4984                 std::map<int, int>::iterator SLiter;
4985                 std::map<wxString, bool>::iterator BIter;;                      
4986                 wxString PropertyData;
4987                 wxString PropertyName;
4988                 wxString PropertyValue;
4989                 wxString PropertyTokens;
4990                 bool FirstToken = TRUE;
4991                 int intPrevValue = 16;
4993                 if (ProcessItemData == TRUE){
4994                 
4995                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
4996                         
4997                 } else {
4998                         
4999                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
5000                         *wxSPropertyDataNameOut = wxT("SOUND");
5001                         
5002                 }
5003                 
5004                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
5005                 intiter != SplitPoints.end(); ++intiter){
5006                 
5007                         SLiter = SplitLength.find(intiter->first);
5008                 
5009                         if (ProcessItemData == TRUE){
5011                                 if (FirstToken == TRUE){
5012                 
5013                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
5014                                         FirstToken = FALSE;
5015                                 
5016                                 } else {
5017                                 
5018                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
5019                                 
5020                                 }
5021                         
5022                         } else {
5023                         
5024                                 if (FirstToken == TRUE){
5025                         
5026                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
5027                                         FirstToken = FALSE;
5028                                                                 
5029                                 } else {
5030                                 
5031                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
5032                                         
5033                                 }
5034                         
5035                         }
5036                         
5037                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5038                         PropertyName = PropertyElement.GetNextToken();                          
5039                         PropertyValue = PropertyElement.GetNextToken();
5040                         
5041                         intPrevValue = intiter->second;
5042                         
5043                         // Process properties.
5044                         
5045                         // Check if there is a lock on the property value. If there is a lock then
5046                         // the property value cannot be changed.
5047                         
5048                         if (PropertyName.IsEmpty()){
5049                         
5050                                 continue;
5051                         
5052                         }
5053                         
5054                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
5055                         
5056                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
5057                         
5058                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5059                         
5060                                 } else {
5061                         
5062                                         PropertyDataMap->erase(PropertyName);
5063                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5064                         
5065                                 }
5066                                 
5067                         }
5068                 
5069                 }
5070                 
5071                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
5072                 *XVCardV4Value = TRUE;
5073                                 
5074         }
5075         
5076         // X-VCARD4-CALURI
5077         
5078         if (wxSProperty == wxT("X-VCARD4-CALURI")){
5080                 if (ProcessItemData == TRUE){
5081         
5082                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
5083                 
5084                 } else {
5085                 
5086                         intPropertyLen = wxSPropertySeg1Ptr->Len();
5087                 
5088                 }
5089                 
5090                 std::map<int, int> SplitPoints;
5091                 std::map<int, int> SplitLength;
5092                 std::map<int, int>::iterator SLiter;
5093                 std::map<wxString, bool>::iterator BIter;;                      
5094                 wxString PropertyData;
5095                 wxString PropertyName;
5096                 wxString PropertyValue;
5097                 wxString PropertyTokens;
5098                 bool FirstToken = TRUE;
5099                 int intPrevValue = 17;
5101                 if (ProcessItemData == TRUE){
5102                 
5103                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
5104                         
5105                 } else {
5106                         
5107                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
5108                         *wxSPropertyDataNameOut = wxT("CALURI");
5109                         
5110                 }
5111                 
5112                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
5113                 intiter != SplitPoints.end(); ++intiter){
5114                 
5115                         SLiter = SplitLength.find(intiter->first);
5116                 
5117                         if (ProcessItemData == TRUE){
5119                                 if (FirstToken == TRUE){
5120                 
5121                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
5122                                         FirstToken = FALSE;
5123                                 
5124                                 } else {
5125                                 
5126                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
5127                                 
5128                                 }
5129                         
5130                         } else {
5131                         
5132                                 if (FirstToken == TRUE){
5133                         
5134                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
5135                                         FirstToken = FALSE;
5136                                                                 
5137                                 } else {
5138                                 
5139                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
5140                                         
5141                                 }
5142                         
5143                         }
5144                         
5145                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5146                         PropertyName = PropertyElement.GetNextToken();                          
5147                         PropertyValue = PropertyElement.GetNextToken();
5148                         
5149                         intPrevValue = intiter->second;
5150                         
5151                         // Process properties.
5152                         
5153                         // Check if there is a lock on the property value. If there is a lock then
5154                         // the property value cannot be changed.
5155                         
5156                         if (PropertyName.IsEmpty()){
5157                         
5158                                 continue;
5159                         
5160                         }
5161                         
5162                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
5163                         
5164                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
5165                         
5166                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5167                         
5168                                 } else {
5169                         
5170                                         PropertyDataMap->erase(PropertyName);
5171                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5172                         
5173                                 }
5174                                 
5175                         }
5176                 
5177                 }
5178                 
5179                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
5180                 *XVCardV4Value = TRUE;
5181                                 
5182         }
5183         
5184         // X-VCARD4-CALADRURI
5185         
5186         if (wxSProperty == wxT("X-VCARD4-CALADRURI")){
5188                 if (ProcessItemData == TRUE){
5189         
5190                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
5191                 
5192                 } else {
5193                 
5194                         intPropertyLen = wxSPropertySeg1Ptr->Len();
5195                 
5196                 }
5197                 
5198                 std::map<int, int> SplitPoints;
5199                 std::map<int, int> SplitLength;
5200                 std::map<int, int>::iterator SLiter;
5201                 std::map<wxString, bool>::iterator BIter;;                      
5202                 wxString PropertyData;
5203                 wxString PropertyName;
5204                 wxString PropertyValue;
5205                 wxString PropertyTokens;
5206                 bool FirstToken = TRUE;
5207                 int intPrevValue = 20;
5209                 if (ProcessItemData == TRUE){
5210                 
5211                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
5212                         
5213                 } else {
5214                         
5215                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
5216                         *wxSPropertyDataNameOut = wxT("CALADRURI");
5217                         
5218                 }
5219                 
5220                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
5221                 intiter != SplitPoints.end(); ++intiter){
5222                 
5223                         SLiter = SplitLength.find(intiter->first);
5224                 
5225                         if (ProcessItemData == TRUE){
5227                                 if (FirstToken == TRUE){
5228                 
5229                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
5230                                         FirstToken = FALSE;
5231                                 
5232                                 } else {
5233                                 
5234                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
5235                                 
5236                                 }
5237                         
5238                         } else {
5239                         
5240                                 if (FirstToken == TRUE){
5241                         
5242                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
5243                                         FirstToken = FALSE;
5244                                                                 
5245                                 } else {
5246                                 
5247                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
5248                                         
5249                                 }
5250                         
5251                         }
5252                         
5253                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5254                         PropertyName = PropertyElement.GetNextToken();                          
5255                         PropertyValue = PropertyElement.GetNextToken();
5256                         
5257                         intPrevValue = intiter->second;
5258                         
5259                         // Process properties.
5260                         
5261                         // Check if there is a lock on the property value. If there is a lock then
5262                         // the property value cannot be changed.
5263                         
5264                         if (PropertyName.IsEmpty()){
5265                         
5266                                 continue;
5267                         
5268                         }
5269                         
5270                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
5271                         
5272                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
5273                         
5274                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5275                         
5276                                 } else {
5277                         
5278                                         PropertyDataMap->erase(PropertyName);
5279                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5280                         
5281                                 }
5282                                 
5283                         }
5284                 
5285                 }
5286                 
5287                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
5288                 *XVCardV4Value = TRUE;
5289                                 
5290         }
5291         
5292         // X-VCARD4-FBURL
5293         
5294         if (wxSProperty == wxT("X-VCARD4-FBURL")){
5296                 if (ProcessItemData == TRUE){
5297         
5298                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
5299                 
5300                 } else {
5301                 
5302                         intPropertyLen = wxSPropertySeg1Ptr->Len();
5303                 
5304                 }
5305                 
5306                 std::map<int, int> SplitPoints;
5307                 std::map<int, int> SplitLength;
5308                 std::map<int, int>::iterator SLiter;
5309                 std::map<wxString, bool>::iterator BIter;;                      
5310                 wxString PropertyData;
5311                 wxString PropertyName;
5312                 wxString PropertyValue;
5313                 wxString PropertyTokens;
5314                 bool FirstToken = TRUE;
5315                 int intPrevValue = 16;
5317                 if (ProcessItemData == TRUE){
5318                 
5319                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
5320                         
5321                 } else {
5322                         
5323                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
5324                         *wxSPropertyDataNameOut = wxT("FBURL");
5325                         
5326                 }
5327                 
5328                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
5329                 intiter != SplitPoints.end(); ++intiter){
5330                 
5331                         SLiter = SplitLength.find(intiter->first);
5332                 
5333                         if (ProcessItemData == TRUE){
5335                                 if (FirstToken == TRUE){
5336                 
5337                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
5338                                         FirstToken = FALSE;
5339                                 
5340                                 } else {
5341                                 
5342                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
5343                                 
5344                                 }
5345                         
5346                         } else {
5347                         
5348                                 if (FirstToken == TRUE){
5349                         
5350                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
5351                                         FirstToken = FALSE;
5352                                                                 
5353                                 } else {
5354                                 
5355                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
5356                                         
5357                                 }
5358                         
5359                         }
5360                         
5361                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5362                         PropertyName = PropertyElement.GetNextToken();                          
5363                         PropertyValue = PropertyElement.GetNextToken();
5364                         
5365                         intPrevValue = intiter->second;
5366                         
5367                         // Process properties.
5368                         
5369                         // Check if there is a lock on the property value. If there is a lock then
5370                         // the property value cannot be changed.
5371                         
5372                         if (PropertyName.IsEmpty()){
5373                         
5374                                 continue;
5375                         
5376                         }
5377                         
5378                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
5379                         
5380                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
5381                         
5382                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5383                         
5384                                 } else {
5385                         
5386                                         PropertyDataMap->erase(PropertyName);
5387                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5388                         
5389                                 }
5390                                 
5391                         }
5392                 
5393                 }
5394                 
5395                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
5396                 *XVCardV4Value = TRUE;
5397                                 
5398         }
5399         
5400         // X-VCARD4-KEY
5401         
5402         if (wxSProperty == wxT("X-VCARD4-KEY")){
5404                 if (ProcessItemData == TRUE){
5405         
5406                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
5407                 
5408                 } else {
5409                 
5410                         intPropertyLen = wxSPropertySeg1Ptr->Len();
5411                 
5412                 }
5413                 
5414                 std::map<int, int> SplitPoints;
5415                 std::map<int, int> SplitLength;
5416                 std::map<int, int>::iterator SLiter;
5417                 std::map<wxString, bool>::iterator BIter;;                      
5418                 wxString PropertyData;
5419                 wxString PropertyName;
5420                 wxString PropertyValue;
5421                 wxString PropertyTokens;
5422                 bool FirstToken = TRUE;
5423                 int intPrevValue = 14;
5425                 if (ProcessItemData == TRUE){
5426                 
5427                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
5428                         
5429                 } else {
5430                         
5431                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
5432                         *wxSPropertyDataNameOut = wxT("KEY");
5433                         
5434                 }
5435                 
5436                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
5437                 intiter != SplitPoints.end(); ++intiter){
5438                 
5439                         SLiter = SplitLength.find(intiter->first);
5440                 
5441                         if (ProcessItemData == TRUE){
5443                                 if (FirstToken == TRUE){
5444                 
5445                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
5446                                         FirstToken = FALSE;
5447                                 
5448                                 } else {
5449                                 
5450                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
5451                                 
5452                                 }
5453                         
5454                         } else {
5455                         
5456                                 if (FirstToken == TRUE){
5457                         
5458                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
5459                                         FirstToken = FALSE;
5460                                                                 
5461                                 } else {
5462                                 
5463                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
5464                                         
5465                                 }
5466                         
5467                         }
5468                         
5469                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5470                         PropertyName = PropertyElement.GetNextToken();                          
5471                         PropertyValue = PropertyElement.GetNextToken();
5472                         
5473                         intPrevValue = intiter->second;
5474                         
5475                         // Process properties.
5476                         
5477                         // Check if there is a lock on the property value. If there is a lock then
5478                         // the property value cannot be changed.
5479                         
5480                         if (PropertyName.IsEmpty()){
5481                         
5482                                 continue;
5483                         
5484                         }
5485                         
5486                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
5487                         
5488                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
5489                         
5490                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5491                         
5492                                 } else {
5493                         
5494                                         PropertyDataMap->erase(PropertyName);
5495                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5496                         
5497                                 }
5498                                 
5499                         }
5500                 
5501                 }
5502                 
5503                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
5504                 *XVCardV4Value = TRUE;
5505                                 
5506         }
5507         
5508         // X-VCARD4-VND-*
5509         
5510         if (wxSProperty.Mid(0, 12) == wxT("X-VCARD4-VND")){
5512                 if (ProcessItemData == TRUE){
5513         
5514                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
5515                 
5516                 } else {
5517                 
5518                         intPropertyLen = wxSPropertySeg1Ptr->Len();
5519                 
5520                 }
5521                 
5522                 std::map<int, int> SplitPoints;
5523                 std::map<int, int> SplitLength;
5524                 std::map<int, int>::iterator SLiter;
5525                 std::map<wxString, bool>::iterator BIter;;                      
5526                 wxString PropertyData;
5527                 wxString PropertyName;
5528                 wxString PropertyValue;
5529                 wxString PropertyTokens;
5530                 bool FirstToken = TRUE;
5531                 int intPrevValue = 14;
5533                 if (ProcessItemData == TRUE){
5534                 
5535                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
5536                         
5537                 } else {
5538                         
5539                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
5540                         *wxSPropertyDataNameOut = wxSProperty.Mid(9);
5541                         
5542                 }
5543                 
5544                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
5545                 intiter != SplitPoints.end(); ++intiter){
5546                 
5547                         SLiter = SplitLength.find(intiter->first);
5548                 
5549                         if (ProcessItemData == TRUE){
5551                                 if (FirstToken == TRUE){
5552                 
5553                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
5554                                         FirstToken = FALSE;
5555                                 
5556                                 } else {
5557                                 
5558                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
5559                                 
5560                                 }
5561                         
5562                         } else {
5563                         
5564                                 if (FirstToken == TRUE){
5565                         
5566                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
5567                                         FirstToken = FALSE;
5568                                                                 
5569                                 } else {
5570                                 
5571                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
5572                                         
5573                                 }
5574                         
5575                         }
5576                         
5577                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5578                         PropertyName = PropertyElement.GetNextToken();                          
5579                         PropertyValue = PropertyElement.GetNextToken();
5580                         
5581                         intPrevValue = intiter->second;
5582                         
5583                         // Process properties.
5584                         
5585                         // Check if there is a lock on the property value. If there is a lock then
5586                         // the property value cannot be changed.
5587                         
5588                         if (PropertyName.IsEmpty()){
5589                         
5590                                 continue;
5591                         
5592                         }
5593                         
5594                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
5595                         
5596                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
5597                         
5598                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5599                         
5600                                 } else {
5601                         
5602                                         PropertyDataMap->erase(PropertyName);
5603                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5604                         
5605                                 }
5606                                 
5607                         }
5608                 
5609                 }
5610                 
5611                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
5612                 *XVCardV4Value = TRUE;          
5613         
5614         }
5615         
5616         // X-ADDRESSBOOKSERVER-KIND
5617         
5618         if (wxSProperty == wxT("X-ADDRESSBOOKSERVER-KIND")){
5619                 
5620                 // Process Data.
5622                 if (ProcessItemData == TRUE){
5623         
5624                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
5625                 
5626                 } else {
5627                 
5628                         intPropertyLen = wxSPropertySeg1Ptr->Len();
5629                 
5630                 }
5631                 
5632                 std::map<int, int> SplitPoints;
5633                 std::map<int, int> SplitLength;
5634                 std::map<int, int>::iterator SLiter;
5635                 std::map<wxString, bool>::iterator BIter;;                      
5636                 wxString PropertyData;
5637                 wxString PropertyName;
5638                 wxString PropertyValue;
5639                 wxString PropertyTokens;
5640                 bool FirstToken = TRUE;
5641                 int intPrevValue = 26;
5643                 if (ProcessItemData == TRUE){
5644                 
5645                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
5646                         
5647                 } else {
5648                         
5649                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
5650                         
5651                 }
5652                 
5653                 *wxSPropertyDataNameOut = wxT("KIND");
5654                 
5655                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
5656                 intiter != SplitPoints.end(); ++intiter){
5657                 
5658                         SLiter = SplitLength.find(intiter->first);
5659                 
5660                         if (ProcessItemData == TRUE){
5662                                 if (FirstToken == TRUE){
5663                 
5664                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
5665                                         FirstToken = FALSE;
5666                                 
5667                                 } else {
5668                                 
5669                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
5670                                 
5671                                 }
5672                         
5673                         } else {
5674                         
5675                                 if (FirstToken == TRUE){
5676                         
5677                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
5678                                         FirstToken = FALSE;
5679                                                                 
5680                                 } else {
5681                                 
5682                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
5683                                         
5684                                 }
5685                         
5686                         }
5687                         
5688                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5689                         PropertyName = PropertyElement.GetNextToken();                          
5690                         PropertyValue = PropertyElement.GetNextToken();
5691                         
5692                         intPrevValue = intiter->second;
5693                         
5694                         // Process properties.
5695                         
5696                         // Check if there is a lock on the property value. If there is a lock then
5697                         // the property value cannot be changed.
5698                         
5699                         if (PropertyName.IsEmpty()){
5700                         
5701                                 continue;
5702                         
5703                         }
5704                         
5705                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
5706                         
5707                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
5708                         
5709                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5710                         
5711                                 } else {
5712                         
5713                                         PropertyDataMap->erase(PropertyName);
5714                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5715                         
5716                                 }
5717                                 
5718                         }
5719                 
5720                 }
5721                 
5722                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
5723                 *XVCardV4Value = TRUE;
5724                 
5725         }
5726         
5727         // X-ADDRESSBOOKSERVER-MEMBER
5728         
5729         if (wxSProperty == wxT("X-ADDRESSBOOKSERVER-MEMBER")){
5730                 
5731                 // Process Data.
5733                 if (ProcessItemData == TRUE){
5734         
5735                         intPropertyLen = wxSPropertySeg1Chopped.Len();          
5736                 
5737                 } else {
5738                 
5739                         intPropertyLen = wxSPropertySeg1Ptr->Len();
5740                 
5741                 }
5742                 
5743                 std::map<int, int> SplitPoints;
5744                 std::map<int, int> SplitLength;
5745                 std::map<int, int>::iterator SLiter;
5746                 std::map<wxString, bool>::iterator BIter;;
5747                 wxString PropertyData;
5748                 wxString PropertyName;
5749                 wxString PropertyValue;
5750                 wxString PropertyTokens;
5751                 bool FirstToken = TRUE;
5752                 int intPrevValue = 28;
5754                 if (ProcessItemData == TRUE){
5755                 
5756                         SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue);
5757                         
5758                 } else {
5759                         
5760                         SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
5761                         
5762                 }
5763                 
5764                 *wxSPropertyDataNameOut = wxT("MEMBER");
5765                 
5766                 for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
5767                 intiter != SplitPoints.end(); ++intiter){
5768                 
5769                         SLiter = SplitLength.find(intiter->first);
5770                 
5771                         if (ProcessItemData == TRUE){
5773                                 if (FirstToken == TRUE){
5774                 
5775                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second));
5776                                         FirstToken = FALSE;
5777                                 
5778                                 } else {
5779                                 
5780                                         PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second));
5781                                 
5782                                 }
5783                         
5784                         } else {
5785                         
5786                                 if (FirstToken == TRUE){
5787                         
5788                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second));
5789                                         FirstToken = FALSE;
5790                                                                 
5791                                 } else {
5792                                 
5793                                         PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second));
5794                                         
5795                                 }
5796                         
5797                         }
5798                         
5799                         wxStringTokenizer PropertyElement (PropertyData, wxT("="));
5800                         PropertyName = PropertyElement.GetNextToken();                          
5801                         PropertyValue = PropertyElement.GetNextToken();
5802                         
5803                         intPrevValue = intiter->second;
5804                         
5805                         // Process properties.
5806                         
5807                         // Check if there is a lock on the property value. If there is a lock then
5808                         // the property value cannot be changed.
5809                         
5810                         if (PropertyName.IsEmpty()){
5811                         
5812                                 continue;
5813                         
5814                         }
5815                         
5816                         if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){
5817                         
5818                                 if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){
5819                         
5820                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5821                         
5822                                 } else {
5823                         
5824                                         PropertyDataMap->erase(PropertyName);
5825                                         PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue));
5826                         
5827                                 }
5828                                 
5829                         }
5830                 
5831                 }
5832                 
5833                 wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr);
5834                 *XVCardV4Value = TRUE;
5835                 
5836                 
5837         }
5838         
5839         // Deal with X-ABLabel specifically.
5840         
5841         if (wxSProperty == wxT("X-ABLabel") && ProcessItemData == TRUE){
5842         
5843         intPropertyLen = wxSPropertySeg1Ptr->Len();
5844         std::map<int, int> SplitPoints;
5845                 std::map<int, int> SplitLength;
5846                 std::map<int, int>::iterator SLiter;                    
5847                 wxString PropertyData;
5848                 wxString PropertyName;
5849                 wxString PropertyValue;
5850                 wxString PropertyTokens;
5851                 int intPrevValue = 11;
5852                 
5853                 SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue);
5855                 PropertyDataMap->insert(std::make_pair(wxT("X-ABLabel"), *wxSPropertySeg2Ptr));
5856                                 
5857         }
5861 void vCard34Conv::ProcessCaptureStringsProc(wxString *strCapture){
5863     CaptureString(strCapture, FALSE);
5867 void vCard34Conv::SplitValues(wxString *PropertyLine, 
5868         std::map<int,int> *SplitPoints, 
5869         std::map<int,int> *SplitLength, 
5870         int intSize){
5871         
5872         size_t intPropertyLen = PropertyLine->Len();
5873         int intSplitsFound = 0;
5874         int intSplitSize = 0;
5875         int intSplitSeek = 0;
5876         
5877         for (int i = intSize; i <= intPropertyLen; i++){
5879                 intSplitSize++;
5880         
5881                 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5882                     PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5883            
5884                     if (intSplitsFound == 0){
5885             
5886                         SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5887           
5888                     } else {
5889            
5890                         SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5891             
5892                     }
5893             
5894                     SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5895             
5896                     intSplitsFound++;
5897                     intSplitSeek = i;
5898                     intSplitSize = 0;
5899             
5900                 }
5902         }
5904         if (intSplitsFound == 0){
5906                 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5907                 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5909         } else {
5911                 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5912                 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5914         }
5918 void vCard34Conv::SplitValuesData(wxString *PropertyLine, 
5919         std::map<int,int> *SplitPoints, 
5920         std::map<int,int> *SplitLength, 
5921         int intSize,
5922         std::map<wxString,wxString> *SplitData){
5923         
5924         wxString DataStr;
5925         wxStringTokenizer PropertyElement;
5926         wxString PropertyName;
5927         wxString PropertyValue;
5928         size_t intPropertyLen = PropertyLine->Len();
5929         int intSplitsFound = 0;
5930         int intSplitSize = 0;
5931         int intSplitSeek = (intSize - 1);
5932         
5933         for (int i = intSize; i <= intPropertyLen; i++){
5935                 intSplitSize++;
5936         
5937                 if (PropertyLine->Mid(i, 1) == wxT(";") &&
5938                     PropertyLine->Mid((i - 1), 1) != wxT("\\")){
5939            
5940                     if (intSplitsFound == 0){
5941             
5942                                 DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize));
5943                                 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
5944           
5945                         } else {
5947                                 DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize - 1));
5948                                 SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
5950                         }
5951                     
5952                     SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
5953             
5954                     intSplitsFound++;
5955                     intSplitSeek = (i + 1);
5956                     intSplitSize = 0;
5957                     
5958                     if (!DataStr.IsEmpty()){
5959                     
5960                         PropertyElement.SetString(DataStr, wxT("="));
5961                         PropertyName = PropertyElement.GetNextToken();
5962                         PropertyValue = PropertyElement.GetNextToken();
5963                         SplitData->insert(std::make_pair(PropertyName, PropertyValue));
5964                     
5965                     }
5966                     
5967                     DataStr.clear();
5968                     PropertyName.clear();
5969                     PropertyValue.clear();
5970             
5971                 }
5973         }
5975         if (intSplitsFound == 0){
5977                 DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize));
5979                 SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
5980                 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5982         } else {
5983                 
5984                 DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize - 1));
5986                 SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
5987                 SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
5989         }
5991         if (!DataStr.IsEmpty()){
5992                 
5993                 PropertyElement.SetString(DataStr, wxT("="));
5994                 PropertyName = PropertyElement.GetNextToken();
5995                 PropertyValue = PropertyElement.GetNextToken();
5996                 SplitData->insert(std::make_pair(PropertyName, PropertyValue));         
5997                 
5998         }
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