Пример #1
0
static std::vector<string> create_sub_info(Context& context) {
  int current = 0;
  std::vector <std::string> result;
  for (const auto& x : context.subs.subs()) {
    for (const auto& n : x.nets) {
      if (n.net_num != context.network_number) {
        continue;
      }
      if (n.host != 0) {
        continue;
      }
      if (!(n.flags & XTRA_NET_AUTO_INFO)) {
        // Not allowed to subs.lst info for sub
        continue;
      }
      sub_info_t s;
      const auto& b = context.subs.sub(current);
      s.stype = n.stype;
      s.category = n.category;
      s.description = stripcolors(x.desc);
      if (s.description.empty()) {
        s.description = stripcolors(context.subs.sub(current).name);
      }
      if (s.description.size() > 60) {
        s.description.resize(60);
      }
      if (b.anony & anony_ansi_only) {
        s.flags += 'A';
      }
      if (x.nets.size() > 1) {
        s.flags += 'G';
      }
      if (b.anony & anony_val_net) {
        s.flags += 'N';
      }
      if (n.flags & XTRA_NET_AUTO_ADDDROP) {
        s.flags += 'R';
      }
      if (b.anony & anony_no_tag) {
        s.flags += 'T';
      }
      result.emplace_back(to_string(s, context.net.sysnum));
    }
    ++current;
  }
  return result;
}
Пример #2
0
char *gfiledata(int nSectionNum, char *pBuffer) {
  gfiledirrec r = gfilesec[ nSectionNum ];
  char x = SPACE;
  if (r.ar != 0) {
    for (int i = 0; i < 16; i++) {
      if ((1 << i) & r.ar) {
        x = static_cast<char>('A' + i);
      }
    }
  }
  sprintf(pBuffer, "|#2%2d |#3%1c  |#1%-40s  |#2%-8s |#9%-3d %-3d %-3d",
          nSectionNum, x, stripcolors(r.name), r.filename, r.sl, r.age, r.maxfiles);
  return pBuffer;
}
Пример #3
0
/** Displays the available file areas for the current user. */
void dirlist(int mode) {
  bool next   = false;
  int oc      = session()->GetCurrentConferenceFileArea();
  int os      = udir[session()->GetCurrentFileArea()].subnum;
  int tally   = 0;
  int nd      = 0;
  int sn      = session()->GetCurrentConferenceFileArea();
  int en      = session()->GetCurrentConferenceFileArea();
  bool done   = false;

  do {
    bool is = false;
    bool abort = false;
    int p = 1;
    int i = sn;
    char *ss = nullptr;

    while (i <= en && uconfdir[i].confnum != -1 && !abort) {
      size_t i1 = 0;
      while (i1 < session()->directories.size() && udir[i1].subnum != -1 && !abort) {
        char s[255];
        size_t firstp = 0;
        if (p && mode == 0) {
          p = 0;
          firstp = i1;
          bout.cls();
          if (uconfdir[1].confnum != -1 && okconf(session()->user())) {
            sprintf(s, " [ %s %c ] [ %s ] ", "Conference",
                    dirconfs[uconfdir[i].confnum].designator,
                    stripcolors(reinterpret_cast<char*>(dirconfs[uconfdir[i].confnum].name)));
          } else {
            sprintf(s, " [ %s File Areas ] ", syscfg.systemname);
          }
          bout.litebar(s);
          DisplayHorizontalBar(78, 7);
          bout << "|#2 Dir Qscan?     Directory Name                          Total Files\r\n";
          DisplayHorizontalBar(78, 7);
        }
        ++nd;
        int directory_number = udir[i1].subnum;
        if (directory_number == 0) {
          is = true;
        }
        std::string scanme = "|#6No ";
        if (qsc_n[ directory_number / 32 ] & (1L << (directory_number % 32))) {
          scanme = "|#5Yes";
        }
        dliscan1(directory_number);
        if (udir[session()->GetCurrentFileArea()].subnum == udir[i1].subnum) {
          sprintf(s, " |#9%3s |#9\xB3 |#6%3s |#9\xB3|B1|15 %-40.40s |#9\xB3 |#9%4d|B0",
                  udir[i1].keys, scanme.c_str(), session()->directories[directory_number].name,
                  session()->numf);
        } else {
          sprintf(s, " |#9%3s |#9\xB3 |#6%3s |#9\xB3 %s%-40.40s |#9\xB3 |#9%4d",
                  udir[i1].keys, scanme.c_str(),
                  (((mode == 1) && (session()->directories[udir[i1].subnum].mask & mask_cdrom)) ? "|#9" : "|#1"),
                  session()->directories[ directory_number ].name, session()->numf);
        }
        if (okansi()) {
          osan(s, &abort, &next);
        } else {
          osan(stripcolors(s), &abort, &next);
        }
        tally += session()->numf;
        int lastp = i1++;
        bout.nl();
        if (lines_listed >= session()->screenlinest - 2 && mode == 0) {
          p = 1;
          lines_listed = 0;
          DisplayHorizontalBar(78, 7);
          bout.bprintf("|#1Select |#9[|#2%d-%d, [Enter]=Next Page, Q=Quit|#9]|#0 : ",
                                            is ? firstp : firstp + 1, lastp);
          ss = mmkey(1, WSession::mmkeyFileAreas, true);
          if (isdigit(ss[0])) {
            for (size_t i3 = 0; i3 < session()->directories.size(); i3++) {
              if (wwiv::strings::IsEquals(udir[i3].keys, ss)) {
                session()->SetCurrentFileArea(i3);
                os      = udir[session()->GetCurrentFileArea()].subnum;
                done    = true;
                abort   = true;
              }
            }
          } else {
            switch (ss[0]) {
            case 'Q':
              if (okconf(session()->user())) {
                setuconf(ConferenceType::CONF_DIRS, oc, os);
              }
              done    = true;
              abort   = true;
              break;
            default:
              bout.backline();
              break;
            }
          }
        }
      }
      if (nd) {
        i++;
      }
      if (!okconf(session()->user())) {
        break;
      }
    }
    if (i == 0) {
      pla("None.", &abort);
      bout.nl();
    }
    if (!abort && mode == 0) {
      p = 1;
      DisplayHorizontalBar(78, 7);
      if (okconf(session()->user())) {
        if (uconfdir[1].confnum != -1) {
          bout.bprintf("|#1Select |#9[|#2%d-%d, J=Join Conference, ?=List Again, Q=Quit|#9]|#0 : ",
                                            is ? 0 : 1, is ? nd - 1 : nd);
        } else {
          bout.bprintf("|#1Select |#9[|#2%d-%d, ?=List Again, Q=Quit|#9]|#0 : ", is ? 0 : 1,
                                            is ? nd - 1 : nd);
        }
      } else {
        bout.bprintf("|#1Select |#9[|#2%d-%d, ?=List Again, Q=Quit|#9]|#0 : ", is ? 0 : 1,
                                          is ? nd - 1 : nd);
      }
      ss = mmkey(0, true);
      if (wwiv::strings::IsEquals(ss, "") ||
          wwiv::strings::IsEquals(ss, "Q") ||
          wwiv::strings::IsEquals(ss, "\r")) {
        if (okconf(session()->user())) {
          setuconf(ConferenceType::CONF_DIRS, oc, os);
        }
        done = true;
      }
      if (wwiv::strings::IsEquals(ss, "J")) {
        if (okconf(session()->user())) {
          jump_conf(ConferenceType::CONF_DIRS);
        }
        sn = en = oc = session()->GetCurrentConferenceFileArea();
        nd = i = 0;
        is = false;
      }
      if (isdigit(ss[0])) {
        for (size_t i3 = 0; i3 < session()->directories.size(); i3++) {
          if (wwiv::strings::IsEquals(udir[i3].keys, ss)) {
            session()->SetCurrentFileArea(i3);
            os = udir[session()->GetCurrentFileArea()].subnum;
            done = true;
          }
        }
      }
      nd = 0;
    } else {
      if (okconf(session()->user())) {
        setuconf(ConferenceType::CONF_DIRS, oc, os);
      }
      done = true;
    }
  } while (!hangup && !done);
}