Package jnode.ftn.types

Examples of jnode.ftn.types.FtnPkt


    List<FtnMessage> unpackedEchomail = new ArrayList<>();
    List<FtnMessage> packedNetmail = new ArrayList<>();
    List<FtnMessage> unpackedNetmail = new ArrayList<>();
    FtnAddress to = new FtnAddress(link.getLinkAddress());
    String password = link.getPaketPassword();
    FtnPkt header = new FtnPkt(selectOurAka(link), to, password, new Date());

    for (FtnMessage message : messages) {
      if (message.isNetmail()) {
        if (packNetmail) {
          packedNetmail.add(message);
        } else {
          unpackedNetmail.add(message);
        }
      } else {
        if (packEchomail) {
          packedEchomail.add(message);
        } else {
          unpackedEchomail.add(message);
        }
      }
    }

    if (!packedNetmail.isEmpty()) {

      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);
        }
View Full Code Here

TOP

Related Classes of jnode.ftn.types.FtnPkt

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.