mirror of
https://github.com/znc/znc.git
synced 2026-05-03 03:52:33 +02:00
Add clang-format configuration.
For now, it uses tabs like before, to make the diff easier to read/check. One of following commits will switch it to spaces.
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
// This class is used from python to call functions which accept CString&
|
||||
// __str__ is added to it in modpython.i
|
||||
class String {
|
||||
public:
|
||||
public:
|
||||
CString s;
|
||||
|
||||
String(const CString& s = "") : s(s) {}
|
||||
@@ -34,15 +34,17 @@ class CPyModule : public CModule {
|
||||
PyObject* m_pyObj;
|
||||
CModPython* m_pModPython;
|
||||
VWebSubPages* _GetSubPages();
|
||||
public:
|
||||
CPyModule(CUser* pUser, CIRCNetwork* pNetwork, const CString& sModName, const CString& sDataPath,
|
||||
CModInfo::EModuleType eType, PyObject* pyObj, CModPython* pModPython)
|
||||
: CModule(nullptr, pUser, pNetwork, sModName, sDataPath, eType) {
|
||||
|
||||
public:
|
||||
CPyModule(CUser* pUser, CIRCNetwork* pNetwork, const CString& sModName,
|
||||
const CString& sDataPath, CModInfo::EModuleType eType,
|
||||
PyObject* pyObj, CModPython* pModPython)
|
||||
: CModule(nullptr, pUser, pNetwork, sModName, sDataPath, eType) {
|
||||
m_pyObj = pyObj;
|
||||
Py_INCREF(pyObj);
|
||||
m_pModPython = pModPython;
|
||||
}
|
||||
PyObject* GetPyObj() { // borrows
|
||||
PyObject* GetPyObj() { // borrows
|
||||
return m_pyObj;
|
||||
}
|
||||
PyObject* GetNewPyObj() {
|
||||
@@ -54,46 +56,59 @@ public:
|
||||
delete this;
|
||||
}
|
||||
CString GetPyExceptionStr();
|
||||
CModPython* GetModPython() {
|
||||
return m_pModPython;
|
||||
}
|
||||
CModPython* GetModPython() { return m_pModPython; }
|
||||
|
||||
bool OnBoot() override;
|
||||
bool WebRequiresLogin() override;
|
||||
bool WebRequiresAdmin() override;
|
||||
CString GetWebMenuTitle() override;
|
||||
bool OnWebPreRequest(CWebSock& WebSock, const CString& sPageName) override;
|
||||
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) override;
|
||||
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName,
|
||||
CTemplate& Tmpl) override;
|
||||
VWebSubPages& GetSubPages() override;
|
||||
void OnPreRehash() override;
|
||||
void OnPostRehash() override;
|
||||
void OnIRCDisconnected() override;
|
||||
void OnIRCConnected() override;
|
||||
EModRet OnIRCConnecting(CIRCSock *pIRCSock) override;
|
||||
void OnIRCConnectionError(CIRCSock *pIRCSock) override;
|
||||
EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName) override;
|
||||
EModRet OnIRCConnecting(CIRCSock* pIRCSock) override;
|
||||
void OnIRCConnectionError(CIRCSock* pIRCSock) override;
|
||||
EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent,
|
||||
CString& sRealName) override;
|
||||
EModRet OnBroadcast(CString& sMessage) override;
|
||||
void OnChanPermission2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, unsigned char uMode, bool bAdded, bool bNoChange) override;
|
||||
void OnOp2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, bool bNoChange) override;
|
||||
void OnDeop2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, bool bNoChange) override;
|
||||
void OnVoice2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, bool bNoChange) override;
|
||||
void OnDevoice2(const CNick* pOpNick, const CNick& Nick, CChan& Channel, bool bNoChange) override;
|
||||
void OnMode2(const CNick* pOpNick, CChan& Channel, char uMode, const CString& sArg, bool bAdded, bool bNoChange) override;
|
||||
void OnRawMode2(const CNick* pOpNick, CChan& Channel, const CString& sModes, const CString& sArgs) override;
|
||||
void OnChanPermission2(const CNick* pOpNick, const CNick& Nick,
|
||||
CChan& Channel, unsigned char uMode, bool bAdded,
|
||||
bool bNoChange) override;
|
||||
void OnOp2(const CNick* pOpNick, const CNick& Nick, CChan& Channel,
|
||||
bool bNoChange) override;
|
||||
void OnDeop2(const CNick* pOpNick, const CNick& Nick, CChan& Channel,
|
||||
bool bNoChange) override;
|
||||
void OnVoice2(const CNick* pOpNick, const CNick& Nick, CChan& Channel,
|
||||
bool bNoChange) override;
|
||||
void OnDevoice2(const CNick* pOpNick, const CNick& Nick, CChan& Channel,
|
||||
bool bNoChange) override;
|
||||
void OnMode2(const CNick* pOpNick, CChan& Channel, char uMode,
|
||||
const CString& sArg, bool bAdded, bool bNoChange) override;
|
||||
void OnRawMode2(const CNick* pOpNick, CChan& Channel, const CString& sModes,
|
||||
const CString& sArgs) override;
|
||||
EModRet OnRaw(CString& sLine) override;
|
||||
EModRet OnStatusCommand(CString& sCommand) override;
|
||||
void OnModCommand(const CString& sCommand) override;
|
||||
void OnModNotice(const CString& sMessage) override;
|
||||
void OnModCTCP(const CString& sMessage) override;
|
||||
void OnQuit(const CNick& Nick, const CString& sMessage, const std::vector<CChan*>& vChans) override;
|
||||
void OnNick(const CNick& Nick, const CString& sNewNick, const std::vector<CChan*>& vChans) override;
|
||||
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) override;
|
||||
void OnQuit(const CNick& Nick, const CString& sMessage,
|
||||
const std::vector<CChan*>& vChans) override;
|
||||
void OnNick(const CNick& Nick, const CString& sNewNick,
|
||||
const std::vector<CChan*>& vChans) override;
|
||||
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel,
|
||||
const CString& sMessage) override;
|
||||
EModRet OnJoining(CChan& Channel) override;
|
||||
void OnJoin(const CNick& Nick, CChan& Channel) override;
|
||||
void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) override;
|
||||
void OnPart(const CNick& Nick, CChan& Channel,
|
||||
const CString& sMessage) override;
|
||||
EModRet OnChanBufferStarting(CChan& Chan, CClient& Client) override;
|
||||
EModRet OnChanBufferEnding(CChan& Chan, CClient& Client) override;
|
||||
EModRet OnChanBufferPlayLine(CChan& Chan, CClient& Client, CString& sLine) override;
|
||||
EModRet OnChanBufferPlayLine(CChan& Chan, CClient& Client,
|
||||
CString& sLine) override;
|
||||
EModRet OnPrivBufferPlayLine(CClient& Client, CString& sLine) override;
|
||||
void OnClientLogin() override;
|
||||
void OnClientDisconnect() override;
|
||||
@@ -112,11 +127,13 @@ public:
|
||||
EModRet OnPrivCTCP(CNick& Nick, CString& sMessage) override;
|
||||
EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage) override;
|
||||
EModRet OnPrivAction(CNick& Nick, CString& sMessage) override;
|
||||
EModRet OnChanAction(CNick& Nick, CChan& Channel, CString& sMessage) override;
|
||||
EModRet OnChanAction(CNick& Nick, CChan& Channel,
|
||||
CString& sMessage) override;
|
||||
EModRet OnPrivMsg(CNick& Nick, CString& sMessage) override;
|
||||
EModRet OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage) override;
|
||||
EModRet OnPrivNotice(CNick& Nick, CString& sMessage) override;
|
||||
EModRet OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage) override;
|
||||
EModRet OnChanNotice(CNick& Nick, CChan& Channel,
|
||||
CString& sMessage) override;
|
||||
EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) override;
|
||||
bool OnServerCapAvailable(const CString& sCap) override;
|
||||
void OnServerCapResult(const CString& sCap, bool bSuccess) override;
|
||||
@@ -129,8 +146,10 @@ public:
|
||||
|
||||
EModRet OnRawMessage(CMessage& Message) override;
|
||||
EModRet OnNumericMessage(CNumericMessage& Message) override;
|
||||
void OnQuitMessage(CQuitMessage& Message, const std::vector<CChan*>& vChans) override;
|
||||
void OnNickMessage(CNickMessage& Message, const std::vector<CChan*>& vChans) override;
|
||||
void OnQuitMessage(CQuitMessage& Message,
|
||||
const std::vector<CChan*>& vChans) override;
|
||||
void OnNickMessage(CNickMessage& Message,
|
||||
const std::vector<CChan*>& vChans) override;
|
||||
void OnKickMessage(CKickMessage& Message) override;
|
||||
void OnJoinMessage(CJoinMessage& Message) override;
|
||||
void OnPartMessage(CPartMessage& Message) override;
|
||||
@@ -160,18 +179,26 @@ public:
|
||||
// Global Modules
|
||||
EModRet OnAddUser(CUser& User, CString& sErrorRet) override;
|
||||
EModRet OnDeleteUser(CUser& User) override;
|
||||
void OnClientConnect(CZNCSock* pSock, const CString& sHost, unsigned short uPort) override;
|
||||
void OnFailedLogin(const CString& sUsername, const CString& sRemoteIP) override;
|
||||
void OnClientConnect(CZNCSock* pSock, const CString& sHost,
|
||||
unsigned short uPort) override;
|
||||
void OnFailedLogin(const CString& sUsername,
|
||||
const CString& sRemoteIP) override;
|
||||
EModRet OnUnknownUserRaw(CClient* pClient, CString& sLine) override;
|
||||
EModRet OnUnknownUserRawMessage(CMessage& Message) override;
|
||||
bool IsClientCapSupported(CClient* pClient, const CString& sCap, bool bState) override;
|
||||
void OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState) override;
|
||||
virtual EModRet OnModuleLoading(const CString& sModName, const CString& sArgs,
|
||||
CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg) override;
|
||||
EModRet OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg) override;
|
||||
bool IsClientCapSupported(CClient* pClient, const CString& sCap,
|
||||
bool bState) override;
|
||||
void OnClientCapRequest(CClient* pClient, const CString& sCap,
|
||||
bool bState) override;
|
||||
virtual EModRet OnModuleLoading(const CString& sModName,
|
||||
const CString& sArgs,
|
||||
CModInfo::EModuleType eType, bool& bSuccess,
|
||||
CString& sRetMsg) override;
|
||||
EModRet OnModuleUnloading(CModule* pModule, bool& bSuccess,
|
||||
CString& sRetMsg) override;
|
||||
virtual EModRet OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
|
||||
bool& bSuccess, CString& sRetMsg) override;
|
||||
void OnGetAvailableMods(std::set<CModInfo>& ssMods, CModInfo::EModuleType eType) override;
|
||||
bool& bSuccess, CString& sRetMsg) override;
|
||||
void OnGetAvailableMods(std::set<CModInfo>& ssMods,
|
||||
CModInfo::EModuleType eType) override;
|
||||
void OnClientCapLs(CClient* pClient, SCString& ssCaps) override;
|
||||
EModRet OnLoginAttempt(std::shared_ptr<CAuthBase> Auth) override;
|
||||
};
|
||||
@@ -180,16 +207,25 @@ static inline CPyModule* AsPyModule(CModule* p) {
|
||||
return dynamic_cast<CPyModule*>(p);
|
||||
}
|
||||
|
||||
inline CPyModule* CreatePyModule(CUser* pUser, CIRCNetwork* pNetwork, const CString& sModName, const CString& sDataPath, CModInfo::EModuleType eType, PyObject* pyObj, CModPython* pModPython) {
|
||||
return new CPyModule(pUser, pNetwork, sModName, sDataPath, eType, pyObj, pModPython);
|
||||
inline CPyModule* CreatePyModule(CUser* pUser, CIRCNetwork* pNetwork,
|
||||
const CString& sModName,
|
||||
const CString& sDataPath,
|
||||
CModInfo::EModuleType eType, PyObject* pyObj,
|
||||
CModPython* pModPython) {
|
||||
return new CPyModule(pUser, pNetwork, sModName, sDataPath, eType, pyObj,
|
||||
pModPython);
|
||||
}
|
||||
|
||||
class CPyTimer : public CTimer {
|
||||
PyObject* m_pyObj;
|
||||
CModPython* m_pModPython;
|
||||
public:
|
||||
CPyTimer(CPyModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription, PyObject* pyObj)
|
||||
: CTimer (pModule, uInterval, uCycles, sLabel, sDescription), m_pyObj(pyObj) {
|
||||
|
||||
public:
|
||||
CPyTimer(CPyModule* pModule, unsigned int uInterval, unsigned int uCycles,
|
||||
const CString& sLabel, const CString& sDescription,
|
||||
PyObject* pyObj)
|
||||
: CTimer(pModule, uInterval, uCycles, sLabel, sDescription),
|
||||
m_pyObj(pyObj) {
|
||||
Py_INCREF(pyObj);
|
||||
pModule->AddTimer(this);
|
||||
m_pModPython = pModule->GetModPython();
|
||||
@@ -203,16 +239,20 @@ public:
|
||||
~CPyTimer();
|
||||
};
|
||||
|
||||
inline CPyTimer* CreatePyTimer(CPyModule* pModule, unsigned int uInterval, unsigned int uCycles,
|
||||
const CString& sLabel, const CString& sDescription, PyObject* pyObj) {
|
||||
return new CPyTimer(pModule, uInterval, uCycles, sLabel, sDescription, pyObj);
|
||||
inline CPyTimer* CreatePyTimer(CPyModule* pModule, unsigned int uInterval,
|
||||
unsigned int uCycles, const CString& sLabel,
|
||||
const CString& sDescription, PyObject* pyObj) {
|
||||
return new CPyTimer(pModule, uInterval, uCycles, sLabel, sDescription,
|
||||
pyObj);
|
||||
}
|
||||
|
||||
class CPySocket : public CSocket {
|
||||
PyObject* m_pyObj;
|
||||
CModPython* m_pModPython;
|
||||
public:
|
||||
CPySocket(CPyModule* pModule, PyObject* pyObj) : CSocket(pModule), m_pyObj(pyObj) {
|
||||
|
||||
public:
|
||||
CPySocket(CPyModule* pModule, PyObject* pyObj)
|
||||
: CSocket(pModule), m_pyObj(pyObj) {
|
||||
Py_INCREF(pyObj);
|
||||
m_pModPython = pModule->GetModPython();
|
||||
}
|
||||
@@ -226,7 +266,7 @@ public:
|
||||
void Disconnected() override;
|
||||
void Timeout() override;
|
||||
void ConnectionRefused() override;
|
||||
void ReadData(const char *data, size_t len) override;
|
||||
void ReadData(const char* data, size_t len) override;
|
||||
void ReadLine(const CString& sLine) override;
|
||||
Csock* GetSockObj(const CString& sHost, unsigned short uPort) override;
|
||||
};
|
||||
@@ -256,62 +296,40 @@ inline bool HaveCharset_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
inline int GetSOMAXCONN() {
|
||||
return SOMAXCONN;
|
||||
}
|
||||
inline int GetSOMAXCONN() { return SOMAXCONN; }
|
||||
|
||||
inline int GetVersionMajor() {
|
||||
return VERSION_MAJOR;
|
||||
}
|
||||
inline int GetVersionMajor() { return VERSION_MAJOR; }
|
||||
|
||||
inline int GetVersionMinor() {
|
||||
return VERSION_MINOR;
|
||||
}
|
||||
inline int GetVersionMinor() { return VERSION_MINOR; }
|
||||
|
||||
inline double GetVersion() {
|
||||
return VERSION;
|
||||
}
|
||||
inline double GetVersion() { return VERSION; }
|
||||
|
||||
inline CString GetVersionExtra() {
|
||||
return ZNC_VERSION_EXTRA;
|
||||
}
|
||||
inline CString GetVersionExtra() { return ZNC_VERSION_EXTRA; }
|
||||
|
||||
class MCString_iter {
|
||||
public:
|
||||
public:
|
||||
MCString_iter() {}
|
||||
MCString::iterator x;
|
||||
MCString_iter(MCString::iterator z) : x(z) {}
|
||||
void plusplus() {
|
||||
++x;
|
||||
}
|
||||
CString get() {
|
||||
return x->first;
|
||||
}
|
||||
bool is_end(CModule* m) {
|
||||
return m->EndNV() == x;
|
||||
}
|
||||
void plusplus() { ++x; }
|
||||
CString get() { return x->first; }
|
||||
bool is_end(CModule* m) { return m->EndNV() == x; }
|
||||
};
|
||||
|
||||
class CModulesIter {
|
||||
public:
|
||||
CModulesIter(CModules *pModules) {
|
||||
public:
|
||||
CModulesIter(CModules* pModules) {
|
||||
m_pModules = pModules;
|
||||
m_it = pModules->begin();
|
||||
}
|
||||
|
||||
void plusplus() {
|
||||
++m_it;
|
||||
}
|
||||
void plusplus() { ++m_it; }
|
||||
|
||||
const CModule* get() const {
|
||||
return *m_it;
|
||||
}
|
||||
const CModule* get() const { return *m_it; }
|
||||
|
||||
bool is_end() const {
|
||||
return m_pModules->end() == m_it;
|
||||
}
|
||||
bool is_end() const { return m_pModules->end() == m_it; }
|
||||
|
||||
CModules *m_pModules;
|
||||
CModules* m_pModules;
|
||||
CModules::const_iterator m_it;
|
||||
};
|
||||
|
||||
|
||||
@@ -17,21 +17,23 @@
|
||||
#pragma once
|
||||
|
||||
class CPyRetString {
|
||||
public:
|
||||
public:
|
||||
CString& s;
|
||||
CPyRetString(CString& S) : s(S) {}
|
||||
static PyObject* wrap(CString& S) {
|
||||
CPyRetString* x = new CPyRetString(S);
|
||||
return SWIG_NewInstanceObj(x, SWIG_TypeQuery("CPyRetString*"), SWIG_POINTER_OWN);
|
||||
return SWIG_NewInstanceObj(x, SWIG_TypeQuery("CPyRetString*"),
|
||||
SWIG_POINTER_OWN);
|
||||
}
|
||||
};
|
||||
|
||||
class CPyRetBool {
|
||||
public:
|
||||
public:
|
||||
bool& b;
|
||||
CPyRetBool(bool& B) : b(B) {}
|
||||
static PyObject* wrap(bool& B) {
|
||||
CPyRetBool* x = new CPyRetBool(B);
|
||||
return SWIG_NewInstanceObj(x, SWIG_TypeQuery("CPyRetBool*"), SWIG_POINTER_OWN);
|
||||
return SWIG_NewInstanceObj(x, SWIG_TypeQuery("CPyRetBool*"),
|
||||
SWIG_POINTER_OWN);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user