1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Fixed an issue where some Exchange servers wouldn't mark messages as read. Fixed incorrect URL encoding in some folder path names. Removed some unneccessary headers from the envelope request.

This commit is contained in:
Matthew Brace 2008-12-24 03:09:37 +00:00
parent 70ab4d7a37
commit dc7a1a0532

View File

@ -300,7 +300,6 @@ public class WebDavStore extends Store {
buffer.append("<?xml version='1.0' ?>"); buffer.append("<?xml version='1.0' ?>");
buffer.append("<a:searchrequest xmlns:a='DAV:'><a:sql>\r\n"); buffer.append("<a:searchrequest xmlns:a='DAV:'><a:sql>\r\n");
buffer.append("SELECT \"DAV:uid\", \"DAV:getcontentlength\","); buffer.append("SELECT \"DAV:uid\", \"DAV:getcontentlength\",");
buffer.append(" \"urn:schemas:mailheader:received\",");
buffer.append(" \"urn:schemas:mailheader:mime-version\","); buffer.append(" \"urn:schemas:mailheader:mime-version\",");
buffer.append(" \"urn:schemas:mailheader:content-type\","); buffer.append(" \"urn:schemas:mailheader:content-type\",");
buffer.append(" \"urn:schemas:mailheader:subject\","); buffer.append(" \"urn:schemas:mailheader:subject\",");
@ -310,9 +309,7 @@ public class WebDavStore extends Store {
buffer.append(" \"urn:schemas:mailheader:from\","); buffer.append(" \"urn:schemas:mailheader:from\",");
buffer.append(" \"urn:schemas:mailheader:to\","); buffer.append(" \"urn:schemas:mailheader:to\",");
buffer.append(" \"urn:schemas:mailheader:in-reply-to\","); buffer.append(" \"urn:schemas:mailheader:in-reply-to\",");
buffer.append(" \"urn:schemas:mailheader:return-path\",");
buffer.append(" \"urn:schemas:mailheader:cc\","); buffer.append(" \"urn:schemas:mailheader:cc\",");
buffer.append(" \"urn:schemas:mailheader:references\",");
buffer.append(" \"urn:schemas:httpmail:read\""); buffer.append(" \"urn:schemas:httpmail:read\"");
buffer.append(" \r\n"); buffer.append(" \r\n");
buffer.append(" FROM \"\"\r\n"); buffer.append(" FROM \"\"\r\n");
@ -388,7 +385,7 @@ public class WebDavStore extends Store {
buffer.append("<a:propertyupdate xmlns:a='DAV:' xmlns:b='urn:schemas:httpmail:'>\r\n"); buffer.append("<a:propertyupdate xmlns:a='DAV:' xmlns:b='urn:schemas:httpmail:'>\r\n");
buffer.append("<a:target>\r\n"); buffer.append("<a:target>\r\n");
for (int i = 0, count = urls.length; i < count; i++) { for (int i = 0, count = urls.length; i < count; i++) {
buffer.append(" <a:href>"+urls[i].substring(urls[i].lastIndexOf('/') + 1)+"</a:href>\r\n"); buffer.append(" <a:href>"+urls[i]+"</a:href>\r\n");
} }
buffer.append("</a:target>\r\n"); buffer.append("</a:target>\r\n");
buffer.append("<a:set>\r\n"); buffer.append("<a:set>\r\n");
@ -548,7 +545,16 @@ public class WebDavStore extends Store {
String[] userParts; String[] userParts;
String encodedName = new String(); String encodedName = new String();
try { try {
encodedName = java.net.URLEncoder.encode(name, "UTF-8"); String[] urlParts = name.split("/");
String url = "";
for (int i = 0, count = urlParts.length; i < count; i++) {
if (i != 0) {
url = url + "/" + java.net.URLEncoder.encode(urlParts[i], "UTF-8");
} else {
url = java.net.URLEncoder.encode(urlParts[i], "UTF-8");
}
}
encodedName = url;
} catch (UnsupportedEncodingException uee) { } catch (UnsupportedEncodingException uee) {
Log.e(Email.LOG_TAG, "UnsupportedEncodingException URLEncoding folder name, skipping encoded"); Log.e(Email.LOG_TAG, "UnsupportedEncodingException URLEncoding folder name, skipping encoded");
encodedName = name; encodedName = name;
@ -573,6 +579,10 @@ public class WebDavStore extends Store {
authenticate(); authenticate();
} }
if (encodedName.equals("INBOX")) {
encodedName = "Inbox";
}
//this.mFolderUrl = WebDavStore.this.mUrl + "/Exchange/" + this.mLocalUsername + "/" + encodedName; //this.mFolderUrl = WebDavStore.this.mUrl + "/Exchange/" + this.mLocalUsername + "/" + encodedName;
this.mFolderUrl = WebDavStore.this.mUrl + encodedName; this.mFolderUrl = WebDavStore.this.mUrl + encodedName;
} }
@ -1337,7 +1347,7 @@ public class WebDavStore extends Store {
try { try {
int status_code = -1; int status_code = -1;
StringEntity messageEntity = new StringEntity(messageBody); StringEntity messageEntity = new StringEntity(messageBody);
HttpGeneric httpmethod = new HttpGeneric(this.mFolderUrl + "/"); HttpGeneric httpmethod = new HttpGeneric(this.mFolderUrl);
HttpResponse response; HttpResponse response;
HttpEntity entity; HttpEntity entity;
@ -1356,6 +1366,7 @@ public class WebDavStore extends Store {
} }
entity = response.getEntity(); entity = response.getEntity();
} catch (UnsupportedEncodingException uee) { } catch (UnsupportedEncodingException uee) {
Log.e(Email.LOG_TAG, "UnsupportedEncodingException: " + uee); Log.e(Email.LOG_TAG, "UnsupportedEncodingException: " + uee);
} catch (IOException ioe) { } catch (IOException ioe) {