mirror of
https://github.com/moparisthebest/davmail
synced 2024-11-13 12:55:06 -05:00
Carddav: more properties
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1139 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
27ad92e9b9
commit
8c15ffec9c
@ -1768,7 +1768,7 @@ public abstract class ExchangeSession {
|
||||
writer.appendProperty("EMAIL;TYPE=other", get("email3"));
|
||||
|
||||
writer.appendProperty("ORG", get("o"), get("department"));
|
||||
writer.appendProperty("URL;WORK", get("businesshomepage"));
|
||||
writer.appendProperty("URL;TYPE=work", get("businesshomepage"));
|
||||
writer.appendProperty("TITLE", get("title"));
|
||||
writer.appendProperty("NOTE", get("description"));
|
||||
|
||||
@ -2627,6 +2627,7 @@ public abstract class ExchangeSession {
|
||||
protected static final String[] VCARD_N_PROPERTIES = {"sn", "givenName", "middlename", "personaltitle", "namesuffix"};
|
||||
protected static final String[] VCARD_ADR_HOME_PROPERTIES = {null, null, "homeStreet", "homeCity", "homeState", "homePostalCode", "homeCountry"};
|
||||
protected static final String[] VCARD_ADR_WORK_PROPERTIES = {"postofficebox", "roomnumber", "street", "l", "st", "postalcode", "co"};
|
||||
protected static final String[] VCARD_ORG_PROPERTIES = {"o", "department"};
|
||||
|
||||
protected void convertContactProperties(Map<String, String> properties, String[] contactProperties, List<String> values) {
|
||||
for (int i = 0; i < values.size() && i < contactProperties.length; i++) {
|
||||
@ -2686,23 +2687,30 @@ public abstract class ExchangeSession {
|
||||
if (property.hasParam("TYPE", "other")) {
|
||||
properties.put("email3", property.getValue());
|
||||
}
|
||||
} else if ("ORG".equals(property.getKey())) {
|
||||
convertContactProperties(properties, VCARD_ORG_PROPERTIES, property.getValues());
|
||||
} else if ("URL".equals(property.getKey())) {
|
||||
if (property.hasParam("TYPE", "work")) {
|
||||
properties.put("businesshomepage", property.getValue());
|
||||
}
|
||||
} else if ("TITLE".equals(property.getKey())) {
|
||||
properties.put("title", property.getValue());
|
||||
} else if ("NOTE".equals(property.getKey())) {
|
||||
properties.put("description", property.getValue());
|
||||
} else if ("CUSTOM1".equals(property.getKey())) {
|
||||
properties.put("extensionattribute1", property.getValue());
|
||||
} else if ("CUSTOM2".equals(property.getKey())) {
|
||||
properties.put("extensionattribute2", property.getValue());
|
||||
} else if ("CUSTOM3".equals(property.getKey())) {
|
||||
properties.put("extensionattribute3", property.getValue());
|
||||
} else if ("CUSTOM4".equals(property.getKey())) {
|
||||
properties.put("extensionattribute4", property.getValue());
|
||||
}
|
||||
/*
|
||||
|
||||
|
||||
writer.appendProperty("EMAIL;TYPE=work", get("email1"));
|
||||
writer.appendProperty("EMAIL;TYPE=home", get("email2"));
|
||||
writer.appendProperty("EMAIL;TYPE=other", get("email3"));
|
||||
|
||||
writer.appendProperty("ORG", get("o"), get("department"));
|
||||
writer.appendProperty("URL;WORK", get("businesshomepage"));
|
||||
writer.appendProperty("TITLE", get("title"));
|
||||
writer.appendProperty("NOTE", get("description"));
|
||||
|
||||
writer.appendProperty("CUSTOM1", get("extensionattribute1"));
|
||||
writer.appendProperty("CUSTOM2", get("extensionattribute2"));
|
||||
writer.appendProperty("CUSTOM3", get("extensionattribute3"));
|
||||
writer.appendProperty("CUSTOM4", get("extensionattribute4"));
|
||||
|
||||
writer.appendProperty("ROLE", get("profession"));
|
||||
writer.appendProperty("NICKNAME", get("nickname"));
|
||||
|
@ -66,7 +66,7 @@ public class VCardReader extends ICSBufferedReader {
|
||||
}
|
||||
|
||||
public boolean hasParam(String paramName, String paramValue) {
|
||||
return params.containsKey(paramName) && params.get(paramName).contains(paramValue);
|
||||
return params != null && params.containsKey(paramName) && params.get(paramName).contains(paramValue);
|
||||
}
|
||||
|
||||
protected void addParam(String paramName, Set<String> paramValues) {
|
||||
@ -152,7 +152,7 @@ public class VCardReader extends ICSBufferedReader {
|
||||
} else if (currentChar == '\\') {
|
||||
state = State.BACKSLASH;
|
||||
}
|
||||
// state == State.BACKSLASH
|
||||
// BACKSLASH state
|
||||
} else {
|
||||
state = State.VALUE;
|
||||
}
|
||||
|
@ -80,6 +80,17 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
|
||||
vCardWriter.appendProperty("EMAIL;TYPE=home", "email2@local.net");
|
||||
vCardWriter.appendProperty("EMAIL;TYPE=other", "email3@local.net");
|
||||
|
||||
vCardWriter.appendProperty("ORG", "o", "department");
|
||||
|
||||
vCardWriter.appendProperty("URL;TYPE=work", "http://local.net");
|
||||
vCardWriter.appendProperty("TITLE", "title");
|
||||
vCardWriter.appendProperty("NOTE", "description");
|
||||
|
||||
vCardWriter.appendProperty("CUSTOM1", "extensionattribute1");
|
||||
vCardWriter.appendProperty("CUSTOM2", "extensionattribute2");
|
||||
vCardWriter.appendProperty("CUSTOM3", "extensionattribute3");
|
||||
vCardWriter.appendProperty("CUSTOM4", "extensionattribute4");
|
||||
|
||||
vCardWriter.endCard();
|
||||
|
||||
session.createOrUpdateContact("testcontactfolder", itemName, vCardWriter.toString(), null, null);
|
||||
@ -120,5 +131,17 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
|
||||
assertEquals("email1@local.net", contact.get("email1"));
|
||||
assertEquals("email2@local.net", contact.get("email2"));
|
||||
assertEquals("email3@local.net", contact.get("email3"));
|
||||
|
||||
assertEquals("o", contact.get("o"));
|
||||
assertEquals("department", contact.get("department"));
|
||||
|
||||
assertEquals("http://local.net", contact.get("businesshomepage"));
|
||||
assertEquals("title", contact.get("title"));
|
||||
assertEquals("description", contact.get("description"));
|
||||
|
||||
assertEquals("extensionattribute1", contact.get("extensionattribute1"));
|
||||
assertEquals("extensionattribute2", contact.get("extensionattribute2"));
|
||||
assertEquals("extensionattribute3", contact.get("extensionattribute3"));
|
||||
assertEquals("extensionattribute4", contact.get("extensionattribute4"));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user