void show_chains(int *mapp, int *map) { char szBuffer[ 255 ]; GetSession()->bout.Color(0); GetSession()->bout.ClearScreen(); GetSession()->bout.NewLine(); bool abort = false; bool next = false; if (GetApplication()->HasConfigFlag(OP_FLAGS_CHAIN_REG) && chains_reg) { sprintf(szBuffer, "|#5 Num |#1%-42.42s|#2%-22.22s|#1%-5.5s", "Description", "Sponsored by", "Usage"); pla(szBuffer, &abort); if (okansi()) { sprintf(szBuffer, "|#%d %s", FRAME_COLOR, "\xDA\xC4\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xBF"); } else { sprintf(szBuffer, " +---+-----------------------------------------+---------------------+-----+"); } pla(szBuffer, &abort); for (int i = 0; i < *mapp && !abort && !hangup; i++) { WUser user; strcat(szBuffer, ". "); if (okansi()) { GetApplication()->GetUserManager()->ReadUser(&user, chains_reg[map[i]].regby[0]); sprintf(szBuffer, " |#%d\xB3|#5%3d|#%d\xB3|#1%-41s|#%d\xB3|%2.2d%-21s|#%d\xB3|#1%5d|#%d\xB3", FRAME_COLOR, i + 1, FRAME_COLOR, chains[map[i]].description, FRAME_COLOR, (chains_reg[map[i]].regby[0]) ? 14 : 13, (chains_reg[map[i]].regby[0]) ? user.GetName() : "Available", FRAME_COLOR, chains_reg[map[i]].usage, FRAME_COLOR); pla(szBuffer, &abort); if (chains_reg[map[i]].regby[0] != 0) { for (int i1 = 1; i1 < 5 && !abort; i1++) { if (chains_reg[map[i]].regby[i1] != 0) { GetApplication()->GetUserManager()->ReadUser(&user, chains_reg[map[i]].regby[i1]); sprintf(szBuffer, " |#%d\xB3 \xBA%-41s\xB3|#2%-21s|#%d\xB3%5.5s\xB3", FRAME_COLOR, " ", user.GetName(), FRAME_COLOR, " "); pla(szBuffer, &abort); } } } } else { GetApplication()->GetUserManager()->ReadUser(&user, chains_reg[map[i]].regby[0]); sprintf(szBuffer, " |%3d|%-41.41s|%-21.21s|%5d|", i + 1, chains[map[i]].description, (chains_reg[map[i]].regby[0]) ? user.GetName() : "Available", chains_reg[map[i]].usage); pla(szBuffer, &abort); if (chains_reg[map[i]].regby[0] != 0) { for (int i1 = 1; i1 < 5; i1++) { if (chains_reg[map[i]].regby[i1] != 0) { GetApplication()->GetUserManager()->ReadUser(&user, chains_reg[map[i]].regby[i1]); sprintf(szBuffer, " | | |%-21.21s| |", (chains_reg[map[i]].regby[i1]) ? user.GetName() : "Available"); pla(szBuffer, &abort); } } } } } if (okansi()) { sprintf(szBuffer, "|#%d %s", FRAME_COLOR, "\xC0\xC4\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xD9"); } else { sprintf(szBuffer, " +---+-----------------------------------------+---------------------+-----+"); } pla(szBuffer, &abort); } else { GetSession()->bout.DisplayLiteBar(" [ %s Online Programs ] ", syscfg.systemname); GetSession()->bout << "|#7\xDA\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC2\xC4\xC4\xC2\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xBF\r\n"; for (int i = 0; i < *mapp && !abort && !hangup; i++) { sprintf(szBuffer, "|#7\xB3|#2%2d|#7\xB3 |#1%-33.33s|#7\xB3", i + 1, chains[map[i]].description); osan(szBuffer, &abort, &next); i++; if (!abort && !hangup) { char szBuffer[ 255 ]; if (i >= *mapp) { sprintf(szBuffer, " |#7\xB3 |#7\xB3"); } else { sprintf(szBuffer, "|#2%2d|#7\xB3 |#1%-33.33s|#7\xB3", i + 1, chains[map[i]].description); } pla(szBuffer, &abort); } } GetSession()->bout << "|#7\xC0\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC1\xC4\xC4\xC1\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xD9\r\n"; } }
/** 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); }
void do_chains() { int *map = static_cast<int*>(BbsAllocA(GetSession()->max_chains * sizeof(int))); WWIV_ASSERT(map != NULL); if (!map) { return; } GetSession()->localIO()->tleft(true); int mapp = 0; memset(odc, 0, sizeof(odc)); for (int i = 0; i < GetSession()->GetNumberOfChains(); i++) { bool ok = true; chainfilerec c = chains[i]; if ((c.ansir & ansir_ansi) && !okansi()) { ok = false; } if ((c.ansir & ansir_local_only) && GetSession()->using_modem) { ok = false; } if (c.sl > GetSession()->GetEffectiveSl()) { ok = false; } if (c.ar && !GetSession()->GetCurrentUser()->HasArFlag(c.ar)) { ok = false; } if (GetApplication()->HasConfigFlag(OP_FLAGS_CHAIN_REG) && chains_reg && (GetSession()->GetEffectiveSl() < 255)) { chainregrec r = chains_reg[ i ]; if (r.maxage) { if (r.minage > GetSession()->GetCurrentUser()->GetAge() || r.maxage < GetSession()->GetCurrentUser()->GetAge()) { ok = false; } } } if (ok) { map[ mapp++ ] = i; if (mapp < 100) { if ((mapp % 10) == 0) { odc[mapp / 10 - 1] = static_cast< char >('0' + (mapp / 10)); } } } } if (mapp == 0) { GetSession()->bout << "\r\n\n|#5Sorry, no external programs available.\r\n"; free(map); GetSession()->SetMMKeyArea(WSession::mmkeyMessageAreas); return; } show_chains(&mapp, map); bool done = false; GetSession()->SetMMKeyArea(WSession::mmkeyMessageAreas); int start = 0; char *ss = NULL; do { GetSession()->SetMMKeyArea(WSession::mmkeyChains); GetSession()->localIO()->tleft(true); GetSession()->bout.NewLine(); GetSession()->bout << "|#7Which chain (1-" << mapp << ", Q=Quit, ?=List): "; int nChainNumber = -1; if (mapp < 100) { ss = mmkey(2); nChainNumber = atoi(ss); } else { char szChainNumber[ 11 ]; input(szChainNumber, 3); nChainNumber = atoi(szChainNumber); } if (nChainNumber > 0 && nChainNumber <= mapp) { done = true; GetSession()->SetMMKeyArea(WSession::mmkeyChains); GetSession()->bout << "\r\n|#6Please wait...\r\n"; run_chain(map[ nChainNumber - 1 ]); } else if (wwiv::strings::IsEquals(ss, "Q")) { GetSession()->SetMMKeyArea(WSession::mmkeyMessageAreas); done = true; } else if (wwiv::strings::IsEquals(ss, "?")) { show_chains(&mapp, map); } else if (wwiv::strings::IsEquals(ss, "P")) { if (start > 0) { start -= 14; } start = std::max<int>(start, 0); } else if (wwiv::strings::IsEquals(ss, "N")) { if (start + 14 < mapp) { start += 14; } } } while (!hangup && !done); free(map); }
void valscan() { // Must be local cosysop or better if (!lcs()) { return; } int ac = 0; int os = GetSession()->GetCurrentMessageArea(); if (uconfsub[1].confnum != -1 && okconf(GetSession()->GetCurrentUser())) { ac = 1; tmp_disable_conf(true); } bool done = false; for (int sn = 0; sn < GetSession()->num_subs && !hangup && !done; sn++) { if (!iscan(sn)) { continue; } if (GetSession()->GetCurrentReadMessageArea() < 0) { return; } uint32_t sq = qsc_p[sn]; // Must be sub with validation "on" if (!(xsubs[GetSession()->GetCurrentReadMessageArea()].num_nets) || !(subboards[GetSession()->GetCurrentReadMessageArea()].anony & anony_val_net)) { continue; } GetSession()->bout.NewLine(); GetSession()->bout.Color(2); GetSession()->bout.ClearEOL(); GetSession()->bout << "{{ ValScanning " << subboards[GetSession()->GetCurrentReadMessageArea()].name << " }}\r\n"; lines_listed = 0; GetSession()->bout.ClearEOL(); if (okansi() && !newline) { GetSession()->bout << "\r\x1b[2A"; } for (int i = 1; i <= GetSession()->GetNumMessagesInCurrentMessageArea() && !hangup && !done; i++) { // was i = 0 if (get_post(i)->status & status_pending_net) { CheckForHangup(); GetSession()->localIO()->tleft(true); if (i > 0 && i <= GetSession()->GetNumMessagesInCurrentMessageArea()) { bool next; int val; read_message(i, &next, &val); GetSession()->bout << "|#4[|#4Subboard: " << subboards[GetSession()->GetCurrentReadMessageArea()].name << "|#1]\r\n"; GetSession()->bout << "|#1D|#9)elete, |#1R|#9)eread |#1V|#9)alidate, |#1M|#9)ark Validated, |#1Q|#9)uit: |#2"; char ch = onek("QDVMR"); switch (ch) { case 'Q': done = true; break; case 'R': i--; continue; case 'V': { open_sub(true); resynch(&i, nullptr); postrec *p1 = get_post(i); p1->status &= ~status_pending_net; write_post(i, p1); close_sub(); send_net_post(p1, subboards[GetSession()->GetCurrentReadMessageArea()].filename, GetSession()->GetCurrentReadMessageArea()); GetSession()->bout.NewLine(); GetSession()->bout << "|#7Message sent.\r\n\n"; } break; case 'M': if (lcs() && i > 0 && i <= GetSession()->GetNumMessagesInCurrentMessageArea() && subboards[GetSession()->GetCurrentReadMessageArea()].anony & anony_val_net && xsubs[GetSession()->GetCurrentReadMessageArea()].num_nets) { open_sub(true); resynch(&i, nullptr); postrec *p1 = get_post(i); p1->status &= ~status_pending_net; write_post(i, p1); close_sub(); GetSession()->bout.NewLine(); GetSession()->bout << "|#9Not set for net pending now.\r\n\n"; } break; case 'D': if (lcs()) { if (i > 0) { open_sub(true); resynch(&i, nullptr); postrec p2 = *get_post(i); delete_message(i); close_sub(); if (p2.ownersys == 0) { WUser tu; GetApplication()->GetUserManager()->ReadUser(&tu, p2.owneruser); if (!tu.IsUserDeleted()) { if (static_cast<unsigned long>(date_to_daten(tu.GetFirstOn())) < p2.daten) { GetSession()->bout.NewLine(); GetSession()->bout << "|#2Remove how many posts credit? "; char szNumCredits[ 11 ]; input(szNumCredits, 3, true); int nNumPostCredits = 1; if (szNumCredits[0]) { nNumPostCredits = atoi(szNumCredits); } nNumPostCredits = std::min<int>(tu.GetNumMessagesPosted(), nNumPostCredits); if (nNumPostCredits) { tu.SetNumMessagesPosted(tu.GetNumMessagesPosted() - static_cast<unsigned short>(nNumPostCredits)); } GetSession()->bout.NewLine(); GetSession()->bout << "|#3Post credit removed = " << nNumPostCredits << wwiv::endl; tu.SetNumDeletedPosts(tu.GetNumDeletedPosts() + 1); GetApplication()->GetUserManager()->WriteUser(&tu, p2.owneruser); GetApplication()->UpdateTopScreen(); } } } resynch(&i, &p2); } } break; } } } } qsc_p[sn] = sq; } if (ac) { tmp_disable_conf(false); } GetSession()->SetCurrentMessageArea(os); GetSession()->bout.NewLine(2); }