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

Carddav: fix multiple mail MAPI properties handling

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1255 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-23 10:13:08 +00:00
parent 1162d54bf6
commit 7ccc8b5b5f
5 changed files with 27 additions and 30 deletions

View File

@ -1725,9 +1725,9 @@ public abstract class ExchangeSession {
writer.appendProperty("ADR;TYPE=other",
get("otherpostofficebox"), null, get("otherstreet"), get("othercity"), get("otherstate"), get("otherpostalcode"), get("othercountry"));
writer.appendProperty("EMAIL;TYPE=work", get("email1"));
writer.appendProperty("EMAIL;TYPE=home", get("email2"));
writer.appendProperty("EMAIL;TYPE=other", get("email3"));
writer.appendProperty("EMAIL;TYPE=work", get("smtpemail1"));
writer.appendProperty("EMAIL;TYPE=home", get("smtpemail2"));
writer.appendProperty("EMAIL;TYPE=other", get("smtpemail3"));
writer.appendProperty("ORG", get("o"), get("department"));
writer.appendProperty("URL;TYPE=work", get("businesshomepage"));
@ -2800,12 +2800,15 @@ public abstract class ExchangeSession {
} else if ("EMAIL".equals(property.getKey())) {
if (property.hasParam("TYPE", "work")) {
properties.put("email1", property.getValue());
properties.put("smtpemail1", property.getValue());
}
if (property.hasParam("TYPE", "home")) {
properties.put("email2", property.getValue());
properties.put("smtpemail2", property.getValue());
}
if (property.hasParam("TYPE", "other")) {
properties.put("email3", property.getValue());
properties.put("smtpemail3", property.getValue());
}
} else if ("ORG".equals(property.getKey())) {
convertContactProperties(properties, VCARD_ORG_PROPERTIES, property.getValues());
@ -3205,9 +3208,9 @@ public abstract class ExchangeSession {
CONTACT_ATTRIBUTES.add("cn");
CONTACT_ATTRIBUTES.add("co");
CONTACT_ATTRIBUTES.add("department");
CONTACT_ATTRIBUTES.add("email1");
CONTACT_ATTRIBUTES.add("email2");
CONTACT_ATTRIBUTES.add("email3");
CONTACT_ATTRIBUTES.add("smtpemail1");
CONTACT_ATTRIBUTES.add("smtpemail2");
CONTACT_ATTRIBUTES.add("smtpemail3");
CONTACT_ATTRIBUTES.add("facsimiletelephonenumber");
CONTACT_ATTRIBUTES.add("givenName");
CONTACT_ATTRIBUTES.add("homeCity");

View File

@ -599,9 +599,7 @@ public class DavExchangeSession extends ExchangeSession {
ArrayList<DavConstants> list = new ArrayList<DavConstants>();
for (Map.Entry<String, String> entry : entrySet()) {
String key = entry.getKey();
if (key.startsWith("email")) {
list.add(Field.createDavProperty("write" + key, entry.getValue()));
} else if (!"photo".equals(key)) {
if (!"photo".equals(key)) {
list.add(Field.createDavProperty(key, entry.getValue()));
}
}

View File

@ -207,14 +207,16 @@ public class Field {
createField(URN_SCHEMAS_CONTACTS, "cn"); // PR_DISPLAY_NAME 0x3001 String
createField(URN_SCHEMAS_CONTACTS, "co"); // workAddressCountry DistinguishedPropertySetType.Address/0x00008049/String
createField(URN_SCHEMAS_CONTACTS, "department"); // PR_DEPARTMENT_NAME 0x3A18 String
// email with display name
createField("writeemail1", URN_SCHEMAS_CONTACTS, "email1"); // DistinguishedPropertySetType.PublicStrings/urn:schemas:contacts:email1/String
createField("writeemail2", URN_SCHEMAS_CONTACTS, "email2"); // DistinguishedPropertySetType.PublicStrings/urn:schemas:contacts:email2/String
createField("writeemail3", URN_SCHEMAS_CONTACTS, "email3"); // DistinguishedPropertySetType.PublicStrings/urn:schemas:contacts:email3/String
// email only
createField("email1", DistinguishedPropertySetType.Address, 0x8084, "email1"); // Email1OriginalDisplayName
createField("email2", DistinguishedPropertySetType.Address, 0x8094, "email2"); // Email2OriginalDisplayName
createField("email3", DistinguishedPropertySetType.Address, 0x80A4, "email3"); // Email3OriginalDisplayName
// smtp email
createField("smtpemail1", DistinguishedPropertySetType.Address, 0x8084, "smtpemail1"); // Email1OriginalDisplayName
createField("smtpemail2", DistinguishedPropertySetType.Address, 0x8094, "smtpemail2"); // Email2OriginalDisplayName
createField("smtpemail3", DistinguishedPropertySetType.Address, 0x80A4, "smtpemail3"); // Email3OriginalDisplayName
// native email
createField("email1", DistinguishedPropertySetType.Address, 0x8083, "email1"); // Email1OriginalDisplayName
createField("email2", DistinguishedPropertySetType.Address, 0x8093, "email2"); // Email2OriginalDisplayName
createField("email3", DistinguishedPropertySetType.Address, 0x80A3, "email3"); // Email3OriginalDisplayName
createField(URN_SCHEMAS_CONTACTS, "facsimiletelephonenumber"); // PR_BUSINESS_FAX_NUMBER 0x3A24 String
createField(URN_SCHEMAS_CONTACTS, "givenName"); // PR_GIVEN_NAME 0x3A06 String

View File

@ -105,17 +105,11 @@ public class Field {
FIELD_MAP.put("email2", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8093, ExtendedFieldURI.PropertyType.String)); // Email2EmailAddress
FIELD_MAP.put("email3", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80A3, ExtendedFieldURI.PropertyType.String)); // Email3EmailAddress
/*
FIELD_MAP.put("email1", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8084, ExtendedFieldURI.PropertyType.String)); // Email1OriginalDisplayName
FIELD_MAP.put("email2", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8094, ExtendedFieldURI.PropertyType.String)); // Email2OriginalDisplayName
FIELD_MAP.put("email3", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80A4, ExtendedFieldURI.PropertyType.String)); // Email3OriginalDisplayName
*/
/*
FIELD_MAP.put("email1", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8080, ExtendedFieldURI.PropertyType.String)); // Email1DisplayName
FIELD_MAP.put("email2", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8090, ExtendedFieldURI.PropertyType.String)); // Email2DisplayName
FIELD_MAP.put("email3", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80A0, ExtendedFieldURI.PropertyType.String)); // Email3DisplayName
*/
FIELD_MAP.put("smtpemail1", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8084, ExtendedFieldURI.PropertyType.String)); // Email1OriginalDisplayName
FIELD_MAP.put("smtpemail2", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8094, ExtendedFieldURI.PropertyType.String)); // Email2OriginalDisplayName
FIELD_MAP.put("smtpemail3", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80A4, ExtendedFieldURI.PropertyType.String)); // Email3OriginalDisplayName
FIELD_MAP.put("facsimiletelephonenumber", new ExtendedFieldURI(0x3A24, ExtendedFieldURI.PropertyType.String));
FIELD_MAP.put("givenName", new ExtendedFieldURI(0x3A06, ExtendedFieldURI.PropertyType.String));

View File

@ -140,9 +140,9 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
assertEquals("postalcode", contact.get("postalcode"));
assertEquals("co", contact.get("co"));
assertEquals("email1@local.net", contact.get("email1"));
assertEquals("email2@local.net", contact.get("email2"));
assertEquals("email3@local.net", contact.get("email3"));
assertEquals("email1@local.net", contact.get("smtpemail1"));
assertEquals("email2@local.net", contact.get("smtpemail2"));
assertEquals("email3@local.net", contact.get("smtpemail3"));
assertEquals("o", contact.get("o"));
assertEquals("department", contact.get("department"));