IMPP uses VCard 4 PREF property for VCard 3, too
rfc2822 opened this issue · 1 comments
rfc2822 commented
When running this test code:
public void testEzvcardPref() throws IOException {
//Impp property = new Impp("xmpp", "test@example.com");
Email property = new Email("test@example.com");
property.setPref(1);
VCard vCard = new VCard();
//vCard.addImpp(property);
vCard.addEmail(property);
StringWriter writer = new StringWriter();
new VCardWriter(writer, VCardVersion.V3_0).write(vCard);
new VCardWriter(writer, VCardVersion.V4_0).write(vCard);
Constants.log.info(writer.toString());
}
The (expected) test output is:
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: BEGIN:VCARD
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: VERSION:3.0
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: EMAIL;TYPE=pref:test@example.com
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: PRODID:ez-vcard 0.9.7
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: END:VCARD
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: BEGIN:VCARD
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: VERSION:4.0
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: EMAIL;PREF=1:test@example.com
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: PRODID:ez-vcard 0.9.7
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: END:VCARD
As you can see, VCard 3 uses TYPE=pref
and for VCard 4, PREF=1
is generated (as expected).
When changing the property to IMPP instead of email (just use the commented lines in the source code above), the output changes to:
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: BEGIN:VCARD
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: VERSION:3.0
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: IMPP;PREF=1:xmpp:test@example.com
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: PRODID:ez-vcard 0.9.7
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: END:VCARD
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: BEGIN:VCARD
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: VERSION:4.0
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: IMPP;PREF=1:xmpp:test@example.com
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: PRODID:ez-vcard 0.9.7
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: END:VCARD
Here, PREF=1
is used for VCard 3, too.
I don't know whether this is because VCard 3 doesn't define IMPP, but RFC 4770 VCard 3 IMPP Extension uses TYPE=pref, too.