diff --git a/bbs/diredit.cpp b/bbs/diredit.cpp index 3a6d0e853..aca40500f 100644 --- a/bbs/diredit.cpp +++ b/bbs/diredit.cpp @@ -129,6 +129,10 @@ static void list_area_tags(const std::vector& 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& area_tags) { auto done{false}; do { @@ -144,7 +148,7 @@ static void edit_ftn_area_tags(std::vector& 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; @@ -178,7 +182,7 @@ static void edit_ftn_area_tags(std::vector& 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; diff --git a/sdk/fido/nodelist.cpp b/sdk/fido/nodelist.cpp index e3655ca38..40183d2d5 100644 --- a/sdk/fido/nodelist.cpp +++ b/sdk/fido/nodelist.cpp @@ -164,6 +164,16 @@ Nodelist::Nodelist(const std::filesystem::path& path, std::string domain) Nodelist::Nodelist(const std::vector& 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() == ';') { @@ -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: { diff --git a/sdk/fido/nodelist.h b/sdk/fido/nodelist.h index 8f5ae71af..f98ad37ec 100644 --- a/sdk/fido/nodelist.h +++ b/sdk/fido/nodelist.h @@ -159,7 +159,9 @@ class Nodelist final { bool Load(const std::filesystem::path& path); bool Load(const std::vector& 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 entries_; std::string domain_; bool initialized_{false}; diff --git a/sdk/fido/nodelist_test.cpp b/sdk/fido/nodelist_test.cpp index 16b31cda2..386cc1368 100644 --- a/sdk/fido/nodelist_test.cpp +++ b/sdk/fido/nodelist_test.cpp @@ -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 @@ -79,7 +94,6 @@ TEST(NodelistTest, Zone) { TEST(NodelistTest, Smoke) { const auto lines = SplitString(raw, "\n"); - Nodelist nl(lines, ""); ASSERT_TRUE(nl); @@ -132,16 +146,25 @@ TEST(NodelistTest, Nets) { ASSERT_TRUE(nl); const auto nets = nl.nets(1); - const std::vectorexpected{10, 102 ,123, 261}; + const std::vectorexpected{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::vectorexpected{1, 1300}; - EXPECT_EQ(expected, nets); + EXPECT_THAT(nets, testing::ElementsAre(1, 1300)); } \ No newline at end of file