MCPcopy Create free account
hub / github.com/annmuor/jnode / checkNetmailMustDropped

Method checkNetmailMustDropped

jnode-core/src/jnode/ftn/FtnTools.java:1463–1533  ·  view source on GitHub ↗

Проверка на дроп нетмейла @param netmail @return

(FtnMessage netmail)

Source from the content-addressed store, hash-verified

1461 * @return
1462 */
1463 public static boolean checkNetmailMustDropped(FtnMessage netmail) {
1464 // дополнительная проверка
1465 if (!MainHandler.getCurrentInstance().getBooleanProperty(NETMAIL_VALID,
1466 true)) {
1467 return false;
1468 }
1469 boolean validFrom = false;
1470 boolean validTo = false;
1471 // к нам на узел
1472 if (isOurPoint(netmail.getToAddr())) {
1473 validTo = true;
1474 } else if (getLinkByFtnAddress(netmail.getToAddr()) != null) {
1475 validTo = true;
1476 } else if (getLinkByFtnAddress(netmail.getToAddr().cloneNode()) != null) {
1477 validTo = true;
1478 } else {
1479 FtnNdlAddress to = NodelistScanner.getInstance().isExists(
1480 netmail.getToAddr());
1481 if (to == null) {
1482 FtnTools.writeReply(
1483 netmail,
1484 "Destination not found",
1485 "Sorry, but destination of your netmail is not found in nodelist\nMessage rejected");
1486 logger.l3(String.format(
1487 "Netmail %s -> %s reject ( dest not found )", netmail
1488 .getFromAddr().toString(), netmail.getToAddr()
1489 .toString()));
1490
1491 } else {
1492 validTo = true;
1493 if (to.getStatus().equals(Status.DOWN)) {
1494 FtnTools.writeReply(netmail, "Destination is DOWN",
1495 "Warning! Destination of your netmail is DOWN.");
1496 logger.l3(String.format(
1497 "Netmail %s -> %s reject ( dest is DOWN )", netmail
1498 .getFromAddr().toString(), netmail
1499 .getToAddr().toString()));
1500 validTo = true;
1501 } else if (to.getStatus().equals(Status.HOLD)) {
1502 FtnTools.writeReply(netmail, "Destination is HOLD",
1503 "Warning! Destination of your netmail is HOLD");
1504 logger.l4(String.format(
1505 "Netmail %s -> %s warn ( dest is Hold )", netmail
1506 .getFromAddr().toString(), netmail
1507 .getToAddr().toString()));
1508
1509 }
1510 }
1511 }
1512
1513 if (isOurPoint(netmail.getFromAddr())) {
1514 validFrom = true;
1515 } else if (getLinkByFtnAddress(netmail.getFromAddr()) != null) {
1516 validFrom = true;
1517 } else if (getLinkByFtnAddress(netmail.getFromAddr().cloneNode()) != null) {
1518 validTo = true;
1519 } else {
1520 FtnNdlAddress from = NodelistScanner.getInstance().isExists(

Callers 1

tossNetmailMethod · 0.80

Calls 15

getCurrentInstanceMethod · 0.95
isOurPointMethod · 0.95
getLinkByFtnAddressMethod · 0.95
getInstanceMethod · 0.95
writeReplyMethod · 0.95
getStatusMethod · 0.95
getBooleanPropertyMethod · 0.80
cloneNodeMethod · 0.80
isExistsMethod · 0.80
l3Method · 0.80
formatMethod · 0.80
l4Method · 0.80

Tested by

no test coverage detected