int DumpBbsDataCommand::Execute() { Networks networks(*config()->config()); if (!networks.IsInitialized()) { LOG(ERROR) << "Unable to load networks."; return 1; } map<const string, BbsListNet> bbslists; for (const auto net : networks.networks()) { string lower_case_network_name(net.name); StringLowerCase(&lower_case_network_name); if (arg("bbslist").as_bool()) { LOG(INFO) << "Parsing BBSLIST.NET"; bbslists.emplace(lower_case_network_name, BbsListNet::ParseBbsListNet(net.sysnum, net.dir)); } else { LOG(INFO) << "Reading BBSDATA.NET"; bbslists.emplace(lower_case_network_name, BbsListNet::ReadBbsDataNet(net.dir)); } } for (const auto& b : bbslists) { cout << "BBSDATA.NET information: : " << b.first << endl; cout << "===========================================================" << endl; cout << b.second.ToString() << endl; } return 0; }
NetworkCommandLine::NetworkCommandLine(wwiv::core::CommandLine& cmdline) { cmdline.set_no_args_allowed(true); cmdline.AddStandardArgs(); AddStandardNetworkArgs(cmdline, File::current_directory()); if (!cmdline.Parse()) { initialized_ = false; } bbsdir_ = cmdline.arg("bbsdir").as_string(); network_number_ = cmdline.arg("net").as_int(); config_.reset(new wwiv::sdk::Config(bbsdir_)); networks_.reset(new wwiv::sdk::Networks(*config_.get())); if (!config_->IsInitialized()) { LOG(ERROR) << "Unable to load CONFIG.DAT."; initialized_ = false; } if (!networks_->IsInitialized()) { LOG(ERROR) << "Unable to load networks."; initialized_ = false; } const auto& nws = networks_->networks(); if (network_number_ < 0 || network_number_ >= size_int(nws)) { LOG(ERROR) << "network number must be between 0 and " << nws.size() << "."; initialized_ = false; return; } network_ = nws[network_number_]; network_name_ = network_.name; StringLowerCase(&network_name_); }
BinkConfig::BinkConfig(const std::string& callout_network_name, const Config& config, const Networks& networks) : config_(config), callout_network_name_(callout_network_name), networks_(networks) { // network names will alwyas be compared lower case. StringLowerCase(&callout_network_name_); system_name_ = config.config()->systemname; if (system_name_.empty()) { system_name_ = "Unnamed WWIV BBS"; } sysop_name_ = config.config()->sysopname; if (sysop_name_.empty()) { sysop_name_ = "Unknown WWIV SysOp"; } gfiles_directory_ = config.config()->gfilesdir; if (networks.contains(callout_network_name)) { const net_networks_rec& net = networks[callout_network_name]; if (net.type == network_type_t::wwivnet) { callout_wwivnet_node_ = net.sysnum; if (callout_wwivnet_node_ == 0) { throw config_error(StringPrintf("NODE not specified for network: '%s'", callout_network_name.c_str())); } binkp_.reset(new Binkp(net.dir)); } else if (net.type == network_type_t::ftn) { callout_fido_node_ = net.fido.fido_address; if (callout_fido_node_.empty()) { throw config_error(StringPrintf("NODE not specified for network: '%s'", callout_network_name.c_str())); } } else { throw config_error("BinkP is not supported for this network type."); } // TODO(rushfan): This needs to be a shim binkp that reads from the nodelist // or overrides. binkp_.reset(new Binkp(net.dir)); } }
MenuDescriptions::MenuDescriptions(const std::string& menupath) :menupath_(menupath) { TextFile file(menupath, DESCRIPT_ION, "rt"); if (file.IsOpen()) { string s; while (file.ReadLine(&s)) { StringTrim(&s); if (s.empty()) { continue; } string::size_type space = s.find(' '); if (space == string::npos) { continue; } string menu_name = s.substr(0, space); string description = s.substr(space + 1); StringLowerCase(&menu_name); StringLowerCase(&description); descriptions_.emplace(menu_name, description); } } }
int DumpCalloutCommand::Execute() { Networks networks(*config()->config()); if (!networks.IsInitialized()) { LOG(ERROR) << "Unable to load networks."; return 1; } map<const string, Callout> callouts; for (const auto net : networks.networks()) { string lower_case_network_name(net.name); StringLowerCase(&lower_case_network_name); callouts.emplace(lower_case_network_name, Callout(net)); } for (const auto& c : callouts) { cout << "CALLOUT.NET information: : " << c.first << endl; cout << "===========================================================" << endl; cout << c.second.ToString() << endl; } return 0; }