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; }
void MenuInstanceData::Menus(const string& menuDirectory, const string& menuName) { path = menuDirectory; menu = menuName; if (Open()) { if (header.nNumbers == MENU_NUMFLAG_DIRNUMBER && udir[0].subnum == -1) { bout << "\r\nYou cannot currently access the file section.\r\n\n"; Close(); return; } // if flagged to display help on entrance, then do so if (session()->user()->IsExpert() && header.nForceHelp == MENU_HELP_ONENTRANCE) { DisplayHelp(); } while (!hangup && !finished) { PrintMenuPrompt(this); const string command = GetCommand(this); MenuExecuteCommand(this, command); } } else if (IsEqualsIgnoreCase(menuName.c_str(), "main")) { // default menu name hangup = true; } Close(); }
static bool IsHostedHere(Context& context, const std::string& subtype) { for (const auto x : context.subs.subs()) { for (const auto n : x.nets) { if (IsEqualsIgnoreCase(subtype.c_str(), n.stype.c_str()) && n.host == 0 && n.net_num == context.network_number) { return true; } } } return false; }