Resolve #967: separate chan & query buffer size settings

This commit is contained in:
J-P Nurmi
2015-07-14 20:53:44 +02:00
parent 0d8083e3df
commit 496a132e32
7 changed files with 96 additions and 26 deletions
+19 -4
View File
@@ -85,7 +85,8 @@ class CAdminMod : public CModule {
{"DenySetBindHost", boolean},
{"DefaultChanModes", str},
{"QuitMsg", str},
{"BufferCount", integer},
{"ChanBufferSize", integer},
{"QueryBufferSize", integer},
{"AutoClearChanBuffer", boolean},
{"AutoClearQueryBuffer",boolean},
{"Password", str},
@@ -212,6 +213,10 @@ class CAdminMod : public CModule {
PutModule("QuitMsg = " + pUser->GetQuitMsg());
else if (sVar == "buffercount")
PutModule("BufferCount = " + CString(pUser->GetBufferCount()));
else if (sVar == "chanbuffersize")
PutModule("ChanBufferSize = " + CString(pUser->GetChanBufferSize()));
else if (sVar == "querybuffersize")
PutModule("QueryBufferSize = " + CString(pUser->GetQueryBufferSize()));
else if (sVar == "keepbuffer")
PutModule("KeepBuffer = " + CString(!pUser->AutoClearChanBuffer())); // XXX compatibility crap, added in 0.207
else if (sVar == "autoclearchanbuffer")
@@ -340,11 +345,21 @@ class CAdminMod : public CModule {
pUser->SetQuitMsg(sValue);
PutModule("QuitMsg = " + sValue);
}
else if (sVar == "buffercount") {
else if (sVar == "chanbuffersize" || sVar == "buffercount") {
unsigned int i = sValue.ToUInt();
// Admins don't have to honour the buffer limit
if (pUser->SetBufferCount(i, GetUser()->IsAdmin())) {
PutModule("BufferCount = " + sValue);
if (pUser->SetChanBufferSize(i, GetUser()->IsAdmin())) {
PutModule("ChanBufferSize = " + sValue);
} else {
PutModule("Setting failed, limit is " +
CString(CZNC::Get().GetMaxBufferSize()));
}
}
else if (sVar == "querybuffersize") {
unsigned int i = sValue.ToUInt();
// Admins don't have to honour the buffer limit
if (pUser->SetQueryBufferSize(i, GetUser()->IsAdmin())) {
PutModule("QueryBufferSize = " + sValue);
} else {
PutModule("Setting failed, limit is " +
CString(CZNC::Get().GetMaxBufferSize()));
+23 -9
View File
@@ -228,19 +228,38 @@
</div>
<div class="section">
<h3>Default Settings</h3>
<h3>Channels</h3>
<div class="sectionbg">
<div class="sectionbody">
<div class="subsection third">
<div class="inputlabel">Channel Modes:</div>
<div class="inputlabel">Default Modes:</div>
<input type="text" name="chanmodes" value="<? VAR DefaultChanModes ?>" maxlength="32"
title="These are the default modes ZNC will set when you join an empty channel." />
<br /><span class="info">Empty = use standard value</span>
</div>
<div class="subsection third">
<div class="inputlabel">Buffer Size:</div>
<input type="number" name="bufsize" value="<? VAR BufferCount ?>" min="0"
title="This is the amount of lines that the playback buffer will store before dropping off the oldest line. The buffers are stored in the memory by default." />
<input type="number" name="chanbufsize" value="<? VAR ChanBufferSize ?>" min="0"
title="This is the amount of lines that the playback buffer will store for channels before dropping off the oldest line. The buffers are stored in the memory by default." />
<br /><span class="info">Empty = use standard value</span>
</div>
</div>
</div>
</div>
<div class="section">
<h3>Queries</h3>
<div class="sectionbg">
<div class="sectionbody">
<div class="subsection third">
<div class="inputlabel">Max Buffers:</div>
<input type="number" name="maxquerybuffers" value="<? VAR MaxQueryBuffers ?>" class="third" min="0"
title="Maximum number of query buffers. 0 is unlimited."/>
</div>
<div class="subsection third">
<div class="inputlabel">Buffer Size:</div>
<input type="number" name="querybufsize" value="<? VAR QueryBufferSize ?>" min="0"
title="This is the amount of lines that the playback buffer will store for queries before dropping off the oldest line. The buffers are stored in the memory by default." />
<br /><span class="info">Empty = use standard value</span>
</div>
</div>
@@ -304,11 +323,6 @@
<input type="number" name="maxnetworks" value="<? VAR MaxNetworks ?>" class="third" min="0"
title="Maximum number of IRC networks allowed for this user." <? IF !ImAdmin ?>disabled="disabled"<? ENDIF ?> />
</div>
<div class="subsection">
<div class="inputlabel">Max Query Buffers:</div>
<input type="number" name="maxquerybuffers" value="<? VAR MaxQueryBuffers ?>" class="third" min="0"
title="Maximum number of query buffers. 0 is unlimited."/>
</div>
<div class="subsection half" id="ctcpreplies_plain">
<div class="inputlabel">CTCP Replies:</div>
+13 -4
View File
@@ -261,12 +261,20 @@ public:
pNewUser->SetDCCBindHost(pUser->GetDCCBindHost());
}
sArg = WebSock.GetParam("bufsize"); if (!sArg.empty()) pNewUser->SetBufferCount(sArg.ToUInt(), spSession->IsAdmin());
sArg = WebSock.GetParam("chanbufsize");
if (!sArg.empty()) {
// First apply the old limit in case the new one is too high
if (pUser)
pNewUser->SetBufferCount(pUser->GetBufferCount(), true);
pNewUser->SetBufferCount(sArg.ToUInt(), spSession->IsAdmin());
pNewUser->SetChanBufferSize(pUser->GetChanBufferSize(), true);
pNewUser->SetChanBufferSize(sArg.ToUInt(), spSession->IsAdmin());
}
sArg = WebSock.GetParam("querybufsize");
if (!sArg.empty()) {
// First apply the old limit in case the new one is too high
if (pUser)
pNewUser->SetQueryBufferSize(pUser->GetQueryBufferSize(), true);
pNewUser->SetQueryBufferSize(sArg.ToUInt(), spSession->IsAdmin());
}
pNewUser->SetSkinName(WebSock.GetParam("skin"));
@@ -1211,7 +1219,8 @@ public:
Tmpl["RealName"] = pUser->GetRealName();
Tmpl["QuitMsg"] = pUser->GetQuitMsg();
Tmpl["DefaultChanModes"] = pUser->GetDefaultChanModes();
Tmpl["BufferCount"] = CString(pUser->GetBufferCount());
Tmpl["ChanBufferSize"] = CString(pUser->GetChanBufferSize());
Tmpl["QueryBufferSize"] = CString(pUser->GetQueryBufferSize());
Tmpl["TimestampFormat"] = pUser->GetTimestampFormat();
Tmpl["Timezone"] = pUser->GetTimezone();
Tmpl["JoinTries"] = CString(pUser->JoinTries());