try {
for (FtnMessage net : packedNetmail) {
FtnPkt head = new FtnPkt(header.getFromAddr(), to,
password, new Date());
Message m = new Message(createZipFile(head, link,
Arrays.asList(net)));
m.setMessageName(generateEchoBundle());
ret.add(m);
}
} catch (Exception e) {
logger.l1(
"Error while writing netmail to link #" + link.getId(),
e);
}
}
if (!packedEchomail.isEmpty()) {
try {
Message m = new Message(createZipFile(header, link,
packedEchomail));
m.setMessageName(generateEchoBundle());
ret.add(m);
} catch (Exception e) {
logger.l1(
"Error while writing echomail to link #" + link.getId(),
e);
}
}
if (!unpackedNetmail.isEmpty()) {
try {
for (FtnMessage net : unpackedNetmail) {
FtnPkt head = new FtnPkt(header.getFromAddr(), to,
password, new Date());
File out = createOutboundFile(link);
FileOutputStream fos = new FileOutputStream(out);
fos.write(head.pack());
fos.write(net.pack());
fos.write(head.finalz());
fos.close();
Message m = new Message(out);
m.setMessageName(generate8d() + ".pkt");
ret.add(m);
}
} catch (Exception e) {
logger.l1(
"Error while writing netmail to link #" + link.getId(),
e);
}
}
if (!unpackedEchomail.isEmpty()) {
try {
File out = createOutboundFile(link);
FileOutputStream fos = new FileOutputStream(out);
fos.write(header.pack());
for (FtnMessage m : unpackedEchomail) {
fos.write(m.pack());
}
fos.write(header.finalz());
fos.close();
Message m = new Message(out);
m.setMessageName(generate8d() + ".pkt");
ret.add(m);
} catch (Exception e) {
logger.l1(
"Error while writing netmail to link #" + link.getId(),
e);