示例#1
0
文件: wfc.cpp 项目: TellarHK/wwiv
static void RunEventsIfNeeded() {
  unique_ptr<WStatus> pStatus(session()->status_manager()->GetStatus());
  if (!IsEquals(date(), pStatus->GetLastDate())) {
    if ((session()->GetBeginDayNodeNumber() == 0) 
        || (session()->instance_number() == session()->GetBeginDayNodeNumber())) {
      cleanup_events();
      beginday(true);
    }
  }

  if (!do_event) {
    check_event();
  }

  while (do_event) {
    run_event(do_event - 1);
    check_event();
  }

  session()->SetCurrentSpeed("KB");
  static time_t last_time_c = 0;
  time_t lCurrentTime = time(nullptr);
  if ((((rand() % 8000) == 0) || (lCurrentTime - last_time_c > 1200)) && net_sysnum) {
    lCurrentTime = last_time_c;
    attempt_callout();
  }
}
示例#2
0
void MenuInstanceData::GenerateMenu() const {
  bout.Color(0);
  bout.nl();

  int iDisplayed = 0;
  if (header.nNumbers != MENU_NUMFLAG_NOTHING) {
    bout.bprintf("|#1%-8.8s  |#2%-25.25s  ", "[#]", "Change Sub/Dir #");
    ++iDisplayed;
  }
  for (const auto& key : insertion_order_) {
    if (!contains(menu_command_map_, key)) {
      continue;
    }
    MenuRec menu = menu_command_map_.at(key);
    if (CheckMenuItemSecurity(&menu, false) &&
        menu.nHide != MENU_HIDE_REGULAR &&
        menu.nHide != MENU_HIDE_BOTH) {
      char szKey[30];
      if (strlen(menu.szKey) > 1 && menu.szKey[0] != '/' && pSecondUserRec->cHotKeys == HOTKEYS_ON) {
        sprintf(szKey, "//%s", menu.szKey);
      } else {
        sprintf(szKey, "[%s]", menu.szKey);
      }
      bout.bprintf("|#1%-8.8s  |#2%-25.25s  ", szKey,
                    menu.szMenuText[0] ? menu.szMenuText : menu.szExecute);
      if (iDisplayed % 2) {
        bout.nl();
      }
      ++iDisplayed;
    }
  }
  if (IsEquals(session()->user()->GetName(), "GUEST")) {
    if (iDisplayed % 2) {
      bout.nl();
    }
    bout.bprintf("|#1%-8.8s  |#2%-25.25s  ",
      pSecondUserRec->cHotKeys == HOTKEYS_ON ? "//APPLY" : "[APPLY]",
      "Guest Account Application");
    ++iDisplayed;
  }
  bout.nl(2);
  return;
}