Carddav: generate OSX compatible VCARD photo and change addressbook-home-set with OSX Address Book

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1264 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-24 15:53:06 +00:00
parent 06bd2e9c7d
commit 674a1436d0
3 changed files with 19 additions and 6 deletions

View File

@ -879,7 +879,11 @@ public class CaldavConnection extends AbstractConnection {
}
if (request.hasProperty("addressbook-home-set") && "users".equals(prefix)) {
response.appendHrefProperty("E:addressbook-home-set", "/users/" + actualPrincipal + "/contacts/");
if (request.isUserAgent("Address%20Book")) {
response.appendHrefProperty("E:addressbook-home-set", "/users/" + actualPrincipal + '/');
} else {
response.appendHrefProperty("E:addressbook-home-set", "/users/" + actualPrincipal + "/contacts/");
}
}
if ("users".equals(prefix)) {

View File

@ -1769,7 +1769,8 @@ public abstract class ExchangeSession {
if ("true".equals(get("haspicture"))) {
try {
ContactPhoto contactPhoto = getContactPhoto(this);
writer.appendProperty("PHOTO;BASE64;TYPE=\"" + contactPhoto.contentType + "\";ENCODING=\"b\"", contactPhoto.content);
writer.writeLine("PHOTO;BASE64;TYPE=\"" + contactPhoto.contentType + "\";ENCODING=\"b\":");
writer.writeLine(contactPhoto.content, true);
} catch (IOException e) {
LOGGER.warn("Unable to get photo from contact " + this.get("cn"));
}

View File

@ -42,11 +42,19 @@ public class ICSBufferedWriter {
* @param line ics event line
*/
public void writeLine(String line) {
if (line.length() > 75) {
buffer.append(line.substring(0, 75));
newLine();
writeLine(line, false);
}
public void writeLine(String line, boolean prefix) {
int maxLength = 77;
if (prefix) {
maxLength--;
buffer.append(' ');
writeLine(line.substring(75));
}
if (line.length() > maxLength) {
buffer.append(line.substring(0, maxLength));
newLine();
writeLine(line.substring(maxLength), true);
} else {
buffer.append(line);
newLine();