コード例 #1
0
ファイル: inetmsg.cpp プロジェクト: bhaggerty/wwiv
void send_inet_email() {
  if (GetSession()->GetCurrentUser()->GetNumEmailSentToday() > getslrec(GetSession()->GetEffectiveSl()).emails) {
    GetSession()->bout.NewLine();
    GetSession()->bout << "|#6Too much mail sent today.\r\n";
    return;
  }
  write_inst(INST_LOC_EMAIL, 0, INST_FLAGS_NONE);
  int nNetworkNumber = getnetnum("FILEnet");
  GetSession()->SetNetworkNumber(nNetworkNumber);
  if (nNetworkNumber == -1) {
    return;
  }
  set_net_num(GetSession()->GetNetworkNumber());
  GetSession()->bout.NewLine();
  GetSession()->bout << "|#9Your Internet Address:|#1 " <<
                     (GetSession()->IsInternetUseRealNames() ? GetSession()->GetCurrentUser()->GetRealName() :
                      GetSession()->GetCurrentUser()->GetName()) <<
                     " <" << GetSession()->internetFullEmailAddress << ">";
  GetSession()->bout.NewLine(2);
  GetSession()->bout << "|#9Enter the Internet mail destination address.\r\n|#7:";
  inputl(net_email_name, 75, true);
  if (check_inet_addr(net_email_name)) {
    unsigned short nUserNumber = 0;
    unsigned short nSystemNumber = 32767;
    irt[0] = 0;
    irt_name[0] = 0;
    grab_quotes(NULL, NULL);
    if (nUserNumber || nSystemNumber) {
      email(nUserNumber, nSystemNumber, false, 0);
    }
  } else {
    GetSession()->bout.NewLine();
    if (net_email_name[0]) {
      GetSession()->bout << "|#6Invalid address format!\r\n";
    } else {
      GetSession()->bout << "|#6Aborted.\r\n";
    }
  }
}
コード例 #2
0
ファイル: gfledit.cpp プロジェクト: bhaggerty/wwiv-1
void modify_sec(int n) {
  char s[81];

  gfiledirrec r = gfilesec[n];
  bool done = false;
  do {
    bout.cls();
    bout.litebar("Editing G-File Area # %d", n);
    bout << "|#9A) Name       : |#2" << r.name << wwiv::endl;
    bout << "|#9B) Filename   : |#2" << r.filename << wwiv::endl;
    bout << "|#9C) SL         : |#2" << static_cast<int>(r.sl) << wwiv::endl;
    bout << "|#9D) Min. Age   : |#2" << static_cast<int>(r.age) << wwiv::endl;
    bout << "|#9E) Max Files  : |#2" << r.maxfiles << wwiv::endl;
    bout << "|#9F) AR         : |#2" << GetArString(r, s) << wwiv::endl;
    bout.nl();
    bout << "|#7(|#2Q|#7=|#1Quit|#7) Which (|#1A|#7-|#1F,|#1[|#7,|#1]|#7) : ";
    char ch = onek("QABCDEF[]", true);
    switch (ch) {
    case 'Q':
      done = true;
      break;
    case '[':
      gfilesec[n] = r;
      if (--n < 0) {
        n = session()->num_sec - 1;
      }
      r = gfilesec[n];
      break;
    case ']':
      gfilesec[n] = r;
      if (++n >= session()->num_sec) {
        n = 0;
      }
      r = gfilesec[n];
      break;
    case 'A':
      bout.nl();
      bout << "|#2New name? ";
      inputl(s, 40);
      if (s[0]) {
        strcpy(r.name, s);
      }
      break;
    case 'B': {
      bout.nl();
      File dir(syscfg.gfilesdir, r.filename);
      if (dir.Exists()) {
        bout << "\r\nThere is currently a directory for this g-file section.\r\n";
        bout << "If you change the filename, the directory will still be there.\r\n\n";
      }
      bout.nl();
      bout << "|#2New filename? ";
      input(s, 8);
      if ((s[0] != 0) && (strchr(s, '.') == 0)) {
        strcpy(r.filename, s);
        File dir(syscfg.gfilesdir, r.filename);
        if (!dir.Exists()) {
          bout.nl();
          bout << "|#5Create directory for this section? ";
          if (yesno()) {
            File dir(syscfg.gfilesdir, r.filename);
            File::mkdirs(dir);
          } else {
            bout << "\r\nYou will have to create the directory manually, then.\r\n\n";
          }
        } else {
          bout << "\r\nA directory already exists under this filename.\r\n\n";
        }
        pausescr();
      }
    }
    break;
    case 'C': {
      bout.nl();
      bout << "|#2New SL? ";
      input(s, 3);
      int i = atoi(s);
      if (i >= 0 && i < 256 && s[0]) {
        r.sl = static_cast<unsigned char>(i);
      }
    }
    break;
    case 'D': {
      bout.nl();
      bout << "|#2New Min Age? ";
      input(s, 3);
      int i = atoi(s);
      if ((i >= 0) && (i < 128) && (s[0])) {
        r.age = static_cast<unsigned char>(i);
      }
    }
    break;
    case 'E': {
      bout.nl();
      bout << "|#1Max 99 files/section.\r\n|#2New max files? ";
      input(s, 3);
      int i = atoi(s);
      if ((i >= 0) && (i < 99) && (s[0])) {
        r.maxfiles = static_cast<unsigned short>(i);
      }
    }
    break;
    case 'F':
      bout.nl();
      bout << "|#2New AR (<SPC>=None) ? ";
      char ch2 = onek("ABCDEFGHIJKLMNOP ");
      if (ch2 == SPACE) {
        r.ar = 0;
      } else {
        r.ar = 1 << (ch2 - 'A');
      }
      break;
    }
  } while (!done && !hangup);
  gfilesec[n] = r;
}
コード例 #3
0
ファイル: gfledit.cpp プロジェクト: bhaggerty/wwiv-1
bool fill_sec(int sn) {
  int nf = 0, i, i1, n1;
  char s[81], s1[81];
  WFindFile fnd;
  bool bFound = false;

  gfilerec *g = read_sec(sn, &n1);
  sprintf(s1, "%s%s%c*.*", syscfg.gfilesdir, gfilesec[sn].filename, File::pathSeparatorChar);
  bFound = fnd.open(s1, 0);
  bool ok = true;
  int chd = 0;
  while ((bFound) && (!hangup) && (nf < gfilesec[sn].maxfiles) && (ok)) {
    if (fnd.GetFileName()[0] == '.') {
      bFound = fnd.next();
      continue;
    }
    strcpy(s, fnd.GetFileName());
    align(s);
    i = 1;
    for (i1 = 0; i1 < nf; i1++) {
      if (compare(fnd.GetFileName(), g[i1].filename)) {
        i = 0;
      }
    }
    if (i) {
      bout << "|#2" << s << " : ";
      inputl(s1, 60);
      if (s1[0]) {
        chd = 1;
        i = 0;
        while (wwiv::strings::StringCompare(s1, g[i].description) > 0 && i < nf) {
          ++i;
        }
        for (i1 = nf; i1 > i; i1--) {
          g[i1] = g[i1 - 1];
        }
        ++nf;
        gfilerec g1;
        strcpy(g1.filename, fnd.GetFileName());
        strcpy(g1.description, s1);
        g1.daten = static_cast<long>(time(nullptr));
        g[i] = g1;
      } else {
        ok = false;
      }
    }
    bFound = fnd.next();
  }
  if (!ok) {
    bout << "|#6Aborted.\r\n";
  }
  if (nf >= gfilesec[sn].maxfiles) {
    bout << "Section full.\r\n";
  }
  if (chd) {
    char szFileName[ MAX_PATH ];
    sprintf(szFileName, "%s%s.gfl", syscfg.datadir, gfilesec[sn].filename);
    File gflFile(szFileName);
    gflFile.Open(File::modeReadWrite | File::modeBinary | File::modeCreateFile | File::modeTruncate);
    gflFile.Write(g, nf * sizeof(gfilerec));
    gflFile.Close();
    WStatus *pStatus = application()->GetStatusManager()->BeginTransaction();
    pStatus->SetGFileDate(date());
    application()->GetStatusManager()->CommitTransaction(pStatus);
  }
  free(g);
  return !ok;
}
コード例 #4
0
ファイル: menu.cpp プロジェクト: insidenothing/wwiv
void ConfigUserMenuSet() {
  if (session()->usernum != nSecondUserRecLoaded) {
    if (!LoadMenuSetup(session()->usernum)) {
      LoadMenuSetup(1);
    }
  }

  nSecondUserRecLoaded = session()->usernum;

  bout.cls();
  bout.litebar("Configure Menus");
  printfile(MENUWEL_NOEXT);
  bool bDone = false;
  while (!bDone && !hangup) {
    bout.nl();
    bout << "|#11|#9) Menuset      :|#2 " << pSecondUserRec->szMenuSet << wwiv::endl;
    bout << "|#12|#9) Use hot keys :|#2 " << (pSecondUserRec->cHotKeys == HOTKEYS_ON ? "Yes" : "No ")
         << wwiv::endl;
    bout.nl();
    bout << "|#9(|#2Q|#9=|#1Quit|#9) : ";
    char chKey = onek("Q12?");

    switch (chKey) {
    case 'Q':
      bDone = true;
      break;
    case '1': {
      ListMenuDirs();
      bout.nl(2);
      bout << "|#9Enter the menu set to use : ";
      string menuSetName;
      inputl(&menuSetName, 8);
      if (ValidateMenuSet(menuSetName.c_str())) {
        wwiv::menus::MenuDescriptions descriptions(GetMenuDirectory());
        bout.nl();
        bout << "|#9Menu Set : |#2" <<  menuSetName.c_str() << " :  |#1" << descriptions.description(menuSetName) << wwiv::endl;
        bout << "|#5Use this menu set? ";
        if (noyes()) {
          strcpy(pSecondUserRec->szMenuSet, menuSetName.c_str());
          break;
        }
      }
      bout.nl();
      bout << "|#6That menu set does not exists, resetting to the default menu set" << wwiv::endl;
      pausescr();
      if (pSecondUserRec->szMenuSet[0] == '\0') {
        strcpy(pSecondUserRec->szMenuSet, "wwiv");
      }
    }
    break;
    case '2':
      pSecondUserRec->cHotKeys = !pSecondUserRec->cHotKeys;
      break;
    case '3':
      pSecondUserRec->cMenuType = !pSecondUserRec->cMenuType;
      break;
    case '?':
      printfile(MENUWEL_NOEXT);
      continue;                           // bypass the below cls()
    }
    bout.cls();
  }

  // If menu is invalid, it picks the first one it finds
  if (!ValidateMenuSet(pSecondUserRec->szMenuSet)) {
    if (session()->num_languages > 1 && session()->user()->GetLanguage() != 0) {
      bout << "|#6No menus for " << languages[session()->user()->GetLanguage()].name
           << " language.";
      input_language();
    }
  }

  WriteMenuSetup(session()->usernum);
  MenuSysopLog(StringPrintf("Menu in use : %s - %s - %s", pSecondUserRec->szMenuSet,
          pSecondUserRec->cHotKeys == HOTKEYS_ON ? "Hot" : "Off", pSecondUserRec->cMenuType == MENUTYPE_REGULAR ? "REG" : "PD"));
  bout.nl(2);
}