forked from trebb/bbdb-vcard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-bbdb-vcard.el
1749 lines (1617 loc) · 44.5 KB
/
test-bbdb-vcard.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; Tests for bbdb-vcard.el
;;
;; Before proceeding, you should probably save your production bbdb file.
;;
;; To run the tests, eval this file.
;; In case of failure, find test results in buffer `bbdb-vcard-test-result'.
;;
;; For the sake of minimality, not all test cases are rfc compliant.
(require 'bbdb-vcard)
(defun bbdb-vcard-import-test
(vcard bbdb-entry search-name
&optional search-company search-net check-creation-date-p)
"Import VCARD and search for it in bbdb by SEARCH-NAME,
SEARCH-COMPANY, (perhaps later) SEARCH-NET. If search result
disagrees with BBDB-ENTRY, talk about it in buffer
bbdb-vcard-test-result. timestamp and, if CHECK-CREATION-DATE-P is
nil, creation-date are not taken into account."
(bbdb-vcard-iterate-vcards 'bbdb-vcard-import-vcard vcard)
(let* ((search-company (or search-company ""))
(bbdb-search-result
(car (bbdb-search (bbdb-search (bbdb-records) search-name)
nil search-company))))
(setf (cdr (assoc 'timestamp (elt bbdb-search-result 7))) "2010-03-04"
(cdr (assoc 'timestamp (elt bbdb-entry 7))) "2010-03-04")
(unless check-creation-date-p
(setf (cdr (assoc 'creation-date (elt bbdb-search-result 7))) "2010-03-04"
(cdr (assoc 'creation-date (elt bbdb-entry 7))) "2010-03-04"))
(unless (equal (subseq bbdb-search-result 0 8)
(subseq bbdb-entry 0 8))
(princ "\nTest failed:\n" (get-buffer-create "bbdb-vcard-test-result"))
(prin1 vcard (get-buffer-create "bbdb-vcard-test-result"))
(princ "\nwas stored as\n" (get-buffer-create "bbdb-vcard-test-result"))
(prin1 (subseq bbdb-search-result 0 8)
(get-buffer-create "bbdb-vcard-test-result"))
(princ "\nbut was expected as\n" (get-buffer-create "bbdb-vcard-test-result"))
(prin1 bbdb-entry (get-buffer-create "bbdb-vcard-test-result")))))
(defun bbdb-vcard-normalize-notes (notes)
"Sort a BBDB NOTES field and delete the timestamps in order to make them
comparable after re-import."
(let ((notes (remove-alist 'notes 'timestamp)))
(setq notes (remove-alist 'notes 'creation-date))
(sort
notes
'(lambda (x y) (if (string= (symbol-name (car x)) (symbol-name (car y)))
(string< (cdr x) (cdr y))
(string< (symbol-name (car x)) (symbol-name (car y))))))))
(defun bbdb-vcard-normalize-record (record)
"Make BBDB RECORD comparable by deleting certain things and sorting others."
(setf (elt record 6) (bbdb-vcard-normalize-notes (elt record 7)))
(subseq record 0 7))
(defun bbdb-vcard-compare-bbdbs (first-bbdb second-bbdb)
"Compare two BBDB record lists. Tell about mismatches in buffer
`bbdb-vcard-test-result'."
(let ((i 0)
first-record second-record)
(while (or (nth i first-bbdb) (nth i second-bbdb))
(unless (equal (bbdb-vcard-normalize-record (nth i first-bbdb))
(bbdb-vcard-normalize-record (nth i second-bbdb)))
(princ "\nRe-import: comparison of these records failed:"
(get-buffer-create "bbdb-vcard-test-result"))
(print (bbdb-vcard-normalize-record (nth i first-bbdb))
(get-buffer-create "bbdb-vcard-test-result"))
(prin1 (bbdb-vcard-normalize-record (nth i second-bbdb))
(get-buffer-create "bbdb-vcard-test-result")))
(incf i))))
;;; Try not to mess up our real BBDB:
(when bbdb-buffer
(save-buffer bbdb-buffer)
(kill-buffer bbdb-buffer))
(when (get-buffer "test-bbdb") (kill-buffer "test-bbdb"))
(setq bbdb-file "/tmp/test-bbdb")
(when (file-exists-p bbdb-file) (delete-file bbdb-file))
(when (get-buffer "bbdb-vcard-test-result") (kill-buffer "bbdb-vcard-test-result"))
;;;; The Import Tests
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(bbdb-vcard-import-test
"
** A vcard without any type parameters.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
FN:First1 Last1
N:Last1;First1
NICKNAME:Firsty1
PHOTO:The Alphabet:
abcdefghijklmnop
qrstuvwsyz
BDAY:1999-12-05
ADR:Box111;Room 111;First Street,First Corner;Cityone;First State;11111;Country
LABEL:Label 1
TEL:+11111111
EMAIL:first1@provider1
MAILER:Wanderlust1
TZ:+01:00
GEO:37.386013;-122.082932
TITLE:Director\\, Research and Development
ROLE:Programmer
LOGO:encoded logo #1
AGENT:CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com
ORG:Company1;Unit1;Subunit1
CATEGORIES:category1
NOTE:This vcard uses every type defined in rfc2426.
PRODID:-//ONLINE DIRECTORY//NONSGML Version 1//EN
REV:1995-10-31T22:27:10Z
SORT-STRING:aaa000
SOUND:Audible1
UID:111-111-111-111
URL:http://first1.host1.org
CLASS:CONFIDENTIAL
KEY:The Key No 1
X-foo:extended type 1
END:VCARD
"
["First1" "Last1"
("Firsty1")
"Company1
Unit1
Subunit1"
(["Office" "+11111111"])
(["Office"
("Box111" "Room 111" "First Street" "First Corner")
"Cityone"
"First State"
"11111"
"Country"])
("first1@provider1")
((x-foo . "extended type 1")
(key . "The Key No 1")
(class . "CONFIDENTIAL")
(uid . "111-111-111-111")
(sound . "Audible1")
(sort-string . "aaa000")
(prodid . "-//ONLINE DIRECTORY//NONSGML Version 1//EN")
(agent . "CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com")
(logo . "encoded logo #1")
(role . "Programmer")
(title . "Director, Research and Development")
(geo . "37.386013;-122.082932")
(tz . "+01:00")
(mailer . "Wanderlust1")
(label . "Label 1")
(photo . "The Alphabet:abcdefghijklmnopqrstuvwsyz")
(mail-alias . "category1")
(anniversary . "1999-12-05 birthday")
(notes . "This vcard uses every type defined in rfc2426.")
(www . "http://first1.host1.org")
(creation-date . "1995-10-31T22:27:10Z") (timestamp . "2010-03-04"))]
"First1 Last1"
nil nil t)
(bbdb-vcard-import-test
"
** Bad vCard: semi-colons where they don't belong
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
FN:First2; Last2
N:Last2;First2
NICKNAME:Firsty2,or; something
PHOTO:The Alphabet:
abcdefghij;klmnop
qrstuvwsyz
BDAY:1999-12-05
ADR:Box111;Room 111;First Street,First Corner;Cityone;First State;11111;Country
LABEL:Label 1;Label 2
TEL:+11111111;+222222
EMAIL:first1@provider1
MAILER:Wanderlust1;Wanderlust2
TZ:+01:00;Here
GEO:37.386013;-122.082932
TITLE:Director\\, Research; and Development
ROLE:Programmer
LOGO:encoded logo #1
AGENT:CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com
ORG:Company1;Unit1;Subunit1
CATEGORIES:category1
NOTE:This isn't a decent vCard. It shouldn't render our bbdb unusable. We don't expect it to re-import unchanged, though.
REV:1995-10-31T22:27:10Z
SORT-STRING:aaa000
SOUND:Audible1
UID:111-111-111-111
URL:http://first1.host1.org; My home
CLASS:CONFIDENTIAL
KEY:The Key No 1
X-foo:extended type 1
END:VCARD
"
["First2" "Last2"
("First2; Last2" "Firsty2" "or; something")
"Company1
Unit1
Subunit1"
(["Office" "+11111111;+222222"])
(["Office" ("Box111" "Room 111" "First Street" "First Corner") "Cityone" "First State" "11111" "Country"])
("first1@provider1")
((x-foo . "extended type 1")
(key . "The Key No 1")
(class . "CONFIDENTIAL")
(uid . "111-111-111-111")
(sound . "Audible1")
(sort-string . "aaa000")
(agent . "CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com")
(logo . "encoded logo #1")
(role . "Programmer")
(title . "Director, Research; and Development")
(geo . "37.386013;-122.082932")
(tz . "+01:00;Here")
(mailer . "Wanderlust1;Wanderlust2")
(label . "Label 1;Label 2")
(photo . "The Alphabet:abcdefghij;klmnopqrstuvwsyz")
(mail-alias . "category1")
(anniversary . "1999-12-05 birthday")
(notes . "This isn't a decent vCard. It shouldn't render our bbdb unusable. We don't expect it to re-import unchanged, though.")
(www . "http://first1.host1.org; My home")
(creation-date . "1995-10-31T22:27:10Z") (timestamp . "2010-03-04"))]
"First2 Last2"
nil nil t)
(bbdb-vcard-import-test
"
** The following is made of examples from rfc2426.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
FN:Mr. John Q. Public\\, Esq.
N:Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
NICKNAME:Robbie
PHOTO;VALUE=uri:http://www.abc.com/pub/photos
/jqpublic.gif
BDAY:1996-04-15
ADR;TYPE=dom,home,postal,parcel:;;123 Main
Street;Any Town;CA;91921-1234
LABEL;TYPE=dom,home,postal,parcel:Mr.John Q. Public\\, Esq.\\n
Mail Drop: TNE QB\\n123 Main Street\\nAny Town\\, CA 91921-1234
\\nU.S.A.
TEL;TYPE=work,voice,pref,msg:+1-213-555-1234
EMAIL;TYPE=internet:jqpublic@xyz.dom1.com
EMAIL;TYPE=internet:jdoe@isp.net
MAILER:PigeonMail 2.1
TZ:-05:00
GEO:37.386013;-122.082932
TITLE:Director\\, Research and Development
ROLE:Programmer
LOGO;ENCODING=b;TYPE=JPEG:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcN
AQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bm
ljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
AGENT;VALUE=uri:
CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com
ORG:ABC\\, Inc.;North American Division;Marketing
CATEGORIES:TRAVEL AGENT
NOTE:This fax number is operational 0800 to 1715
EST\\, Mon-Fri.
PRODID:-//ONLINE DIRECTORY//NONSGML Version 1//EN
REV:1995-10-31T22:27:10Z
SOUND;TYPE=BASIC;ENCODING=b:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcN
AQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bm
ljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
UID:19950401-080045-40000F192713-0052
URL:http://www.swbyps.restaurant.french/~chezchic.html
CLASS:PUBLIC
KEY;ENCODING=b:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQA
wdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENbW11bmljYX
Rpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
ZW1zMRwwGgYDVQQDExNyb290Y2EubmV0c2NhcGUuY29tMB4XDTk3MDYwNj
E5NDc1OVoXDTk3MTIwMzE5NDc1OVowgYkxCzAJBgNVBAYTAlVTMSYwJAYD
VQQKEx1OZXRzY2FwZSBDb21tdW5pY2F0aW9ucyBDb3JwLjEYMBYGA1UEAx
MPVGltb3RoeSBBIEhvd2VzMSEwHwYJKoZIhvcNAQkBFhJob3dlc0BuZXRz
Y2FwZS5jb20xFTATBgoJkiaJk/IsZAEBEwVob3dlczBcMA0GCSqGSIb3DQ
EBAQUAA0sAMEgCQQC0JZf6wkg8pLMXHHCUvMfL5H6zjSk4vTTXZpYyrdN2
dXcoX49LKiOmgeJSzoiFKHtLOIboyludF90CgqcxtwKnAgMBAAGjNjA0MB
EGCWCGSAGG+EIBAQQEAwIAoDAfBgNVHSMEGDAWgBT84FToB/GV3jr3mcau
+hUMbsQukjANBgkqhkiG9w0BAQQFAAOBgQBexv7o7mi3PLXadkmNP9LcIP
mx93HGp0Kgyx1jIVMyNgsemeAwBM+MSlhMfcpbTrONwNjZYW8vJDSoi//y
rZlVt9bJbs7MNYZVsyF1unsqaln4/vy6Uawfg8VUMk1U7jt8LYpo4YULU7
UZHPYVUaSgVttImOHZIKi4hlPXBOhcUQ==
END:VCARD
"
["Dr. John Philip Paul" "Stevenson Jr. M.D. A.C.P."
("Mr. John Q. Public, Esq." "Robbie")
"ABC, Inc.
North American Division
Marketing"
(["Office" "+1-213-555-1234"])
(["Home"
("123 Main Street")
"Any Town"
"CA"
"91921-1234"
""])
("jqpublic@xyz.dom1.com" "jdoe@isp.net")
((key\;encoding=b . "MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENbW11bmljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0ZW1zMRwwGgYDVQQDExNyb290Y2EubmV0c2NhcGUuY29tMB4XDTk3MDYwNjE5NDc1OVoXDTk3MTIwMzE5NDc1OVowgYkxCzAJBgNVBAYTAlVTMSYwJAYDVQQKEx1OZXRzY2FwZSBDb21tdW5pY2F0aW9ucyBDb3JwLjEYMBYGA1UEAxMPVGltb3RoeSBBIEhvd2VzMSEwHwYJKoZIhvcNAQkBFhJob3dlc0BuZXRzY2FwZS5jb20xFTATBgoJkiaJk/IsZAEBEwVob3dlczBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC0JZf6wkg8pLMXHHCUvMfL5H6zjSk4vTTXZpYyrdN2dXcoX49LKiOmgeJSzoiFKHtLOIboyludF90CgqcxtwKnAgMBAAGjNjA0MBEGCWCGSAGG+EIBAQQEAwIAoDAfBgNVHSMEGDAWgBT84FToB/GV3jr3mcau+hUMbsQukjANBgkqhkiG9w0BAQQFAAOBgQBexv7o7mi3PLXadkmNP9LcIPmx93HGp0Kgyx1jIVMyNgsemeAwBM+MSlhMfcpbTrONwNjZYW8vJDSoi//yrZlVt9bJbs7MNYZVsyF1unsqaln4/vy6Uawfg8VUMk1U7jt8LYpo4YULU7UZHPYVUaSgVttImOHZIKi4hlPXBOhcUQ==")
(class . "PUBLIC")
(uid . "19950401-080045-40000F192713-0052")
(sound\;type=basic\;encoding=b . "MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0")
(prodid . "-//ONLINE DIRECTORY//NONSGML Version 1//EN")
(agent\;value=uri . "CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com")
(logo\;encoding=b\;type=jpeg . "MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0")
(role . "Programmer")
(title . "Director, Research and Development")
(geo . "37.386013;-122.082932")
(tz . "-05:00")
(mailer . "PigeonMail 2.1")
(label\;type=dom\,home\,postal\,parcel . "Mr.John Q. Public, Esq.
Mail Drop: TNE QB
123 Main Street
Any Town, CA 91921-1234
U.S.A.")
(photo\;value=uri . "http://www.abc.com/pub/photos/jqpublic.gif")
(mail-alias . "TRAVEL AGENT")
(anniversary . "1996-04-15 birthday")
(notes . "This fax number is operational 0800 to 1715 EST, Mon-Fri.")
(www . "http://www.swbyps.restaurant.french/~chezchic.html")
(creation-date . "1995-10-31T22:27:10Z") (timestamp . "2010-03-04"))]
"John"
nil nil t)
(bbdb-vcard-import-test
"
** Exactly the same as before.
Re-reading it shouldn't duplicate anything.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
FN:Mr. John Q. Public\\, Esq.
N:Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
NICKNAME:Robbie
PHOTO;VALUE=uri:http://www.abc.com/pub/photos
/jqpublic.gif
BDAY:1996-04-15
ADR;TYPE=dom,home,postal,parcel:;;123 Main
Street;Any Town;CA;91921-1234
LABEL;TYPE=dom,home,postal,parcel:Mr.John Q. Public\\, Esq.\\n
Mail Drop: TNE QB\\n123 Main Street\\nAny Town\\, CA 91921-1234
\\nU.S.A.
TEL;TYPE=work,voice,pref,msg:+1-213-555-1234
EMAIL;TYPE=internet:jqpublic@xyz.dom1.com
EMAIL;TYPE=internet:jdoe@isp.net
MAILER:PigeonMail 2.1
TZ:-05:00
GEO:37.386013;-122.082932
TITLE:Director\\, Research and Development
ROLE:Programmer
LOGO;ENCODING=b;TYPE=JPEG:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcN
AQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bm
ljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
AGENT;VALUE=uri:
CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com
ORG:ABC\\, Inc.;North American Division;Marketing
CATEGORIES:TRAVEL AGENT
NOTE:This fax number is operational 0800 to 1715
EST\\, Mon-Fri.
PRODID:-//ONLINE DIRECTORY//NONSGML Version 1//EN
REV:1995-10-31T22:27:10Z
SOUND;TYPE=BASIC;ENCODING=b:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcN
AQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bm
ljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
UID:19950401-080045-40000F192713-0052
URL:http://www.swbyps.restaurant.french/~chezchic.html
CLASS:PUBLIC
KEY;ENCODING=b:MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQA
wdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENbW11bmljYX
Rpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
ZW1zMRwwGgYDVQQDExNyb290Y2EubmV0c2NhcGUuY29tMB4XDTk3MDYwNj
E5NDc1OVoXDTk3MTIwMzE5NDc1OVowgYkxCzAJBgNVBAYTAlVTMSYwJAYD
VQQKEx1OZXRzY2FwZSBDb21tdW5pY2F0aW9ucyBDb3JwLjEYMBYGA1UEAx
MPVGltb3RoeSBBIEhvd2VzMSEwHwYJKoZIhvcNAQkBFhJob3dlc0BuZXRz
Y2FwZS5jb20xFTATBgoJkiaJk/IsZAEBEwVob3dlczBcMA0GCSqGSIb3DQ
EBAQUAA0sAMEgCQQC0JZf6wkg8pLMXHHCUvMfL5H6zjSk4vTTXZpYyrdN2
dXcoX49LKiOmgeJSzoiFKHtLOIboyludF90CgqcxtwKnAgMBAAGjNjA0MB
EGCWCGSAGG+EIBAQQEAwIAoDAfBgNVHSMEGDAWgBT84FToB/GV3jr3mcau
+hUMbsQukjANBgkqhkiG9w0BAQQFAAOBgQBexv7o7mi3PLXadkmNP9LcIP
mx93HGp0Kgyx1jIVMyNgsemeAwBM+MSlhMfcpbTrONwNjZYW8vJDSoi//y
rZlVt9bJbs7MNYZVsyF1unsqaln4/vy6Uawfg8VUMk1U7jt8LYpo4YULU7
UZHPYVUaSgVttImOHZIKi4hlPXBOhcUQ==
END:VCARD
"
["Dr. John Philip Paul" "Stevenson Jr. M.D. A.C.P."
("Mr. John Q. Public, Esq." "Robbie")
"ABC, Inc.
North American Division
Marketing"
(["Office" "+1-213-555-1234"])
(["Home"
("123 Main Street")
"Any Town"
"CA"
"91921-1234"
""])
("jqpublic@xyz.dom1.com" "jdoe@isp.net")
((key\;encoding=b . "MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENbW11bmljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0ZW1zMRwwGgYDVQQDExNyb290Y2EubmV0c2NhcGUuY29tMB4XDTk3MDYwNjE5NDc1OVoXDTk3MTIwMzE5NDc1OVowgYkxCzAJBgNVBAYTAlVTMSYwJAYDVQQKEx1OZXRzY2FwZSBDb21tdW5pY2F0aW9ucyBDb3JwLjEYMBYGA1UEAxMPVGltb3RoeSBBIEhvd2VzMSEwHwYJKoZIhvcNAQkBFhJob3dlc0BuZXRzY2FwZS5jb20xFTATBgoJkiaJk/IsZAEBEwVob3dlczBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC0JZf6wkg8pLMXHHCUvMfL5H6zjSk4vTTXZpYyrdN2dXcoX49LKiOmgeJSzoiFKHtLOIboyludF90CgqcxtwKnAgMBAAGjNjA0MBEGCWCGSAGG+EIBAQQEAwIAoDAfBgNVHSMEGDAWgBT84FToB/GV3jr3mcau+hUMbsQukjANBgkqhkiG9w0BAQQFAAOBgQBexv7o7mi3PLXadkmNP9LcIPmx93HGp0Kgyx1jIVMyNgsemeAwBM+MSlhMfcpbTrONwNjZYW8vJDSoi//yrZlVt9bJbs7MNYZVsyF1unsqaln4/vy6Uawfg8VUMk1U7jt8LYpo4YULU7UZHPYVUaSgVttImOHZIKi4hlPXBOhcUQ==")
(class . "PUBLIC")
(uid . "19950401-080045-40000F192713-0052")
(sound\;type=basic\;encoding=b . "MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0")
(prodid . "-//ONLINE DIRECTORY//NONSGML Version 1//EN")
(agent\;value=uri . "CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com")
(logo\;encoding=b\;type=jpeg . "MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0")
(role . "Programmer")
(title . "Director, Research and Development")
(geo . "37.386013;-122.082932")
(tz . "-05:00")
(mailer . "PigeonMail 2.1")
(label\;type=dom\,home\,postal\,parcel . "Mr.John Q. Public, Esq.
Mail Drop: TNE QB
123 Main Street
Any Town, CA 91921-1234
U.S.A.")
(photo\;value=uri . "http://www.abc.com/pub/photos/jqpublic.gif")
(www . "http://www.swbyps.restaurant.french/~chezchic.html")
(mail-alias . "TRAVEL AGENT")
(anniversary . "1996-04-15 birthday")
(notes . "This fax number is operational 0800 to 1715 EST, Mon-Fri.")
(creation-date . "1995-10-31T22:27:10Z") (timestamp . "2010-03-04"))]
"John"
nil nil t)
(bbdb-vcard-import-test
"
** Re-use of existing BBDB entries.
*** N, ORG, EMAIL
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyA;FirstA
ORG:OrgA;UnitA
EMAIL:userA@hostA.example.com
END:vcard
"
["FirstA" "FamilyA"
nil
"OrgA
UnitA"
nil
nil
("userA@hostA.example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstA FamilyA")
(bbdb-vcard-import-test
"
*** The same again; shouldn't change the previous one.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyA;FirstA
ORG:OrgA;UnitA
EMAIL:userA@hostA.example.com
END:VCARD
"
["FirstA" "FamilyA"
nil
"OrgA
UnitA"
nil
nil
("userA@hostA.example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstA FamilyA")
(bbdb-vcard-import-test
"
*** Same N, same ORG, different EMAIL, which should be added to the previous
one.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyA;FirstA
ORG:OrgA;UnitA
EMAIL:personA@example.com
END:VCARD
"
["FirstA" "FamilyA"
nil
"OrgA
UnitA"
nil
nil
("userA@hostA.example.com" "personA@example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstA FamilyA")
(bbdb-vcard-import-test
"
*** Same N, same ORG, no EMAIL; shouldn't change anything.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyA;FirstA
ORG:OrgA;UnitA
END:VCARD
"
["FirstA" "FamilyA"
nil
"OrgA
UnitA"
nil
nil
("userA@hostA.example.com" "personA@example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstA FamilyA")
(bbdb-vcard-import-test
"
*** Same N, same EMAIL, no ORG; shouldn't change anything.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyA;FirstA
EMAIL:userA@hostA.example.com
END:VCARD
"
["FirstA" "FamilyA"
nil
"OrgA
UnitA"
nil
nil
("userA@hostA.example.com" "personA@example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstA FamilyA")
(bbdb-vcard-import-test
"
*** Same N, same EMAIL, different ORG by which Company of the previous one
should be replaced.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyA;FirstA
ORG:OrgA;UnitB
EMAIL:userA@hostA.example.com
END:VCARD
"
["FirstA" "FamilyA"
nil
"OrgA
UnitB"
nil
nil
("userA@hostA.example.com" "personA@example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstA FamilyA")
(bbdb-vcard-import-test
"
*** Different N, same EMAIL, same ORG; should go into a fresh entry.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyA1;FirstA1
ORG:OrgA;UnitB
EMAIL:userA@hostA.example.com
END:VCARD
"
["FirstA1" "FamilyA1"
nil
"OrgA
UnitB"
nil
nil
("userA@hostA.example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstA1 FamilyA1")
(bbdb-vcard-import-test
"
** AKA has various sources; duplicates are being discarded.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyB;FirstB
A.N:PseudonymB;FirstB
FN:The FirstB of FamilyB
A.FN:FirstB1 FamilyB1
B.FN:FirstB2 FamilyB2
C.FN:FirstB FamilyB
NICKNAME:Bee,Effy Bee,FirstB FamilyB
END:VCARD
"
["FirstB" "FamilyB"
("FirstB2 FamilyB2"
"FirstB1 FamilyB1"
"The FirstB of FamilyB"
"FirstB PseudonymB"
"Bee"
"Effy Bee")
nil
nil
nil
nil
((creation-date . "2010-03-04") (timestamp . "2010-03-04"))]
"FirstB FamilyB")
(bbdb-vcard-import-test
"
** Additional ORGs go to Notes, org.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyC;FirstC
ORG:OrgC1
ORG:OrgC2
END:vcard
"
["FirstC" "FamilyC"
nil
"OrgC1"
nil
nil
nil
((org . "OrgC2")
(creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstC FamilyC")
(bbdb-vcard-import-test
"
*** ... but only if they are unique
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyC;FirstC
ORG:OrgC1
ORG:OrgC2
ORG:OrgC3
ORG:OrgC3
ORG:OrgC4
END:VCARD
"
["FirstC" "FamilyC"
nil
"OrgC1"
nil
nil
nil
((org . "OrgC4")
(org . "OrgC3")
(org . "OrgC2")
(creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstC FamilyC")
(bbdb-vcard-import-test
"
** Prefixes are discarded.
------------------------------------------------------------
X.BEGIN:VCARD
X.VERSION:3.0
X.N:FamilyD;FirstD
X.ORG:OrgD;UnitD
X.EMAIL:userD@hostD.example.com
X.END:VCARD
"
["FirstD" "FamilyD"
nil
"OrgD
UnitD"
nil
nil
("userD@hostD.example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstD FamilyD")
(bbdb-vcard-import-test
"
*** Same as before, don't change anything.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyD;FirstD
ORG:OrgD;UnitD
EMAIL:userD@hostD.example.com
END:VCARD
"
["FirstD" "FamilyD"
nil
"OrgD
UnitD"
nil
nil
("userD@hostD.example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstD FamilyD")
(bbdb-vcard-import-test
"
*** Same as before, don't change anything.
------------------------------------------------------------
Y.BEGIN:VCARD
Y.VERSION:3.0
Y.N:FamilyD;FirstD
Y.ORG:OrgD;UnitD
Y.EMAIL:userD@hostD.example.com
Y.END:VCARD
"
["FirstD" "FamilyD"
nil
"OrgD
UnitD"
nil
nil
("userD@hostD.example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstD FamilyD")
(bbdb-vcard-import-test
"
** Case Insensitivity
------------------------------------------------------------
BEGIN:Vcard
Version:3.0
n:FamilyE;FirstE
Org:OrgE;UnitE
email:userE@hostE.example.com
end:vcard
"
["FirstE" "FamilyE"
nil
"OrgE
UnitE"
nil
nil
("userE@hostE.example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstE FamilyE")
(bbdb-vcard-import-test
"
** Non-ASCII Content
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
FN:Franz Rübezahl
N:Rübezahl;Franz
NICKNAME:Fränzchen,Rübe
ADR:Postschließfach 17;Zimmer Zwölf;Einbahnstraße;Ödstadt;;75480;
ORG:Rübe AG
END:VCARD
"
["Franz" "Rübezahl"
("Fränzchen" "Rübe")
"Rübe AG"
nil
(["Office"
("Postschließfach 17" "Zimmer Zwölf" "Einbahnstraße")
"Ödstadt"
""
"75480"
""])
nil
((creation-date . "2010-03-06") (timestamp . "2010-03-06")) ]
"Rübe")
(bbdb-vcard-import-test
"
*** Multiple, structured ADR
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyF;FirstF
ORG:OrgF;UnitF
ADR;TYPE=dom,home,postal,parcel:Box111,LHS;Room 111,or not;First Street,First Corner;Cityone;First State;11111,22222;Country
ADR;TYPE=intl,work,postal,parcel:Box222,RHS;Room 22,or something;Second Street,First Corner;Citytwo;Second State;222,33333;Country
ADR;TYPE=dom,work,postal,parcel:;;Second Street,First Corner;Citytwo;;222,33333;
ADR;TYPE=intl;TYPE=home;TYPE=parcel:;;Third Street,First Corner;Citythree;;222,33333;
END:VCARD
"
["FirstF" "FamilyF"
nil
"OrgF
UnitF"
nil
(["Home"
("Box111" "LHS" "Room 111" "or not" "First Street" "First Corner")
"Cityone"
"First State"
"11111\n22222"
"Country"]
["Office"
("Box222" "RHS" "Room 22" "or something" "Second Street" "First Corner")
"Citytwo"
"Second State"
"222\n33333"
"Country"]
["Office"
("Second Street" "First Corner")
"Citytwo"
""
"222\n33333"
""]
["Home"
("Third Street" "First Corner")
"Citythree"
""
"222\n33333"
""])
nil
((creation-date . "2010-03-04") (timestamp . "2010-03-04"))]
"FirstF FamilyF")
(bbdb-vcard-import-test
"
*** Skip types from bbdb-vcard-skip-on-import
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyH;FirstH
ORG:OrgH;UnitH
EMAIL:userH@hostH.example.com
X-GSM-FOO:Blah
X-GSM-BAR:Blahblah
END:VCARD
"
["FirstH" "FamilyH"
nil
"OrgH
UnitH"
nil
nil
("userH@hostH.example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstH FamilyH")
(bbdb-vcard-import-test
"
*** Skip empty types.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyG;FirstG
ORG:OrgG;UnitG
EMAIL:userG@hostG.example.com
ROLE:
TITLE:
GEO:
END:VCARD
"
["FirstG" "FamilyG"
nil
"OrgG
UnitG"
nil
nil
("userG@hostG.example.com")
((creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstG FamilyG")
(bbdb-vcard-import-test
"
*** Remove X-BBDB- prefixes
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyN;FirstN
ORG:OrgN;UnitN
EMAIL:userN@hostN.example.com
X-BBDB-MARK-CHAR:b
X-BBDB-TEX-NAME:{\\\\em FirstM FamilyM}
END:VCARD
"
["FirstN" "FamilyN"
nil
"OrgN
UnitN"
nil
nil
("userN@hostN.example.com")
((tex-name . "{\\em FirstM FamilyM}")
(mark-char . "b")
(creation-date . "2010-03-04") (timestamp . "2010-03-04"))]
"FirstN FamilyN")
(bbdb-vcard-import-test
"
** Merging of vcard NOTEs
*** A vcard with two NOTEs.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyI;FirstI
ORG:OrgI
NOTE:Note No. 1a
NOTE:Note No. 1b
END:VCARD
"
["FirstI" "FamilyI"
nil
"OrgI"
nil
nil
nil
((notes . "Note No. 1a;\nNote No. 1b")
(creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstI FamilyI")
(bbdb-vcard-import-test
"
*** Same as before, but a different NOTE.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyI;FirstI
ORG:OrgI
NOTE:Note No. 2
END:VCARD
"
["FirstI" "FamilyI"
nil
"OrgI"
nil
nil
nil
((notes . "Note No. 1a;\nNote No. 1b;\nNote No. 2")
(creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstI FamilyI")
(bbdb-vcard-import-test
"
*** Same as before, but a NOTE we've seen already
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyI;FirstI
ORG:OrgI
NOTE:Note No. 1b
END:VCARD
"
["FirstI" "FamilyI"
nil
"OrgI"
nil
nil
nil
((notes . "Note No. 1a;\nNote No. 1b;\nNote No. 2")
(creation-date . "2010-03-04") (timestamp . "2010-03-04")) ]
"FirstI FamilyI")
(bbdb-vcard-import-test
"
** Merging of vcard CATEGORIES
*** A vcard with two CATEGORIES.
------------------------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:FamilyM;FirstM
ORG:OrgI
CATEGORIES:Category 1a,Category 1b
CATEGORIES:Category 2a,Category 2b
END:VCARD
"
["FirstM" "FamilyM"
nil
"OrgI"
nil
nil
nil
((mail-alias . "Category 1a,Category 1b,Category 2a,Category 2b")
(creation-date . "2010-03-04") (timestamp . "2010-03-04"))]
"FirstM FamilyM")
(bbdb-vcard-import-test
"
*** Same as before, but a different CATEGORIES.