" + sTitle + " | |
" + sTitle.Escape_n(CString::EHTML) + " | |
| \r\n";
if (!m_pUser) {
sRet += "[Home] \r\n" - "[ZNC Settings] \r\n" + "[Settings] \r\n" "[Add User] \r\n" "[List Users] \r\n"; } @@ -300,19 +302,111 @@ bool CAdminSock::OnPageRequest(const CString& sURI, CString& sPageRet) { bool CAdminSock::SettingsPage(CString& sPageRet) { if (!GetParam("submitted").ToUInt()) { - sPageRet = Header("Error"); - sPageRet += "The global settings page has not been implemented yet."; + sPageRet = Header("Settings"); + + CString sVHosts; + + const VCString& vsVHosts = m_pModule->GetZNC()->GetVHosts(); + for (unsigned int a = 0; a < vsVHosts.size(); a++) { + sVHosts += vsVHosts[a] + "\r\n"; + } + + sPageRet += " \r\n"; + sPageRet += Footer(); return true; } + CString sArg; + sArg = GetParam("statusprefix"); m_pModule->GetZNC()->SetStatusPrefix(sArg); + sArg = GetParam("ispooffile"); m_pModule->GetZNC()->SetISpoofFile(sArg); + sArg = GetParam("ispoofformat"); m_pModule->GetZNC()->SetISpoofFormat(sArg); + //sArg = GetParam(""); if (!sArg.empty()) { m_pModule->GetZNC()->Set(sArg); } + + VCString vsArgs = GetParam("vhosts").Split("\n"); + m_pModule->GetZNC()->ClearVHosts(); + + unsigned int a = 0; + for (a = 0; a < vsArgs.size(); a++) { + m_pModule->GetZNC()->AddVHost(vsArgs[a].Trim_n()); + } + + set Ident: \r\n"
"\r\n" " RealName: \r\n" - " \r\n" - "VHost: \r\n" - " \r\n" - "QuitMsg: \r\n" + " \r\n"; + + const VCString& vsVHosts = m_pModule->GetZNC()->GetVHosts(); + + if (vsVHosts.size()) { + sPageRet += "VHost: \r\n" + " \r\n"; + } + + sPageRet += "QuitMsg: \r\n" " \r\n" " Servers: \r\n"
@@ -424,7 +530,7 @@ bool CAdminSock::UserPage(CString& sPageRet, CUser* pUser) {
CString sUsername = GetParam("user");
if (!pUser && m_pModule->GetZNC()->FindUser(sUsername)) {
- GetErrorPage(sPageRet, "Invalid Submission [User " + sUsername.Escape_n(CString::EHTML) + " already exists]");
+ GetErrorPage(sPageRet, "Invalid Submission [User " + sUsername + " already exists]");
return true;
}
@@ -439,20 +545,20 @@ bool CAdminSock::UserPage(CString& sPageRet, CUser* pUser) {
// Add User Submission
if (!pNewUser->IsValid(sErr)) {
delete pNewUser;
- GetErrorPage(sPageRet, "Invalid submission [" + sErr.Escape_n(CString::EHTML) + "]");
+ GetErrorPage(sPageRet, "Invalid submission [" + sErr + "]");
return true;
}
m_pModule->GetZNC()->AddUser(pNewUser);
if (!m_pModule->GetZNC()->WriteConfig()) {
- GetErrorPage(sPageRet, "User edited, but config was not written");
+ GetErrorPage(sPageRet, "User added, but config was not written");
return true;
}
} else {
// Edit User Submission
if (!pUser->Clone(*pNewUser, sErr)) {
delete pNewUser;
- GetErrorPage(sPageRet, "Invalid Submission [" + sErr.Escape_n(CString::EHTML) + "]");
+ GetErrorPage(sPageRet, "Invalid Submission [" + sErr + "]");
return true;
}
@@ -521,7 +627,9 @@ CUser* CAdminSock::GetNewUser(CString& sPageRet) {
CString sModRet;
CString sArg = vsArgs[a].TrimRight_n("\r");
if (!sArg.empty()) {
- pNewUser->GetModules().LoadModule(sArg, "", pNewUser, sModRet);
+ try {
+ pNewUser->GetModules().LoadModule(sArg, "", pNewUser, sModRet);
+ } catch (...) {}
}
}
\r\n" " | |