Examples of FtnAddress


Examples of jnode.ftn.types.FtnAddress

        Collections.sort(elements, new Comparator<ConnectionStatData.ConnectionStatDataElement>() {

            @Override
            public int compare(ConnectionStatData.ConnectionStatDataElement arg0,
                               ConnectionStatData.ConnectionStatDataElement arg1) {
                FtnAddress a1 = arg0.linkStr != null ? new FtnAddress(arg0.linkStr) : null;
                FtnAddress a2 = arg1.linkStr != null ? new FtnAddress(arg1.linkStr) : null;
                if (a1 == null && a2 != null) {
                    return 1;
                } else if (a2 == null && a1 != null) {
                    return -1;
                } else if (a1 == null && a2 == null) {
                    return 0;
                } else {
                    return new FtnTools.Ftn4DComparator().compare(a1, a2);
                }
            }

        });


        int iOkT = 0;
        int iFaT = 0;
        int oOkT = 0;
        int oFaT = 0;
        int bsT = 0;
        int brT = 0;
        for (ConnectionStatData.ConnectionStatDataElement element : elements) {
            FtnAddress link = element.linkStr != null ? new FtnAddress(element.linkStr) : null;
            String linkName = (link != null) ? link.toString()
                    : "Unknown";
            iOkT += element.incomingOk;
            iFaT += element.incomingFailed;
            oOkT += element.outgoingOk;
            oFaT += element.outgoingFailed;
View Full Code Here

Examples of jnode.ftn.types.FtnAddress

    if (connectionState != STATE_ADDR) {
      error("We weren't waiting for M_ADR");
    }
    for (String addr : arg.replace("^[ ]*", "").split(" ")) {
      try {
        FtnAddress a = new FtnAddress(addr);
        Link link = FtnTools.getLinkByFtnAddress(a);
        boolean nodelist = NodelistScanner.getInstance().isExists(a) != null;
        if (link != null || nodelist) {
          foreignAddress.add(a);
        }
      } catch (NumberFormatException e) {
        logger.l4("Invalid address " + addr);
      }
    }

    if (foreignAddress.isEmpty()) {
      error("No valid address specified");
      return;
    }
    Link link = FtnTools.getLinkByFtnAddress(foreignAddress);
    if (link != null) {
      String ourAka = FtnTools.getOptionString(link,
          LinkOption.STRING_OUR_AKA);
      if (ourAka != null) {
        try {
          FtnAddress addr = new FtnAddress(ourAka);
          if (ourAddress.contains(addr)) {
            ourAddress.clear();
            ourAddress.add(addr);
          }
        } catch (NumberFormatException e) {
        }
      }
      foreignLink = link;
      secure = true;
    } else {
      boolean nodelist = false;
      for (FtnAddress a : foreignAddress) {
        if (NodelistScanner.getInstance().isExists(a) != null) {
          nodelist = true;
          break;
        }
      }
      if (!nodelist) {
        error("No one address you specified exists in Nodelist");
        return;
      }
    }
    for (FtnAddress addr : foreignAddress) {
      if (!PollQueue.getSelf().isActive(addr)) {
        PollQueue.getSelf().start(addr);
      } else {
        busy("Already connected with " + addr.toString());
      }
    }
    if (clientConnection) {
      frames.addLast(new BinkpFrame(BinkpCommand.M_PWD, getAuthPassword(
          foreignLink, secure, cramAlgo, cramText)));
View Full Code Here

Examples of jnode.ftn.types.FtnAddress

          "Done: %s %s, %s, S/R: %d/%d (%d/%d bytes) (%d/%d cps)",
          (clientConnection) ? "to" : "from", address,
          (connectionState == STATE_END) ? "OK" : "ERROR",
          total_sent_files, total_recv_files, total_sent_bytes,
          total_recv_bytes, scps, rcps));
      event = new ConnectionEndEvent(new FtnAddress(address),
          !clientConnection, (connectionState == STATE_END),
          total_recv_bytes, total_sent_bytes);
    } else {
      event = new ConnectionEndEvent(clientConnection, false);
      logger.l3("Connection ended as unknown");
View Full Code Here

Examples of jnode.ftn.types.FtnAddress

        continue;
      }
      Matcher m = pBoss.matcher(line);
      if (m.matches()) {
        FtnNdlAddress boss = NodelistScanner.getInstance().isExists(
            new FtnAddress(m.group(1)));
        if (boss == null) {
          addError(linenum, line + " not found in nodelist", errors);
          bossnotfound = true;
        } else {
          if (multi || bosses.isEmpty()) {
View Full Code Here

Examples of jnode.ftn.types.FtnAddress

   */
  public static List<FtnAddress> read4D(String list2d) {
    List<FtnAddress> ret = new ArrayList<>();
    for (String l2d : list2d.split(" ")) {
      try {
        ret.add(new FtnAddress(l2d));
      } catch (RuntimeException e) {
      }
    }
    return ret;
  }
View Full Code Here

Examples of jnode.ftn.types.FtnAddress

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

Examples of jnode.ftn.types.FtnAddress

        rewrite.getNew_to_name(), rewrite.getNew_subject() };
    for (int i = 0; i < 5; i++) {
      if (fields[i] != null && !fields[i].equals("*")) {
        switch (i) {
        case 0:
          FtnAddress nfa = new FtnAddress(fields[i]);
          if (message.getMsgid() != null) {
            Matcher msgid = Pattern.compile(
                "^" + message.getFromAddr() + " (\\S+)$")
                .matcher(message.getMsgid());
            if (msgid.find()) {
              String msg = msgid.replaceFirst(nfa + " $1");
              message.setText(message.getText().replace(
                  message.getMsgid(), msg));
              message.setMsgid(msg);

            }
          } // TODO : netmail msgid
          Matcher origin = Pattern.compile(
              "^ \\* Origin: (.*) \\(" + message.getFromAddr()
                  + "\\)$", Pattern.MULTILINE).matcher(
              message.getText());
          if (origin.find()) {
            message.setText(origin.replaceFirst(" * Origin: $1 ("
                + nfa + ")"));
          }
          message.setFromAddr(nfa);
          logger.l5("Rewrite fromAddr to " + fields[i]);
          break;
        case 1:
          message.setToAddr(new FtnAddress(fields[i]));
          logger.l5("Rewrite toAddr to " + fields[i]);
          break;
        case 2:
          message.setFromName(fields[i]);
          logger.l5("Rewrite fromAddr to " + fields[i]);
View Full Code Here

Examples of jnode.ftn.types.FtnAddress

   * @param message
   * @return
   */
  public static Link getRouting(FtnMessage message) {
    Link routeVia;
    FtnAddress routeTo = message.getToAddr().clone();
    routeVia = getLinkByFtnAddress(routeTo);
    // check our point
    if (!isOurPoint(routeTo)) {
      routeTo.setPoint(0);
      routeVia = getLinkByFtnAddress(routeTo);
      // а теперь - по роутингу
      if (routeVia == null) {
        List<Route> routes = ORMManager.get(Route.class).getOrderAnd(
            "nice", true);
View Full Code Here

Examples of jnode.ftn.types.FtnAddress

  }

  public static Link getRoutingFallback(FtnMessage message,
      Link previousRouteVia) {
    Link routeVia = null;
    FtnAddress routeTo = message.getToAddr().clone();
    if (isOurPoint(routeTo)) {
      return null;
    }
    // direct link can be down for us - use cross way
    List<Route> routes = ORMManager.get(Route.class).getOrderAnd("nice",
View Full Code Here

Examples of jnode.ftn.types.FtnAddress

   * @param subject
   * @param text
   * @throws SQLException
   */
  public static void writeReply(FtnMessage fmsg, String subject, String text) {
    FtnAddress from = getPrimaryFtnAddress();
    StringBuilder sb = new StringBuilder();
    if (fmsg.getMsgid() != null) {
      sb.append("\001REPLY: " + fmsg.getMsgid() + "\n");
    }
    sb.append(text);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.