Carddav: other address and homeposteofficebox properties

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1141 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-06 16:26:55 +00:00
parent 72fb2053d4
commit 2e3f7bfc0b
3 changed files with 35 additions and 4 deletions

View File

@ -1759,9 +1759,11 @@ public abstract class ExchangeSession {
// the street address; the locality (e.g., city); the region (e.g., state or province);
// the postal code; the country name
writer.appendProperty("ADR;TYPE=home",
null, null, get("homeStreet"), get("homeCity"), get("homeState"), get("homePostalCode"), get("homeCountry"));
get("homepostofficebox"), null, get("homeStreet"), get("homeCity"), get("homeState"), get("homePostalCode"), get("homeCountry"));
writer.appendProperty("ADR;TYPE=work",
get("postofficebox"), get("roomnumber"), get("street"), get("l"), get("st"), get("postalcode"), get("co"));
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"));
@ -2625,8 +2627,9 @@ 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_HOME_PROPERTIES = {"homepostofficebox", 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_ADR_OTHER_PROPERTIES = {"otherpostofficebox", null, "otherstreet", "othercity", "otherstate", "otherpostalcode", "othercountry"};
protected static final String[] VCARD_ORG_PROPERTIES = {"o", "department"};
protected void convertContactProperties(Map<String, String> properties, String[] contactProperties, List<String> values) {
@ -2676,6 +2679,8 @@ public abstract class ExchangeSession {
convertContactProperties(properties, VCARD_ADR_HOME_PROPERTIES, property.getValues());
} else if (property.hasParam("TYPE", "work")) {
convertContactProperties(properties, VCARD_ADR_WORK_PROPERTIES, property.getValues());
} else if (property.hasParam("TYPE", "other")) {
convertContactProperties(properties, VCARD_ADR_OTHER_PROPERTIES, property.getValues());
}
} else if ("EMAIL".equals(property.getKey())) {
if (property.hasParam("TYPE", "work")) {
@ -3043,6 +3048,7 @@ public abstract class ExchangeSession {
CONTACT_ATTRIBUTES.add("homePostalCode");
CONTACT_ATTRIBUTES.add("homeState");
CONTACT_ATTRIBUTES.add("homeStreet");
CONTACT_ATTRIBUTES.add("homepostofficebox");
CONTACT_ATTRIBUTES.add("l");
CONTACT_ATTRIBUTES.add("manager");
CONTACT_ATTRIBUTES.add("mobile");
@ -3066,6 +3072,13 @@ public abstract class ExchangeSession {
CONTACT_ATTRIBUTES.add("im");
CONTACT_ATTRIBUTES.add("middlename");
CONTACT_ATTRIBUTES.add("lastmodified");
CONTACT_ATTRIBUTES.add("otherstreet");
CONTACT_ATTRIBUTES.add("otherstate");
CONTACT_ATTRIBUTES.add("otherpostofficebox");
CONTACT_ATTRIBUTES.add("otherpostalcode");
CONTACT_ATTRIBUTES.add("othercountry");
CONTACT_ATTRIBUTES.add("othercity");
}
/**

View File

@ -200,8 +200,10 @@ public class Field {
createField("email1", DistinguishedPropertySetType.Address, 0x8083, "email1"); // Email1EmailAddress
createField("email2", DistinguishedPropertySetType.Address, 0x8093, "email2"); // Email2EmailAddress
createField("email3", DistinguishedPropertySetType.Address, 0x80A3, "email3"); // Email3EmailAddress
createField(URN_SCHEMAS_CONTACTS, "facsimiletelephonenumber"); // PR_BUSINESS_FAX_NUMBER 0x3A24 String
createField(URN_SCHEMAS_CONTACTS, "givenName"); // PR_GIVEN_NAME 0x3A06 String
createField(URN_SCHEMAS_CONTACTS, "homepostofficebox"); // PR_HOME_ADDRESS_POST_OFFICE_BOX 0x3A5E String
createField(URN_SCHEMAS_CONTACTS, "homeCity"); // PR_HOME_ADDRESS_CITY 0x3A59 String
createField(URN_SCHEMAS_CONTACTS, "homeCountry"); // PR_HOME_ADDRESS_COUNTRY 0x3A5A String
createField(URN_SCHEMAS_CONTACTS, "homePhone"); // PR_HOME_TELEPHONE_NUMBER 0x3A09 String
@ -230,6 +232,13 @@ public class Field {
createField("description", URN_SCHEMAS_HTTPMAIL, "textdescription"); // PR_BODY 0x1000 String
createField("im", SCHEMAS_MAPI, "InstMsg"); // InstantMessagingAddress DistinguishedPropertySetType.Address/0x00008062/String
createField(URN_SCHEMAS_CONTACTS, "otherstreet"); // PR_OTHER_ADDRESS_STREET 0x3A63 String
createField(URN_SCHEMAS_CONTACTS, "otherstate"); // PR_OTHER_ADDRESS_STATE_OR_PROVINCE 0x3A62 String
createField(URN_SCHEMAS_CONTACTS, "otherpostofficebox"); // PR_OTHER_ADDRESS_POST_OFFICE_BOX 0x3A64 String
createField(URN_SCHEMAS_CONTACTS, "otherpostalcode"); // PR_OTHER_ADDRESS_POSTAL_CODE 0x3A61 String
createField(URN_SCHEMAS_CONTACTS, "othercountry"); // PR_OTHER_ADDRESS_COUNTRY 0x3A60 String
createField(URN_SCHEMAS_CONTACTS, "othercity"); // PR_OTHER_ADDRESS_CITY 0x3A5F String
// contact private flags
createField("private", DistinguishedPropertySetType.Common, 0x8506, "private"); // True/False
createField("sensitivity", 0x0036, PropertyType.Long); // PR_SENSITIVITY SENSITIVITY_PRIVATE=2, SENSITIVITY_NONE = 0

View File

@ -73,9 +73,10 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
vCardWriter.appendProperty("TEL;TYPE=fax", "facsimiletelephonenumber");
vCardWriter.appendProperty("TEL;TYPE=pager", "pager");
vCardWriter.appendProperty("ADR;TYPE=home", null, null, "homeStreet", "homeCity", "homeState", "homePostalCode", "homeCountry");
vCardWriter.appendProperty("ADR;TYPE=home", "homepostofficebox", null, "homeStreet", "homeCity", "homeState", "homePostalCode", "homeCountry");
vCardWriter.appendProperty("ADR;TYPE=work", "postofficebox", "roomnumber", "street", "l", "st", "postalcode", "co");
vCardWriter.appendProperty("ADR;TYPE=other", "otherpostofficebox", null, "otherstreet", "othercity", "otherstate", "otherpostalcode", "othercountry");
vCardWriter.appendProperty("EMAIL;TYPE=work", "email1@local.net");
vCardWriter.appendProperty("EMAIL;TYPE=home", "email2@local.net");
vCardWriter.appendProperty("EMAIL;TYPE=other", "email3@local.net");
@ -119,6 +120,7 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
assertEquals("facsimiletelephonenumber", contact.get("facsimiletelephonenumber"));
assertEquals("pager", contact.get("pager"));
assertEquals("homepostofficebox", contact.get("homepostofficebox"));
assertEquals("homeStreet", contact.get("homeStreet"));
assertEquals("homeCity", contact.get("homeCity"));
assertEquals("homeState", contact.get("homeState"));
@ -152,5 +154,12 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
assertEquals("profession", contact.get("profession"));
assertEquals("im", contact.get("im"));
//assertEquals("bday", contact.get("bday"));
assertEquals("otherpostofficebox", contact.get("otherpostofficebox"));
assertEquals("otherstreet", contact.get("otherstreet"));
assertEquals("othercity", contact.get("othercity"));
assertEquals("otherstate", contact.get("otherstate"));
assertEquals("otherpostalcode", contact.get("otherpostalcode"));
assertEquals("othercountry", contact.get("othercountry"));
}
}