mirror of
https://github.com/znc/znc.git
synced 2026-08-11 11:23:18 +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:
+26
-17
@@ -25,35 +25,40 @@
|
||||
#include <znc/Chan.h>
|
||||
#include <znc/IRCNetwork.h>
|
||||
|
||||
class CRejoinJob: public CTimer {
|
||||
public:
|
||||
CRejoinJob(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription)
|
||||
: CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {
|
||||
}
|
||||
class CRejoinJob : public CTimer {
|
||||
public:
|
||||
CRejoinJob(CModule* pModule, unsigned int uInterval, unsigned int uCycles,
|
||||
const CString& sLabel, const CString& sDescription)
|
||||
: CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {}
|
||||
|
||||
virtual ~CRejoinJob() {}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void RunJob() override {
|
||||
CIRCNetwork* pNetwork = GetModule()->GetNetwork();
|
||||
CChan* pChan = pNetwork->FindChan(GetName().Token(1, true));
|
||||
|
||||
if (pChan) {
|
||||
pChan->Enable();
|
||||
GetModule()->PutIRC("JOIN " + pChan->GetName() + " " + pChan->GetKey());
|
||||
GetModule()->PutIRC("JOIN " + pChan->GetName() + " " +
|
||||
pChan->GetKey());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CRejoinMod : public CModule {
|
||||
private:
|
||||
private:
|
||||
unsigned int delay = 10;
|
||||
|
||||
public:
|
||||
public:
|
||||
MODCONSTRUCTOR(CRejoinMod) {
|
||||
AddHelpCommand();
|
||||
AddCommand("SetDelay", static_cast<CModCommand::ModCmdFunc>(&CRejoinMod::OnSetDelayCommand), "<secs>", "Set the rejoin delay");
|
||||
AddCommand("ShowDelay", static_cast<CModCommand::ModCmdFunc>(&CRejoinMod::OnShowDelayCommand), "", "Show the rejoin delay");
|
||||
AddCommand("SetDelay", static_cast<CModCommand::ModCmdFunc>(
|
||||
&CRejoinMod::OnSetDelayCommand),
|
||||
"<secs>", "Set the rejoin delay");
|
||||
AddCommand("ShowDelay", static_cast<CModCommand::ModCmdFunc>(
|
||||
&CRejoinMod::OnShowDelayCommand),
|
||||
"", "Show the rejoin delay");
|
||||
}
|
||||
virtual ~CRejoinMod() {}
|
||||
|
||||
@@ -70,8 +75,9 @@ public:
|
||||
if ((i == 0 && sArgs == "0") || i > 0)
|
||||
delay = i;
|
||||
else {
|
||||
sErrorMsg = "Illegal argument, "
|
||||
"must be a positive number or 0";
|
||||
sErrorMsg =
|
||||
"Illegal argument, "
|
||||
"must be a positive number or 0";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -104,7 +110,8 @@ public:
|
||||
PutModule("Rejoin delay disabled");
|
||||
}
|
||||
|
||||
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& pChan, const CString& sMessage) override {
|
||||
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& pChan,
|
||||
const CString& sMessage) override {
|
||||
if (GetNetwork()->GetCurNick().Equals(sKickedNick)) {
|
||||
if (!delay) {
|
||||
PutIRC("JOIN " + pChan.GetName() + " " + pChan.GetKey());
|
||||
@@ -112,15 +119,17 @@ public:
|
||||
return;
|
||||
}
|
||||
AddTimer(new CRejoinJob(this, delay, 1, "Rejoin " + pChan.GetName(),
|
||||
"Rejoin channel after a delay"));
|
||||
"Rejoin channel after a delay"));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<> void TModInfo<CRejoinMod>(CModInfo& Info) {
|
||||
template <>
|
||||
void TModInfo<CRejoinMod>(CModInfo& Info) {
|
||||
Info.SetWikiPage("kickrejoin");
|
||||
Info.SetHasArgs(true);
|
||||
Info.SetArgsHelpText("You might enter the number of seconds to wait before rejoining.");
|
||||
Info.SetArgsHelpText(
|
||||
"You might enter the number of seconds to wait before rejoining.");
|
||||
}
|
||||
|
||||
NETWORKMODULEDEFS(CRejoinMod, "Autorejoin on kick")
|
||||
|
||||
Reference in New Issue
Block a user