本文整理汇总了C++中WUser::GetUserNameAndNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ WUser::GetUserNameAndNumber方法的具体用法?C++ WUser::GetUserNameAndNumber怎么用?C++ WUser::GetUserNameAndNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WUser
的用法示例。
在下文中一共展示了WUser::GetUserNameAndNumber方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wfc_screen
void wfc_screen() {
char szBuffer[ 255 ];
instancerec ir;
WUser u;
static double wfc_time = 0, poll_time = 0;
if (!GetApplication()->HasConfigFlag(OP_FLAGS_WFC_SCREEN)) {
return;
}
int nNumNewMessages = check_new_mail(GetSession()->usernum);
std::unique_ptr<WStatus> pStatus(GetApplication()->GetStatusManager()->GetStatus());
if (GetSession()->wfc_status == 0) {
GetSession()->localIO()->SetCursor(WLocalIO::cursorNone);
GetSession()->localIO()->LocalCls();
if (pszScreenBuffer == NULL) {
pszScreenBuffer = new char[4000];
WFile wfcFile(syscfg.datadir, WFC_DAT);
if (!wfcFile.Open(WFile::modeBinary | WFile::modeReadOnly)) {
wfc_cls();
std::cout << wfcFile.GetFullPathName() << " NOT FOUND." << std::endl;
GetApplication()->AbortBBS();
}
wfcFile.Read(pszScreenBuffer, 4000);
}
DisplayWFCScreen(pszScreenBuffer);
sprintf(szBuffer, "Activity and Statistics of %s Node %d", syscfg.systemname, GetApplication()->GetInstanceNumber());
GetSession()->localIO()->LocalXYAPrintf(1 + ((76 - strlen(szBuffer)) / 2), 4, 15, szBuffer);
GetSession()->localIO()->LocalXYAPrintf(8, 1, 14, fulldate());
std::string osVersion = WWIV_GetOSVersion();
GetSession()->localIO()->LocalXYAPrintf(40, 1, 3, "OS: ");
GetSession()->localIO()->LocalXYAPrintf(44, 1, 14, osVersion.c_str());
GetSession()->localIO()->LocalXYAPrintf(21, 6, 14, "%d", pStatus->GetNumCallsToday());
GetSession()->localIO()->LocalXYAPrintf(21, 7, 14, "%d", fwaiting);
if (nNumNewMessages) {
GetSession()->localIO()->LocalXYAPrintf(29, 7 , 3, "New:");
GetSession()->localIO()->LocalXYAPrintf(34, 7 , 12, "%d", nNumNewMessages);
}
GetSession()->localIO()->LocalXYAPrintf(21, 8, 14, "%d", pStatus->GetNumUploadsToday());
GetSession()->localIO()->LocalXYAPrintf(21, 9, 14, "%d", pStatus->GetNumMessagesPostedToday());
GetSession()->localIO()->LocalXYAPrintf(21, 10, 14, "%d", pStatus->GetNumLocalPosts());
GetSession()->localIO()->LocalXYAPrintf(21, 11, 14, "%d", pStatus->GetNumEmailSentToday());
GetSession()->localIO()->LocalXYAPrintf(21, 12, 14, "%d", pStatus->GetNumFeedbackSentToday());
GetSession()->localIO()->LocalXYAPrintf(21, 13, 14, "%d Mins (%.1f%%)", pStatus->GetMinutesActiveToday(),
100.0 * static_cast<float>(pStatus->GetMinutesActiveToday()) / 1440.0);
GetSession()->localIO()->LocalXYAPrintf(58, 6, 14, "%s%s", wwiv_version, beta_version);
GetSession()->localIO()->LocalXYAPrintf(58, 7, 14, "%d", pStatus->GetNetworkVersion());
GetSession()->localIO()->LocalXYAPrintf(58, 8, 14, "%d", pStatus->GetNumUsers());
GetSession()->localIO()->LocalXYAPrintf(58, 9, 14, "%ld", pStatus->GetCallerNumber());
if (pStatus->GetDays()) {
GetSession()->localIO()->LocalXYAPrintf(58, 10, 14, "%.2f", static_cast<float>(pStatus->GetCallerNumber()) /
static_cast<float>(pStatus->GetDays()));
} else {
GetSession()->localIO()->LocalXYAPrintf(58, 10, 14, "N/A");
}
GetSession()->localIO()->LocalXYAPrintf(58, 11, 14, sysop2() ? "Available " : "Not Available");
if (ok_modem_stuff) {
GetSession()->localIO()->LocalXYAPrintf(58, 12, 14, "%-20.20s", modem_i->name);
GetSession()->localIO()->LocalXYAPrintf(58, 13, 14, "%-20s", "Waiting For Call");
} else {
GetSession()->localIO()->LocalXYAPrintf(58, 12, 14, "Local %code", (syscfgovr.primaryport) ? 'M' : 'N');
GetSession()->localIO()->LocalXYAPrintf(58, 13, 14, "Waiting For Command");
}
int i = 0, i1 = 0;
while (GetSession()->wfcdrvs[i] > 0 && GetSession()->wfcdrvs[i] < GetApplication()->GetHomeDir()[0] && i1 < 5) {
if (iscdrom(static_cast<char>(GetSession()->wfcdrvs[i]))) {
GetSession()->localIO()->LocalXYAPrintf(2, 16 + i1, 3, "CDROM %c..", GetSession()->wfcdrvs[i] + '@');
GetSession()->localIO()->LocalXYAPrintf(12 - 1, 17 + i1 - 1, 14, "%10.1f MB", 0.0f);
i1++;
} else {
char szTmpPath[4];
sprintf(szTmpPath, "%c:\\", GetSession()->wfcdrvs[i] + '@');
long lFreeDiskSpace = static_cast<long>(freek1(szTmpPath));
char szTempDiskSize[81];
if (lFreeDiskSpace > 0) {
if (lFreeDiskSpace > 2048) {
sprintf(szTempDiskSize, "%10.1f GB", static_cast<float>(lFreeDiskSpace) / (1024.0 * 1024.0));
} else {
sprintf(szTempDiskSize, "%10.1f MB", static_cast<float>(lFreeDiskSpace) / 1024.0);
}
GetSession()->localIO()->LocalXYAPrintf(2, 16 + i1, 3, "Drive %c..", GetSession()->wfcdrvs[i] + '@');
GetSession()->localIO()->LocalXYAPrintf(12 - 1, 17 + i1 - 1, 14, "%s", szTempDiskSize);
i1++;
}
}
i++;
}
get_inst_info(GetApplication()->GetInstanceNumber(), &ir);
if (ir.user < syscfg.maxusers && ir.user > 0) {
GetApplication()->GetUserManager()->ReadUserNoCache(&u, ir.user);
GetSession()->localIO()->LocalXYAPrintf(33, 16, 14, "%-20.20s", u.GetUserNameAndNumber(ir.user));
} else {
GetSession()->localIO()->LocalXYAPrintf(33, 16, 14, "%-20.20s", "Nobody");
}
GetSession()->wfc_status = 1;
wfc_update();
//.........这里部分代码省略.........
示例2: multimail
void multimail(int *pnUserNumber, int numu) {
mailrec m, m1;
char s[255], s2[81];
WUser user;
if (freek1(syscfg.msgsdir) < 10) {
bout.nl();
bout << "Sorry, not enough disk space left.\r\n\n";
return;
}
bout.nl();
int i = 0;
if (getslrec(session()->GetEffectiveSl()).ability & ability_email_anony) {
i = anony_enable_anony;
}
bout << "|#5Show all recipients in mail? ";
bool show_all = yesno();
int j = 0;
string s1 = StringPrintf("\003""6CC: \003""1");
m.msg.storage_type = EMAIL_STORAGE;
strcpy(irt, "Multi-Mail");
irt_name[0] = 0;
File::Remove(QUOTES_TXT);
std::string t;
inmsg(&m.msg, &t, &i, true, "email", INMSG_FSED, "Multi-Mail", MSGED_FLAG_NONE);
if (m.msg.stored_as == 0xffffffff) {
return;
}
strcpy(m.title, t.c_str());
bout << "Mail sent to:\r\n";
sysoplog("Multi-Mail to:");
lineadd(&m.msg, "\003""7----", "email");
for (int cv = 0; cv < numu; cv++) {
if (pnUserNumber[cv] < 0) {
continue;
}
application()->users()->ReadUser(&user, pnUserNumber[cv]);
if ((user.GetSl() == 255 && (user.GetNumMailWaiting() > (syscfg.maxwaiting * 5))) ||
((user.GetSl() != 255) && (user.GetNumMailWaiting() > syscfg.maxwaiting)) ||
user.GetNumMailWaiting() > 200) {
bout << user.GetUserNameAndNumber(pnUserNumber[cv]) << " mailbox full, not sent.";
pnUserNumber[cv] = -1;
continue;
}
if (user.IsUserDeleted()) {
bout << "User deleted, not sent.\r\n";
pnUserNumber[cv] = -1;
continue;
}
strcpy(s, " ");
user.SetNumMailWaiting(user.GetNumMailWaiting() + 1);
application()->users()->WriteUser(&user, pnUserNumber[cv]);
if (pnUserNumber[cv] == 1) {
++fwaiting;
}
strcat(s, user.GetUserNameAndNumber(pnUserNumber[cv]));
WStatus* pStatus = application()->GetStatusManager()->BeginTransaction();
if (pnUserNumber[cv] == 1) {
pStatus->IncrementNumFeedbackSentToday();
session()->user()->SetNumFeedbackSentToday(session()->user()->GetNumFeedbackSentToday() + 1);
session()->user()->SetNumFeedbackSent(session()->user()->GetNumFeedbackSent() + 1);
++fsenttoday;
} else {
pStatus->IncrementNumEmailSentToday();
session()->user()->SetNumEmailSent(session()->user()->GetNumEmailSent() + 1);
session()->user()->SetNumEmailSentToday(session()->user()->GetNumEmailSentToday() + 1);
}
application()->GetStatusManager()->CommitTransaction(pStatus);
sysoplog(s);
bout << s;
bout.nl();
if (show_all) {
sprintf(s2, "%-22.22s ", user.GetUserNameAndNumber(pnUserNumber[cv]));
s1.assign(s2);
j++;
if (j >= 3) {
lineadd(&m.msg, s1, "email");
j = 0;
s1 = "\003""1 ";
}
}
}
if (show_all) {
if (j) {
lineadd(&m.msg, s1, "email");
}
}
s1 = StringPrintf("\003""2Mail Sent to %d Addresses!", numu);
lineadd(&m.msg, "\003""7----", "email");
lineadd(&m.msg, s1, "email");
m.anony = static_cast< unsigned char >(i);
m.fromsys = 0;
m.fromuser = static_cast<unsigned short>(session()->usernum);
m.tosys = 0;
//.........这里部分代码省略.........
示例3: slash_e
//.........这里部分代码省略.........
}
bool done = false;
numu = 0;
do {
bout.nl(2);
bout << "|#2Multi-Mail: A,M,D,L,E,Q,? : ";
ch = onek("QAMDEL?");
switch (ch) {
case '?':
printfile(MMAIL_NOEXT);
break;
case 'Q':
done = true;
break;
case 'A':
bout.nl();
bout << "Enter names/numbers for users, one per line, max 20.\r\n\n";
mml_s = nullptr;
add_list(nUserNumber, &numu, MAX_LIST, so());
break;
case 'M': {
sprintf(s, "%s*.MML", syscfg.datadir);
bFound = fnd.open(s, 0);
if (bFound) {
bout.nl();
bout << "No mailing lists available.\r\n\n";
break;
}
bout.nl();
bout << "Available mailing lists:\r\n\n";
while (bFound) {
strcpy(s, fnd.GetFileName());
sss = strchr(s, '.');
if (sss) {
*sss = 0;
}
bout << s;
bout.nl();
bFound = fnd.next();
}
bout.nl();
bout << "|#2Which? ";
input(s, 8);
File fileMailList(syscfg.datadir, s);
if (!fileMailList.Open(File::modeBinary | File::modeReadOnly)) {
bout.nl();
bout << "Unknown mailing list.\r\n\n";
} else {
i1 = fileMailList.GetLength();
mml_s = static_cast<char *>(BbsAllocA(i1 + 10L));
fileMailList.Read(mml_s, i1);
mml_s[i1] = '\n';
mml_s[i1 + 1] = 0;
fileMailList.Close();
mml_started = 0;
add_list(nUserNumber, &numu, MAX_LIST, so());
if (mml_s) {
free(mml_s);
mml_s = nullptr;
}
}
}
break;
case 'E':
if (!numu) {
bout.nl();
bout << "Need to specify some users first - use A or M\r\n\n";
} else {
multimail(nUserNumber, numu);
done = true;
}
break;
case 'D':
if (numu) {
bout.nl();
bout << "|#2Delete which? ";
input(s, 2);
i = atoi(s);
if ((i > 0) && (i <= numu)) {
--numu;
for (i1 = i - 1; i1 < numu; i1++) {
nUserNumber[i1] = nUserNumber[i1 + 1];
}
}
}
break;
case 'L':
for (i = 0; i < numu; i++) {
WUser user;
application()->users()->ReadUser(&user, nUserNumber[i]);
bout << i + 1 << ". " << user.GetUserNameAndNumber(nUserNumber[i]) << wwiv::endl;
}
break;
}
CheckForHangup();
} while (!done && !hangup);
}
示例4: oneuser
int oneuser() {
char s[81], *ss;
int nUserNumber, nSystemNumber, i;
WUser user;
if (mml_s) {
if (mml_started) {
ss = strtok(nullptr, "\r\n");
} else {
ss = strtok(mml_s, "\r\n");
}
mml_started = 1;
if (ss == nullptr) {
free(mml_s);
mml_s = nullptr;
return -1;
}
strcpy(s, ss);
for (i = 0; s[i] != 0; i++) {
s[i] = upcase(s[i]);
}
} else {
bout << "|#2>";
input(s, 40);
}
nUserNumber = finduser1(s);
if (nUserNumber == 65535) {
return -1;
}
if (s[0] == 0) {
return -1;
}
if (nUserNumber <= 0) {
bout.nl();
bout << "Unknown user.\r\n\n";
return 0;
}
nSystemNumber = 0;
if (ForwardMessage(&nUserNumber, &nSystemNumber)) {
bout.nl();
bout << "Forwarded.\r\n\n";
if (nSystemNumber) {
bout << "Forwarded to another system.\r\n";
bout << "Can't send multi-mail to another system.\r\n\n";
return 0;
}
}
if (nUserNumber == 0) {
bout.nl();
bout << "Unknown user.\r\n\n";
return 0;
}
application()->users()->ReadUser(&user, nUserNumber);
if (((user.GetSl() == 255) && (user.GetNumMailWaiting() > (syscfg.maxwaiting * 5))) ||
((user.GetSl() != 255) && (user.GetNumMailWaiting() > syscfg.maxwaiting)) ||
(user.GetNumMailWaiting() > 200)) {
bout.nl();
bout << "Mailbox full.\r\n\n";
return 0;
}
if (user.IsUserDeleted()) {
bout.nl();
bout << "Deleted user.\r\n\n";
return 0;
}
bout << " -> " << user.GetUserNameAndNumber(nUserNumber) << wwiv::endl;
return nUserNumber;
}
示例5: mailr
void mailr() {
mailrec m, m1;
filestatusrec fsr;
WFile *pFileEmail = OpenEmailFile(false);
WWIV_ASSERT(pFileEmail);
if (pFileEmail->IsOpen()) {
int nRecordNumber = pFileEmail->GetLength() / sizeof(mailrec) - 1;
char c = ' ';
while (nRecordNumber >= 0 && c != 'Q' && !hangup) {
pFileEmail->Seek(nRecordNumber * sizeof(mailrec), WFile::seekBegin);
pFileEmail->Read(&m, sizeof(mailrec));
if (m.touser != 0) {
pFileEmail->Close();
do {
WUser user;
GetApplication()->GetUserManager()->ReadUser(&user, m.touser);
GetSession()->bout << "|#1 To|#7: |#" << GetSession()->GetMessageColor() << user.GetUserNameAndNumber(
m.touser) << wwiv::endl;
int tp = 80;
int nn = 0;
if (m.status & status_source_verified) {
tp -= 2;
}
if (m.status & status_new_net) {
tp -= 1;
if (wwiv::strings::GetStringLength(m.title) <= tp) {
nn = m.title[tp + 1];
} else {
nn = 0;
}
} else {
nn = 0;
}
set_net_num(nn);
GetSession()->bout << "|#1Subj|#7: |#" << GetSession()->GetMessageColor() << m.title << wwiv::endl;
if (m.status & status_file) {
WFile attachDat(syscfg.datadir, ATTACH_DAT);
if (attachDat.Open(WFile::modeReadOnly | WFile::modeBinary, WFile::shareUnknown, WFile::permReadWrite)) {
bool found = false;
long lAttachFileSize = attachDat.Read(&fsr, sizeof(fsr));
while (lAttachFileSize > 0 && !found) {
if (m.daten == static_cast<unsigned long>(fsr.id)) {
GetSession()->bout << "|#1Filename|#0.... |#2" << fsr.filename << " (" << fsr.numbytes << " bytes)|#0\r\n";
found = true;
}
if (!found) {
lAttachFileSize = attachDat.Read(&fsr, sizeof(fsr));
}
}
if (!found) {
GetSession()->bout << "|#1Filename|#0.... |#2File : Unknown or Missing|#0\r\n";
}
attachDat.Close();
} else {
GetSession()->bout << "|#1Filename|#0.... |#2|#2File : Unknown or Missing|#0\r\n";
}
}
bool next;
read_message1(&(m.msg), (char)(m.anony & 0x0f), true, &next, "email", m.fromsys, m.fromuser);
GetSession()->bout << "|#2R,D,Q,<space> : ";
if (next) {
c = ' ';
} else {
c = onek("QRD ");
}
if (c == 'D') {
pFileEmail = OpenEmailFile(true);
pFileEmail->Seek(nRecordNumber * sizeof(mailrec), WFile::seekBegin);
pFileEmail->Read(&m1, sizeof(mailrec));
if (memcmp(&m, &m1, sizeof(mailrec)) == 0) {
delmail(pFileEmail, nRecordNumber);
bool found = false;
if (m.status & status_file) {
WFile attachFile(syscfg.datadir, ATTACH_DAT);
if (attachFile.Open(WFile::modeReadWrite | WFile::modeBinary)) {
long lAttachFileSize = attachFile.Read(&fsr, sizeof(fsr));
while (lAttachFileSize > 0 && !found) {
if (m.daten == static_cast<unsigned long>(fsr.id)) {
found = true;
fsr.id = 0;
attachFile.Seek(static_cast<long>(sizeof(filestatusrec)) * -1L, WFile::seekCurrent);
attachFile.Write(&fsr, sizeof(filestatusrec));
WFile::Remove(GetApplication()->GetAttachmentDirectory().c_str(), fsr.filename);
} else {
attachFile.Read(&fsr, sizeof(filestatusrec));
}
}
attachFile.Close();
}
}
} else {
GetSession()->bout << "Mail file changed; try again.\r\n";
}
pFileEmail->Close();
if (!GetSession()->IsUserOnline() && m.touser == 1 && m.tosys == 0) {
GetSession()->GetCurrentUser()->SetNumMailWaiting(GetSession()->GetCurrentUser()->GetNumMailWaiting() - 1);
}
}
GetSession()->bout.NewLine(2);
//.........这里部分代码省略.........
示例6: valuser
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) {
//.........这里部分代码省略.........