Permalink
Browse files

Rename (non-) KeepBuffer to AutoClearChanBuffer.

It should be a less confusing name...
  • Loading branch information...
1 parent ef54786 commit 27f42d11187054719c5065a4d0d0d3b9af9062cf @DarthGandalf DarthGandalf committed May 9, 2012
View
@@ -111,7 +111,7 @@ class CChan {
void SetTopicOwner(const CString& s) { m_sTopicOwner = s; }
void SetTopicDate(unsigned long u) { m_ulTopicDate = u; }
void SetDefaultModes(const CString& s) { m_sDefaultModes = s; }
- void SetKeepBuffer(bool b);
+ void SetAutoClearChanBuffer(bool b);
void SetDetached(bool b = true) { m_bDetached = b; }
void SetInConfig(bool b) { m_bInConfig = b; }
void SetCreationDate(unsigned long u) { m_ulCreationDate = u; }
@@ -137,7 +137,7 @@ class CChan {
const CString& GetDefaultModes() const { return m_sDefaultModes; }
const map<CString,CNick>& GetNicks() const { return m_msNicks; }
unsigned int GetNickCount() const { return m_msNicks.size(); }
- bool KeepBuffer() const { return m_bKeepBuffer; }
+ bool AutoClearChanBuffer() const { return m_bAutoClearChanBuffer; }
bool IsDetached() const { return m_bDetached; }
bool InConfig() const { return m_bInConfig; }
unsigned long GetCreationDate() const { return m_ulCreationDate; }
@@ -148,7 +148,7 @@ class CChan {
protected:
bool m_bDetached;
bool m_bIsOn;
- bool m_bKeepBuffer;
+ bool m_bAutoClearChanBuffer;
bool m_bInConfig;
bool m_bDisabled;
CString m_sName;
View
@@ -116,7 +116,7 @@ class CUser {
bool AddCTCPReply(const CString& sCTCP, const CString& sReply);
bool DelCTCPReply(const CString& sCTCP);
bool SetBufferCount(unsigned int u, bool bForce = false);
- void SetKeepBuffer(bool b);
+ void SetAutoClearChanBuffer(bool b);
void SetBeingDeleted(bool b) { m_bBeingDeleted = b; }
void SetTimestampFormat(const CString& s) { m_sTimestampFormat = s; }
@@ -158,7 +158,7 @@ class CUser {
CString GetQuitMsg() const;
const MCString& GetCTCPReplies() const;
unsigned int GetBufferCount() const;
- bool KeepBuffer() const;
+ bool AutoClearChanBuffer() const;
bool IsBeingDeleted() const { return m_bBeingDeleted; }
CString GetTimezone() const { return m_sTimezone; }
unsigned long long BytesRead() const { return m_uBytesRead; }
@@ -195,7 +195,7 @@ class CUser {
bool m_bDenyLoadMod;
bool m_bAdmin;
bool m_bDenySetBindHost;
- bool m_bKeepBuffer;
+ bool m_bAutoClearChanBuffer;
bool m_bBeingDeleted;
bool m_bAppendTimestamp;
bool m_bPrependTimestamp;
@@ -212,6 +212,9 @@ class CUser {
CString m_sSkinName;
CModules* m_pModules;
+
+private:
+ void SetKeepBuffer(bool b) { SetAutoClearChanBuffer(!b); } // XXX compatibility crap, added in 0.207
};
#endif // !_USER_H
View
@@ -44,27 +44,27 @@ class CAdminMod : public CModule {
static const char* integer = "Integer";
//static const char* doublenum = "Double";
static const char* vars[][2] = {
- {"Nick", str},
- {"Altnick", str},
- {"Ident", str},
- {"RealName", str},
- {"BindHost", str},
- {"MultiClients", boolean},
- {"DenyLoadMod", boolean},
- {"DenySetBindHost", boolean},
- {"DefaultChanModes", str},
- {"QuitMsg", str},
- {"BufferCount", integer},
- {"KeepBuffer", boolean},
- {"Password", str},
- {"JoinTries", integer},
- {"Timezone", str},
- {"Admin", boolean},
- {"AppendTimestamp", boolean},
- {"PrependTimestamp", boolean},
- {"TimestampFormat", str},
- {"DCCBindHost", str},
- {"StatusPrefix", str}
+ {"Nick", str},
+ {"Altnick", str},
+ {"Ident", str},
+ {"RealName", str},
+ {"BindHost", str},
+ {"MultiClients", boolean},
+ {"DenyLoadMod", boolean},
+ {"DenySetBindHost", boolean},
+ {"DefaultChanModes", str},
+ {"QuitMsg", str},
+ {"BufferCount", integer},
+ {"AutoClearChanBuffer", boolean},
+ {"Password", str},
+ {"JoinTries", integer},
+ {"Timezone", str},
+ {"Admin", boolean},
+ {"AppendTimestamp", boolean},
+ {"PrependTimestamp", boolean},
+ {"TimestampFormat", str},
+ {"DCCBindHost", str},
+ {"StatusPrefix", str}
};
for (unsigned int i = 0; i != ARRAY_SIZE(vars); ++i) {
VarTable.AddRow();
@@ -78,12 +78,12 @@ class CAdminMod : public CModule {
CVarTable.AddColumn("Variable");
CVarTable.AddColumn("Type");
static const char* cvars[][2] = {
- {"DefModes", str},
- {"Key", str},
- {"Buffer", integer},
- {"InConfig", boolean},
- {"KeepBuffer", boolean},
- {"Detached", boolean}
+ {"DefModes", str},
+ {"Key", str},
+ {"Buffer", integer},
+ {"InConfig", boolean},
+ {"AutoClearChanBuffer", boolean},
+ {"Detached", boolean}
};
for (unsigned int i = 0; i != ARRAY_SIZE(cvars); ++i) {
CVarTable.AddRow();
@@ -152,7 +152,9 @@ class CAdminMod : public CModule {
else if (sVar == "buffercount")
PutModule("BufferCount = " + CString(pUser->GetBufferCount()));
else if (sVar == "keepbuffer")
- PutModule("KeepBuffer = " + CString(pUser->KeepBuffer()));
+ PutModule("KeepBuffer = " + CString(!pUser->AutoClearChanBuffer())); // XXX compatibility crap, added in 0.207
+ else if (sVar == "autoclearchanbuffer")
+ PutModule("AutoClearChanBuffer = " + CString(pUser->AutoClearChanBuffer()));
else if (sVar == "jointries")
PutModule("JoinTries = " + CString(pUser->JoinTries()));
else if (sVar == "timezone")
@@ -252,10 +254,15 @@ class CAdminMod : public CModule {
CString(CZNC::Get().GetMaxBufferSize()));
}
}
- else if (sVar == "keepbuffer") {
+ else if (sVar == "keepbuffer") { // XXX compatibility crap, added in 0.207
+ bool b = !sValue.ToBool();
+ pUser->SetAutoClearChanBuffer(b);
+ PutModule("AutoClearChanBuffer = " + CString(b));
+ }
+ else if (sVar == "autoclearchanbuffer") {
bool b = sValue.ToBool();
- pUser->SetKeepBuffer(b);
- PutModule("KeepBuffer = " + CString(b));
+ pUser->SetAutoClearChanBuffer(b);
+ PutModule("AutoClearChanBuffer = " + CString(b));
}
else if (sVar == "password") {
const CString sSalt = CUtils::GetSalt();
@@ -349,7 +356,9 @@ class CAdminMod : public CModule {
else if (sVar == "inconfig")
PutModule("InConfig = " + CString(pChan->InConfig()));
else if (sVar == "keepbuffer")
- PutModule("KeepBuffer = " + CString(pChan->KeepBuffer()));
+ PutModule("KeepBuffer = " + CString(!pChan->AutoClearChanBuffer()));// XXX compatibility crap, added in 0.207
+ else if (sVar == "autoclearchanbuffer")
+ PutModule("AutoClearChanBuffer = " + CString(pChan->AutoClearChanBuffer()));
else if (sVar == "detached")
PutModule("Detached = " + CString(pChan->IsDetached()));
else if (sVar == "key")
@@ -402,10 +411,14 @@ class CAdminMod : public CModule {
bool b = sValue.ToBool();
pChan->SetInConfig(b);
PutModule("InConfig = " + CString(b));
- } else if (sVar == "keepbuffer") {
+ } else if (sVar == "keepbuffer") { // XXX compatibility crap, added in 0.207
+ bool b = !sValue.ToBool();
+ pChan->SetAutoClearChanBuffer(b);
+ PutModule("AutoClearChanBuffer = " + CString(b));
+ } else if (sVar == "autoclearchanbuffer") {
bool b = sValue.ToBool();
- pChan->SetKeepBuffer(b);
- PutModule("KeepBuffer = " + CString(b));
+ pChan->SetAutoClearChanBuffer(b);
+ PutModule("AutoClearChanBuffer = " + CString(b));
} else if (sVar == "detached") {
bool b = sValue.ToBool();
if (pChan->IsDetached() != b) {
View
@@ -18,8 +18,8 @@ class CBuffExtras : public CModule {
virtual ~CBuffExtras() {}
void AddBuffer(CChan& Channel, const CString& sMessage) {
- // If they have keep buffer disabled, only add messages if no client is connected
- if (!Channel.KeepBuffer() && m_pNetwork->IsUserOnline())
+ // If they have AutoClearChanBuffer enabled, only add messages if no client is connected
+ if (Channel.AutoClearChanBuffer() && m_pNetwork->IsUserOnline())
return;
Channel.AddBuffer(":" + GetModNick() + "!" + GetModName() + "@znc.in PRIVMSG " + _NAMEDFMT(Channel.GetName()) + " :{text}", sMessage);
@@ -25,9 +25,9 @@ class CClearBufferOnMsgMod : public CModule {
continue;
(*it)->ClearBuffer();
- // We force KeepBuffer on all channels since this module
- // doesnt make any sense without
- (*it)->SetKeepBuffer(true);
+ // We deny AutoClearChanBuffer on all channels since this module
+ // doesn't make any sense with it
+ (*it)->SetAutoClearChanBuffer(false);
}
}
}
View
@@ -46,7 +46,7 @@ class CCryptMod : public CModule {
if (it != EndNV()) {
CChan* pChan = m_pNetwork->FindChan(sTarget);
if (pChan) {
- if (pChan->KeepBuffer())
+ if (!pChan->AutoClearChanBuffer())
pChan->AddBuffer(":\244" + _NAMEDFMT(m_pNetwork->GetIRCNick().GetNickMask()) + " PRIVMSG " + _NAMEDFMT(sTarget) + " :" + _NAMEDFMT(sMessage));
m_pUser->PutUser(":\244" + m_pNetwork->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :" + sMessage, NULL, m_pClient);
}
@@ -50,7 +50,7 @@
<label for="save">Save to config</label>
</span>
<? LOOP OptionLoop ?>
- <span class="checkboxandlabel">
+ <span class="checkboxandlabel" title="<? VAR Tooltip ?>">
<input type="checkbox" name="<? VAR Name ?>" id="opt_<? VAR Name ?>" value="true"<? IF Checked ?> checked="checked"<? ENDIF ?><? IF Disabled ?> disabled="disabled"<? ENDIF ?> />
<label for="opt_<? VAR Name ?>"><? VAR DisplayName ?></label>
</span>
@@ -74,4 +74,4 @@
</div>
</form>
-<? INC Footer.tmpl ?>
+<? INC Footer.tmpl ?>
@@ -219,7 +219,7 @@
<div class="sectionbg">
<div class="sectionbody lotsofcheckboxes">
<? LOOP OptionLoop ?>
- <span class="checkboxandlabel">
+ <span class="checkboxandlabel" title="<? VAR Tooltip ?>">
<input type="checkbox" name="<? VAR Name ?>" id="opt_<? VAR Name ?>" value="1"<? IF Checked ?> checked="checked"<? ENDIF ?><? IF Disabled ?> disabled="disabled"<? ENDIF ?> />
<label for="opt_<? VAR Name ?>"><? VAR DisplayName ?></label>
</span>
View
@@ -89,7 +89,7 @@ class CSaveBuff : public CModule
const vector<CChan *>& vChans = m_pNetwork->GetChans();
for (u_int a = 0; a < vChans.size(); a++)
{
- if (!vChans[a]->KeepBuffer())
+ if (vChans[a]->AutoClearChanBuffer())
continue;
if (!BootStrap(vChans[a]))
@@ -154,7 +154,7 @@ class CSaveBuff : public CModule
CString sPath = GetPath(vChans[a]->GetName());
CFile File(sPath);
- if (!vChans[a]->KeepBuffer()) {
+ if (vChans[a]->AutoClearChanBuffer()) {
File.Delete();
continue;
}
@@ -268,8 +268,8 @@ class CSaveBuff : public CModule
void AddBuffer(CChan& chan, const CString &sLine)
{
- // If they have keep buffer disabled, only add messages if no client is connected
- if (!chan.KeepBuffer() && m_pNetwork->IsUserAttached())
+ // If they have AutoClearChanBuffer enabled, only add messages if no client is connected
+ if (chan.AutoClearChanBuffer() && m_pNetwork->IsUserAttached())
return;
chan.AddBuffer(sLine);
}
View
@@ -226,7 +226,7 @@ class CWebAdminMod : public CModule {
pNewUser->SetBufferCount(pUser->GetBufferCount(), true);
pNewUser->SetBufferCount(WebSock.GetParam("bufsize").ToUInt(), spSession->IsAdmin());
pNewUser->SetSkinName(WebSock.GetParam("skin"));
- pNewUser->SetKeepBuffer(WebSock.GetParam("keepbuffer").ToBool());
+ pNewUser->SetAutoClearChanBuffer(WebSock.GetParam("autoclearchanbuffer").ToBool());
pNewUser->SetMultiClients(WebSock.GetParam("multiclients").ToBool());
pNewUser->SetTimestampAppend(WebSock.GetParam("appendtimestamp").ToBool());
pNewUser->SetTimestampPrepend(WebSock.GetParam("prependtimestamp").ToBool());
@@ -569,9 +569,10 @@ class CWebAdminMod : public CModule {
// o1 used to be AutoCycle which was removed
CTemplate& o2 = Tmpl.AddRow("OptionLoop");
- o2["Name"] = "keepbuffer";
- o2["DisplayName"] = "Keep Buffer";
- if ((pChan && pChan->KeepBuffer()) || (!pChan && pUser->KeepBuffer())) { o2["Checked"] = "true"; }
+ o2["Name"] = "autoclearchanbuffer";
+ o2["DisplayName"] = "Auto Clear Chan Buffer";
+ o2["Tooltip"] = "Automatically Clear Channel Buffer After Playback";
+ if ((pChan && pChan->AutoClearChanBuffer()) || (!pChan && pUser->AutoClearChanBuffer())) { o2["Checked"] = "true"; }
CTemplate& o3 = Tmpl.AddRow("OptionLoop");
o3["Name"] = "detached";
@@ -616,7 +617,7 @@ class CWebAdminMod : public CModule {
pChan->SetBufferCount(WebSock.GetParam("buffercount").ToUInt(), spSession->IsAdmin());
pChan->SetDefaultModes(WebSock.GetParam("defmodes"));
pChan->SetInConfig(WebSock.GetParam("save").ToBool());
- pChan->SetKeepBuffer(WebSock.GetParam("keepbuffer").ToBool());
+ pChan->SetAutoClearChanBuffer(WebSock.GetParam("autoclearchanbuffer").ToBool());
pChan->SetKey(WebSock.GetParam("key"));
bool bDetached = WebSock.GetParam("detached").ToBool();
@@ -1054,9 +1055,10 @@ class CWebAdminMod : public CModule {
}
CTemplate& o1 = Tmpl.AddRow("OptionLoop");
- o1["Name"] = "keepbuffer";
- o1["DisplayName"] = "Keep Buffer";
- if (!pUser || pUser->KeepBuffer()) { o1["Checked"] = "true"; }
+ o1["Name"] = "autoclearchanbuffer";
+ o1["DisplayName"] = "Auto Clear Chan Buffer";
+ o1["Tooltip"] = "Automatically Clear Channel Buffer After Playback (the default value for new channels)";
+ if (!pUser || pUser->AutoClearChanBuffer()) { o1["Checked"] = "true"; }
/* o2 used to be auto cycle which was removed */
View
@@ -28,15 +28,17 @@ CChan::CChan(const CString& sName, CIRCNetwork* pNetwork, bool bInConfig, CConfi
m_bDetached = false;
m_bDisabled = false;
SetBufferCount(m_pNetwork->GetUser()->GetBufferCount(), true);
- SetKeepBuffer(m_pNetwork->GetUser()->KeepBuffer());
+ SetAutoClearChanBuffer(m_pNetwork->GetUser()->AutoClearChanBuffer());
Reset();
if (pConfig) {
CString sValue;
if (pConfig->FindStringEntry("buffer", sValue))
SetBufferCount(sValue.ToUInt(), true);
+ if (pConfig->FindStringEntry("autoclearchanbuffer", sValue))
+ SetAutoClearChanBuffer(sValue.ToBool());
if (pConfig->FindStringEntry("keepbuffer", sValue))
- SetKeepBuffer(sValue.ToBool());
+ SetAutoClearChanBuffer(!sValue.ToBool()); // XXX Compatibility crap, added in 0.207
if (pConfig->FindStringEntry("detached", sValue))
SetDetached(sValue.ToBool());
if (pConfig->FindStringEntry("autocycle", sValue))
@@ -72,8 +74,8 @@ CConfig CChan::ToConfig() {
if (pUser->GetBufferCount() != GetBufferCount())
config.AddKeyValuePair("Buffer", CString(GetBufferCount()));
- if (pUser->KeepBuffer() != KeepBuffer())
- config.AddKeyValuePair("KeepBuffer", CString(KeepBuffer()));
+ if (pUser->AutoClearChanBuffer() != AutoClearChanBuffer())
+ config.AddKeyValuePair("AutoClearChanBuffer", CString(AutoClearChanBuffer()));
if (IsDetached())
config.AddKeyValuePair("Detached", "true");
if (!GetKey().empty())
@@ -87,7 +89,7 @@ CConfig CChan::ToConfig() {
void CChan::Clone(CChan& chan) {
// We assume that m_sName and m_pNetwork are equal
SetBufferCount(chan.GetBufferCount(), true);
- SetKeepBuffer(chan.KeepBuffer());
+ SetAutoClearChanBuffer(chan.AutoClearChanBuffer());
SetKey(chan.GetKey());
SetDefaultModes(chan.GetDefaultModes());
@@ -219,10 +221,10 @@ void CChan::SetModes(const CString& sModes) {
ModeChange(sModes);
}
-void CChan::SetKeepBuffer(bool b) {
- m_bKeepBuffer = b;
+void CChan::SetAutoClearChanBuffer(bool b) {
+ m_bAutoClearChanBuffer = b;
- if (!m_bKeepBuffer && !IsDetached() && m_pNetwork->IsUserOnline()) {
+ if (m_bAutoClearChanBuffer && !IsDetached() && m_pNetwork->IsUserOnline()) {
ClearBuffer();
}
}
@@ -349,8 +351,8 @@ CString CChan::GetOptions() const {
sRet += (sRet.empty()) ? "Detached" : ", Detached";
}
- if (KeepBuffer()) {
- sRet += (sRet.empty()) ? "KeepBuffer" : ", KeepBuffer";
+ if (AutoClearChanBuffer()) {
+ sRet += (sRet.empty()) ? "AutoClearChanBuffer" : ", AutoClearChanBuffer";
}
return sRet;
@@ -561,7 +563,7 @@ void CChan::SendBuffer(CClient* pClient) {
break;
}
- if (!KeepBuffer()) {
+ if (AutoClearChanBuffer()) {
ClearBuffer();
}
}
Oops, something went wrong.

0 comments on commit 27f42d1

Please sign in to comment.