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