mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 11:12:22 -05:00
Carddav: ignore key prefix in VCARD
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1215 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
efe80418ac
commit
e894e65da7
@ -114,6 +114,14 @@ public class VCardReader extends ICSBufferedReader {
|
||||
}
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
int dotIndex = key.indexOf('.');
|
||||
if (dotIndex < 0) {
|
||||
this.key = key;
|
||||
} else {
|
||||
this.key = key.substring(dotIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,11 +155,11 @@ public class VCardReader extends ICSBufferedReader {
|
||||
char currentChar = line.charAt(i);
|
||||
if (state == State.KEY) {
|
||||
if (currentChar == ':') {
|
||||
property.key = line.substring(startIndex, i);
|
||||
property.setKey(line.substring(startIndex, i));
|
||||
state = State.VALUE;
|
||||
startIndex = i + 1;
|
||||
} else if (currentChar == ';') {
|
||||
property.key = line.substring(startIndex, i);
|
||||
property.setKey(line.substring(startIndex, i));
|
||||
state = State.PARAM_NAME;
|
||||
startIndex = i + 1;
|
||||
}
|
||||
|
@ -299,4 +299,20 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
|
||||
|
||||
}
|
||||
|
||||
public void testKeyPrefix() throws IOException {
|
||||
ExchangeSession.Contact contact = (ExchangeSession.Contact) session.getItem("testcontactfolder", itemName);
|
||||
|
||||
VCardWriter vCardWriter = new VCardWriter();
|
||||
vCardWriter.startCard();
|
||||
vCardWriter.appendProperty("ITEM1.TEL;TYPE=CELL;TYPE=pref", "mobile with prefix");
|
||||
vCardWriter.endCard();
|
||||
|
||||
ExchangeSession.ItemResult result = session.createOrUpdateContact("testcontactfolder", itemName, vCardWriter.toString(), contact.etag, null);
|
||||
assertEquals(200, result.status);
|
||||
|
||||
contact = (ExchangeSession.Contact) session.getItem("testcontactfolder", itemName);
|
||||
|
||||
assertEquals("mobile with prefix", contact.get("mobile"));
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user