diff --git a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java index 57c0e6fce..978c496a1 100644 --- a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java +++ b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java @@ -196,7 +196,6 @@ public class WebMail extends HttpServlet private static final String NEW_TEXT = "new_text"; private static final String NEW_FILENAME = "new_filename"; private static final String NEW_UPLOAD = "new_upload"; - private static final String NEW_BCC_TO_SELF = "new_bcc_to_self"; private static final String LIST = "list"; private static final String PREV = "prev"; @@ -247,7 +246,7 @@ public class WebMail extends HttpServlet private static final String CONFIG_COMPOSER_COLS = "composer.cols"; private static final String CONFIG_COMPOSER_ROWS = "composer.rows"; - private static final String CONFIG_BCC_TO_SELF = "composer.bcc.to.self"; + private static final String CONFIG_COPY_TO_SENT = "composer.copy.to.sent"; static final String CONFIG_LEAVE_ON_SERVER = "pop3.leave.on.server"; public static final String CONFIG_BACKGROUND_CHECK = "pop3.check.enable"; public static final String CONFIG_CHECK_MINUTES = "pop3.check.interval.minutes"; @@ -292,14 +291,12 @@ public class WebMail extends HttpServlet public boolean reallyDelete; String themePath, imgPath; boolean isMobile; - boolean bccToSelf; private final List nonces; private static final int MAX_NONCES = 15; public final Log log; SessionObject(Log log) { - bccToSelf = Boolean.parseBoolean(Config.getProperty( CONFIG_BCC_TO_SELF, "true" )); nonces = new ArrayList(MAX_NONCES + 1); caches = new HashMap(8); this.log = log; @@ -2566,13 +2563,6 @@ public class WebMail extends HttpServlet Mail.getRecipientsFromList( ccList, cc, ok ); Mail.getRecipientsFromList( bccList, bcc, ok ); - String bccToSelf = request.getParameter( NEW_BCC_TO_SELF ); - boolean toSelf = "1".equals(bccToSelf); - // save preference in session - sessionObject.bccToSelf = toSelf; - if (toSelf && sender != null && sender.length() > 0 && !bccList.contains(sender)) - bccList.add( sender ); - Encoding qp = EncodingFactory.getEncoding( "quoted-printable" ); Encoding hl = EncodingFactory.getEncoding( "HEADERLINE" ); @@ -2775,28 +2765,31 @@ public class WebMail extends HttpServlet if (log.shouldDebug()) log.debug("Sent email deleted from drafts"); } // now store to sent - mc = sessionObject.caches.get(DIR_SENT); - if (mc != null) { - waitForLoad(sessionObject, mc); - I2PAppContext ctx = I2PAppContext.getGlobalContext(); - String uidl = ctx.random().nextLong() + "sent"; - Writer wout = null; - boolean copyOK = false; - Buffer buffer = null; - try { - buffer = mc.getFullWriteBuffer(uidl); - wout = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream(), "ISO-8859-1")); - SMTPClient.writeMail(wout, body, - attachments, boundary); - if (log.shouldDebug()) log.debug("Sent email saved to Sent"); - copyOK = true; - } catch (IOException ioe) { - sessionObject.error += _t("Unable to save mail.") + ' ' + ioe.getMessage() + '\n'; - if (log.shouldDebug()) log.debug("Sent email saved error", ioe); - } finally { - if (wout != null) try { wout.close(); } catch (IOException ioe) {} - if (buffer != null) - mc.writeComplete(uidl, buffer, copyOK); + // if configured (default true) + if (Boolean.parseBoolean(Config.getProperty(CONFIG_COPY_TO_SENT, "true"))) { + mc = sessionObject.caches.get(DIR_SENT); + if (mc != null) { + waitForLoad(sessionObject, mc); + I2PAppContext ctx = I2PAppContext.getGlobalContext(); + String uidl = ctx.random().nextLong() + "sent"; + Writer wout = null; + boolean copyOK = false; + Buffer buffer = null; + try { + buffer = mc.getFullWriteBuffer(uidl); + wout = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream(), "ISO-8859-1")); + SMTPClient.writeMail(wout, body, + attachments, boundary); + if (log.shouldDebug()) log.debug("Sent email saved to Sent"); + copyOK = true; + } catch (IOException ioe) { + sessionObject.error += _t("Unable to save mail.") + ' ' + ioe.getMessage() + '\n'; + if (log.shouldDebug()) log.debug("Sent email saved error", ioe); + } finally { + if (wout != null) try { wout.close(); } catch (IOException ioe) {} + if (buffer != null) + mc.writeComplete(uidl, buffer, copyOK); + } } } } else { @@ -2957,7 +2950,6 @@ public class WebMail extends HttpServlet "" + _t("To") + ":\n" + "" + _t("Cc") + ":\n" + "" + _t("Bcc") + ":\n" + - "\n" + "" + _t("Subject") + ":\n" + "" + "
\n" + diff --git a/apps/susimail/src/susimail.properties b/apps/susimail/src/susimail.properties index 0a7903125..b5012e897 100644 --- a/apps/susimail/src/susimail.properties +++ b/apps/susimail/src/susimail.properties @@ -11,7 +11,7 @@ susimail.pager.pagesize=30 susimail.composer.cols=80 susimail.composer.rows=15 -susimail.composer.bcc.to.self=false +susimail.composer.copy.to.sent=true susimail.pop3.leave.on.server=false susimail.pop3.check.enable=false