bool cConsole::cfLastIp::operator ( )() { string who; int count = 10; enum {eIP_ALL,eIP_WHO, eIP_COUNT}; enum {eLAST_IP,eLAST_NICK, eLAST_RANGE}; const char *ids[]={"ip","nick","range", NULL}; const int ids_nums[]={eLAST_IP,eLAST_NICK, eLAST_RANGE}; int id; GetIDEnum(1,id, ids, ids_nums); GetParStr(eIP_WHO,who); GetParInt(eIP_COUNT,count); unsigned long range_min,range_max; switch(id) { case eLAST_IP: GetPI()->mIPLog->GetLastIP(who, count, *mOS); break; case eLAST_NICK: GetPI()->mIPLog->GetLastNick(who, count, *mOS); break; case eLAST_RANGE: GetParIPRange(eIP_WHO,range_min,range_max); default:break; } return true; }
bool cConsole::cfErrLuaScript::operator()() { int eclass; if (GetParInt(1, eclass)) { stringstream ss; ss << GetPI()->err_class; string oldValue = ss.str(); ss.str(""); ss << eclass; string newValue = ss.str(); GetPI()->SetErrClass(eclass); (*mOS) << autosprintf(_("Updated configuration %s.%s from '%s' to '%s'."), "pi_lua", "err_class", oldValue.c_str(), newValue.c_str()); } else { (*mOS) << autosprintf(_("Current error class: %d"), GetPI()->err_class); } return true; }
bool cConsole::cfLogLuaScript::operator()() { int level; if (GetParInt(1, level)) { stringstream ss; ss << GetPI()->log_level; string oldValue = ss.str(); ss.str(""); ss << level; string newValue = ss.str(); GetPI()->SetLogLevel(level); (*mOS) << autosprintf(_("Updated configuration %s.%s from '%s' to '%s'."), "pi_lua", "log_level", oldValue.c_str(), newValue.c_str()); } else { (*mOS) << autosprintf(_("Current log level: %d"), GetPI()->log_level); } return true; }
bool cConsole::cfHistoryOf::operator ( )() { string who; int count = 10; enum {eHI_ALL,eHI_WHO, eHI_COUNT}; enum {eHIST_IP,eHIST_NICK}; const char *ids[]={"ip","nick", NULL}; const int ids_nums[]={eHIST_IP,eHIST_NICK}; int id=-1; GetIDEnum(1,id, ids, ids_nums); GetParStr(eHI_WHO,who); GetParInt(eHI_COUNT,count); switch(id) { case eHIST_IP: GetPI()->mIPLog->GetIPHistory(who, count, *mOS); break; case eHIST_NICK: GetPI()->mIPLog->GetNickHistory(who, count, *mOS); break; default: break; } return true; }