コード例 #1
0
ファイル: sysopf.cpp プロジェクト: bhaggerty/wwiv
void valuser(int nUserNumber) {
  char s[81], s1[81], s2[81], s3[81], ar1[20], dar1[20];

  WUser user;
  GetApplication()->GetUserManager()->ReadUser(&user, nUserNumber);
  if (!user.IsUserDeleted()) {
    GetSession()->bout.NewLine();
    GetSession()->bout << "|#9Name: |#2" << user.GetUserNameAndNumber(nUserNumber) << wwiv::endl;
    GetSession()->bout << "|#9RN  : |#2" << user.GetRealName() << wwiv::endl;
    GetSession()->bout << "|#9PH  : |#2" << user.GetVoicePhoneNumber() << wwiv::endl;
    GetSession()->bout << "|#9Age : |#2" << user.GetAge() << " " << user.GetGender() << wwiv::endl;
    GetSession()->bout << "|#9Comp: |#2" << ctypes(user.GetComputerType()) << wwiv::endl;
    if (user.GetNote()[0]) {
      GetSession()->bout << "|#9Note: |#2" << user.GetNote() << wwiv::endl;
    }
    GetSession()->bout << "|#9SL  : |#2" << user.GetSl() << wwiv::endl;
    if (user.GetSl() != 255 && user.GetSl() < GetSession()->GetEffectiveSl()) {
      GetSession()->bout << "|#9New : ";
      input(s, 3, true);
      if (s[0]) {
        int nSl = atoi(s);
        if (!GetApplication()->GetWfcStatus() && nSl >= GetSession()->GetEffectiveSl()) {
          nSl = -2;
        }
        if (nSl >= 0 && nSl < 255) {
          user.SetSl(nSl);
        }
        if (nSl == -1) {
          GetSession()->bout.NewLine();
          GetSession()->bout << "|#9Delete? ";
          if (yesno()) {
            deluser(nUserNumber);
            GetSession()->bout.NewLine();
            GetSession()->bout << "|#6Deleted.\r\n\n";
          } else {
            GetSession()->bout.NewLine();
            GetSession()->bout << "|#3NOT deleted.\r\n";
          }
          return;
        }
      }
    }
    GetSession()->bout.NewLine();
    GetSession()->bout << "|#9DSL : |#2" << user.GetDsl() << wwiv::endl;
    if (user.GetDsl() != 255 && user.GetDsl() < GetSession()->GetCurrentUser()->GetDsl()) {
      GetSession()->bout << "|#9New ? ";
      input(s, 3, true);
      if (s[0]) {
        int nDsl = atoi(s);
        if (!GetApplication()->GetWfcStatus() && nDsl >= GetSession()->GetCurrentUser()->GetDsl()) {
          nDsl = -1;
        }
        if (nDsl >= 0 && nDsl < 255) {
          user.SetDsl(nDsl);
        }
      }
    }
    strcpy(s3, restrict_string);
    int ar2     = 1;
    int dar2    = 1;
    ar1[0]      = RETURN;
    dar1[0]     = RETURN;
    for (int i = 0; i <= 15; i++) {
      if (user.HasArFlag(1 << i)) {
        s[i] = static_cast<char>('A' + i);
      } else {
        s[i] = SPACE;
      }
      if (GetSession()->GetCurrentUser()->HasArFlag(1 << i)) {
        ar1[ar2++] = static_cast<char>('A' + i);
      }
      if (user.HasDarFlag(1 << i)) {
        s1[i] = static_cast<char>('A' + i);
      } else {
        s1[i] = SPACE;
      }
      if (GetSession()->GetCurrentUser()->HasDarFlag(1 << i)) {
        dar1[dar2++] = static_cast<char>('A' + i);
      }
      if (user.HasRestrictionFlag(1 << i)) {
        s2[i] = s3[i];
      } else {
        s2[i] = SPACE;
      }
    }
    s[16]       = '\0';
    s1[16]      = '\0';
    s2[16]      = '\0';
    ar1[ar2]    = '\0';
    dar1[dar2]  = '\0';
    GetSession()->bout.NewLine();
    char ch1 = '\0';
    if (ar2 > 1) {
      do {
        GetSession()->bout << "|#9AR  : |#2" << s << wwiv::endl;
        GetSession()->bout << "|#9Togl? ";
        ch1 = onek(ar1);
        if (ch1 != RETURN) {
          ch1 -= 'A';
          if (s[ch1] == SPACE) {
            s[ch1] = ch1 + 'A';
          } else {
            s[ch1] = SPACE;
          }
          user.ToggleArFlag(1 << ch1);
          ch1 = 0;
        }
      } while (!hangup && ch1 != RETURN);
    }
    GetSession()->bout.NewLine();
    ch1 = 0;
    if (dar2 > 1) {
      do {
        GetSession()->bout << "|#9DAR : |#2" << s1 << wwiv::endl;
        GetSession()->bout << "|#9Togl? ";
        ch1 = onek(dar1);
        if (ch1 != RETURN) {
          ch1 -= 'A';
          if (s1[ch1] == SPACE) {
            s1[ch1] = ch1 + 'A';
          } else {
            s1[ch1] = SPACE;
          }
          user.ToggleDarFlag(1 << ch1);
          ch1 = 0;
        }
      } while (!hangup && ch1 != RETURN);
    }
    GetSession()->bout.NewLine();
    ch1     = 0;
    s[0]    = RETURN;
    s[1]    = '?';
    strcpy(&(s[2]), restrict_string);
    do {
      GetSession()->bout << "      |#2" << s3 << wwiv::endl;
      GetSession()->bout << "|#9Rstr: |#2" << s2 << wwiv::endl;
      GetSession()->bout << "|#9Togl? ";
      ch1 = onek(s);
      if (ch1 != RETURN && ch1 != SPACE && ch1 != '?') {
        int i = -1;
        for (int i1 = 0; i1 < 16; i1++) {
          if (ch1 == s[i1 + 2]) {
            i = i1;
          }
        }
        if (i > -1) {
          user.ToggleRestrictionFlag(1 << i);
          if (s2[i] == SPACE) {
            s2[i] = s3[i];
          } else {
            s2[i] = SPACE;
          }
        }
        ch1 = 0;
      }
      if (ch1 == '?') {
        ch1 = 0;
        printfile(SRESTRCT_NOEXT);
      }
    } while (!hangup && ch1 == 0);
    GetApplication()->GetUserManager()->WriteUser(&user, nUserNumber);
    GetSession()->bout.NewLine();
  } else {
    GetSession()->bout << "\r\n|#6No Such User.\r\n\n";
  }
}