mirror of
https://github.com/znc/znc.git
synced 2026-07-05 17:31:06 +02:00
clang-format: switch tabs to spaces
I like tabs, but I have to admit that spaces make source code more consistent, because every editor/viewer tends to render tabs differently :(
This commit is contained in:
+71
-71
@@ -20,98 +20,98 @@
|
||||
|
||||
class CFOModule : public CModule {
|
||||
public:
|
||||
MODCONSTRUCTOR(CFOModule) {}
|
||||
virtual ~CFOModule() {}
|
||||
MODCONSTRUCTOR(CFOModule) {}
|
||||
virtual ~CFOModule() {}
|
||||
|
||||
bool IsOnlineModNick(const CString& sNick) {
|
||||
const CString& sPrefix = GetUser()->GetStatusPrefix();
|
||||
if (!sNick.StartsWith(sPrefix)) return false;
|
||||
bool IsOnlineModNick(const CString& sNick) {
|
||||
const CString& sPrefix = GetUser()->GetStatusPrefix();
|
||||
if (!sNick.StartsWith(sPrefix)) return false;
|
||||
|
||||
CString sModNick = sNick.substr(sPrefix.length());
|
||||
if (sModNick.Equals("status") ||
|
||||
GetNetwork()->GetModules().FindModule(sModNick) ||
|
||||
GetUser()->GetModules().FindModule(sModNick) ||
|
||||
CZNC::Get().GetModules().FindModule(sModNick))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
CString sModNick = sNick.substr(sPrefix.length());
|
||||
if (sModNick.Equals("status") ||
|
||||
GetNetwork()->GetModules().FindModule(sModNick) ||
|
||||
GetUser()->GetModules().FindModule(sModNick) ||
|
||||
CZNC::Get().GetModules().FindModule(sModNick))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
EModRet OnUserRaw(CString& sLine) override {
|
||||
// Handle ISON
|
||||
if (sLine.Token(0).Equals("ison")) {
|
||||
VCString vsNicks;
|
||||
EModRet OnUserRaw(CString& sLine) override {
|
||||
// Handle ISON
|
||||
if (sLine.Token(0).Equals("ison")) {
|
||||
VCString vsNicks;
|
||||
|
||||
// Get the list of nicks which are being asked for
|
||||
sLine.Token(1, true).TrimLeft_n(":").Split(" ", vsNicks, false);
|
||||
// Get the list of nicks which are being asked for
|
||||
sLine.Token(1, true).TrimLeft_n(":").Split(" ", vsNicks, false);
|
||||
|
||||
CString sBNCNicks;
|
||||
for (const CString& sNick : vsNicks) {
|
||||
if (IsOnlineModNick(sNick)) {
|
||||
sBNCNicks += " " + sNick;
|
||||
}
|
||||
}
|
||||
// Remove the leading space
|
||||
sBNCNicks.LeftChomp();
|
||||
CString sBNCNicks;
|
||||
for (const CString& sNick : vsNicks) {
|
||||
if (IsOnlineModNick(sNick)) {
|
||||
sBNCNicks += " " + sNick;
|
||||
}
|
||||
}
|
||||
// Remove the leading space
|
||||
sBNCNicks.LeftChomp();
|
||||
|
||||
if (!GetNetwork()->GetIRCSock()) {
|
||||
// if we are not connected to any IRC server, send
|
||||
// an empty or module-nick filled response.
|
||||
PutUser(":irc.znc.in 303 " + GetClient()->GetNick() + " :" +
|
||||
sBNCNicks);
|
||||
} else {
|
||||
// We let the server handle this request and then act on
|
||||
// the 303 response from the IRC server.
|
||||
m_ISONRequests.push_back(sBNCNicks);
|
||||
}
|
||||
}
|
||||
if (!GetNetwork()->GetIRCSock()) {
|
||||
// if we are not connected to any IRC server, send
|
||||
// an empty or module-nick filled response.
|
||||
PutUser(":irc.znc.in 303 " + GetClient()->GetNick() + " :" +
|
||||
sBNCNicks);
|
||||
} else {
|
||||
// We let the server handle this request and then act on
|
||||
// the 303 response from the IRC server.
|
||||
m_ISONRequests.push_back(sBNCNicks);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle WHOIS
|
||||
if (sLine.Token(0).Equals("whois")) {
|
||||
CString sNick = sLine.Token(1);
|
||||
// Handle WHOIS
|
||||
if (sLine.Token(0).Equals("whois")) {
|
||||
CString sNick = sLine.Token(1);
|
||||
|
||||
if (IsOnlineModNick(sNick)) {
|
||||
CIRCNetwork* pNetwork = GetNetwork();
|
||||
PutUser(":znc.in 311 " + pNetwork->GetCurNick() + " " + sNick +
|
||||
" znc znc.in * :" + sNick);
|
||||
PutUser(":znc.in 312 " + pNetwork->GetCurNick() + " " + sNick +
|
||||
" *.znc.in :Bouncer");
|
||||
PutUser(":znc.in 318 " + pNetwork->GetCurNick() + " " + sNick +
|
||||
" :End of /WHOIS list.");
|
||||
if (IsOnlineModNick(sNick)) {
|
||||
CIRCNetwork* pNetwork = GetNetwork();
|
||||
PutUser(":znc.in 311 " + pNetwork->GetCurNick() + " " + sNick +
|
||||
" znc znc.in * :" + sNick);
|
||||
PutUser(":znc.in 312 " + pNetwork->GetCurNick() + " " + sNick +
|
||||
" *.znc.in :Bouncer");
|
||||
PutUser(":znc.in 318 " + pNetwork->GetCurNick() + " " + sNick +
|
||||
" :End of /WHOIS list.");
|
||||
|
||||
return HALT;
|
||||
}
|
||||
}
|
||||
return HALT;
|
||||
}
|
||||
}
|
||||
|
||||
return CONTINUE;
|
||||
}
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
EModRet OnRaw(CString& sLine) override {
|
||||
// Handle 303 reply if m_Requests is not empty
|
||||
if (sLine.Token(1) == "303" && !m_ISONRequests.empty()) {
|
||||
VCString::iterator it = m_ISONRequests.begin();
|
||||
EModRet OnRaw(CString& sLine) override {
|
||||
// Handle 303 reply if m_Requests is not empty
|
||||
if (sLine.Token(1) == "303" && !m_ISONRequests.empty()) {
|
||||
VCString::iterator it = m_ISONRequests.begin();
|
||||
|
||||
sLine.Trim();
|
||||
sLine.Trim();
|
||||
|
||||
// Only append a space if this isn't an empty reply
|
||||
if (sLine.Right(1) != ":") {
|
||||
sLine += " ";
|
||||
}
|
||||
// Only append a space if this isn't an empty reply
|
||||
if (sLine.Right(1) != ":") {
|
||||
sLine += " ";
|
||||
}
|
||||
|
||||
// add BNC nicks to the reply
|
||||
sLine += *it;
|
||||
m_ISONRequests.erase(it);
|
||||
}
|
||||
// add BNC nicks to the reply
|
||||
sLine += *it;
|
||||
m_ISONRequests.erase(it);
|
||||
}
|
||||
|
||||
return CONTINUE;
|
||||
}
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
private:
|
||||
VCString m_ISONRequests;
|
||||
VCString m_ISONRequests;
|
||||
};
|
||||
|
||||
template <>
|
||||
void TModInfo<CFOModule>(CModInfo& Info) {
|
||||
Info.SetWikiPage("modules_online");
|
||||
Info.SetWikiPage("modules_online");
|
||||
}
|
||||
|
||||
NETWORKMODULEDEFS(CFOModule, "Make ZNC's *modules to be \"online\".")
|
||||
|
||||
Reference in New Issue
Block a user