本文整理汇总了C++中WUser类的典型用法代码示例。如果您正苦于以下问题:C++ WUser类的具体用法?C++ WUser怎么用?C++ WUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ch_direct
void ch_direct(const char *pszMessage, int loc, char *pszColorString, int node, int nOffSet) {
if (strlen(pszMessage + nOffSet) == 0) {
bout << "|#1[|#9Message required after using a / or > command.|#1]\r\n";
return;
}
instancerec ir;
get_inst_info(node, &ir);
char szMessage[ 512 ];
if (ir.loc == loc) {
if (!strlen(pszMessage + nOffSet)) {
bout << "|#1[|#9Message required after using a / or > command.|#1]\r\n";
return;
}
WUser u;
application()->users()->ReadUser(&u, ir.user);
char szUserName[ 81 ];
strcpy(szUserName, u.GetName());
sprintf(szMessage, "|#9From %.12s|#6 [to %s]|#1: %s%s",
session()->user()->GetName(), szUserName, pszColorString,
pszMessage + nOffSet + 1);
for (int i = 1; i <= num_instances(); i++) {
get_inst_info(i, &ir);
if (ir.loc == loc && i != application()->GetInstanceNumber()) {
send_inst_str(i, szMessage);
}
}
bout << "|#1[|#9Message directed to " << szUserName << "|#1\r\n";
} else {
bout << szMessage;
bout.nl();
}
}
开发者ID:venom49637,项目名称:wwiv,代码行数:33,代码来源:chat.cpp
示例2: wfc_update
void wfc_update() {
if (!GetApplication()->HasConfigFlag(OP_FLAGS_WFC_SCREEN)) {
return;
}
instancerec ir;
WUser u;
get_inst_info(inst_num, &ir);
GetApplication()->GetUserManager()->ReadUserNoCache(&u, ir.user);
GetSession()->localIO()->LocalXYAPrintf(57, 18, 15, "%-3d", inst_num);
if (ir.flags & INST_FLAGS_ONLINE) {
GetSession()->localIO()->LocalXYAPrintf(42, 19, 14, "%-25.25s", u.GetUserNameAndNumber(ir.user));
} else {
GetSession()->localIO()->LocalXYAPrintf(42, 19, 14, "%-25.25s", "Nobody");
}
char szBuffer[ 255 ];
szBuffer[0] = '\0';
make_inst_str(inst_num, szBuffer, INST_FORMAT_WFC);
GetSession()->localIO()->LocalXYAPrintf(42, 20, 14, "%-25.25s", szBuffer);
if (num_instances() > 1) {
do {
++inst_num;
if (inst_num > num_instances()) {
inst_num = 1;
}
} while (inst_num == GetApplication()->GetInstanceNumber());
}
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:30,代码来源:wfc.cpp
示例3: LoadMenuSetup
bool LoadMenuSetup(int user_number) {
if (!pSecondUserRec) {
MenuSysopLog("Mem Error");
return false;
}
UnloadMenuSetup();
if (!user_number) {
return false;
}
File userConfig(syscfg.datadir, CONFIG_USR);
if (!userConfig.Exists()) {
return false;
}
WUser user;
application()->users()->ReadUser(&user, user_number);
if (userConfig.Open(File::modeReadOnly | File::modeBinary)) {
userConfig.Seek(user_number * sizeof(user_config), File::seekBegin);
int len = userConfig.Read(pSecondUserRec, sizeof(user_config));
userConfig.Close();
if (len != sizeof(user_config) || !IsEqualsIgnoreCase(reinterpret_cast<char*>(pSecondUserRec->name), user.GetName())) {
memset(pSecondUserRec, 0, sizeof(user_config));
strcpy(reinterpret_cast<char*>(pSecondUserRec->name), user.GetName());
return 0;
}
nSecondUserRecLoaded = user_number;
return true;
}
return false;
}
开发者ID:insidenothing,项目名称:wwiv,代码行数:32,代码来源:menu.cpp
示例4: find_new_usernum
static int find_new_usernum(const WUser* pUser, uint32_t* qsc) {
File userFile(syscfg.datadir, USER_LST);
for (int i = 0; !userFile.IsOpen() && (i < 20); i++) {
if (!userFile.Open(File::modeBinary | File::modeReadWrite | File::modeCreateFile)) {
Wait(0.1);
}
}
if (!userFile.IsOpen()) {
return -1;
}
int nNewUserNumber = static_cast<int>((userFile.GetLength() / syscfg.userreclen) - 1);
userFile.Seek(syscfg.userreclen, File::seekBegin);
int nUserNumber = 1;
if (nNewUserNumber == application()->GetStatusManager()->GetUserCount()) {
nUserNumber = nNewUserNumber + 1;
} else {
while (nUserNumber <= nNewUserNumber) {
if (nUserNumber % 25 == 0) {
userFile.Close();
for (int n = 0; !userFile.IsOpen() && (n < 20); n++) {
if (!userFile.Open(File::modeBinary | File::modeReadWrite | File::modeCreateFile)) {
Wait(0.1);
}
}
if (!userFile.IsOpen()) {
return -1;
}
userFile.Seek(static_cast<long>(nUserNumber * syscfg.userreclen), File::seekBegin);
nNewUserNumber = static_cast<int>((userFile.GetLength() / syscfg.userreclen) - 1);
}
WUser tu;
userFile.Read(&tu.data, syscfg.userreclen);
if (tu.IsUserDeleted() && tu.GetSl() != 255) {
userFile.Seek(static_cast<long>(nUserNumber * syscfg.userreclen), File::seekBegin);
userFile.Write(&pUser->data, syscfg.userreclen);
userFile.Close();
write_qscn(nUserNumber, qsc, false);
InsertSmallRecord(nUserNumber, pUser->GetName());
return nUserNumber;
} else {
nUserNumber++;
}
}
}
if (nUserNumber <= syscfg.maxusers) {
userFile.Seek(static_cast<long>(nUserNumber * syscfg.userreclen), File::seekBegin);
userFile.Write(&pUser->data, syscfg.userreclen);
userFile.Close();
write_qscn(nUserNumber, qsc, false);
InsertSmallRecord(nUserNumber, pUser->GetName());
return nUserNumber;
} else {
userFile.Close();
return -1;
}
}
开发者ID:insidenothing,项目名称:wwiv,代码行数:60,代码来源:newuser.cpp
示例5: intro
// Displays which channel the user is in, who's in the channel with them,
// whether or not the channel is secured, and tells the user how to obtain
// help
void intro(int loc) {
int nodes[20];
bout << "|#7You are in " << channels[loc - INST_LOC_CH1 + 1].name << wwiv::endl;
who_online(nodes, loc);
if (nodes[0]) {
for (int i = 1; i <= nodes[0]; i++) {
WUser u;
application()->users()->ReadUser(&u, nodes[i]);
if (((nodes[0] - i) == 1) && (nodes[0] >= 2)) {
bout << "|#1" << u.GetName() << " |#7and ";
} else {
bout << "|#1" << u.GetName() << (((nodes[0] > 1) && (i != nodes[0])) ? "|#7, " : " ");
}
}
}
if (nodes[0] == 1) {
bout << "|#7is here with you.\r\n";
} else if (nodes[0] > 1) {
bout << "|#7are here with you.\r\n";
} else {
bout << "|#7You are the only one here.\r\n";
}
char szFileName[ MAX_PATH ];
sprintf(szFileName, "CHANNEL.%d", (loc + 1 - INST_LOC_CH1));
if (loc != INST_LOC_CH1 && File::Exists(szFileName)) {
bout << "|#7This channel is |#1secured|#7.\r\n";
}
bout << "|#7Type ? for help.\r\n";
}
开发者ID:venom49637,项目名称:wwiv,代码行数:33,代码来源:chat.cpp
示例6: finduser1
// Takes user name/handle as parameter, and returns user number, if found,
// else returns 0.
int finduser1(const string searchString) {
if (searchString.empty()) {
return 0;
}
int nFindUserNum = finduser(searchString);
if (nFindUserNum > 0) {
return nFindUserNum;
}
string userNamePart = searchString;
StringUpperCase(userNamePart);
for (int i1 = 0; i1 < GetApplication()->GetStatusManager()->GetUserCount(); i1++) {
if (strstr(reinterpret_cast<char*>(smallist[i1].name), userNamePart.c_str()) != NULL) {
int nCurrentUserNum = smallist[i1].number;
WUser user;
GetApplication()->GetUserManager()->ReadUser(&user, nCurrentUserNum);
GetSession()->bout << "|#5Do you mean " << user.GetUserNameAndNumber(nCurrentUserNum) << " (Y/N/Q)? ";
char ch = ynq();
if (ch == 'Y') {
return nCurrentUserNum;
}
if (ch == 'Q') {
return 0;
}
}
}
return 0;
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:30,代码来源:finduser.cpp
示例7: wusrinst
int wusrinst(char *n) {
instancerec ir;
for (int i = 0; i <= num_instances(); i++) {
get_inst_info(i, &ir);
if (ir.flags & INST_FLAGS_ONLINE) {
WUser user;
application()->users()->ReadUser(&user, ir.user);
if (IsEqualsIgnoreCase(user.GetName(), n)) {
return i;
}
}
}
return 0;
}
开发者ID:venom49637,项目名称:wwiv,代码行数:15,代码来源:chat.cpp
示例8: WriteMenuSetup
void WriteMenuSetup(int user_number) {
if (!user_number) {
return;
}
WUser user;
application()->users()->ReadUser(&user, user_number);
strcpy(pSecondUserRec->name, user.GetName());
File userConfig(syscfg.datadir, CONFIG_USR);
if (!userConfig.Open(File::modeReadWrite | File::modeBinary | File::modeCreateFile)) {
return;
}
userConfig.Seek(user_number * sizeof(user_config), File::seekBegin);
userConfig.Write(pSecondUserRec, sizeof(user_config));
userConfig.Close();
}
开发者ID:insidenothing,项目名称:wwiv,代码行数:18,代码来源:menu.cpp
示例9: WriteMenuSetup
void WriteMenuSetup(int nUserNum) {
if (!nUserNum) {
return;
}
WUser user;
GetApplication()->GetUserManager()->ReadUser(&user, nUserNum);
strcpy(pSecondUserRec->name, user.GetName());
WFile userConfig(syscfg.datadir, CONFIG_USR);
if (!userConfig.Open(WFile::modeReadWrite | WFile::modeBinary | WFile::modeCreateFile)) {
return;
}
userConfig.Seek(nUserNum * sizeof(user_config), WFile::seekBegin);
userConfig.Write(pSecondUserRec, sizeof(user_config));
userConfig.Close();
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:18,代码来源:menu.cpp
示例10: downloaded
void downloaded(char *pszFileName, long lCharsPerSecond) {
uploadsrec u;
for (int i1 = 0; i1 < GetSession()->numbatch; i1++) {
if (wwiv::strings::IsEquals(pszFileName, batch[i1].filename) &&
batch[i1].sending) {
dliscan1(batch[i1].dir);
int nRecNum = recno(batch[i1].filename);
if (nRecNum > 0) {
WFile file(g_szDownloadFileName);
file.Open(WFile::modeReadWrite | WFile::modeBinary | WFile::modeCreateFile,
WFile::shareUnknown, WFile::permReadWrite);
FileAreaSetRecord(file, nRecNum);
file.Read(&u, sizeof(uploadsrec));
GetSession()->GetCurrentUser()->SetFilesDownloaded(GetSession()->GetCurrentUser()->GetFilesDownloaded() + 1);
GetSession()->GetCurrentUser()->SetDownloadK(GetSession()->GetCurrentUser()->GetDownloadK() +
static_cast<int>(bytes_to_k(u.numbytes)));
++u.numdloads;
FileAreaSetRecord(file, nRecNum);
file.Write(&u, sizeof(uploadsrec));
file.Close();
if (lCharsPerSecond) {
sysoplogf("Downloaded \"%s\" (%ld cps)", u.filename, lCharsPerSecond);
} else {
sysoplogf("Downloaded \"%s\"", u.filename);
}
if (syscfg.sysconfig & sysconfig_log_dl) {
WUser user;
GetApplication()->GetUserManager()->ReadUser(&user, u.ownerusr);
if (!user.IsUserDeleted()) {
if (date_to_daten(user.GetFirstOn()) < static_cast<signed int>(u.daten)) {
ssm(u.ownerusr, 0, "%s downloaded|#1 \"%s\" |#7on %s",
GetSession()->GetCurrentUser()->GetUserNameAndNumber(GetSession()->usernum), u.filename, fulldate());
}
}
}
}
delbatch(i1);
return;
}
}
sysoplogf("!!! Couldn't find \"%s\" in DL batch queue.", pszFileName);
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:43,代码来源:batch.cpp
示例11: check_dupes
bool check_dupes(const char *pszPhoneNumber) {
int nUserNumber = find_phone_number(pszPhoneNumber);
if (nUserNumber && nUserNumber != session()->usernum) {
char szBuffer[ 255 ];
sprintf(szBuffer, " %s entered phone # %s", session()->user()->GetName(), pszPhoneNumber);
sysoplog(szBuffer, false);
ssm(1, 0, szBuffer);
WUser user;
application()->users()->ReadUser(&user, nUserNumber);
sprintf(szBuffer, " also entered by %s", user.GetName());
sysoplog(szBuffer, false);
ssm(1, 0, szBuffer);
return true;
}
return false;
}
开发者ID:insidenothing,项目名称:wwiv,代码行数:19,代码来源:newuser.cpp
示例12: strcpy
char *read_inet_addr(char *pszInternetEmailAddress, int nUserNumber) {
if (!nUserNumber) {
return NULL;
}
if (nUserNumber == GetSession()->usernum && check_inet_addr(GetSession()->GetCurrentUser()->GetEmailAddress())) {
strcpy(pszInternetEmailAddress, GetSession()->GetCurrentUser()->GetEmailAddress());
} else {
//pszInternetEmailAddress = NULL;
*pszInternetEmailAddress = 0;
WFile inetAddrFile(syscfg.datadir, INETADDR_DAT);
if (!inetAddrFile.Exists()) {
inetAddrFile.Open(WFile::modeReadWrite | WFile::modeBinary | WFile::modeCreateFile, WFile::shareUnknown,
WFile::permReadWrite);
for (int i = 0; i <= syscfg.maxusers; i++) {
long lCurPos = 80L * static_cast<long>(i);
inetAddrFile.Seek(lCurPos, WFile::seekBegin);
inetAddrFile.Write(pszInternetEmailAddress, 80L);
}
} else {
char szUserName[ 255 ];
inetAddrFile.Open(WFile::modeReadOnly | WFile::modeBinary);
long lCurPos = 80L * static_cast<long>(nUserNumber);
inetAddrFile.Seek(lCurPos, WFile::seekBegin);
inetAddrFile.Read(szUserName, 80L);
if (check_inet_addr(szUserName)) {
strcpy(pszInternetEmailAddress, szUserName);
} else {
sprintf(pszInternetEmailAddress, "User #%d", nUserNumber);
WUser user;
GetApplication()->GetUserManager()->ReadUser(&user, nUserNumber);
user.SetEmailAddress("");
GetApplication()->GetUserManager()->WriteUser(&user, nUserNumber);
}
}
inetAddrFile.Close();
}
return pszInternetEmailAddress;
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:39,代码来源:inetmsg.cpp
示例13: finduser
//
// Returns user number
// or 0 if user not found
// or special value
//
// This function will remove the special characters from arround the searchString that are
// used by the network and remote, etc.
//
// Special values:
//
// -1 = NEW USER
// -2 = WWIVnet
// -3 = Remote Command
// -4 = Unknown Special Login
//
int finduser(const std::string searchString) {
WUser user;
guest_user = false;
GetApplication()->GetUserManager()->SetUserWritesAllowed(true);
if (searchString == "NEW") {
return -1;
}
if (searchString == "[email protected]@-!") {
return -2;
}
if (searchString == "[email protected]@-!") {
return -3;
}
int nUserNumber = atoi(searchString.c_str());
if (nUserNumber > 0) {
GetApplication()->GetUserManager()->ReadUser(&user, nUserNumber);
if (user.IsUserDeleted()) {
//printf( "DEBUG: User %s is deleted!\r\n", user.GetName() );
return 0;
}
return nUserNumber;
}
nUserNumber = GetApplication()->GetUserManager()->FindUser(searchString);
if (nUserNumber == 0L) {
return 0;
} else {
GetApplication()->GetUserManager()->ReadUser(&user, nUserNumber);
if (user.IsUserDeleted()) {
return 0;
} else {
if (IsEqualsIgnoreCase(user.GetName(), "GUEST")) {
guest_user = true;
GetApplication()->GetUserManager()->SetUserWritesAllowed(false);
}
return nUserNumber;
}
}
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:54,代码来源:finduser.cpp
示例14: make_inst_str
/*
* Builds a string (in pszOutInstanceString) like:
*
* Instance 1: Offline
* LastUser: Sysop #1
*
* or
*
* Instance 22: Network transmission
* CurrUser: Sysop #1
*/
void make_inst_str(int nInstanceNum, std::string *out, int nInstanceFormat) {
const string s = StringPrintf("|#1Instance %-3d: |#2", nInstanceNum);
instancerec ir;
get_inst_info(nInstanceNum, &ir);
const string activity_string = GetInstanceActivityString(ir);
switch (nInstanceFormat) {
case INST_FORMAT_WFC:
out->assign(activity_string); // WFC addition
break;
case INST_FORMAT_OLD:
// Not used anymore.
out->assign(s);
break;
case INST_FORMAT_LIST: {
std::string userName;
if (ir.user < syscfg.maxusers && ir.user > 0) {
WUser user;
application()->users()->ReadUser(&user, ir.user);
if (ir.flags & INST_FLAGS_ONLINE) {
userName = user.GetUserNameAndNumber(ir.user);
} else {
userName = "Last: ";
userName += user.GetUserNameAndNumber(ir.user);
}
} else {
userName = "(Nobody)";
}
out->assign(StringPrintf("|#5%-4d |#2%-35.35s |#1%-37.37s", nInstanceNum, userName.c_str(), activity_string.c_str()));
}
break;
default:
out->assign(StringPrintf("** INVALID INSTANCE FORMAT PASSED [%d] **", nInstanceFormat));
break;
}
}
开发者ID:venom49637,项目名称:wwiv,代码行数:49,代码来源:multinst.cpp
示例15: ch_whisper
// This function is called when a / sign is encountered at the beginning of
// a message, used for whispering
void ch_whisper(const char *pszMessage, char *pszColorString, int node, int nOffSet) {
if (strlen(pszMessage + nOffSet) == 0) {
bout << "|#1[|#9Message required after using a / or > command.|#1]\r\n";
return;
}
if (!node) {
return;
}
instancerec ir;
get_inst_info(node, &ir);
char szText[ 512 ];
if (ir.loc >= INST_LOC_CH1 && ir.loc <= INST_LOC_CH10) {
sprintf(szText, "|#9From %.12s|#6 [WHISPERED]|#2|#1:%s%s", session()->user()->GetName(), pszColorString,
pszMessage + nOffSet);
} else {
strcpy(szText, pszMessage + nOffSet);
}
send_inst_str(node, szText);
WUser u;
application()->users()->ReadUser(&u, ir.user);
bout << "|#1[|#9Message sent only to " << u.GetName() << "|#1]\r\n";
}
开发者ID:venom49637,项目名称:wwiv,代码行数:25,代码来源:chat.cpp
示例16: set_user_age
void set_user_age() {
std::unique_ptr<WStatus> pStatus(GetApplication()->GetStatusManager()->GetStatus());
int nUserNumber = 1;
do {
WUser user;
GetApplication()->GetUserManager()->ReadUser(&user, nUserNumber);
int nAge = years_old(user.GetBirthdayMonth(), user.GetBirthdayDay(), user.GetBirthdayYear());
if (nAge != user.GetAge()) {
user.SetAge(nAge);
GetApplication()->GetUserManager()->WriteUser(&user, nUserNumber);
}
++nUserNumber;
} while (nUserNumber <= pStatus->GetNumUsers());
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:14,代码来源:sysopf.cpp
示例17: reset_files
void reset_files() {
WUser user;
WStatus* pStatus = GetApplication()->GetStatusManager()->BeginTransaction();
pStatus->SetNumUsers(0);
GetSession()->bout.NewLine();
int nNumUsers = GetApplication()->GetUserManager()->GetNumberOfUserRecords();
WFile userFile(syscfg.datadir, USER_LST);
if (userFile.Open(WFile::modeBinary | WFile::modeReadWrite)) {
for (int i = 1; i <= nNumUsers; i++) {
long pos = static_cast<long>(syscfg.userreclen) * static_cast<long>(i);
userFile.Seek(pos, WFile::seekBegin);
userFile.Read(&user.data, syscfg.userreclen);
if (!user.IsUserDeleted()) {
user.FixUp();
if (isr1(i, nNumUsers, user.GetName())) {
pStatus->IncrementNumUsers();
}
} else {
memset(&user.data, 0, syscfg.userreclen);
user.SetInactFlag(0);
user.SetInactFlag(inact_deleted);
}
userFile.Seek(pos, WFile::seekBegin);
userFile.Write(&user.data, syscfg.userreclen);
if ((i % 10) == 0) {
userFile.Close();
GetSession()->bout << i << "\r ";
userFile.Open(WFile::modeBinary | WFile::modeReadWrite);
}
}
userFile.Close();
}
GetSession()->bout << "\r\n\r\n";
WFile namesFile(syscfg.datadir, NAMES_LST);
if (!namesFile.Open(WFile::modeReadWrite | WFile::modeBinary | WFile::modeTruncate)) {
std::cout << namesFile.GetFullPathName() << " NOT FOUND" << std::endl;
GetApplication()->AbortBBS(true);
}
namesFile.Write(smallist, sizeof(smalrec) * pStatus->GetNumUsers());
namesFile.Close();
GetApplication()->GetStatusManager()->CommitTransaction(pStatus);
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:44,代码来源:sysopf.cpp
示例18: auto_purge
void auto_purge() {
char s[80];
unsigned int days = 0;
int skipsl = 0;
IniFile iniFile(FilePath(GetApplication()->GetHomeDir(), WWIV_INI), INI_TAG);
if (iniFile.IsOpen()) {
days = iniFile.GetNumericValue("AUTO_USER_PURGE");
skipsl = iniFile.GetNumericValue("NO_PURGE_SL");
}
iniFile.Close();
if (days < 60) {
if (days > 0) {
sysoplog("!!! WARNING: Auto-Purge canceled [AUTO_USER_PURGE < 60]", false);
sysoplog("!!! WARNING: Edit WWIV.INI and Fix this", false);
}
return;
}
time_t tTime = time(NULL);
int nUserNumber = 1;
sysoplogfi(false, "Auto-Purged Inactive Users (over %d days, SL less than %d)", days, skipsl);
do {
WUser user;
GetApplication()->GetUserManager()->ReadUser(&user, nUserNumber);
if (!user.IsExemptAutoDelete()) {
unsigned int d = static_cast<unsigned int>((tTime - user.GetLastOnDateNumber()) / SECONDS_PER_DAY_FLOAT);
// if user is not already deleted && SL<NO_PURGE_SL && last_logon
// greater than AUTO_USER_PURGE days ago
if (!user.IsUserDeleted() && user.GetSl() < skipsl && d > days) {
sprintf(s, "*** AUTOPURGE: Deleted User: #%3.3d %s", nUserNumber, user.GetName());
sysoplog(s, false);
deluser(nUserNumber);
}
}
++nUserNumber;
} while (nUserNumber <= GetApplication()->GetStatusManager()->GetUserCount());
}
开发者ID:bhaggerty,项目名称:wwiv,代码行数:40,代码来源:sysopf.cpp
示例19: show_chains
// Displays the list of chains to a user
static void show_chains(int *mapp, int *map) {
bout.Color(0);
bout.cls();
bout.nl();
bool abort = false;
bool next = false;
if (application()->HasConfigFlag(OP_FLAGS_CHAIN_REG) && chains_reg) {
pla(StringPrintf("|#5 Num |#1%-42.42s|#2%-22.22s|#1%-5.5s", "Description", "Sponsored by", "Usage"), &abort);
if (okansi()) {
pla(StringPrintf("|#%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"), &abort);
} else {
pla(StringPrintf(" +---+-----------------------------------------+---------------------+-----+"), &abort);
}
for (int i = 0; i < *mapp && !abort && !hangup; i++) {
WUser user;
if (okansi()) {
application()->users()->ReadUser(&user, chains_reg[map[i]].regby[0]);
pla(StringPrintf(" |#%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), &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) {
application()->users()->ReadUser(&user, chains_reg[map[i]].regby[i1]);
pla(StringPrintf(" |#%d\xB3 \xBA%-41s\xB3|#2%-21s|#%d\xB3%5.5s\xB3",
FRAME_COLOR, " ", user.GetName(), FRAME_COLOR, " "), &abort);
}
}
}
} else {
application()->users()->ReadUser(&user, chains_reg[map[i]].regby[0]);
pla(StringPrintf(" |%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), &abort);
if (chains_reg[map[i]].regby[0] != 0) {
for (int i1 = 1; i1 < 5; i1++) {
if (chains_reg[map[i]].regby[i1] != 0) {
application()->users()->ReadUser(&user, chains_reg[map[i]].regby[i1]);
pla(StringPrintf(" | | |%-21.21s| |",
(chains_reg[map[i]].regby[i1]) ? user.GetName() : "Available"), &abort);
}
}
}
}
}
if (okansi()) {
pla(StringPrintf("|#%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"), &abort);
} else {
pla(StringPrintf(" +---+-----------------------------------------+---------------------+-----+"), &abort);
}
} else {
bout.litebar(" %s Online Programs ", syscfg.systemname);
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++) {
osan(StringPrintf("|#7\xB3|#2%2d|#7\xB3 |#1%-33.33s|#7\xB3", i + 1, chains[map[i]].description), &abort, &next);
i++;
if (!abort && !hangup) {
if (i >= *mapp) {
pla(StringPrintf(" |#7\xB3 |#7\xB3"), &abort);
} else {
pla(StringPrintf("|#2%2d|#7\xB3 |#1%-33.33s|#7\xB3", i + 1, chains[map[i]].description), &abort);
}
}
}
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";
}
}
开发者ID:bhaggerty,项目名称:wwiv-1,代码行数:79,代码来源:chains.cpp
示例20: 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;
//.........这里部分代码省略.........
开发者ID:wwivsoftwareservices,项目名称:wwiv,代码行数:101,代码来源:multmail.cpp
注:本文中的WUser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论