示例#1
0
void CSubChannelCfg::OnOK() 
{

	UpdateData(TRUE);

	g_sSettings.SetSubFirstIsSupoer(m_bFirstIsSuper);
	g_sSettings.SetAutoCloseSub(m_bAutoClose);
	g_sSettings.SetLimitSub(m_uMax);


	UINT uMode = 0;


	uMode = g_sSettings.GetChannelMode();
	if(m_bEnable){

		uMode |= CM_SUBCHANNELS;
	}
	else{

		uMode &= ~CM_SUBCHANNELS;
	}
	g_sSettings.SetChannelMode(uMode);

	switch(m_nSubLevel){

	case 0:  // everyone
		uMode = UM_NORMAL;
		break;
	case 1:	// voice admin agent
		uMode = UM_ADMIN|UM_AGENT|UM_VOICED;
		break;
	case 2: // admin agent
		uMode = UM_ADMIN|UM_AGENT;
		break;
	case 3:// admin
		uMode = UM_ADMIN;
		break;
	default: // host
		uMode = UM_HOST;
		break;
	}
	g_sSettings.SetSubPermission(uMode);
	g_sSettings.SetDisplaySubText(m_bDisplaySubs);
	g_sSettings.SetSubListed(m_bSubList);

	g_sSettings.Save();
	CWnd* pWnd = AfxGetApp()->m_pMainWnd;
	if(pWnd){

		pWnd->SendMessage(UWM_SETTINGS, 0, 0);
	}
}
示例#2
0
void CSubChannelCfg::Load()
{

	m_bEnable		= (g_sSettings.GetChannelMode() & CM_SUBCHANNELS) == CM_SUBCHANNELS;
	m_bAutoClose	= g_sSettings.GetAutoCloseSub();
	m_uMax			= g_sSettings.GetLimitSub();
	m_bLimit		= m_uMax > 0;
	m_bDisplaySubs	= g_sSettings.GetDisplaySubText();
	m_bFirstIsSuper = g_sSettings.GetSubFirstIsSuper();
	m_bSubList		= g_sSettings.GetSubListed();

	UINT uMode = g_sSettings.GetSubPermission();

	if(uMode == UM_NORMAL){

		m_nSubLevel = 0;
	}
	else if(((uMode & UM_ADMIN) == UM_ADMIN) && ((uMode & UM_AGENT) == UM_AGENT) && ((uMode & UM_VOICED) == UM_VOICED)){

		m_nSubLevel = 1;
	}
	else if(((uMode & UM_ADMIN) == UM_ADMIN) && ((uMode & UM_AGENT) == UM_AGENT)){

		m_nSubLevel = 2;
	}
	else if((uMode & UM_ADMIN) == UM_ADMIN){

		m_nSubLevel = 3;
	}
	else{

		m_nSubLevel = 4;
	}

	UpdateData(FALSE);

	OnEnableSubs();
}
示例#3
0
void CSettingsBar::OnBnClickedOk()
{

	UpdateData(TRUE);

	m_strKeyMsg.Replace("\r\n", "\\n");
	m_strMotd.Replace("\r\n", "\\n");
	g_sSettings.SetGodName(m_strGodName);
	g_sSettings.SetGodVisible(m_bGodVisible);
	g_sSettings.SetGodFiles(m_dwGodFiles);
	g_sSettings.SetGodLine(m_nLine);
	g_sSettings.SetListed(m_bRoomListed);
	g_sSettings.SetTopic(m_strTopic);
	g_sSettings.SetMotd(m_strMotd);
	g_sSettings.SetKeyMsg(m_strKeyMsg);
	g_sSettings.SetWelcome(m_strWelcome);
	g_sSettings.SetColor(m_nColor);
	g_sSettings.SetKeyword(m_strKeyWord);
	
	UINT uMode = g_sSettings.GetChannelMode();
	if(m_strKeyWord.GetLength() && (uMode&CM_KEYWORD != CM_KEYWORD)){

		uMode |= CM_KEYWORD;
	}
	else if(m_strKeyWord.IsEmpty() && (uMode&CM_KEYWORD == CM_KEYWORD)){

		uMode &= ~CM_KEYWORD;
	}
	g_sSettings.SetChannelMode(uMode);
	g_sSettings.Save();

	CWnd* pWnd = AfxGetApp()->m_pMainWnd;
	if(pWnd){

		pWnd->SendMessage(UWM_SETTINGS, 0, 0);
	}
}