2008-12-06 19:29:11 -05:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
package com.fsck.k9.mail.transport;
|
2008-12-06 19:29:11 -05:00
|
|
|
|
|
|
|
import android.util.Log;
|
2010-03-03 23:00:30 -05:00
|
|
|
|
2014-12-16 06:51:52 -05:00
|
|
|
import com.fsck.k9.mail.K9MailLib;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.mail.Message;
|
|
|
|
import com.fsck.k9.mail.MessagingException;
|
2011-06-07 10:39:41 -04:00
|
|
|
import com.fsck.k9.mail.ServerSettings;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.mail.Transport;
|
2014-12-11 22:23:32 -05:00
|
|
|
import com.fsck.k9.mail.store.StoreConfig;
|
2014-12-18 03:33:09 -05:00
|
|
|
import com.fsck.k9.mail.store.webdav.WebDavStore;
|
2009-12-09 22:16:42 -05:00
|
|
|
|
2014-10-04 05:37:30 -04:00
|
|
|
import java.util.Collections;
|
|
|
|
|
2014-12-16 06:51:52 -05:00
|
|
|
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public class WebDavTransport extends Transport {
|
2011-06-07 10:39:41 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Decodes a WebDavTransport URI.
|
|
|
|
*
|
|
|
|
* <p>
|
2011-06-08 23:50:43 -04:00
|
|
|
* <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.
|
2011-06-07 10:39:41 -04:00
|
|
|
* </p>
|
|
|
|
*/
|
|
|
|
public static ServerSettings decodeUri(String uri) {
|
2011-06-08 23:50:43 -04:00
|
|
|
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);
|
2011-06-07 10:39:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-24 19:40:29 -05:00
|
|
|
private WebDavStore store;
|
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);
|
2010-10-23 21:03:29 -04:00
|
|
|
|
2014-12-16 06:51:52 -05:00
|
|
|
if (K9MailLib.isDebug())
|
|
|
|
Log.d(LOG_TAG, ">>> New WebDavTransport creation complete");
|
2008-12-06 19:29:11 -05:00
|
|
|
}
|
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void open() throws MessagingException {
|
2014-12-16 06:51:52 -05:00
|
|
|
if (K9MailLib.isDebug())
|
|
|
|
Log.d(LOG_TAG, ">>> open called on WebDavTransport ");
|
2010-01-02 20:50:41 -05:00
|
|
|
|
2009-01-27 00:39:41 -05:00
|
|
|
store.getHttpClient();
|
2008-12-06 19:29:11 -05:00
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void close() {
|
2008-12-06 19:29:11 -05:00
|
|
|
}
|
2009-11-24 19:40:29 -05:00
|
|
|
|
2010-04-16 08:20:10 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void sendMessage(Message message) throws MessagingException {
|
2014-10-04 05:37:30 -04:00
|
|
|
store.sendMessages(Collections.singletonList(message));
|
2008-12-06 19:29:11 -05:00
|
|
|
}
|
|
|
|
}
|