webadmin: Add DCCBindHost

Before this commit, editing some user in webadmin cleared their DCCBindHost.
That's definitely not what we want.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2226 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-12-31 08:32:58 +00:00
parent 853ddc5c2a
commit 570fab6e44
2 changed files with 32 additions and 2 deletions

View File

@@ -233,11 +233,16 @@ public:
sArg = WebSock.GetParam("bindhost");
// To change BindHosts be admin or don't have DenySetBindHost
if (spSession->IsAdmin() || !spSession->GetUser()->DenySetBindHost()) {
CString sArg2 = WebSock.GetParam("dccbindhost");
if (!sArg.empty()) {
pNewUser->SetBindHost(sArg);
}
if (!sArg2.empty()) {
pNewUser->SetDCCBindHost(sArg2);
}
} else if (pUser){
pNewUser->SetBindHost(pUser->GetBindHost());
pNewUser->SetDCCBindHost(pUser->GetDCCBindHost());
}
// First apply the old limit in case the new one is too high
@@ -681,19 +686,27 @@ public:
}
// To change BindHosts be admin or don't have DenySetBindHost
if (spSession->IsAdmin() || !spSession->GetUser()->DenySetBindHost()) {
const VCString& vsBindHosts = CZNC::Get().GetBindHosts();
bool bFoundBindHost = false;
if (spSession->IsAdmin() || !spSession->GetUser()->DenySetBindHost()) {
bool bFoundDCCBindHost = false;
for (unsigned int b = 0; b < vsBindHosts.size(); b++) {
const CString& sBindHost = vsBindHosts[b];
CTemplate& l = Tmpl.AddRow("BindHostLoop");
CTemplate& k = Tmpl.AddRow("DCCBindHostLoop");
l["BindHost"] = sBindHost;
k["BindHost"] = sBindHost;
if (pUser && pUser->GetBindHost() == sBindHost) {
l["Checked"] = "true";
bFoundBindHost = true;
}
if (pUser && pUser->GetDCCBindHost() == sBindHost) {
k["Checked"] = "true";
bFoundDCCBindHost = true;
}
}
// If our current bindhost is not in the global list...
@@ -703,6 +716,12 @@ public:
l["BindHost"] = pUser->GetBindHost();
l["Checked"] = "true";
}
if (pUser && !bFoundDCCBindHost && !pUser->GetDCCBindHost().empty()) {
CTemplate& l = Tmpl.AddRow("DCCBindHostLoop");
l["BindHost"] = pUser->GetDCCBindHost();
l["Checked"] = "true";
}
}
vector<CFile> vDirs;

View File

@@ -82,6 +82,17 @@
<div style="clear: both;"></div>
<? ENDIF ?>
<? IF DCCBindHostLoop ?>
<div class="subsection">
<div class="inputlabel">DCCBindHost:</div>
<select name="dccbindhost">
<option value="">- Default -</option>
<? LOOP DCCBindHostLoop ?><option value="<? VAR BindHost ?>"<? IF Checked ?> selected="selected"<? ENDIF ?>><? VAR BindHost ?></option><? ENDLOOP ?>
</select>
</div>
<div style="clear: both;"></div>
<? ENDIF ?>
<div class="subsection">
<div class="inputlabel">Quit Message:</div>
<div><input type="text" name="quitmsg" value="<? VAR QuitMsg ?>" class="full" maxlength="256" /></div>