Skip to content

Commit

Permalink
Fix a couple of FTN issues.
Browse files Browse the repository at this point in the history
Hub FTN NODELIST file variable not recognized #1616
File Echo Area Tag field limit - FTN #1617

We don't do anything with the hub variable yet, but we add it as an
entry into the nodelist database.

Fixes #1616
Fixes #1617
  • Loading branch information
wwiv committed Dec 27, 2023
1 parent cfa20f6 commit 8bb1568
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 13 deletions.
8 changes: 6 additions & 2 deletions bbs/diredit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ static void list_area_tags(const std::vector<wwiv::sdk::files::dir_area_t>& area
}
}

// I don't think there is a real max length, but we'll pick something
// File Echo Area Tag field limit - FTN #1617
static const int kAreaTagLength = 60;

static void edit_ftn_area_tags(std::vector<wwiv::sdk::files::dir_area_t>& area_tags) {
auto done{false};
do {
Expand All @@ -144,7 +148,7 @@ static void edit_ftn_area_tags(std::vector<wwiv::sdk::files::dir_area_t>& area_t
case 'A': {
files::dir_area_t da{};
bout.outstr("Enter Name? ");
da.area_tag = bin.input_upper(12);
da.area_tag = bin.input_upper(kAreaTagLength);
const auto r = select_network();
if (!r) {
break;
Expand Down Expand Up @@ -178,7 +182,7 @@ static void edit_ftn_area_tags(std::vector<wwiv::sdk::files::dir_area_t>& area_t
}
files::dir_area_t da{};
bout.outstr("Enter Name? ");
da.area_tag = bin.input_upper(12);
da.area_tag = bin.input_upper(kAreaTagLength);
const auto nr = select_network();
if (!nr) {
break;
Expand Down
20 changes: 14 additions & 6 deletions sdk/fido/nodelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ Nodelist::Nodelist(const std::filesystem::path& path, std::string domain)
Nodelist::Nodelist(const std::vector<std::string>& lines, std::string domain)
: domain_(std::move(domain)), initialized_(Load(lines)) {}

bool Nodelist::AddEntry(uint16_t zone, uint16_t net, NodelistEntry& e) {
if (zone == 0 || net == 0) {
// skip malformed entries.
return false;
}
FidoAddress address(zone, net, e.number(), 0, domain_);
e.address(address);
entries_.emplace(address, e);
}

bool Nodelist::HandleLine(const std::string& line, uint16_t& zone, uint16_t& region, uint16_t& net, uint16_t& hub) {
if (line.empty()) return true;
if (line.front() == ';') {
Expand All @@ -182,18 +192,16 @@ bool Nodelist::HandleLine(const std::string& line, uint16_t& zone, uint16_t& reg
case NodelistKeyword::hub:
{
hub = e->number();
// Hub's should have entries in the database
// Hub FTN NODELIST file variable not recognized #1616
AddEntry(zone, net, e.value());
} break;
// Let's include pvt nodes since you can still route
// to them.
case NodelistKeyword::pvt:
case NodelistKeyword::node:
{
FidoAddress address(zone, net, e->number(), 0, domain_);
e->address(address);
if (zone != 0 && net != 0) {
// skip malformed entries.
entries_.emplace(address, e.value());
}
AddEntry(zone, net, e.value());
} break;
case NodelistKeyword::region:
{
Expand Down
2 changes: 2 additions & 0 deletions sdk/fido/nodelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ class Nodelist final {
bool Load(const std::filesystem::path& path);
bool Load(const std::vector<std::string>& lines);

bool AddEntry(uint16_t zone, uint16_t net, NodelistEntry& e);
bool HandleLine(const std::string& line, uint16_t& zone, uint16_t& region, uint16_t& net, uint16_t& hub );

std::map<FidoAddress, NodelistEntry> entries_;
std::string domain_;
bool initialized_{false};
Expand Down
33 changes: 28 additions & 5 deletions sdk/fido/nodelist_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ Zone,1,North_America,Slaterville_Springs_NY,Sysop_Name1,1-607-555-1212,9600,CM,X
Region,10,Calif-Nevada,Aptos_CA,Sysop_Name10,-Unpublished-,300,CM,XX,INA:realitycheckbbs.org,IBN,IFC
,1,Region_10_Echomail_Coordinator_Calif_Nevada,Aptos_CA,Sysop_Name10_1,-Unpublished-,300,CM,XX,INA:realitycheckbbs.org,IBN,IFC
;
;
Host,109,National_Capital_Area_Net_109,Washington_DC,Frank_Reid,1-757-481-6611,9600,CM,XA,V32b,V42b,V34,IBN:bbsdoors.com
,41,Internet_Email_Gateway,Wheaton_MD,Andrew_Miller,1-301-949-5764,9600,CM,XR,V32b,V42
,42,Usenet_News_Gateway,Wheaton_MD,Andrew_Miller,1-301-949-5764,9600,CM,XR,V32b,V42
,201,bbs.cyberchatnet.com,Vienna_VA,Phillip_Taylor,-Unpublished-,9600,CM,INA:bbs.cyberchatnet.com,IBN,IFC
,202,bbs.cyberchatnet.com,Vienna_VA,Phillip_Taylor,1-703-310-7439,9600,XR,V32b,V42
Pvt,264,www.TheLitterBox.org,Bluemont_VA,Tony_Campbell,-Unpublished-,300,IP
,432,The_Idea_Link,Wheaton_MD,Andrew_Miller,1-301-949-5764,9600,CM,XR,V32b,V42
Hub,500,Greater_PG_Co_Lcl_Hub,Laurel,Frank_Reid,1-757-481-6611,9600,CM,XA,V32b,V42b,V34
Pvt,560,The_Play_Pen,Upper_Marlboro_MD,Jeffrey_Estevez,-Unpublished-,300,IP
,567,www.bbsdoors.com,Laurel_MD,Frank_Reid,-Unpublished-,300,CM,IBN:bbsdoors.com
,568,Eagle's_Dare,Upper_Marlboro_MD,Frank_Reid,1-757-481-6611,9600,CM,XA,V32b,V42b,V34
,909,Lincoln_Legacy,Leesburg_VA,John_Covici,1-703-777-8383,9600,CM,HST,V42B,V32B
;
;
Host,102,SoCalNet,Aptos_CA,Sysop_Name102,-Unpublished-,300,CM,XX,INA:realitycheckbbs.org,IBN,IFC
,501,iNK_tWO,Covina_CA,Sysop_Name102_501,-Unpublished-,300,CM,XA,INA:bbs.inktwo.com,IBN
Down,943,Mysteria,Sierra_Madre_CA,Sysop_Name102_943,1-626-555-51212,9600,CM,XA,H16,V32b,V42b,V34,VFC,INA:mysteria.com,IBN
Expand Down Expand Up @@ -79,7 +94,6 @@ TEST(NodelistTest, Zone) {

TEST(NodelistTest, Smoke) {
const auto lines = SplitString(raw, "\n");

Nodelist nl(lines, "");
ASSERT_TRUE(nl);

Expand Down Expand Up @@ -132,16 +146,25 @@ TEST(NodelistTest, Nets) {
ASSERT_TRUE(nl);

const auto nets = nl.nets(1);
const std::vector<uint16_t>expected{10, 102 ,123, 261};
const std::vector<uint16_t>expected{10, 102 ,109, 123, 261};
EXPECT_EQ(expected, nets);
}

TEST(NodelistTest, Nodes) {
TEST(NodelistTest, Nodes_With_Hub_109) {
const auto lines = SplitString(raw, "\n");
const Nodelist nl(lines, "");
ASSERT_TRUE(nl);

const auto nets = nl.nodes(1, 109);
// 500 is the hub entry in net 109
EXPECT_THAT(nets, testing::Contains(500));
}

TEST(NodelistTest, Nodes_261) {
const auto lines = SplitString(raw, "\n");
const Nodelist nl(lines, "");
ASSERT_TRUE(nl);

const auto nets = nl.nodes(1, 261);
const std::vector<uint16_t>expected{1, 1300};
EXPECT_EQ(expected, nets);
EXPECT_THAT(nets, testing::ElementsAre(1, 1300));
}

0 comments on commit 8bb1568

Please sign in to comment.