void LogUserFunction(const MenuInstanceData* menu_data, const string& command, MenuRec* pMenu) { switch (menu_data->header.nLogging) { case MENU_LOGTYPE_KEY: sysopchar(command); break; case MENU_LOGTYPE_COMMAND: sysoplog(pMenu->szExecute); break; case MENU_LOGTYPE_DESC: sysoplog(pMenu->szMenuText[0] ? pMenu->szMenuText : pMenu->szExecute); break; case MENU_LOGTYPE_NONE: default: break; } }
// printf style function to write to the sysop log void sysoplogfi(bool bIndent, const char *pszFormat, ...) { va_list ap; char szBuffer[2048]; va_start(ap, pszFormat); WWIV_VSNPRINTF(szBuffer, sizeof(szBuffer), pszFormat, ap); va_end(ap); sysoplog(szBuffer, bIndent); }
void MenuSysopLog(const string& msg) { const string log_message = StrCat("*MENU* : ", msg); sysoplog(log_message); bout << log_message << wwiv::endl; }
/** * Writes the auto message */ void write_automessage() { std::vector<std::string> lines; std::string rollOver; GetSession()->bout << "\r\n|#9Enter auto-message. Max 5 lines. Colors allowed:|#0\r\n\n"; for (int i = 0; i < 5; i++) { GetSession()->bout << "|#7" << i + 1 << ":|#0"; std::string line; inli(line, rollOver, 70); StringTrimEnd(line); lines.push_back(line); } GetSession()->bout.NewLine(); bool bAnonStatus = false; if (getslrec(GetSession()->GetEffectiveSl()).ability & ability_post_anony) { GetSession()->bout << "|#9Anonymous? "; bAnonStatus = yesno(); } GetSession()->bout << "|#9Is this OK? "; if (yesno()) { WStatus *pStatus = GetApplication()->GetStatusManager()->BeginTransaction(); pStatus->SetAutoMessageAnonymous(bAnonStatus); pStatus->SetAutoMessageAuthorUserNumber(GetSession()->usernum); GetApplication()->GetStatusManager()->CommitTransaction(pStatus); WTextFile file(syscfg.gfilesdir, AUTO_MSG, "wt"); std::string authorName = GetSession()->GetCurrentUser()->GetUserNameAndNumber(GetSession()->usernum); file.WriteFormatted("%s\r\n", authorName.c_str()); sysoplog("Changed Auto-message"); #if defined(_MSC_VER) && (_MSC_VER < 1800) for (std::vector<std::string>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter) { std::string line = (*iter); StringTrimEnd(line); #else for (const auto& line : lines) { #endif file.Write(line); file.Write("\r\n"); sysoplog(line, true); } GetSession()->bout << "\r\n|#5Auto-message saved.\r\n\n"; file.Close(); } } char ShowAMsgMenuAndGetInput(const std::string& autoMessageLockFileName) { bool bCanWrite = false; if (!GetSession()->GetCurrentUser()->IsRestrictionAutomessage() && !WFile::Exists(autoMessageLockFileName)) { bCanWrite = (getslrec(GetSession()->GetEffectiveSl()).posts) ? true : false; } char cmdKey = 0; if (cs()) { GetSession()->bout << "|#9(|#2Q|#9)uit, (|#2R|#9)ead, (|#2A|#9)uto-reply, (|#2W|#9)rite, (|#2L|#9)ock, (|#2D|#9)el, (|#2U|#9)nlock : "; cmdKey = onek("QRWALDU", true); } else if (bCanWrite) { GetSession()->bout << "|#9(|#2Q|#9)uit, (|#2R|#9)ead, (|#2A|#9)uto-reply, (|#2W|#9)rite : "; cmdKey = onek("QRWA", true); } else { GetSession()->bout << "|#9(|#2Q|#9)uit, (|#2R|#9)ead, (|#2A|#9)uto-reply : "; cmdKey = onek("QRA", true); } return cmdKey; }