mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Added KeepBuffer/Buffer config options to the User class
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@168 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
13
Chan.cpp
13
Chan.cpp
@@ -3,6 +3,19 @@
|
||||
#include "User.h"
|
||||
#include "Utils.h"
|
||||
|
||||
CChan::CChan(const string& sName, CUser* pUser) {
|
||||
m_sName = sName;
|
||||
m_pUser = pUser;
|
||||
m_bAutoCycle = true;
|
||||
m_bDetached = false;
|
||||
m_uBufferCount = m_pUser->GetBufferCount();
|
||||
m_bKeepBuffer = m_pUser->KeepBuffer();
|
||||
Reset();
|
||||
}
|
||||
CChan::~CChan() {
|
||||
ClearNicks();
|
||||
}
|
||||
|
||||
void CChan::Reset() {
|
||||
m_bWhoDone = false;
|
||||
m_bIsOn = false;
|
||||
|
||||
14
Chan.h
14
Chan.h
@@ -23,18 +23,8 @@ public:
|
||||
Key = 1 << 6
|
||||
} EMode;
|
||||
|
||||
CChan(const string& sName, CUser* pUser, unsigned int uBufferCount = 0) {
|
||||
m_sName = sName;
|
||||
m_pUser = pUser;
|
||||
m_bKeepBuffer = false;
|
||||
m_bAutoCycle = true;
|
||||
m_bDetached = false;
|
||||
m_uBufferCount = uBufferCount;
|
||||
Reset();
|
||||
}
|
||||
virtual ~CChan() {
|
||||
ClearNicks();
|
||||
}
|
||||
CChan(const string& sName, CUser* pUser);
|
||||
virtual ~CChan();
|
||||
|
||||
void Reset();
|
||||
void Joined();
|
||||
|
||||
10
User.cpp
10
User.cpp
@@ -21,6 +21,8 @@ CUser::CUser(const string& sUserName, CZNC* pZNC) {
|
||||
m_bKeepNick = false;
|
||||
m_bDenyLoadMod = false;
|
||||
m_sStatusPrefix = "*";
|
||||
m_uBufferCount = 50;
|
||||
m_bKeepBuffer = false;
|
||||
m_pZNC->GetManager().AddCron(new CKeepNickTimer(this));
|
||||
m_pZNC->GetManager().AddCron(new CJoinTimer(this));
|
||||
}
|
||||
@@ -80,7 +82,7 @@ bool CUser::AddChan(CChan* pChan) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CUser::AddChan(const string& sName, unsigned int uBufferCount) {
|
||||
bool CUser::AddChan(const string& sName) {
|
||||
if (sName.empty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -91,7 +93,7 @@ bool CUser::AddChan(const string& sName, unsigned int uBufferCount) {
|
||||
}
|
||||
}
|
||||
|
||||
CChan* pChan = new CChan(sName, this, uBufferCount);
|
||||
CChan* pChan = new CChan(sName, this);
|
||||
m_vChans.push_back(pChan);
|
||||
return true;
|
||||
}
|
||||
@@ -379,6 +381,8 @@ void CUser::SetIRCNick(const CNick& n) { m_IRCNick = n; }
|
||||
void CUser::SetIRCServer(const string& s) { m_sIRCServer = s; }
|
||||
void CUser::SetQuitMsg(const string& s) { m_sQuitMsg = s; }
|
||||
void CUser::SetVersionReply(const string& s) { m_sVersionReply = s; }
|
||||
void CUser::SetBufferCount(unsigned int u) { m_uBufferCount = u; }
|
||||
void CUser::SetKeepBuffer(bool b) { m_bKeepBuffer = b; }
|
||||
|
||||
bool CUser::SetStatusPrefix(const string& s) {
|
||||
if ((!s.empty()) && (s.length() < 6) && (s.find(' ') == string::npos)) {
|
||||
@@ -416,4 +420,6 @@ const CNick& CUser::GetIRCNick() const { return m_IRCNick; }
|
||||
const string& CUser::GetIRCServer() const { return m_sIRCServer; }
|
||||
const string& CUser::GetQuitMsg() const { return m_sQuitMsg; }
|
||||
const string& CUser::GetVersionReply() const { return m_sVersionReply; }
|
||||
unsigned int CUser::GetBufferCount() const { return m_uBufferCount; }
|
||||
bool CUser::KeepBuffer() const { return m_bKeepBuffer; }
|
||||
// !Getters
|
||||
|
||||
9
User.h
9
User.h
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
CChan* FindChan(const string& sName);
|
||||
bool AddChan(CChan* pChan);
|
||||
bool AddChan(const string& sName, unsigned int uBufferCount = 50);
|
||||
bool AddChan(const string& sName);
|
||||
bool DelChan(const string& sName);
|
||||
bool AddServer(const string& sName);
|
||||
bool AddServer(const string& sName, unsigned short uPort, const string& sPass = "", bool bSSL = false);
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
void SetIRCServer(const string& s);
|
||||
void SetQuitMsg(const string& s);
|
||||
void SetVersionReply(const string& s);
|
||||
void SetBufferCount(unsigned int u);
|
||||
void SetKeepBuffer(bool b);
|
||||
// !Setters
|
||||
|
||||
// Getters
|
||||
@@ -103,6 +105,8 @@ public:
|
||||
const string& GetIRCServer() const;
|
||||
const string& GetQuitMsg() const;
|
||||
const string& GetVersionReply() const;
|
||||
unsigned int GetBufferCount() const;
|
||||
bool KeepBuffer() const;
|
||||
// !Getters
|
||||
private:
|
||||
protected:
|
||||
@@ -126,10 +130,13 @@ protected:
|
||||
bool m_bUseClientIP;
|
||||
bool m_bKeepNick;
|
||||
bool m_bDenyLoadMod;
|
||||
bool m_bKeepBuffer;
|
||||
|
||||
vector<CServer*> m_vServers;
|
||||
vector<CChan*> m_vChans;
|
||||
set<string> m_ssAllowedHosts;
|
||||
unsigned int m_uServerIdx;
|
||||
unsigned int m_uBufferCount;
|
||||
|
||||
#ifdef _MODULES
|
||||
CModules m_Modules;
|
||||
|
||||
24
znc.conf
24
znc.conf
@@ -23,6 +23,15 @@ StatusPrefix = *
|
||||
// You can override the global StatusPrefix on a per user basis. Using - is a good alternative in mIRC but it breaks BitchX
|
||||
#StatusPrefix = -
|
||||
|
||||
// This is the playback buffer size (in LINES) - WARNING: setting this too high could cause you to get a lot of text when you attach
|
||||
Buffer = 50
|
||||
|
||||
// This will play the whole channel buffer back to you each time you connect. It will also buffer channels while you are attached
|
||||
KeepBuffer = false
|
||||
|
||||
// You may choose not to take advantage of znc's auto cycle which will cycle the channel if you are the last person and not opped
|
||||
#AutoCycle = false
|
||||
|
||||
// Password used to connect.
|
||||
Pass = pass
|
||||
|
||||
@@ -41,9 +50,6 @@ StatusPrefix = *
|
||||
ChanModes = +stn
|
||||
KeepNick = true
|
||||
|
||||
// You may choose not to take advantage of znc's auto cycle which will cycle the channel if you are the last person and not opped
|
||||
#AutoCycle = false
|
||||
|
||||
// You may use multiple Allow lines to restrict access to this user. All connections are denied by default unless they match an ip below.
|
||||
// Note: IPs only!
|
||||
Allow = *
|
||||
@@ -79,17 +85,13 @@ StatusPrefix = *
|
||||
Key = znc
|
||||
Modes = +sn-t
|
||||
|
||||
// You can override the user's auto cycle on a per channel basis
|
||||
#AutoCycle = true
|
||||
|
||||
// You can add channels that znc will join but not forward to your client
|
||||
#Detached = true
|
||||
|
||||
// This is the playback buffer size (in LINES) - WARNING: setting this too high could cause you to get a lot of text when you attach
|
||||
Buffer = 50
|
||||
|
||||
// This will play the whole buffer back to you each time you connect. It will also buffer channels while you are attached
|
||||
#KeepBuffer = true
|
||||
// You can override some of the user options on a per channel basis
|
||||
AutoCycle = true
|
||||
Buffer = 500
|
||||
KeepBuffer = true
|
||||
</Chan>
|
||||
</User>
|
||||
|
||||
|
||||
8
znc.cpp
8
znc.cpp
@@ -367,7 +367,13 @@ bool CZNC::ParseConfig(const string& sConfigFile) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (strcasecmp(sName.c_str(), "Nick") == 0) {
|
||||
if (strcasecmp(sName.c_str(), "Buffer") == 0) {
|
||||
pUser->SetBufferCount(strtoul(sValue.c_str(), NULL, 10));
|
||||
continue;
|
||||
} else if (strcasecmp(sName.c_str(), "KeepBuffer") == 0) {
|
||||
pUser->SetKeepBuffer((strcasecmp(sValue.c_str(), "true") == 0));
|
||||
continue;
|
||||
} else if (strcasecmp(sName.c_str(), "Nick") == 0) {
|
||||
pUser->SetNick(sValue);
|
||||
continue;
|
||||
} else if (strcasecmp(sName.c_str(), "VersionReply") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user