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