Implemented StripControls for channel messages and notices

This commit is contained in:
ManiacTwister
2015-02-06 20:14:36 +01:00
committed by J-P Nurmi
parent be5f26ba18
commit f27109f1b4
8 changed files with 109 additions and 1 deletions
+13
View File
@@ -127,6 +127,8 @@ CIRCNetwork::CIRCNetwork(CUser *pUser, const CString& sName) {
m_uJoinDelay = 0;
SetStripControls(false);
m_RawBuffer.SetLineCount(100, true); // This should be more than enough raws, especially since we are buffering the MOTD separately
m_MotdBuffer.SetLineCount(200, true); // This should be more than enough motd lines
m_NoticeBuffer.SetLineCount(250, true);
@@ -176,6 +178,7 @@ void CIRCNetwork::Clone(const CIRCNetwork& Network, bool bCloneName) {
SetBindHost(Network.GetBindHost());
SetEncoding(Network.GetEncoding());
SetQuitMsg(Network.GetQuitMsg());
SetStripControls(Network.StripControls());
m_ssTrustedFingerprints = Network.m_ssTrustedFingerprints;
// Servers
@@ -352,6 +355,7 @@ bool CIRCNetwork::ParseConfig(CConfig *pConfig, CString& sError, bool bUpgrade)
size_t numStringOptions = sizeof(StringOptions) / sizeof(StringOptions[0]);
TOption<bool> BoolOptions[] = {
{ "ircconnectenabled", &CIRCNetwork::SetIRCConnectEnabled },
{ "stripcontrols", &CIRCNetwork::SetStripControls },
};
size_t numBoolOptions = sizeof(BoolOptions) / sizeof(BoolOptions[0]);
TOption<double> DoubleOptions[] = {
@@ -510,6 +514,7 @@ CConfig CIRCNetwork::ToConfig() const {
config.AddKeyValuePair("FloodBurst", CString(GetFloodBurst()));
config.AddKeyValuePair("JoinDelay", CString(GetJoinDelay()));
config.AddKeyValuePair("Encoding", m_sEncoding);
config.AddKeyValuePair("StripControls", CString(StripControls()));
if (!m_sQuitMsg.empty()) {
config.AddKeyValuePair("QuitMsg", m_sQuitMsg);
@@ -1280,6 +1285,14 @@ void CIRCNetwork::CheckIRCConnect() {
CZNC::Get().AddNetworkToQueue(this);
}
void CIRCNetwork::SetStripControls(bool b) {
for (CChan* pChan : GetChans()) {
pChan->InheritStripControls(b);
}
m_bStripControls = b;
}
bool CIRCNetwork::PutIRC(const CString& sLine) {
CIRCSock* pIRCSock = GetIRCSock();