Example #1
0
bool cPenaltyList::LoadTo(sPenalty &pen, const string &Nick)
{
	if(mCache.IsLoaded() && !mCache.Find(Nick)) return false;
	SetBaseTo(&pen);
	pen.mNick = Nick;
	return LoadPK();
}
Example #2
0
bool cPenaltyList::AddPenalty(sPenalty &penal)
{
	SetBaseTo(&mModel);
	mModel.mNick = penal.mNick;
	mModel.mOpNick = penal.mOpNick;
	bool keep = false;
	if (LoadPK())
	{
		if(penal.mStartChat > mModel.mStartChat) mModel.mStartChat = penal.mStartChat;
		if(penal.mStartCTM > mModel.mStartCTM) mModel.mStartCTM = penal.mStartCTM;
		if(penal.mStartPM > mModel.mStartPM) mModel.mStartPM = penal.mStartPM;
		if(penal.mStartSearch > mModel.mStartSearch) mModel.mStartSearch = penal.mStartSearch;
		if(penal.mStopKick > mModel.mStopKick) mModel.mStopKick = penal.mStopKick;
		if(penal.mStopShare0 > mModel.mStopShare0) mModel.mStopShare0 = penal.mStopShare0;
		if(penal.mStopReg > mModel.mStopReg) mModel.mStopReg = penal.mStopReg;
		if(penal.mStopOpchat > mModel.mStopOpchat) mModel.mStopOpchat = penal.mStopOpchat;
		keep = mModel.ToKeepIt();
	}
	else
	{
		SetBaseTo(&penal);
		keep = penal.ToKeepIt();
		if (keep)
		{
			mCache.Add(penal.mNick);
		}
	}

	DeletePK();

	if( keep )
		return SavePK(false);
	else
		return false;
}
Example #3
0
/** find nick in reglist
if not foud return 0
else return 1 and fill in the reuserinfo parameter */
bool cRegList::FindRegInfo(cRegUserInfo &ui, const string &nick)
{
	if(mCache.IsLoaded() && !mCache.Find(nick))
		return false;//@todo nick2dbkey
	SetBaseTo(&ui);
	ui.mNick = nick;//@todo nick2dbkey
	return LoadPK();
}
Example #4
0
bool cConfMySQL::UpdatePKVar(const char* var_name, string &new_val)
{
	cConfigItemBase * item = NULL;
	string var(var_name);
	item = operator[](var);

	if (!item)
		return false;

	LoadPK();
	item->ConvertFrom(new_val);
	return UpdatePKVar(item);
}
Example #5
0
bool cPenaltyList::RemPenalty(sPenalty &penal)
{
	SetBaseTo(&mModel);
	mModel.mNick = penal.mNick;
	mModel.mOpNick = penal.mOpNick;
	time_t Now = cTime().Sec();
	if(LoadPK()) {
		if(penal.mStartChat < Now) mModel.mStartChat = Now;
		if(penal.mStartCTM < Now) mModel.mStartCTM = Now;
		if(penal.mStartPM < Now) mModel.mStartPM = Now;
		if(penal.mStartSearch < Now) mModel.mStartSearch = Now;
		if(penal.mStopKick < Now) mModel.mStopKick = Now;
		if(penal.mStopShare0 < Now) mModel.mStopShare0 = Now;
		if(penal.mStopReg < Now) mModel.mStopReg = Now;
		if(penal.mStopOpchat < Now) mModel.mStopOpchat = Now;
	}
	if(mModel.ToKeepIt())
		return SavePK();
	else
		DeletePK();
	return true;
}