mirror of
https://github.com/znc/znc.git
synced 2026-07-06 01:41:12 +02:00
Implement protection from flood.
For ZNC-server connection
This commit is contained in:
@@ -114,6 +114,16 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindDoubleEntry(const CString& sName, double& fRes, double fDefault = 0) {
|
||||
CString s;
|
||||
if (FindStringEntry(sName, s)) {
|
||||
fRes = s.ToDouble();
|
||||
return true;
|
||||
}
|
||||
fRes = fDefault;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindSubConfig(const CString& sName, SubConfig& Config, bool bErase = true) {
|
||||
SubConfigMap::iterator it = m_SubConfigs.find(sName);
|
||||
if (it == m_SubConfigs.end()) {
|
||||
|
||||
@@ -137,6 +137,11 @@ public:
|
||||
void SetIdent(const CString& s);
|
||||
void SetRealName(const CString& s);
|
||||
|
||||
double GetFloodRate() const { return m_fFloodRate; }
|
||||
unsigned short int GetFloodBurst() const { return m_uFloodBurst; }
|
||||
void SetFloodRate(double fFloodRate) { m_fFloodRate = fFloodRate; }
|
||||
void SetFloodBurst(unsigned short int uFloodBurst) { m_uFloodBurst = uFloodBurst; }
|
||||
|
||||
CString ExpandString(const CString& sStr) const;
|
||||
CString& ExpandString(const CString& sStr, CString& sRet) const;
|
||||
private:
|
||||
@@ -170,6 +175,9 @@ protected:
|
||||
CNick m_IRCNick;
|
||||
bool m_bIRCAway;
|
||||
|
||||
double m_fFloodRate; ///< Set to -1 to disable protection.
|
||||
unsigned short int m_uFloodBurst;
|
||||
|
||||
CBuffer m_RawBuffer;
|
||||
CBuffer m_MotdBuffer;
|
||||
CBuffer m_QueryBuffer;
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include <znc/Socket.h>
|
||||
#include <znc/Nick.h>
|
||||
|
||||
#include <deque>
|
||||
using std::deque;
|
||||
|
||||
// Forward Declarations
|
||||
class CChan;
|
||||
class CUser;
|
||||
@@ -54,6 +57,7 @@ public:
|
||||
virtual void ReachedMaxBuffer();
|
||||
|
||||
void PutIRC(const CString& sLine);
|
||||
void PutIRCQuick(const CString& sLine); //!< Should be used for PONG only
|
||||
void ResetChans();
|
||||
void Quit(const CString& sQuitMsg = "");
|
||||
|
||||
@@ -102,6 +106,7 @@ private:
|
||||
// This is called when we connect and the nick we want is already taken
|
||||
void SendAltNick(const CString& sBadNick);
|
||||
void SendNextCap();
|
||||
void TrySend();
|
||||
protected:
|
||||
bool m_bAuthed;
|
||||
bool m_bNamesx;
|
||||
@@ -123,6 +128,13 @@ protected:
|
||||
static const time_t m_uCTCPFloodTime;
|
||||
static const unsigned int m_uCTCPFloodCount;
|
||||
MCString m_mISupport;
|
||||
deque<CString> m_vsSendQueue;
|
||||
short int m_iSendsAllowed;
|
||||
unsigned short int m_uFloodBurst;
|
||||
double m_fFloodRate;
|
||||
bool m_bFloodProtection;
|
||||
|
||||
friend class CIRCFloodTimer;
|
||||
};
|
||||
|
||||
#endif // !_IRCSOCK_H
|
||||
|
||||
Reference in New Issue
Block a user