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:
Alexey Sokolov
2015-12-06 22:36:35 +00:00
parent 02f8749a8b
commit 33b0627d75
132 changed files with 12743 additions and 8904 deletions
+87 -56
View File
@@ -22,8 +22,9 @@ using std::vector;
#ifdef HAVE_PTHREAD
class CSampleJob : public CModuleJob {
public:
CSampleJob(CModule *pModule) : CModuleJob(pModule, "sample", "Message the user after a delay") {}
public:
CSampleJob(CModule* pModule)
: CModuleJob(pModule, "sample", "Message the user after a delay") {}
~CSampleJob() {
if (wasCancelled()) {
@@ -40,64 +41,59 @@ public:
for (int i = 0; i < 10; i++) {
// Regularly check if we were cancelled
if (wasCancelled())
return;
if (wasCancelled()) return;
sleep(1);
}
}
void runMain() override {
GetModule()->PutModule("Sample job done");
}
void runMain() override { GetModule()->PutModule("Sample job done"); }
};
#endif
class CSampleTimer : public CTimer {
public:
CSampleTimer(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription) : CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {}
public:
CSampleTimer(CModule* pModule, unsigned int uInterval, unsigned int uCycles,
const CString& sLabel, const CString& sDescription)
: CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {}
virtual ~CSampleTimer() {}
private:
protected:
void RunJob() override {
GetModule()->PutModule("TEST!!!!");
}
private:
protected:
void RunJob() override { GetModule()->PutModule("TEST!!!!"); }
};
class CSampleMod : public CModule {
public:
public:
MODCONSTRUCTOR(CSampleMod) {}
bool OnLoad(const CString& sArgs, CString& sMessage) override {
PutModule("I'm being loaded with the arguments: [" + sArgs + "]");
//AddTimer(new CSampleTimer(this, 300, 0, "Sample", "Sample timer for sample things."));
//AddTimer(new CSampleTimer(this, 5, 20, "Another", "Another sample timer."));
//AddTimer(new CSampleTimer(this, 25000, 5, "Third", "A third sample timer."));
// AddTimer(new CSampleTimer(this, 300, 0, "Sample", "Sample timer for sample
// things."));
// AddTimer(new CSampleTimer(this, 5, 20, "Another", "Another sample timer."));
// AddTimer(new CSampleTimer(this, 25000, 5, "Third", "A third sample timer."));
#ifdef HAVE_PTHREAD
AddJob(new CSampleJob(this));
#endif
return true;
}
virtual ~CSampleMod() {
PutModule("I'm being unloaded!");
}
virtual ~CSampleMod() { PutModule("I'm being unloaded!"); }
bool OnBoot() override {
// This is called when the app starts up (only modules that are loaded in the config will get this event)
// This is called when the app starts up (only modules that are loaded
// in the config will get this event)
return true;
}
void OnIRCConnected() override {
PutModule("You got connected BoyOh.");
}
void OnIRCConnected() override { PutModule("You got connected BoyOh."); }
void OnIRCDisconnected() override {
PutModule("You got disconnected BoyOh.");
}
EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName) override {
EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent,
CString& sRealName) override {
sRealName += " - ZNC";
return CONTINUE;
}
@@ -108,28 +104,47 @@ public:
return CONTINUE;
}
void OnChanPermission(const CNick& OpNick, const CNick& Nick, CChan& Channel, unsigned char uMode, bool bAdded, bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] set mode [" + Channel.GetName() + ((bAdded) ? "] +" : "] -") + CString(uMode) + " " + Nick.GetNick());
void OnChanPermission(const CNick& OpNick, const CNick& Nick,
CChan& Channel, unsigned char uMode, bool bAdded,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] set mode [" + Channel.GetName() +
((bAdded) ? "] +" : "] -") + CString(uMode) + " " +
Nick.GetNick());
}
void OnOp(const CNick& OpNick, const CNick& Nick, CChan& Channel, bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] opped [" + Nick.GetNick() + "] on [" + Channel.GetName() + "]");
void OnOp(const CNick& OpNick, const CNick& Nick, CChan& Channel,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] opped [" + Nick.GetNick() + "] on [" + Channel.GetName() +
"]");
}
void OnDeop(const CNick& OpNick, const CNick& Nick, CChan& Channel, bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] deopped [" + Nick.GetNick() + "] on [" + Channel.GetName() + "]");
void OnDeop(const CNick& OpNick, const CNick& Nick, CChan& Channel,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] deopped [" + Nick.GetNick() + "] on [" +
Channel.GetName() + "]");
}
void OnVoice(const CNick& OpNick, const CNick& Nick, CChan& Channel, bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] voiced [" + Nick.GetNick() + "] on [" + Channel.GetName() + "]");
void OnVoice(const CNick& OpNick, const CNick& Nick, CChan& Channel,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] voiced [" + Nick.GetNick() + "] on [" + Channel.GetName() +
"]");
}
void OnDevoice(const CNick& OpNick, const CNick& Nick, CChan& Channel, bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] devoiced [" + Nick.GetNick() + "] on [" + Channel.GetName() + "]");
void OnDevoice(const CNick& OpNick, const CNick& Nick, CChan& Channel,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] devoiced [" + Nick.GetNick() + "] on [" +
Channel.GetName() + "]");
}
void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs) override {
PutModule("* " + OpNick.GetNick() + " sets mode: " + sModes + " " + sArgs + " (" + Channel.GetName() + ")");
void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes,
const CString& sArgs) override {
PutModule("* " + OpNick.GetNick() + " sets mode: " + sModes + " " +
sArgs + " (" + Channel.GetName() + ")");
}
EModRet OnRaw(CString& sLine) override {
@@ -142,12 +157,17 @@ public:
return CONTINUE;
}
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) override {
PutModule("[" + OpNick.GetNick() + "] kicked [" + sKickedNick + "] from [" + Channel.GetName() + "] with the msg [" + sMessage + "]");
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel,
const CString& sMessage) override {
PutModule("[" + OpNick.GetNick() + "] kicked [" + sKickedNick +
"] from [" + Channel.GetName() + "] with the msg [" +
sMessage + "]");
}
void OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) override {
PutModule("* Quits: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" + Nick.GetHost() + ") (" + sMessage + ")");
void OnQuit(const CNick& Nick, const CString& sMessage,
const vector<CChan*>& vChans) override {
PutModule("* Quits: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" +
Nick.GetHost() + ") (" + sMessage + ")");
}
EModRet OnTimerAutoJoin(CChan& Channel) override {
@@ -156,16 +176,20 @@ public:
}
void OnJoin(const CNick& Nick, CChan& Channel) override {
PutModule("* Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" + Nick.GetHost() + ")");
PutModule("* Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" +
Nick.GetHost() + ")");
}
void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) override {
PutModule("* Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" + Nick.GetHost() + ")");
void OnPart(const CNick& Nick, CChan& Channel,
const CString& sMessage) override {
PutModule("* Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" +
Nick.GetHost() + ")");
}
EModRet OnInvite(const CNick& Nick, const CString& sChan) override {
if (sChan.Equals("#test")) {
PutModule(Nick.GetNick() + " invited us to " + sChan + ", ignoring invites to " + sChan);
PutModule(Nick.GetNick() + " invited us to " + sChan +
", ignoring invites to " + sChan);
return HALT;
}
@@ -173,7 +197,8 @@ public:
return CONTINUE;
}
void OnNick(const CNick& OldNick, const CString& sNewNick, const vector<CChan*>& vChans) override {
void OnNick(const CNick& OldNick, const CString& sNewNick,
const vector<CChan*>& vChans) override {
PutModule("* " + OldNick.GetNick() + " is now known as " + sNewNick);
}
@@ -203,8 +228,10 @@ public:
return CONTINUE;
}
EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage) override {
PutModule("[" + Nick.GetNick() + "] chanctcp [" + sMessage + "] to [" + Channel.GetName() + "]");
EModRet OnChanCTCP(CNick& Nick, CChan& Channel,
CString& sMessage) override {
PutModule("[" + Nick.GetNick() + "] chanctcp [" + sMessage + "] to [" +
Channel.GetName() + "]");
sMessage = "\00311,5 " + sMessage + " \003";
return CONTINUE;
@@ -224,21 +251,25 @@ public:
return CONTINUE;
}
EModRet OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage) override {
PutModule("[" + Nick.GetNick() + "] channotice [" + sMessage + "] to [" + Channel.GetName() + "]");
EModRet OnChanNotice(CNick& Nick, CChan& Channel,
CString& sMessage) override {
PutModule("[" + Nick.GetNick() + "] channotice [" + sMessage +
"] to [" + Channel.GetName() + "]");
sMessage = "\00311,5 " + sMessage + " \003";
return CONTINUE;
}
EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) override {
PutModule("* " + Nick.GetNick() + " changes topic on " + Channel.GetName() + " to '" + sTopic + "'");
PutModule("* " + Nick.GetNick() + " changes topic on " +
Channel.GetName() + " to '" + sTopic + "'");
return CONTINUE;
}
EModRet OnUserTopic(CString& sTarget, CString& sTopic) override {
PutModule("* " + GetClient()->GetNick() + " changed topic on " + sTarget + " to '" + sTopic + "'");
PutModule("* " + GetClient()->GetNick() + " changed topic on " +
sTarget + " to '" + sTopic + "'");
return CONTINUE;
}
@@ -285,11 +316,11 @@ public:
}
};
template<> void TModInfo<CSampleMod>(CModInfo& Info) {
template <>
void TModInfo<CSampleMod>(CModInfo& Info) {
Info.SetWikiPage("sample");
Info.SetHasArgs(true);
Info.SetArgsHelpText("Description of module arguments goes here.");
}
MODULEDEFS(CSampleMod, "To be used as a sample for writing modules")