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

Carddav: add gender property

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1238 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-20 20:18:01 +00:00
parent 1a1e7a960b
commit 68bfabc393
3 changed files with 23 additions and 5 deletions

View File

@ -1733,7 +1733,14 @@ public abstract class ExchangeSession {
writer.appendProperty("X-AIM", get("im"));
writer.appendProperty("BDAY", convertZuluDateToBday(get("bday")));
writer.appendProperty("X-ANNIVERSARY", convertZuluDateToBday(get("anniversary")));
writer.appendProperty("ANNIVERSARY", convertZuluDateToBday(get("anniversary")));
String gender = get("gender");
if ("1".equals(gender)) {
writer.appendProperty("SEX", "2");
} else if ("2".equals(gender)) {
writer.appendProperty("SEX", "1");
}
writer.appendProperty("CATEGORIES", get("keywords"));
@ -2781,8 +2788,8 @@ public abstract class ExchangeSession {
properties.put("im", property.getValue());
} else if ("BDAY".equals(property.getKey())) {
properties.put("bday", convertBDayToZulu(property.getValue()));
} else if ("X-ANNIVERSARY".equals(property.getKey())) {
properties.put("anniversary", convertBDayToZulu(property.getValue()));
} else if ("ANNIVERSARY".equals(property.getKey())) {
properties.put("anniversary", convertBDayToZulu(property.getValue()));
} else if ("CATEGORIES".equals(property.getKey())) {
properties.put("keywords", property.getValue());
} else if ("CLASS".equals(property.getKey())) {
@ -2793,6 +2800,13 @@ public abstract class ExchangeSession {
properties.put("sensitivity", "2");
properties.put("private", "true");
}
} else if ("SEX".equals(property.getKey())) {
String propertyValue = property.getValue();
if ("1".equals(propertyValue)) {
properties.put("gender", "2");
} else if ("2".equals(propertyValue)) {
properties.put("gender", "1");
}
} else if ("X-ASSISTANT".equals(property.getKey())) {
properties.put("secretarycn", property.getValue());
} else if ("X-MANAGER".equals(property.getKey())) {
@ -2834,7 +2848,7 @@ public abstract class ExchangeSession {
LOGGER.warn("Invalid date: " + value);
}
}
return result;
}
@ -3187,7 +3201,7 @@ public abstract class ExchangeSession {
CONTACT_ATTRIBUTES.add("haspicture");
CONTACT_ATTRIBUTES.add("keywords");
CONTACT_ATTRIBUTES.add("othermobile");
CONTACT_ATTRIBUTES.add("gender");
CONTACT_ATTRIBUTES.add("private");
CONTACT_ATTRIBUTES.add("sensitivity");
}

View File

@ -249,6 +249,8 @@ public class Field {
createField(URN_SCHEMAS_CONTACTS, "othercountry"); // PR_OTHER_ADDRESS_COUNTRY 0x3A60 String
createField(URN_SCHEMAS_CONTACTS, "othercity"); // PR_OTHER_ADDRESS_CITY 0x3A5F String
createField(URN_SCHEMAS_CONTACTS, "gender"); // PR_GENDER 0x3A4D Integer16
createField("keywords", SCHEMAS_EXCHANGE, "keywords-utf8", PropertyType.StringArray); // PS_PUBLIC_STRINGS Keywords String
//createField("keywords", DistinguishedPropertySetType.PublicStrings, "Keywords", ); // PS_PUBLIC_STRINGS Keywords String

View File

@ -141,6 +141,8 @@ public class Field {
FIELD_MAP.put("othercountry", new ExtendedFieldURI(0x3A60, ExtendedFieldURI.PropertyType.String));
FIELD_MAP.put("othercity", new ExtendedFieldURI(0x3A5F, ExtendedFieldURI.PropertyType.String));
FIELD_MAP.put("gender", new ExtendedFieldURI(0x3A4D, ExtendedFieldURI.PropertyType.Short));
FIELD_MAP.put("keywords", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "Keywords", ExtendedFieldURI.PropertyType.StringArray));
FIELD_MAP.put("private", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Common, 0x8506, ExtendedFieldURI.PropertyType.Boolean));