mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
Added gmail plugin containing both imap and smtp, with unit test
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package net.sf.briar.plugins.email;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.microedition.io.StreamConnection;
|
||||
|
||||
import net.sf.briar.api.plugins.simplex.SimplexTransportWriter;
|
||||
|
||||
public class GmailTransportConnectionWriter implements SimplexTransportWriter {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(GmailTransportConnectionWriter.class.getName());
|
||||
|
||||
private final StreamConnection stream;
|
||||
private final long capacity = 25 * 1000 * 1000;
|
||||
|
||||
public GmailTransportConnectionWriter(StreamConnection stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
public long getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
return stream.openOutputStream();
|
||||
}
|
||||
|
||||
public boolean shouldFlush() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void dispose(boolean exception) {
|
||||
try {
|
||||
stream.close();
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user