forked from I2P_Developers/i2p.i2p
SusiMail: Include attachments when forwarding (ticket #2087)
This commit is contained in:
@ -28,6 +28,7 @@ import i2p.susi.util.Config;
|
|||||||
import i2p.susi.util.DecodingOutputStream;
|
import i2p.susi.util.DecodingOutputStream;
|
||||||
import i2p.susi.util.EscapeHTMLOutputStream;
|
import i2p.susi.util.EscapeHTMLOutputStream;
|
||||||
import i2p.susi.util.EscapeHTMLWriter;
|
import i2p.susi.util.EscapeHTMLWriter;
|
||||||
|
import i2p.susi.util.FileBuffer;
|
||||||
import i2p.susi.util.FilenameUtil;
|
import i2p.susi.util.FilenameUtil;
|
||||||
import i2p.susi.util.Folder;
|
import i2p.susi.util.Folder;
|
||||||
import i2p.susi.util.Folder.SortOrder;
|
import i2p.susi.util.Folder.SortOrder;
|
||||||
@ -1203,8 +1204,41 @@ public class WebMail extends HttpServlet
|
|||||||
if( buf.length() > 0 )
|
if( buf.length() > 0 )
|
||||||
cc = buf.toString();
|
cc = buf.toString();
|
||||||
}
|
}
|
||||||
|
I2PAppContext ctx = I2PAppContext.getGlobalContext();
|
||||||
if( forward ) {
|
if( forward ) {
|
||||||
// TODO attachments are not forwarded
|
List<MailPart> parts = part.parts;
|
||||||
|
if (!parts.isEmpty()) {
|
||||||
|
// Copy each valid attachment from the mail to a file
|
||||||
|
// in Drafts/attachments and add to list
|
||||||
|
// This is similar to the add attachment code in processComposeButtons()
|
||||||
|
attachments = new ArrayList<Attachment>(parts.size());
|
||||||
|
MailCache drafts = sessionObject.caches.get(DIR_DRAFTS);
|
||||||
|
for (MailPart mp : parts) {
|
||||||
|
if (mp.name == null || mp.type == null || mp.encoding == null) {
|
||||||
|
if (log.shouldDebug())
|
||||||
|
log.debug("skipping fwd att: " + mp);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String temp = "susimail-attachment-" + ctx.random().nextLong();
|
||||||
|
File f;
|
||||||
|
if (drafts != null) {
|
||||||
|
f = new File(drafts.getAttachmentDir(), temp);
|
||||||
|
} else {
|
||||||
|
f = new File(ctx.getTempDir(), temp);
|
||||||
|
}
|
||||||
|
Buffer out = new FileBuffer(f);
|
||||||
|
boolean ok = false;
|
||||||
|
try {
|
||||||
|
mp.decode(0, out);
|
||||||
|
ok = true;
|
||||||
|
attachments.add(new Attachment(mp.name, mp.type, mp.encoding, f));
|
||||||
|
} catch (IOException e) {
|
||||||
|
sessionObject.error += _t("Error reading uploaded file: {0}", e.getMessage()) + '\n';
|
||||||
|
} finally {
|
||||||
|
out.writeComplete(ok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
subject = mail.subject;
|
subject = mail.subject;
|
||||||
if (!(subject.startsWith("Fwd:") ||
|
if (!(subject.startsWith("Fwd:") ||
|
||||||
subject.startsWith("fwd:") ||
|
subject.startsWith("fwd:") ||
|
||||||
@ -1242,7 +1276,7 @@ public class WebMail extends HttpServlet
|
|||||||
// then P-R-G in processRequest()
|
// then P-R-G in processRequest()
|
||||||
StringBuilder draft = composeDraft(sessionObject, from, to, cc, bcc,
|
StringBuilder draft = composeDraft(sessionObject, from, to, cc, bcc,
|
||||||
subject, text.toString(), attachments);
|
subject, text.toString(), attachments);
|
||||||
String draftuidl = I2PAppContext.getGlobalContext().random().nextLong() + "drft";
|
String draftuidl = ctx.random().nextLong() + "drft";
|
||||||
boolean ok = saveDraft(sessionObject, draftuidl, draft);
|
boolean ok = saveDraft(sessionObject, draftuidl, draft);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
sessionObject.draftUIDL = draftuidl;
|
sessionObject.draftUIDL = draftuidl;
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2018-04-22 zzz
|
||||||
|
* SusiMail: Include attachments when forwarding (ticket #2087)
|
||||||
|
|
||||||
|
2018-04-21 zzz
|
||||||
|
* SusiMail: Remove Bcc-to-self feature, replace with
|
||||||
|
copy-to-sent config (ticket #2087)
|
||||||
|
|
||||||
2018-04-19 zzz
|
2018-04-19 zzz
|
||||||
* SusiMail:
|
* SusiMail:
|
||||||
- Fix reply/forward filling in compose form
|
- Fix reply/forward filling in compose form
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 5;
|
public final static long BUILD = 6;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
Reference in New Issue
Block a user