Force a space between if, for, while and (

This was done via:
   sed -ir 's/if(/if (/g; s/for(/for (/g; s/while(/while (/g' \
        *.h *.cpp modules/*.cpp



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1030 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-04-20 13:08:44 +00:00
parent b0a1714b86
commit c64d7bc108
21 changed files with 126 additions and 126 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ CBufLine::CBufLine(const CString& sPre, const CString& sPost, bool bIncNick=true
CBufLine::~CBufLine() {}
void CBufLine::GetLine(const CString& sTarget, CString& sRet) {
if(m_bIncNick)
if (m_bIncNick)
sRet = m_sPre + sTarget + m_sPost;
else
sRet = m_sPre + m_sPost;
@@ -43,8 +43,8 @@ int CBuffer::AddLine(const CString& sPre, const CString& sPost, bool bIncNick) {
}
int CBuffer::UpdateLine(const CString& sPre, const CString& sPost, bool bIncNick) {
for(iterator it = begin(); it != end(); it++) {
if(it->GetPre() == sPre) {
for (iterator it = begin(); it != end(); it++) {
if (it->GetPre() == sPre) {
it->SetPost(sPost);
it->SetIncNick(bIncNick);
return size();
+6 -6
View File
@@ -107,7 +107,7 @@ void CChan::JoinUser(bool bForce, const CString& sKey, CClient* pClient) {
pThisClient = pClient;
for (map<CString,CNick*>::iterator a = m_msNicks.begin(); a != m_msNicks.end(); a++) {
if(pThisClient->HasNamesx()) {
if (pThisClient->HasNamesx()) {
sPerm = a->second->GetPermStr();
} else {
char c = a->second->GetPermChar();
@@ -116,7 +116,7 @@ void CChan::JoinUser(bool bForce, const CString& sKey, CClient* pClient) {
sPerm += c;
}
}
if(pThisClient->HasUHNames() && !a->second->GetIdent().empty() && !a->second->GetHost().empty()) {
if (pThisClient->HasUHNames() && !a->second->GetIdent().empty() && !a->second->GetHost().empty()) {
sNick = a->first + "!" + a->second->GetIdent() + "@" + a->second->GetHost();
} else {
sNick = a->first;
@@ -444,19 +444,19 @@ bool CChan::AddNick(const CString& sNick) {
pNick->SetUser(m_pUser);
}
if(!sIdent.empty())
if (!sIdent.empty())
pNick->SetIdent(sIdent);
if(!sHost.empty())
if (!sHost.empty())
pNick->SetHost(sHost);
for(CString::size_type i = 0; i < sPrefix.length(); i++) {
for (CString::size_type i = 0; i < sPrefix.length(); i++) {
if (pNick->AddPerm(sPrefix[i])) {
IncPermCount(sPrefix[i]);
}
}
if (pNick->GetNick().CaseCmp(m_pUser->GetCurNick()) == 0) {
for(CString::size_type i = 0; i < sPrefix.length(); i++) {
for (CString::size_type i = 0; i < sPrefix.length(); i++) {
AddPerm(sPrefix[i]);
}
}
+3 -3
View File
@@ -247,10 +247,10 @@ void CClient::ReadLine(const CString& sData) {
return; // Don't forward this msg. We don't want the client getting us disconnected.
} else if (sCommand.CaseCmp("PROTOCTL") == 0) {
unsigned int i = 1;
while(!sLine.Token(i).empty()) {
if(sLine.Token(i).CaseCmp("NAMESX") == 0) {
while (!sLine.Token(i).empty()) {
if (sLine.Token(i).CaseCmp("NAMESX") == 0) {
m_bNamesx = true;
} else if(sLine.Token(i).CaseCmp("UHNAMES") == 0) {
} else if (sLine.Token(i).CaseCmp("UHNAMES") == 0) {
m_bUHNames = true;
}
i++;
+5 -5
View File
@@ -119,7 +119,7 @@ bool CFile::Exists(const CString& sFile) {
unsigned long long CFile::GetSize(const CString& sFile) {
struct stat st;
if(stat(sFile.c_str(), &st) != 0) {
if (stat(sFile.c_str(), &st) != 0) {
return 0;
}
@@ -167,7 +167,7 @@ int CFile::Copy(const CString& sNewFileName, bool bOverwrite) {
}
bool CFile::Delete(const CString& sFileName) {
if(!CFile::Exists(sFileName)) {
if (!CFile::Exists(sFileName)) {
return false;
}
@@ -175,7 +175,7 @@ bool CFile::Delete(const CString& sFileName) {
}
bool CFile::Move(const CString& sOldFileName, const CString& sNewFileName, bool bOverwrite) {
if((!bOverwrite) && (CFile::Exists(sNewFileName))) {
if ((!bOverwrite) && (CFile::Exists(sNewFileName))) {
return false;
}
@@ -184,7 +184,7 @@ bool CFile::Move(const CString& sOldFileName, const CString& sNewFileName, bool
}
bool CFile::Copy(const CString& sOldFileName, const CString& sNewFileName, bool bOverwrite) {
if((!bOverwrite) && (CFile::Exists(sNewFileName))) {
if ((!bOverwrite) && (CFile::Exists(sNewFileName))) {
return false;
}
@@ -277,7 +277,7 @@ bool CFile::ReadLine(CString& sData, const CString & sDelimiter) {
bool bEOF = false;
while(true) {
while (true) {
CString::size_type iFind = m_sBuffer.find(sDelimiter);
if (iFind != CString::npos) {
sData = m_sBuffer.substr(0, (iFind + 1));
+1 -1
View File
@@ -160,7 +160,7 @@ bool CHTTPSock::PrintFile(const CString& sFileName, CString sContentType) {
char szBuf[4096];
int iLen = 0;
while((iLen = File.Read(szBuf, 4096)) > 0) {
while ((iLen = File.Read(szBuf, 4096)) > 0) {
Write(szBuf, iLen);
}
+4 -4
View File
@@ -552,7 +552,7 @@ void CIRCSock::ReadLine(const CString& sData) {
} else if (sCmd.CaseCmp("MODE") == 0) {
CString sTarget = sRest.Token(0);
CString sModes = sRest.Token(1, true);
if(sModes.Left(1) == ":")
if (sModes.Left(1) == ":")
sModes = sModes.substr(1);
CChan* pChan = m_pUser->FindChan(sTarget);
@@ -579,7 +579,7 @@ void CIRCSock::ReadLine(const CString& sData) {
} else if (uMode == '-') {
bAdd = false;
} else {
if(bAdd) {
if (bAdd) {
m_scUserModes.insert(uMode);
} else {
m_scUserModes.erase(uMode);
@@ -709,7 +709,7 @@ void CIRCSock::ReadLine(const CString& sData) {
// :blub!dummy@rox-8DBEFE92 WALLOPS :this is a test
CString sMsg = sRest.Token(0, true);
if(sMsg.Left(1) == ":") {
if (sMsg.Left(1) == ":") {
sMsg.LeftChomp();
}
@@ -848,7 +848,7 @@ bool CIRCSock::OnChanCTCP(CNick& Nick, const CString& sChan, CString& sMessage)
// Record a /me
if (sMessage.Left(7).CaseCmp("ACTION ") == 0) {
sMessage = sMessage.substr(7);
if(pChan->KeepBuffer() || !m_pUser->IsUserAttached()) {
if (pChan->KeepBuffer() || !m_pUser->IsUserAttached()) {
pChan->AddBuffer(":" + Nick.GetNickMask() + " PRIVMSG " + sChan + " :\001ACTION " + m_pUser->AddTimestamp(sMessage) + "\001");
}
MODULECALL(OnChanAction(Nick, *pChan, sMessage), m_pUser, NULL, return true);
+1 -1
View File
@@ -1023,7 +1023,7 @@ CString& MCString::Decode(CString& sValue) {
char *endptr;
CString sTmp;
while(*pTmp) {
while (*pTmp) {
if (*pTmp != '%') {
sTmp += *pTmp++;
} else {
+4 -4
View File
@@ -148,7 +148,7 @@ CString& CUser::AddTimestamp(const CString& sStr, CString& sRet) const {
char szTimestamp[1024];
time_t tm;
if(GetTimestampFormat().empty() || (!m_bAppendTimestamp && !m_bPrependTimestamp)) {
if (GetTimestampFormat().empty() || (!m_bAppendTimestamp && !m_bPrependTimestamp)) {
sRet = sStr;
} else {
time(&tm);
@@ -207,14 +207,14 @@ void CUser::UserConnected(CClient* pClient) {
}
}
if(GetIRCSock() != NULL) {
if (GetIRCSock() != NULL) {
CString sUserMode("");
const set<unsigned char>& scUserModes = GetIRCSock()->GetUserModes();
for (set<unsigned char>::iterator it = scUserModes.begin();
it != scUserModes.end(); it++) {
sUserMode += *it;
}
if(!sUserMode.empty()) {
if (!sUserMode.empty()) {
pClient->PutClient(":" + GetIRCNick().GetNick() + " MODE " + GetIRCNick().GetNick() + " :+" + sUserMode);
}
}
@@ -989,7 +989,7 @@ bool CUser::IsChan(const CString& sChan) const {
return false; // There is no way this is a chan
if (GetChanPrefixes().empty())
return true; // We can't know, so we allow everything
// Thanks to the above if(empty), we can do sChan[0]
// Thanks to the above if (empty), we can do sChan[0]
return GetChanPrefixes().find(sChan[0]) != CString::npos;
}
+2 -2
View File
@@ -66,7 +66,7 @@ void CUtils::GenerateCert(FILE *pOut, bool bEncPrivKey, const CString& sHost) {
PEM_write_RSAPrivateKey(pOut, pRSA, (bEncPrivKey ? EVP_des_ede3_cbc() : NULL), NULL, 0, NULL, NULL);
if(!(pCert = X509_new())) {
if (!(pCert = X509_new())) {
EVP_PKEY_free(pKey);
return;
}
@@ -619,7 +619,7 @@ CString CBlowfish::MD5(const CString & sInput, bool bHexEncode) {
if (!bHexEncode) {
sRet.append((const char *)data, MD5_DIGEST_LENGTH);
} else {
for(int a = 0; a < MD5_DIGEST_LENGTH; a++) {
for (int a = 0; a < MD5_DIGEST_LENGTH; a++) {
sRet += g_HexDigits[data[a] >> 4];
sRet += g_HexDigits[data[a] & 0xf];
}
+3 -3
View File
@@ -258,7 +258,7 @@ inline bool ReadFile(const CString & sFilename, CString & sLine) {
return false;
}
while((bytes = fread(inbuff, sizeof(char), RF_BUFF, f)) > 0) {
while ((bytes = fread(inbuff, sizeof(char), RF_BUFF, f)) > 0) {
sLine.append(inbuff, bytes);
}
@@ -310,7 +310,7 @@ inline bool ReadLine(const CString & sData, CString & sLine, CString::size_type
inline CString Lower(const CString & sLine) {
CString sRet;
for(u_int a = 0; a < sLine.length(); a++) {
for (u_int a = 0; a < sLine.length(); a++) {
sRet += tolower(sLine[a]);
}
@@ -319,7 +319,7 @@ inline CString Lower(const CString & sLine) {
inline CString Upper(const CString & sLine) {
CString sRet;
for(u_int a = 0; a < sLine.length(); a++) {
for (u_int a = 0; a < sLine.length(); a++) {
sRet += toupper(sLine[a]);
}
+12 -12
View File
@@ -90,7 +90,7 @@ public:
virtual void OnIRCConnected()
{
if(m_bIsAway)
if (m_bIsAway)
Away(true); // reset away if we are reconnected
else
Back(); // ircd seems to remember your away if you killed the client and came back
@@ -103,7 +103,7 @@ public:
{
CString sLine;
CString::size_type iPos = 0;
while(ReadLine(sFile, sLine, iPos))
while (ReadLine(sFile, sLine, iPos))
{
sLine.Trim();
AddMessage(sLine);
@@ -124,7 +124,7 @@ public:
{
CString sFile = CRYPT_VERIFICATION_TOKEN;
for(u_int b = 0; b < m_vMessages.size(); b++)
for (u_int b = 0; b < m_vMessages.size(); b++)
sFile += m_vMessages[b] + "\n";
CBlowfish c(m_sPassword, BF_ENCRYPT);
@@ -153,7 +153,7 @@ public:
if (sCmdName == "away")
{
CString sReason;
if(sCommand.Token(1) != "-quiet")
if (sCommand.Token(1) != "-quiet")
{
sReason = sCommand.Token(1, true);
PutModNotice("You have been marked as away", "away");
@@ -170,7 +170,7 @@ public:
}
else if (sCmdName == "messages")
{
for(u_int a = 0; a < m_vMessages.size(); a++)
for (u_int a = 0; a < m_vMessages.size(); a++)
PutModule(m_vMessages[a], "away");
}
else if (sCmdName == "delete")
@@ -179,7 +179,7 @@ public:
if (sWhich == "all")
{
PutModNotice("Deleted " + CString(m_vMessages.size()) + " Messages.", "away");
for(u_int a = 0; a < m_vMessages.size(); a++)
for (u_int a = 0; a < m_vMessages.size(); a++)
m_vMessages.erase(m_vMessages.begin() + a--);
}
@@ -222,7 +222,7 @@ public:
else if (sCmdName == "show")
{
map< CString, vector< CString> > msvOutput;
for(u_int a = 0; a < m_vMessages.size(); a++)
for (u_int a = 0; a < m_vMessages.size(); a++)
{
CString sTime = m_vMessages[a].Token(0, false, ":");
CString sWhom = m_vMessages[a].Token(1, false, ":");
@@ -252,10 +252,10 @@ public:
sTmp += sMessage;
msvOutput[sWhom].push_back(sTmp);
}
for(map< CString, vector< CString> >::iterator it = msvOutput.begin(); it != msvOutput.end(); it++)
for (map< CString, vector< CString> >::iterator it = msvOutput.begin(); it != msvOutput.end(); it++)
{
PutModule(it->first, "away");
for(u_int a = 0; a < it->second.size(); a++)
for (u_int a = 0; a < it->second.size(); a++)
PutModule(it->second[a]);
}
PutModule("#--- End Messages", "away");
@@ -273,7 +273,7 @@ public:
SetAwayTime(iSetting);
if(iSetting == 0)
if (iSetting == 0)
PutModule("Timer disabled");
else
PutModule("Timer set to " + CString(iSetting) + " seconds");
@@ -349,7 +349,7 @@ public:
virtual EModRet OnUserNotice(CString& sTarget, CString& sMessage)
{
Ping();
if(m_bIsAway)
if (m_bIsAway)
Back();
return(CONTINUE);
@@ -357,7 +357,7 @@ public:
virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage)
{
Ping();
if(m_bIsAway)
if (m_bIsAway)
Back();
return(CONTINUE);
+1 -1
View File
@@ -147,7 +147,7 @@ public:
PutModule(sMsg);
}
} else if(sCommand.Token(0).CaseCmp("HELP") == 0) {
} else if (sCommand.Token(0).CaseCmp("HELP") == 0) {
PutModule("Commands are: show, timers, set [awaynick]");
}
}
+4 -4
View File
@@ -48,7 +48,7 @@ public:
virtual ~CEmail()
{
vector<Csock*> vSocks = m_pManager->FindSocksByName("EMAIL::" + m_pUser->GetUserName());
for(u_int a = 0; a < vSocks.size(); a++)
for (u_int a = 0; a < vSocks.size(); a++)
m_pManager->DelSockByAddr(vSocks[a]);
}
@@ -91,7 +91,7 @@ public:
if (!m_bInitialized)
{
m_bInitialized = true;
for(u_int a = 0; a < vEmails.size(); a++)
for (u_int a = 0; a < vEmails.size(); a++)
m_ssUidls.insert(vEmails[a].sUidl);
stringstream s;
@@ -106,7 +106,7 @@ public:
Table.AddColumn("Size");
Table.AddColumn("Subject");
for(u_int a = 0; a < vEmails.size(); a++)
for (u_int a = 0; a < vEmails.size(); a++)
{
if (m_ssUidls.find(vEmails[a].sUidl) == m_ssUidls.end())
{
@@ -180,7 +180,7 @@ public:
tmp.sUidl = (char *)CMD5(m_sMailBuffer.substr(0, 255));
CString sLine;
CString::size_type iPos = 0;
while(::ReadLine(m_sMailBuffer, sLine, iPos))
while (::ReadLine(m_sMailBuffer, sLine, iPos))
{
sLine.Trim();
if (sLine.empty())
+12 -12
View File
@@ -102,7 +102,7 @@ public:
{
HV *pHash = newHV();
sv_2mortal((SV *) pHash);
for(CPerlHash::iterator it = this->begin(); it != this->end(); it++)
for (CPerlHash::iterator it = this->begin(); it != this->end(); it++)
{
SV *pSV = it->second.GetSV(false);
hv_store(pHash, it->first.c_str(), it->first.length(), pSV, 0);
@@ -220,7 +220,7 @@ public:
{
const map<CString,CUser*> & msUsers = CZNC::Get().GetUserMap();
for(map<CString,CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); it++)
for (map<CString,CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); it++)
{ // need to set it on all of these
m_pUser = it->second;
CBNone("OnShutdown");
@@ -248,7 +248,7 @@ public:
CFile cFile(sModule);
if ((cFile.Exists()) && (cFile.Open(O_RDONLY)))
{
while(cFile.ReadLine(sBuffer))
while (cFile.ReadLine(sBuffer))
sScript += sBuffer;
cFile.Close();
@@ -262,7 +262,7 @@ public:
if ((sName.CaseCmp("loadperlmodule") == 0) && (pUser))
{
m_pUser = pUser;
if(sValue.Right(3) == ".pm")
if (sValue.Right(3) == ".pm")
LoadPerlMod(sValue);
else
LoadPerlMod(sValue + ".pm");
@@ -275,7 +275,7 @@ public:
void DumpError(const CString & sError)
{
CString sTmp = sError;
for(CString::size_type a = 0; a < sTmp.size(); a++)
for (CString::size_type a = 0; a < sTmp.size(); a++)
{
if (isspace(sTmp[a]))
sTmp[a] = ' ';
@@ -345,7 +345,7 @@ public:
VPString vsArgs;
vsArgs.push_back(Nick.GetNickMask());
vsArgs.push_back(sMessage);
for(vector<CChan*>::size_type a = 0; a < vChans.size(); a++)
for (vector<CChan*>::size_type a = 0; a < vChans.size(); a++)
vsArgs.push_back(vChans[a]->GetName());
CallBack("OnQuit", vsArgs);
@@ -356,7 +356,7 @@ public:
VPString vsArgs;
vsArgs.push_back(Nick.GetNickMask());
vsArgs.push_back(sNewNick);
for(vector<CChan*>::size_type a = 0; a < vChans.size(); a++)
for (vector<CChan*>::size_type a = 0; a < vChans.size(); a++)
vsArgs.push_back(vChans[a]->GetName());
CallBack("OnNick", vsArgs);
@@ -474,7 +474,7 @@ public:
{
CString sCommand = sLine.Token(0);
if(sCommand.CaseCmp("loadperlmod", 11) == 0 || sCommand.CaseCmp("unloadperlmod", 13) == 0 || sCommand.CaseCmp("reloadperlmod", 13) == 0)
if (sCommand.CaseCmp("loadperlmod", 11) == 0 || sCommand.CaseCmp("unloadperlmod", 13) == 0 || sCommand.CaseCmp("reloadperlmod", 13) == 0)
{
CString sModule = sLine.Token(1);
if (sModule.Right(3) != ".pm")
@@ -662,7 +662,7 @@ XS(XS_ZNC_GetNicks)
const map< CString,CNick* > & mscNicks = pChan->GetNicks();
for(map< CString,CNick* >::const_iterator it = mscNicks.begin(); it != mscNicks.end(); it++)
for (map< CString,CNick* >::const_iterator it = mscNicks.begin(); it != mscNicks.end(); it++)
{
CNick & cNick = *(it->second);
CPerlHash cHash;
@@ -693,7 +693,7 @@ XS(XS_ZNC_GetString)
PString sReturn;
CString sName = (char *)SvPV(ST(0),PL_na);
if(sName == "UserName") sReturn = pUser->GetUserName();
if (sName == "UserName") sReturn = pUser->GetUserName();
else if (sName == "Nick") sReturn = pUser->GetNick();
else if (sName == "AltNick") sReturn = pUser->GetAltNick();
else if (sName == "Ident") sReturn = pUser->GetIdent();
@@ -946,7 +946,7 @@ CModPerl::EModRet CModPerl::CallBack(const PString & sHookName, const VPString &
else
sFuncToCall = ZNCCallSockCB;
}
for(VPString::size_type a = 0; a < vsArgs.size(); a++)
for (VPString::size_type a = 0; a < vsArgs.size(); a++)
XPUSHs(vsArgs[a].GetSV());
PUTBACK;
@@ -1054,7 +1054,7 @@ void CModPerl::LoadPerlMod(const CString & sModule)
void CModPerl::DestroyAllSocks(const CString & sModuleName)
{
for(u_int a = 0; a < m_pManager->size(); a++)
for (u_int a = 0; a < m_pManager->size(); a++)
{
if ((*m_pManager)[a]->GetSockName() == ZNCSOCK)
{
+3 -3
View File
@@ -32,16 +32,16 @@ public:
virtual void OnModCommand(const CString& sCommand)
{
CString sCmdName = sCommand.Token(0).AsLower();
if(sCmdName == "set") {
if (sCmdName == "set") {
CString sPass = sCommand.Token(1, true);
m_sPass = sPass;
PutModule("Password set");
} else if(sCmdName == "show") {
} else if (sCmdName == "show") {
if (m_sPass.empty())
PutModule("No password set");
else
PutModule("Current password: " + m_sPass);
} else if(sCmdName == "save") {
} else if (sCmdName == "save") {
SetNV("Password", m_sPass);
PutModule("Saved!");
} else {
+23 -23
View File
@@ -41,7 +41,7 @@ public:
GLOBALMODCONSTRUCTOR(CPartylineMod) {}
virtual ~CPartylineMod() {
while(m_ssChannels.size()) {
while (m_ssChannels.size()) {
delete *m_ssChannels.begin();
m_ssChannels.erase(m_ssChannels.begin());
}
@@ -87,13 +87,13 @@ public:
CPartylineChannel* pChannel;
it->second.Split(",", vsChannels, false);
if(!pUser) {
if (!pUser) {
// TODO: give some usefull message?
continue;
}
for(VCString::iterator i = vsChannels.begin(); i != vsChannels.end(); i++) {
if(i->Trim_n().empty())
for (VCString::iterator i = vsChannels.begin(); i != vsChannels.end(); i++) {
if (i->Trim_n().empty())
continue;
pChannel = GetChannel(*i);
JoinUser(pUser, pChannel);
@@ -108,7 +108,7 @@ public:
CString sChans;
const CString &sUser = pUser->GetUserName();
for(set<CPartylineChannel*>::iterator it = m_ssChannels.begin();
for (set<CPartylineChannel*>::iterator it = m_ssChannels.begin();
it != m_ssChannels.end(); it++) {
if ((*it)->IsFixedChan(sUser)) {
sChans += "," + (*it)->GetName();
@@ -449,7 +449,7 @@ public:
PutModule(sTmp);
}
} else if (sCommand.CaseCmp("ADDFIXCHAN") == 0) {
if(!m_pUser->IsAdmin()) {
if (!m_pUser->IsAdmin()) {
PutModule("Access denied");
return;
}
@@ -458,12 +458,12 @@ public:
CUser* pUser = CZNC::Get().FindUser(sUser);
CPartylineChannel* pChan;
if(sChan.Left(2) != "~#") {
if (sChan.Left(2) != "~#") {
PutModule("Invalid channel name");
return;
}
if(pUser == NULL) {
if (pUser == NULL) {
PutModule("Unknown User '" + sUser + "'");
return;
}
@@ -476,7 +476,7 @@ public:
PutModule("Fixed " + sUser + " to channel " + sChan);
} else if (sCommand.CaseCmp("DELFIXCHAN") == 0) {
if(!m_pUser->IsAdmin()) {
if (!m_pUser->IsAdmin()) {
PutModule("Access denied");
return;
}
@@ -485,12 +485,12 @@ public:
CUser* pUser = CZNC::Get().FindUser(sUser);
CPartylineChannel* pChan = FindChannel(sChan);
if(pUser == NULL) {
if (pUser == NULL) {
PutModule("Unknown User '" + sUser + "'");
return;
}
if(!pChan || !pChan->IsFixedChan(sUser)) {
if (!pChan || !pChan->IsFixedChan(sUser)) {
PutModule(sUser + " is not in " + sChan + " or isnt fixed to it");
return;
}
@@ -501,38 +501,38 @@ public:
PutModule("Removed " + sUser + " from " + sChan);
} else if (sCommand.CaseCmp("LISTFIXCHANS") == 0) {
if(!m_pUser->IsAdmin()) {
if (!m_pUser->IsAdmin()) {
PutModule("Access denied");
return;
}
CString sUser = sLine.Token(1);
CUser* pUser = CZNC::Get().FindUser(sUser);
if(!pUser) {
if (!pUser) {
PutModule("User not found!");
return;
}
for (set<CPartylineChannel*>::const_iterator a = m_ssChannels.begin(); a != m_ssChannels.end(); a++) {
if((*a)->IsFixedChan(sUser)) {
if ((*a)->IsFixedChan(sUser)) {
PutModule((*a)->GetName());
}
}
PutModule("--- End of list");
} else if (sCommand.CaseCmp("LISTFIXUSERS") == 0) {
if(!m_pUser->IsAdmin()) {
if (!m_pUser->IsAdmin()) {
PutModule("Access denied");
return;
}
CString sChan = sLine.Token(1).Left(32);
CPartylineChannel* pChan = FindChannel(sChan);
if(!pChan) {
if (!pChan) {
PutModule("Channel does not exist!");
return;
}
const set<CString>& sNicks = pChan->GetNicks();
for(set<CString>::const_iterator it = sNicks.begin(); it != sNicks.end(); it++) {
if(pChan->IsFixedChan(*it)) {
for (set<CString>::const_iterator it = sNicks.begin(); it != sNicks.end(); it++) {
if (pChan->IsFixedChan(*it)) {
PutModule(*it);
}
}
@@ -556,9 +556,9 @@ public:
void PutChan(const set<CString>& ssNicks, const CString& sLine, bool bIncludeCurUser = true, bool bIncludeClient = true, CUser* pUser = NULL, CClient* pClient = NULL) {
const map<CString, CUser*>& msUsers = CZNC::Get().GetUserMap();
if(!pUser)
if (!pUser)
pUser = m_pUser;
if(!pClient)
if (!pClient)
pClient = m_pClient;
for (map<CString, CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); it++) {
@@ -601,8 +601,8 @@ public:
CPartylineChannel* FindChannel(const CString& sChan) {
CString sChannel = sChan.AsLower();
for(set<CPartylineChannel*>::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); it++) {
if((*it)->GetName().AsLower() == sChannel)
for (set<CPartylineChannel*>::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); it++) {
if ((*it)->GetName().AsLower() == sChannel)
return *it;
}
@@ -612,7 +612,7 @@ public:
CPartylineChannel* GetChannel(const CString& sChannel) {
CPartylineChannel* pChannel = FindChannel(sChannel);
if(pChannel == NULL) {
if (pChannel == NULL) {
pChannel = new CPartylineChannel(sChannel.AsLower());
m_ssChannels.insert(pChannel);
}
+10 -10
View File
@@ -29,17 +29,17 @@ public:
virtual void OnModCommand(const CString& sCommand)
{
CString sCmdName = sCommand.Token(0).AsLower();
if(sCmdName == "add")
if (sCmdName == "add")
{
CString sPerf = sCommand.Token(1, true);
if(sPerf.Left(1) == "/")
if (sPerf.Left(1) == "/")
sPerf.LeftChomp();
if(sPerf.Token(0).CaseCmp("MSG") == 0) {
if (sPerf.Token(0).CaseCmp("MSG") == 0) {
sPerf = "PRIVMSG " + sPerf.Token(1, true);
}
if((sPerf.Token(0).CaseCmp("PRIVMSG") == 0 ||
if ((sPerf.Token(0).CaseCmp("PRIVMSG") == 0 ||
sPerf.Token(0).CaseCmp("NOTICE") == 0) &&
sPerf.Token(2).Left(1) != ":") {
sPerf = sPerf.Token(0) + " " + sPerf.Token(1)
@@ -48,7 +48,7 @@ public:
m_vPerform.push_back(sPerf);
PutModule("Added!");
Save();
} else if(sCmdName == "del")
} else if (sCmdName == "del")
{
u_int iNum = atoi(sCommand.Token(1, true).c_str());
if (iNum > m_vPerform.size() || iNum <= 0)
@@ -62,14 +62,14 @@ public:
PutModule("Command Erased.");
}
Save();
} else if(sCmdName == "list")
} else if (sCmdName == "list")
{
int i = 1;
CString sExpanded;
for(VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++, i++)
for (VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++, i++)
{
sExpanded = GetUser()->ExpandString(*it);
if(sExpanded != *it)
if (sExpanded != *it)
PutModule(CString(i) + ": " + *it + " (" + sExpanded + ")");
else
PutModule(CString(i) + ": " + *it);
@@ -83,7 +83,7 @@ public:
virtual void OnIRCConnected()
{
for(VCString::iterator it = m_vPerform.begin();
for (VCString::iterator it = m_vPerform.begin();
it != m_vPerform.end(); it++)
{
PutIRC(GetUser()->ExpandString(*it));
@@ -95,7 +95,7 @@ private:
{
CString sBuffer = "";
for(VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++)
for (VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++)
{
sBuffer += *it + "\n";
}
+8 -8
View File
@@ -80,7 +80,7 @@ public:
}
const vector<CChan *>& vChans = m_pUser->GetChans();
for(u_int a = 0; a < vChans.size(); a++)
for (u_int a = 0; a < vChans.size(); a++)
{
if (!vChans[a]->KeepBuffer())
continue;
@@ -105,7 +105,7 @@ public:
CString sLine;
CString::size_type iPos = 0;
while(ReadLine(sFile, sLine, iPos))
while (ReadLine(sFile, sLine, iPos))
{
sLine.Trim();
pChan->AddBuffer(sLine);
@@ -125,7 +125,7 @@ public:
if (!m_sPassword.empty())
{
const vector<CChan *>& vChans = m_pUser->GetChans();
for(u_int a = 0; a < vChans.size(); a++)
for (u_int a = 0; a < vChans.size(); a++)
{
if (!vChans[a]->KeepBuffer())
continue;
@@ -142,7 +142,7 @@ public:
CString sFile = CRYPT_VERIFICATION_TOKEN;
for(u_int b = 0; b < vBuffer.size(); b++)
for (u_int b = 0; b < vBuffer.size(); b++)
sFile += vBuffer[b] + "\n";
CBlowfish c(m_sPassword, BF_ENCRYPT);
@@ -181,7 +181,7 @@ public:
{
CString sLine;
iPos = 0;
while(ReadLine(sFile, sLine, iPos))
while (ReadLine(sFile, sLine, iPos))
{
sLine.Trim();
PutModule("[" + sLine + "]");
@@ -209,7 +209,7 @@ public:
{
CString sLine;
CString::size_type iPos = 0;
while(ReadLine(sFile, sLine, iPos))
while (ReadLine(sFile, sLine, iPos))
{
sLine.Trim();
PutUser(sLine);
@@ -241,7 +241,7 @@ public:
}
virtual void OnQuit(const CNick& cNick, const CString& sMessage, const vector<CChan*>& vChans)
{
for(u_int a = 0; a < vChans.size(); a++)
for (u_int a = 0; a < vChans.size(); a++)
{
if (!vChans[a]->KeepBuffer())
continue;
@@ -253,7 +253,7 @@ public:
virtual void OnNick(const CNick& cNick, const CString& sNewNick, const vector<CChan*>& vChans)
{
for(u_int a = 0; a < vChans.size(); a++)
for (u_int a = 0; a < vChans.size(); a++)
{
if (!vChans[a]->KeepBuffer())
continue;
+7 -7
View File
@@ -98,7 +98,7 @@ public:
virtual void DumpBuffer()
{
for(vector<CS_STRING>::reverse_iterator it = m_vBuffer.rbegin(); it != m_vBuffer.rend(); it++)
for (vector<CS_STRING>::reverse_iterator it = m_vBuffer.rbegin(); it != m_vBuffer.rend(); it++)
ReadLine(*it);
m_vBuffer.clear();
@@ -136,7 +136,7 @@ public:
virtual void OnUserAttached()
{
CString sName = "SCHAT::" + m_pUser->GetUserName();
for(u_int a = 0; a < m_pManager->size(); a++)
for (u_int a = 0; a < m_pManager->size(); a++)
{
if ((*m_pManager)[a]->GetSockName() != sName.c_str() ||
((*m_pManager)[a]->GetType() == CSChatSock::LISTENER))
@@ -150,7 +150,7 @@ public:
void CleanSocks()
{
CString sName = "SCHAT::" + m_pUser->GetUserName();
for(u_int a= 0; a < m_pManager->size(); a++)
for (u_int a= 0; a < m_pManager->size(); a++)
{
if ((*m_pManager)[a]->GetSockName() == sName)
m_pManager->DelSock(a--);
@@ -185,7 +185,7 @@ public:
if ((sCom.CaseCmp("chat") == 0) && (!sArgs.empty())) {
CString sSockName = "SCHAT::" + m_pUser->GetUserName();
CString sNick = "(s)" + sArgs;
for(u_int a= 0; a < m_pManager->size(); a++)
for (u_int a= 0; a < m_pManager->size(); a++)
{
if ((*m_pManager)[a]->GetSockName() != sSockName)
continue;
@@ -231,7 +231,7 @@ public:
Table.AddColumn("Port");
Table.AddColumn("Status");
Table.AddColumn("Cipher");
for(u_int a= 0; a < m_pManager->size(); a++)
for (u_int a= 0; a < m_pManager->size(); a++)
{
if ((*m_pManager)[a]->GetSockName() != sName)
continue;
@@ -277,7 +277,7 @@ public:
} else if (sCom.CaseCmp("close") == 0)
{
CString sName = "SCHAT::" + m_pUser->GetUserName();
for(u_int a = 0; a < m_pManager->size(); a++)
for (u_int a = 0; a < m_pManager->size(); a++)
{
if ((*m_pManager)[a]->GetSockName() != sName)
continue;
@@ -302,7 +302,7 @@ public:
Table.AddColumn("RemoteIP:Port");
Table.AddColumn("Type");
Table.AddColumn("Cipher");
for(u_int a = 0; a < m_pManager->size(); a++)
for (u_int a = 0; a < m_pManager->size(); a++)
{
Table.AddRow();
Csock *pSock = (*m_pManager)[a];
+2 -2
View File
@@ -59,7 +59,7 @@ public:
else if ((sCmdName == "list") && (sChannel.empty()))
{
int i = 1;
for(MCString::iterator it = BeginNV(); it != EndNV(); it++, i++)
for (MCString::iterator it = BeginNV(); it != EndNV(); it++, i++)
{
if (it->second.empty())
PutModule(CString(i) + ": " + it->first);
@@ -76,7 +76,7 @@ public:
virtual void RunJob()
{
for(MCString::iterator it = BeginNV(); it != EndNV(); it++)
for (MCString::iterator it = BeginNV(); it != EndNV(); it++)
{
if (!m_pUser->FindChan(it->first))
{
+12 -12
View File
@@ -39,7 +39,7 @@ CZNC::CZNC() {
}
CZNC::~CZNC() {
if(m_pISpoofLockFile)
if (m_pISpoofLockFile)
ReleaseISpoof();
#ifdef _MODULES
@@ -226,12 +226,12 @@ int CZNC::Loop() {
}
bool CZNC::WriteISpoof(CUser* pUser) {
if(m_pISpoofLockFile != NULL)
if (m_pISpoofLockFile != NULL)
return false;
if (!m_sISpoofFile.empty()) {
m_pISpoofLockFile = new CLockFile;
if(!m_pISpoofLockFile->TryExLock(m_sISpoofFile, true)) {
if (!m_pISpoofLockFile->TryExLock(m_sISpoofFile, true)) {
delete m_pISpoofLockFile;
m_pISpoofLockFile = NULL;
return false;
@@ -257,7 +257,7 @@ bool CZNC::WriteISpoof(CUser* pUser) {
}
void CZNC::ReleaseISpoof() {
if(m_pISpoofLockFile == NULL)
if (m_pISpoofLockFile == NULL)
return;
if (!m_sISpoofFile.empty()) {
@@ -563,7 +563,7 @@ bool CZNC::WriteNewConfig(const CString& sConfig) {
// Listen
unsigned int uPort = 0;
while(!CUtils::GetNumInput("What port would you like ZNC to listen on?", uPort, 1, 65535)) ;
while (!CUtils::GetNumInput("What port would you like ZNC to listen on?", uPort, 1, 65535)) ;
CString sSSL;
#ifdef HAVE_LIBSSL
@@ -749,8 +749,8 @@ bool CZNC::WriteNewConfig(const CString& sConfig) {
bool bSSL = false;
uPort = 0;
while(!CUtils::GetInput("IRC server", sHost, "", "host only") || !CServer::IsValidHostName(sHost)) ;
while(!CUtils::GetNumInput("[" + sHost + "] Port", uPort, 1, 65535, 6667)) ;
while (!CUtils::GetInput("IRC server", sHost, "", "host only") || !CServer::IsValidHostName(sHost)) ;
while (!CUtils::GetNumInput("[" + sHost + "] Port", uPort, 1, 65535, 6667)) ;
CUtils::GetInput("[" + sHost + "] Password (probably empty)", sPass);
#ifdef HAVE_LIBSSL
@@ -1213,14 +1213,14 @@ bool CZNC::DoRehash(CString& sError)
pUser->SetTimestampPrepend(sValue.ToBool());
continue;
} else if (sName.CaseCmp("Timestamp") == 0) {
if(sValue.Trim_n().CaseCmp("true") != 0) {
if(sValue.Trim_n().CaseCmp("append") == 0) {
if (sValue.Trim_n().CaseCmp("true") != 0) {
if (sValue.Trim_n().CaseCmp("append") == 0) {
pUser->SetTimestampAppend(true);
pUser->SetTimestampPrepend(false);
} else if(sValue.Trim_n().CaseCmp("prepend") == 0) {
} else if (sValue.Trim_n().CaseCmp("prepend") == 0) {
pUser->SetTimestampAppend(false);
pUser->SetTimestampPrepend(true);
} else if(sValue.Trim_n().CaseCmp("false") == 0) {
} else if (sValue.Trim_n().CaseCmp("false") == 0) {
pUser->SetTimestampAppend(false);
pUser->SetTimestampPrepend(false);
} else {
@@ -1377,7 +1377,7 @@ bool CZNC::DoRehash(CString& sError)
m_sISpoofFormat = sValue;
continue;
} else if (sName.CaseCmp("ISpoofFile") == 0) {
if(sValue.Left(2) == "~/") {
if (sValue.Left(2) == "~/") {
sValue.LeftChomp(2);
sValue = GetHomePath() + "/" + sValue;
}