コード例 #1
0
ファイル: networkf.cpp プロジェクト: wwivbbs/wwiv
static bool import_bundles(const Config& config, const FidoCallout& callout,
  const net_networks_rec& net, const std::string& dir, const std::string& mask) {
  VLOG(1) << "import_bundles: mask: " << mask;
  WFindFile files;
  bool has_next = files.open(FilePath(dir, mask), WFINDFILE_FILES);
  while (has_next) {
    if (files.GetFileSize() == 0) {
      // skip zero byte files.
      continue;
    }
    const auto& name = files.GetFileName();
    string lname = ToStringLowerCase(name);
    if (ends_with(lname, ".pkt")) {
      if (import_packet_file(config, callout, net, dir, name)) {
        LOG(INFO) << "Successfully imported packet: " << FilePath(dir, name);
        File::Remove(dir, name);
      }
    } else if (import_bundle_file(config, callout, net, dir, name)) {
      LOG(INFO) << "Successfully imported bundle: " << FilePath(dir, name);
      File::Remove(dir, name);
    }
    has_next = files.next();
  }
  return true;
}