k-9/k9mail-library/src/main/java/com/fsck/k9/mail/transport/WebDavTransport.java

71 lines
1.8 KiB
Java
Raw Normal View History

Merge into 'trunk' r51837@31b (orig r127): ismarc31 | 2008-11-10 19:10:50 -0500 Experimental branch for Exchange WebDAV support r51838@31b (orig r128): ismarc31 | 2008-11-10 19:24:52 -0500 Initial proof-of-concept code for WebDav support r51839@31b (orig r129): ismarc31 | 2008-11-10 22:02:37 -0500 Fixed a couple of migration issues and enabled WebDav as a mail type r53269@31b (orig r132): ismarc31 | 2008-11-21 21:55:55 -0500 Mostly rewritten class and organization. Better implementation of message fetching. Consolidated response parsing. Removed a large number of redundant calls. There is still some unused functions needing cleaning up, and some unimplemented actions r53338@31b (orig r133): ismarc31 | 2008-11-22 16:50:02 -0500 Removed more redundant and unused calls. Implemented checking read status r53453@31b (orig r134): ismarc31 | 2008-11-24 20:13:24 -0500 Added support for marking messages as read. r53454@31b (orig r135): ismarc31 | 2008-11-24 22:04:04 -0500 Added support for deleting messages server side r53455@31b (orig r136): ismarc31 | 2008-11-25 01:32:19 -0500 Improved flag setting functionality, do bulk HTTP request instead of lots of little ones r53589@31b (orig r138): young.bradley | 2008-11-29 16:18:25 -0500 Missing some ports (webDavPorts); this causes an array index out of bounds exception when anything other than "None" or "SSL (Optional)" are selected. Adding the three additional ports solves this issue. r53590@31b (orig r139): young.bradley | 2008-11-30 00:47:42 -0500 Initial support for sending via WebDav r53591@31b (orig r140): ismarc31 | 2008-11-30 20:12:41 -0500 Fix for display names being URL Encoded for folders. Initial support of Uid Hashmaps instead of plain arrays. r53592@31b (orig r141): ismarc31 | 2008-11-30 21:46:06 -0500 Fix to constructor of HttpGeneric(final String uri). URLs returned from Exchange aren't always fully encoded, this fixes the encoding before creating the method. r53593@31b (orig r142): ismarc31 | 2008-12-01 02:22:16 -0500 Completed support for using hashmaps instead of arrays for indexing urls to emails and read status. Delete is safe again and read status is correct the first time through. r53594@31b (orig r143): ismarc31 | 2008-12-01 22:20:50 -0500 Fix for double-Inbox display issue. Removed volumous amounts of Log.d messages. r53644@31b (orig r157): young.bradley | 2008-12-04 15:14:28 -0500 Fix for wildcard certificates (e.g. issued to *.example.com). Only checking the trust of the certificate itself, since apparently the full chain causes it to not work. r53765@31b (orig r161): ismarc31 | 2008-12-06 18:55:08 -0500 Implemented new functionality for pulling message envelope. Uses a WebDAV call for all messages rather than parsing the stream. Message size is properly set now as well. r54055@31b (orig r163): jessev | 2008-12-06 19:28:24 -0500 * merge fixes
2008-12-06 19:29:11 -05:00
package com.fsck.k9.mail.transport;
Merge into 'trunk' r51837@31b (orig r127): ismarc31 | 2008-11-10 19:10:50 -0500 Experimental branch for Exchange WebDAV support r51838@31b (orig r128): ismarc31 | 2008-11-10 19:24:52 -0500 Initial proof-of-concept code for WebDav support r51839@31b (orig r129): ismarc31 | 2008-11-10 22:02:37 -0500 Fixed a couple of migration issues and enabled WebDav as a mail type r53269@31b (orig r132): ismarc31 | 2008-11-21 21:55:55 -0500 Mostly rewritten class and organization. Better implementation of message fetching. Consolidated response parsing. Removed a large number of redundant calls. There is still some unused functions needing cleaning up, and some unimplemented actions r53338@31b (orig r133): ismarc31 | 2008-11-22 16:50:02 -0500 Removed more redundant and unused calls. Implemented checking read status r53453@31b (orig r134): ismarc31 | 2008-11-24 20:13:24 -0500 Added support for marking messages as read. r53454@31b (orig r135): ismarc31 | 2008-11-24 22:04:04 -0500 Added support for deleting messages server side r53455@31b (orig r136): ismarc31 | 2008-11-25 01:32:19 -0500 Improved flag setting functionality, do bulk HTTP request instead of lots of little ones r53589@31b (orig r138): young.bradley | 2008-11-29 16:18:25 -0500 Missing some ports (webDavPorts); this causes an array index out of bounds exception when anything other than "None" or "SSL (Optional)" are selected. Adding the three additional ports solves this issue. r53590@31b (orig r139): young.bradley | 2008-11-30 00:47:42 -0500 Initial support for sending via WebDav r53591@31b (orig r140): ismarc31 | 2008-11-30 20:12:41 -0500 Fix for display names being URL Encoded for folders. Initial support of Uid Hashmaps instead of plain arrays. r53592@31b (orig r141): ismarc31 | 2008-11-30 21:46:06 -0500 Fix to constructor of HttpGeneric(final String uri). URLs returned from Exchange aren't always fully encoded, this fixes the encoding before creating the method. r53593@31b (orig r142): ismarc31 | 2008-12-01 02:22:16 -0500 Completed support for using hashmaps instead of arrays for indexing urls to emails and read status. Delete is safe again and read status is correct the first time through. r53594@31b (orig r143): ismarc31 | 2008-12-01 22:20:50 -0500 Fix for double-Inbox display issue. Removed volumous amounts of Log.d messages. r53644@31b (orig r157): young.bradley | 2008-12-04 15:14:28 -0500 Fix for wildcard certificates (e.g. issued to *.example.com). Only checking the trust of the certificate itself, since apparently the full chain causes it to not work. r53765@31b (orig r161): ismarc31 | 2008-12-06 18:55:08 -0500 Implemented new functionality for pulling message envelope. Uses a WebDAV call for all messages rather than parsing the stream. Message size is properly set now as well. r54055@31b (orig r163): jessev | 2008-12-06 19:28:24 -0500 * merge fixes
2008-12-06 19:29:11 -05:00
import android.util.Log;
2014-12-16 06:51:52 -05:00
import com.fsck.k9.mail.K9MailLib;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.mail.Transport;
import com.fsck.k9.mail.store.StoreConfig;
2014-12-18 03:33:09 -05:00
import com.fsck.k9.mail.store.webdav.WebDavStore;
import java.util.Collections;
2014-12-16 06:51:52 -05:00
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
public class WebDavTransport extends Transport {
/**
* Decodes a WebDavTransport URI.
*
* <p>
* <b>Note:</b> Everything related to sending messages via WebDAV is handled by
* {@link WebDavStore}. So the transport URI is the same as the store URI.
* </p>
*/
public static ServerSettings decodeUri(String uri) {
return WebDavStore.decodeUri(uri);
}
/**
* Creates a WebDavTransport URI.
*
* <p>
* <b>Note:</b> Everything related to sending messages via WebDAV is handled by
* {@link WebDavStore}. So the transport URI is the same as the store URI.
* </p>
*/
public static String createUri(ServerSettings server) {
return WebDavStore.createUri(server);
}
private WebDavStore store;
Merge into 'trunk' r51837@31b (orig r127): ismarc31 | 2008-11-10 19:10:50 -0500 Experimental branch for Exchange WebDAV support r51838@31b (orig r128): ismarc31 | 2008-11-10 19:24:52 -0500 Initial proof-of-concept code for WebDav support r51839@31b (orig r129): ismarc31 | 2008-11-10 22:02:37 -0500 Fixed a couple of migration issues and enabled WebDav as a mail type r53269@31b (orig r132): ismarc31 | 2008-11-21 21:55:55 -0500 Mostly rewritten class and organization. Better implementation of message fetching. Consolidated response parsing. Removed a large number of redundant calls. There is still some unused functions needing cleaning up, and some unimplemented actions r53338@31b (orig r133): ismarc31 | 2008-11-22 16:50:02 -0500 Removed more redundant and unused calls. Implemented checking read status r53453@31b (orig r134): ismarc31 | 2008-11-24 20:13:24 -0500 Added support for marking messages as read. r53454@31b (orig r135): ismarc31 | 2008-11-24 22:04:04 -0500 Added support for deleting messages server side r53455@31b (orig r136): ismarc31 | 2008-11-25 01:32:19 -0500 Improved flag setting functionality, do bulk HTTP request instead of lots of little ones r53589@31b (orig r138): young.bradley | 2008-11-29 16:18:25 -0500 Missing some ports (webDavPorts); this causes an array index out of bounds exception when anything other than "None" or "SSL (Optional)" are selected. Adding the three additional ports solves this issue. r53590@31b (orig r139): young.bradley | 2008-11-30 00:47:42 -0500 Initial support for sending via WebDav r53591@31b (orig r140): ismarc31 | 2008-11-30 20:12:41 -0500 Fix for display names being URL Encoded for folders. Initial support of Uid Hashmaps instead of plain arrays. r53592@31b (orig r141): ismarc31 | 2008-11-30 21:46:06 -0500 Fix to constructor of HttpGeneric(final String uri). URLs returned from Exchange aren't always fully encoded, this fixes the encoding before creating the method. r53593@31b (orig r142): ismarc31 | 2008-12-01 02:22:16 -0500 Completed support for using hashmaps instead of arrays for indexing urls to emails and read status. Delete is safe again and read status is correct the first time through. r53594@31b (orig r143): ismarc31 | 2008-12-01 22:20:50 -0500 Fix for double-Inbox display issue. Removed volumous amounts of Log.d messages. r53644@31b (orig r157): young.bradley | 2008-12-04 15:14:28 -0500 Fix for wildcard certificates (e.g. issued to *.example.com). Only checking the trust of the certificate itself, since apparently the full chain causes it to not work. r53765@31b (orig r161): ismarc31 | 2008-12-06 18:55:08 -0500 Implemented new functionality for pulling message envelope. Uses a WebDAV call for all messages rather than parsing the stream. Message size is properly set now as well. r54055@31b (orig r163): jessev | 2008-12-06 19:28:24 -0500 * merge fixes
2008-12-06 19:29:11 -05:00
2014-12-12 10:19:13 -05:00
public WebDavTransport(StoreConfig storeConfig) throws MessagingException {
store = new WebDavStore(storeConfig);
2014-12-16 06:51:52 -05:00
if (K9MailLib.isDebug())
Log.d(LOG_TAG, ">>> New WebDavTransport creation complete");
Merge into 'trunk' r51837@31b (orig r127): ismarc31 | 2008-11-10 19:10:50 -0500 Experimental branch for Exchange WebDAV support r51838@31b (orig r128): ismarc31 | 2008-11-10 19:24:52 -0500 Initial proof-of-concept code for WebDav support r51839@31b (orig r129): ismarc31 | 2008-11-10 22:02:37 -0500 Fixed a couple of migration issues and enabled WebDav as a mail type r53269@31b (orig r132): ismarc31 | 2008-11-21 21:55:55 -0500 Mostly rewritten class and organization. Better implementation of message fetching. Consolidated response parsing. Removed a large number of redundant calls. There is still some unused functions needing cleaning up, and some unimplemented actions r53338@31b (orig r133): ismarc31 | 2008-11-22 16:50:02 -0500 Removed more redundant and unused calls. Implemented checking read status r53453@31b (orig r134): ismarc31 | 2008-11-24 20:13:24 -0500 Added support for marking messages as read. r53454@31b (orig r135): ismarc31 | 2008-11-24 22:04:04 -0500 Added support for deleting messages server side r53455@31b (orig r136): ismarc31 | 2008-11-25 01:32:19 -0500 Improved flag setting functionality, do bulk HTTP request instead of lots of little ones r53589@31b (orig r138): young.bradley | 2008-11-29 16:18:25 -0500 Missing some ports (webDavPorts); this causes an array index out of bounds exception when anything other than "None" or "SSL (Optional)" are selected. Adding the three additional ports solves this issue. r53590@31b (orig r139): young.bradley | 2008-11-30 00:47:42 -0500 Initial support for sending via WebDav r53591@31b (orig r140): ismarc31 | 2008-11-30 20:12:41 -0500 Fix for display names being URL Encoded for folders. Initial support of Uid Hashmaps instead of plain arrays. r53592@31b (orig r141): ismarc31 | 2008-11-30 21:46:06 -0500 Fix to constructor of HttpGeneric(final String uri). URLs returned from Exchange aren't always fully encoded, this fixes the encoding before creating the method. r53593@31b (orig r142): ismarc31 | 2008-12-01 02:22:16 -0500 Completed support for using hashmaps instead of arrays for indexing urls to emails and read status. Delete is safe again and read status is correct the first time through. r53594@31b (orig r143): ismarc31 | 2008-12-01 22:20:50 -0500 Fix for double-Inbox display issue. Removed volumous amounts of Log.d messages. r53644@31b (orig r157): young.bradley | 2008-12-04 15:14:28 -0500 Fix for wildcard certificates (e.g. issued to *.example.com). Only checking the trust of the certificate itself, since apparently the full chain causes it to not work. r53765@31b (orig r161): ismarc31 | 2008-12-06 18:55:08 -0500 Implemented new functionality for pulling message envelope. Uses a WebDAV call for all messages rather than parsing the stream. Message size is properly set now as well. r54055@31b (orig r163): jessev | 2008-12-06 19:28:24 -0500 * merge fixes
2008-12-06 19:29:11 -05:00
}
@Override
public void open() throws MessagingException {
2014-12-16 06:51:52 -05:00
if (K9MailLib.isDebug())
Log.d(LOG_TAG, ">>> open called on WebDavTransport ");
store.getHttpClient();
Merge into 'trunk' r51837@31b (orig r127): ismarc31 | 2008-11-10 19:10:50 -0500 Experimental branch for Exchange WebDAV support r51838@31b (orig r128): ismarc31 | 2008-11-10 19:24:52 -0500 Initial proof-of-concept code for WebDav support r51839@31b (orig r129): ismarc31 | 2008-11-10 22:02:37 -0500 Fixed a couple of migration issues and enabled WebDav as a mail type r53269@31b (orig r132): ismarc31 | 2008-11-21 21:55:55 -0500 Mostly rewritten class and organization. Better implementation of message fetching. Consolidated response parsing. Removed a large number of redundant calls. There is still some unused functions needing cleaning up, and some unimplemented actions r53338@31b (orig r133): ismarc31 | 2008-11-22 16:50:02 -0500 Removed more redundant and unused calls. Implemented checking read status r53453@31b (orig r134): ismarc31 | 2008-11-24 20:13:24 -0500 Added support for marking messages as read. r53454@31b (orig r135): ismarc31 | 2008-11-24 22:04:04 -0500 Added support for deleting messages server side r53455@31b (orig r136): ismarc31 | 2008-11-25 01:32:19 -0500 Improved flag setting functionality, do bulk HTTP request instead of lots of little ones r53589@31b (orig r138): young.bradley | 2008-11-29 16:18:25 -0500 Missing some ports (webDavPorts); this causes an array index out of bounds exception when anything other than "None" or "SSL (Optional)" are selected. Adding the three additional ports solves this issue. r53590@31b (orig r139): young.bradley | 2008-11-30 00:47:42 -0500 Initial support for sending via WebDav r53591@31b (orig r140): ismarc31 | 2008-11-30 20:12:41 -0500 Fix for display names being URL Encoded for folders. Initial support of Uid Hashmaps instead of plain arrays. r53592@31b (orig r141): ismarc31 | 2008-11-30 21:46:06 -0500 Fix to constructor of HttpGeneric(final String uri). URLs returned from Exchange aren't always fully encoded, this fixes the encoding before creating the method. r53593@31b (orig r142): ismarc31 | 2008-12-01 02:22:16 -0500 Completed support for using hashmaps instead of arrays for indexing urls to emails and read status. Delete is safe again and read status is correct the first time through. r53594@31b (orig r143): ismarc31 | 2008-12-01 22:20:50 -0500 Fix for double-Inbox display issue. Removed volumous amounts of Log.d messages. r53644@31b (orig r157): young.bradley | 2008-12-04 15:14:28 -0500 Fix for wildcard certificates (e.g. issued to *.example.com). Only checking the trust of the certificate itself, since apparently the full chain causes it to not work. r53765@31b (orig r161): ismarc31 | 2008-12-06 18:55:08 -0500 Implemented new functionality for pulling message envelope. Uses a WebDAV call for all messages rather than parsing the stream. Message size is properly set now as well. r54055@31b (orig r163): jessev | 2008-12-06 19:28:24 -0500 * merge fixes
2008-12-06 19:29:11 -05:00
}
@Override
public void close() {
Merge into 'trunk' r51837@31b (orig r127): ismarc31 | 2008-11-10 19:10:50 -0500 Experimental branch for Exchange WebDAV support r51838@31b (orig r128): ismarc31 | 2008-11-10 19:24:52 -0500 Initial proof-of-concept code for WebDav support r51839@31b (orig r129): ismarc31 | 2008-11-10 22:02:37 -0500 Fixed a couple of migration issues and enabled WebDav as a mail type r53269@31b (orig r132): ismarc31 | 2008-11-21 21:55:55 -0500 Mostly rewritten class and organization. Better implementation of message fetching. Consolidated response parsing. Removed a large number of redundant calls. There is still some unused functions needing cleaning up, and some unimplemented actions r53338@31b (orig r133): ismarc31 | 2008-11-22 16:50:02 -0500 Removed more redundant and unused calls. Implemented checking read status r53453@31b (orig r134): ismarc31 | 2008-11-24 20:13:24 -0500 Added support for marking messages as read. r53454@31b (orig r135): ismarc31 | 2008-11-24 22:04:04 -0500 Added support for deleting messages server side r53455@31b (orig r136): ismarc31 | 2008-11-25 01:32:19 -0500 Improved flag setting functionality, do bulk HTTP request instead of lots of little ones r53589@31b (orig r138): young.bradley | 2008-11-29 16:18:25 -0500 Missing some ports (webDavPorts); this causes an array index out of bounds exception when anything other than "None" or "SSL (Optional)" are selected. Adding the three additional ports solves this issue. r53590@31b (orig r139): young.bradley | 2008-11-30 00:47:42 -0500 Initial support for sending via WebDav r53591@31b (orig r140): ismarc31 | 2008-11-30 20:12:41 -0500 Fix for display names being URL Encoded for folders. Initial support of Uid Hashmaps instead of plain arrays. r53592@31b (orig r141): ismarc31 | 2008-11-30 21:46:06 -0500 Fix to constructor of HttpGeneric(final String uri). URLs returned from Exchange aren't always fully encoded, this fixes the encoding before creating the method. r53593@31b (orig r142): ismarc31 | 2008-12-01 02:22:16 -0500 Completed support for using hashmaps instead of arrays for indexing urls to emails and read status. Delete is safe again and read status is correct the first time through. r53594@31b (orig r143): ismarc31 | 2008-12-01 22:20:50 -0500 Fix for double-Inbox display issue. Removed volumous amounts of Log.d messages. r53644@31b (orig r157): young.bradley | 2008-12-04 15:14:28 -0500 Fix for wildcard certificates (e.g. issued to *.example.com). Only checking the trust of the certificate itself, since apparently the full chain causes it to not work. r53765@31b (orig r161): ismarc31 | 2008-12-06 18:55:08 -0500 Implemented new functionality for pulling message envelope. Uses a WebDAV call for all messages rather than parsing the stream. Message size is properly set now as well. r54055@31b (orig r163): jessev | 2008-12-06 19:28:24 -0500 * merge fixes
2008-12-06 19:29:11 -05:00
}
@Override
public void sendMessage(Message message) throws MessagingException {
store.sendMessages(Collections.singletonList(message));
Merge into 'trunk' r51837@31b (orig r127): ismarc31 | 2008-11-10 19:10:50 -0500 Experimental branch for Exchange WebDAV support r51838@31b (orig r128): ismarc31 | 2008-11-10 19:24:52 -0500 Initial proof-of-concept code for WebDav support r51839@31b (orig r129): ismarc31 | 2008-11-10 22:02:37 -0500 Fixed a couple of migration issues and enabled WebDav as a mail type r53269@31b (orig r132): ismarc31 | 2008-11-21 21:55:55 -0500 Mostly rewritten class and organization. Better implementation of message fetching. Consolidated response parsing. Removed a large number of redundant calls. There is still some unused functions needing cleaning up, and some unimplemented actions r53338@31b (orig r133): ismarc31 | 2008-11-22 16:50:02 -0500 Removed more redundant and unused calls. Implemented checking read status r53453@31b (orig r134): ismarc31 | 2008-11-24 20:13:24 -0500 Added support for marking messages as read. r53454@31b (orig r135): ismarc31 | 2008-11-24 22:04:04 -0500 Added support for deleting messages server side r53455@31b (orig r136): ismarc31 | 2008-11-25 01:32:19 -0500 Improved flag setting functionality, do bulk HTTP request instead of lots of little ones r53589@31b (orig r138): young.bradley | 2008-11-29 16:18:25 -0500 Missing some ports (webDavPorts); this causes an array index out of bounds exception when anything other than "None" or "SSL (Optional)" are selected. Adding the three additional ports solves this issue. r53590@31b (orig r139): young.bradley | 2008-11-30 00:47:42 -0500 Initial support for sending via WebDav r53591@31b (orig r140): ismarc31 | 2008-11-30 20:12:41 -0500 Fix for display names being URL Encoded for folders. Initial support of Uid Hashmaps instead of plain arrays. r53592@31b (orig r141): ismarc31 | 2008-11-30 21:46:06 -0500 Fix to constructor of HttpGeneric(final String uri). URLs returned from Exchange aren't always fully encoded, this fixes the encoding before creating the method. r53593@31b (orig r142): ismarc31 | 2008-12-01 02:22:16 -0500 Completed support for using hashmaps instead of arrays for indexing urls to emails and read status. Delete is safe again and read status is correct the first time through. r53594@31b (orig r143): ismarc31 | 2008-12-01 22:20:50 -0500 Fix for double-Inbox display issue. Removed volumous amounts of Log.d messages. r53644@31b (orig r157): young.bradley | 2008-12-04 15:14:28 -0500 Fix for wildcard certificates (e.g. issued to *.example.com). Only checking the trust of the certificate itself, since apparently the full chain causes it to not work. r53765@31b (orig r161): ismarc31 | 2008-12-06 18:55:08 -0500 Implemented new functionality for pulling message envelope. Uses a WebDAV call for all messages rather than parsing the stream. Message size is properly set now as well. r54055@31b (orig r163): jessev | 2008-12-06 19:28:24 -0500 * merge fixes
2008-12-06 19:29:11 -05:00
}
}