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); } }
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); } }