1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 19:22:22 -05:00

Carddav: adjust fields accepting multiple values

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1229 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-20 14:27:41 +00:00
parent 7064d5a690
commit 344216989f
2 changed files with 24 additions and 1 deletions

View File

@ -106,7 +106,13 @@ public class VCardReader extends ICSBufferedReader {
}
}
// iPhone encodes category separator
if (c == ',' && !"NOTE".equals(key)) {
if (c == ',' &&
// multivalued properties
("N".equals(key) ||
"ADR".equals(key) ||
"CATEGORIES".equals(key) ||
"NICKNAME".equals(key)
)) {
// convert multiple values to multiline values (e.g. street)
c = '\n';
}

View File

@ -372,4 +372,21 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
ExchangeSession.ItemResult result = session.createOrUpdateContact("testcontactfolder", itemName, itemBody, contact.etag, null);
assertEquals(200, result.status);
}
public void testIphoneEncodedComma() throws IOException {
ExchangeSession.Contact contact = getCurrentContact();
VCardWriter vCardWriter = new VCardWriter();
vCardWriter.startCard();
vCardWriter.appendProperty("ITEM1.TEL;TYPE=CELL;TYPE=pref", "mobile\\, with comma");
vCardWriter.endCard();
ExchangeSession.ItemResult result = session.createOrUpdateContact("testcontactfolder", itemName, vCardWriter.toString(), contact.etag, null);
assertEquals(200, result.status);
contact = getCurrentContact();
assertEquals("mobile, with comma", contact.get("mobile"));
}
}