Package jnode.ftn.types

Examples of jnode.ftn.types.FtnMessage


   *
   * @param mail
   * @return
   */
  public static FtnMessage netmailToFtnMessage(Netmail mail) {
    FtnMessage message = new FtnMessage();
    message.setNetmail(true);
    message.setFromName(mail.getFromName());
    message.setToName(mail.getToName());
    message.setFromAddr(new FtnAddress(mail.getFromFTN()));
    message.setToAddr(new FtnAddress(mail.getToFTN()));
    message.setDate(mail.getDate());
    message.setSubject(mail.getSubject());
    message.setAttribute(mail.getAttr());
    StringBuilder text = new StringBuilder();
    text.append(mail.getText());
    if (text.charAt(text.length() - 1) != '\n') {
      text.append('\n');
    }
    for (FtnAddress address : MainHandler.getCurrentInstance().getInfo()
        .getAddressList()) {
      text.append(String.format(ROUTE_VIA, address.toString(),
          FORMAT.format(new Date())));
    }
    message.setText(text.toString());
    return message;
  }
View Full Code Here


   * @param text
   */
  public static void writeNetmail(FtnAddress from, FtnAddress to,
      String fromName, String toName, String subject, String text,
      int attr, boolean route) {
    FtnMessage message = new FtnMessage();

    StringBuilder sb = new StringBuilder();
    sb.append(String.format("\001MSGID: %s %s\n\001PID: %s\n\001TID: %s\n",
        from.toString(), generate8d(), MainHandler.getVersion(),
        MainHandler.getVersion()));
    sb.append(text);
    sb.append("\n\n--- " + MainHandler.getVersion() + "\n");
    message.setDate(new Date());
    message.setToAddr(to);
    message.setFromAddr(from);
    message.setToName(toName);
    message.setFromName(fromName);
    message.setSubject(subject);
    message.setText(sb.toString());
    message.setNetmail(true);
    message.setAttribute(attr);
    processRewrite(message);
    Link routeVia = null;
    if (route) {
      routeVia = getRouting(message);
      if (routeVia == null) {
View Full Code Here

    if (expiredNetmail.isEmpty()) {
      return;
    }
    for (Netmail netmail : expiredNetmail) {
     
      FtnMessage msg = FtnTools.netmailToFtnMessage(netmail);
      msg.setToAddr(new FtnAddress(netmail.getToFTN()));
      Link routeVia = FtnTools.getRoutingFallback(msg,
          netmail.getRouteVia());
      if (routeVia != null) {
        netmail.setRouteVia(routeVia);
        logger.l3("Netmail #" + netmail.getId() + " re-routed via "
View Full Code Here

TOP

Related Classes of jnode.ftn.types.FtnMessage

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.