From acea3ab3b5e0a3d0d918960a8998bae6b082527c Mon Sep 17 00:00:00 2001 From: Matthew Brace Date: Thu, 19 Feb 2009 04:35:15 +0000 Subject: [PATCH] Pull destination url from OWA login page. Order of priority for destination is: User specified mailbox path, destination form value on OWA login page, "/" character. --- .../android/email/mail/store/WebDavStore.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/mail/store/WebDavStore.java b/src/com/android/email/mail/store/WebDavStore.java index 4dbdedd2a..2b9c08f0b 100644 --- a/src/com/android/email/mail/store/WebDavStore.java +++ b/src/com/android/email/mail/store/WebDavStore.java @@ -479,6 +479,7 @@ public class WebDavStore extends Store { String[] urlParts = url.split("/"); String finalUrl = ""; String loginUrl = new String(); + String destinationUrl = new String(); if (this.mAuthPath != null && !this.mAuthPath.equals("") && @@ -553,7 +554,15 @@ public class WebDavStore extends Store { } else { loginUrl = finalUrl + tagParts[1]; } - matched = true; + } + + if (tempText.indexOf("destination") >= 0) { + String[] tagParts = tempText.split("value"); + if (tagParts[1] != null) { + String[] valueParts = tagParts[1].split("\""); + destinationUrl = valueParts[1]; + matched = true; + } } } istream.close(); @@ -570,8 +579,11 @@ public class WebDavStore extends Store { if (this.mMailboxPath != null && !this.mMailboxPath.equals("")) { pairs.add(new BasicNameValuePair("destination", finalUrl + this.mMailboxPath)); + } else if (destinationUrl != null && + !destinationUrl.equals("")) { + pairs.add(new BasicNameValuePair("destination", destinationUrl)); } else { - pairs.add(new BasicNameValuePair("destination", url)); + pairs.add(new BasicNameValuePair("destination", "/")); } pairs.add(new BasicNameValuePair("flags", "0")); pairs.add(new BasicNameValuePair("SubmitCreds", "Log+On"));