Some more fun with tabs

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1966 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-05-02 08:36:57 +00:00
parent 6b3f8929c7
commit 99f1efc843
37 changed files with 275 additions and 277 deletions
+37 -37
View File
@@ -14,36 +14,36 @@
#include "znc.h"
#include "WebModules.h"
#define CALLMOD(MOD, CLIENT, USER, FUNC) { \
CModule* pModule = CZNC::Get().GetModules().FindModule(MOD); \
if (pModule) { \
try { \
pModule->SetClient(CLIENT); \
pModule->SetUser(USER); \
pModule->FUNC; \
pModule->SetClient(NULL); \
pModule->SetUser(NULL); \
} catch (CModule::EModException e) { \
if (e == CModule::UNLOAD) { \
CZNC::Get().GetModules().UnloadModule(MOD); \
} \
} \
} else { \
pModule = (USER)->GetModules().FindModule(MOD); \
if (pModule) { \
try { \
pModule->SetClient(CLIENT); \
pModule->FUNC; \
pModule->SetClient(NULL); \
} catch (CModule::EModException e) { \
if (e == CModule::UNLOAD) { \
(USER)->GetModules().UnloadModule(MOD); \
} \
} \
} else { \
PutStatus("No such module [" + MOD + "]"); \
} \
} \
#define CALLMOD(MOD, CLIENT, USER, FUNC) { \
CModule* pModule = CZNC::Get().GetModules().FindModule(MOD); \
if (pModule) { \
try { \
pModule->SetClient(CLIENT); \
pModule->SetUser(USER); \
pModule->FUNC; \
pModule->SetClient(NULL); \
pModule->SetUser(NULL); \
} catch (CModule::EModException e) { \
if (e == CModule::UNLOAD) { \
CZNC::Get().GetModules().UnloadModule(MOD); \
} \
} \
} else { \
pModule = (USER)->GetModules().FindModule(MOD); \
if (pModule) { \
try { \
pModule->SetClient(CLIENT); \
pModule->FUNC; \
pModule->SetClient(NULL); \
} catch (CModule::EModException e) { \
if (e == CModule::UNLOAD) { \
(USER)->GetModules().UnloadModule(MOD); \
} \
} \
} else { \
PutStatus("No such module [" + MOD + "]"); \
} \
} \
}
CClient::~CClient() {
@@ -96,7 +96,7 @@ void CClient::ReadLine(const CString& sData) {
AuthUser();
}
return; // Don't forward this msg. ZNC has already registered us.
return; // Don't forward this msg. ZNC has already registered us.
}
} else if (sCommand.Equals("NICK")) {
CString sNick = sLine.Token(1);
@@ -111,7 +111,7 @@ void CClient::ReadLine(const CString& sData) {
if ((m_bGotPass) && (m_bGotUser)) {
AuthUser();
}
return; // Don't forward this msg. ZNC will handle nick changes until auth is complete
return; // Don't forward this msg. ZNC will handle nick changes until auth is complete
}
} else if (sCommand.Equals("USER")) {
if (!IsAttached()) {
@@ -129,7 +129,7 @@ void CClient::ReadLine(const CString& sData) {
"Try /quote PASS <username>:<password>");
}
return; // Don't forward this msg. ZNC has already registered us.
return; // Don't forward this msg. ZNC has already registered us.
}
}
@@ -189,7 +189,7 @@ void CClient::ReadLine(const CString& sData) {
return;
}
} else if (sCommand.Equals("PONG")) {
return; // Block pong replies, we already responded to the pings
return; // Block pong replies, we already responded to the pings
} else if (sCommand.Equals("JOIN")) {
CString sChans = sLine.Token(1);
CString sKey = sLine.Token(2);
@@ -287,8 +287,8 @@ void CClient::ReadLine(const CString& sData) {
} else if (sCommand.Equals("QUIT")) {
m_pUser->UserDisconnected(this);
Close(Csock::CLT_AFTERWRITE); // Treat a client quit as a detach
return; // Don't forward this msg. We don't want the client getting us disconnected.
Close(Csock::CLT_AFTERWRITE); // Treat a client quit as a detach
return; // Don't forward this msg. We don't want the client getting us disconnected.
} else if (sCommand.Equals("PROTOCTL")) {
VCString vsTokens;
VCString::const_iterator it;
@@ -301,7 +301,7 @@ void CClient::ReadLine(const CString& sData) {
m_bUHNames = true;
}
}
return; // If the server understands it, we already enabled namesx / uhnames
return; // If the server understands it, we already enabled namesx / uhnames
} else if (sCommand.Equals("NOTICE")) {
CString sTarget = sLine.Token(1);
CString sMsg = sLine.Token(2, true);
+18 -19
View File
@@ -106,7 +106,7 @@ void CIRCSock::ReadLine(const CString& sData) {
CString sRest = sLine.Token(3, true);
switch (uRaw) {
case 1: {// :irc.server.com 001 nick :Welcome to the Internet Relay Network nick
case 1: { // :irc.server.com 001 nick :Welcome to the Internet Relay Network nick
if (m_bAuthed && sServer == "irc.znc.in") {
// m_bAuthed == true => we already received another 001 => we might be in a traffic loop
m_pUser->PutStatus("ZNC seems to be connected to itself, disconnecting...");
@@ -115,7 +115,7 @@ void CIRCSock::ReadLine(const CString& sData) {
}
m_pUser->SetIRCServer(sServer);
SetTimeout(240, TMO_READ); // Now that we are connected, let nature take its course
SetTimeout(240, TMO_READ); // Now that we are connected, let nature take its course
PutIRC("WHO " + sNick);
m_bAuthed = true;
@@ -152,13 +152,13 @@ void CIRCSock::ReadLine(const CString& sData) {
case 2:
case 3:
case 4:
case 250: // highest connection count
case 251: // user count
case 252: // oper count
case 254: // channel count
case 255: // client count
case 265: // local users
case 266: // global users
case 250: // highest connection count
case 251: // user count
case 252: // oper count
case 254: // channel count
case 255: // client count
case 265: // local users
case 266: // global users
m_pUser->UpdateRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
break;
case 305:
@@ -167,7 +167,7 @@ void CIRCSock::ReadLine(const CString& sData) {
case 306:
m_pUser->SetIRCAway(true);
break;
case 324: { // MODE
case 324: { // MODE
sRest.Trim();
CChan* pChan = m_pUser->FindChan(sRest.Token(0));
@@ -247,7 +247,7 @@ void CIRCSock::ReadLine(const CString& sData) {
break;
}
case 353: { // NAMES
case 353: { // NAMES
sRest.Trim();
// Todo: allow for non @+= server msgs
CChan* pChan = m_pUser->FindChan(sRest.Token(1));
@@ -267,8 +267,8 @@ void CIRCSock::ReadLine(const CString& sData) {
// We forwarded it already, so return
return;
}
case 366: { // end of names list
m_pUser->PutUser(sLine); // First send them the raw
case 366: { // end of names list
m_pUser->PutUser(sLine); // First send them the raw
// :irc.server.com 366 nick #chan :End of /NAMES list.
CChan* pChan = m_pUser->FindChan(sRest.Token(0));
@@ -290,13 +290,13 @@ void CIRCSock::ReadLine(const CString& sData) {
}
}
return; // return so we don't send them the raw twice
return; // return so we don't send them the raw twice
}
case 375: // begin motd
case 422: // MOTD File is missing
case 375: // begin motd
case 422: // MOTD File is missing
m_pUser->ClearMotdBuffer();
case 372: // motd
case 376: // end motd
case 372: // motd
case 376: // end motd
m_pUser->AddMotdBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
break;
case 437:
@@ -487,7 +487,6 @@ void CIRCSock::ReadLine(const CString& sData) {
}
} else if (sTarget == m_Nick.GetNick()) {
CString sModeArg = sModes.Token(0);
// CString sArgs = sModes.Token(1, true); Usermode changes got no params
bool bAdd = true;
/* no module call defined (yet?)
MODULECALL(OnRawUserMode(*pOpNick, *this, sModeArg, sArgs), m_pUser, NULL, );
+53 -53
View File
@@ -18,62 +18,62 @@
# warning "your crap box doesnt define RTLD_LOCAL !?"
#endif
#define _MODUNLOADCHK(func, type) \
for (unsigned int a = 0; a < size(); a++) { \
try { \
type* pMod = (type *) (*this)[a]; \
CClient* pOldClient = pMod->GetClient(); \
pMod->SetClient(m_pClient); \
if (m_pUser) { \
CUser* pOldUser = pMod->GetUser(); \
pMod->SetUser(m_pUser); \
pMod->func; \
pMod->SetUser(pOldUser); \
} else { \
pMod->func; \
} \
pMod->SetClient(pOldClient); \
} catch (CModule::EModException e) { \
if (e == CModule::UNLOAD) { \
UnloadModule((*this)[a]->GetModName()); \
} \
} \
#define _MODUNLOADCHK(func, type) \
for (unsigned int a = 0; a < size(); a++) { \
try { \
type* pMod = (type *) (*this)[a]; \
CClient* pOldClient = pMod->GetClient(); \
pMod->SetClient(m_pClient); \
if (m_pUser) { \
CUser* pOldUser = pMod->GetUser(); \
pMod->SetUser(m_pUser); \
pMod->func; \
pMod->SetUser(pOldUser); \
} else { \
pMod->func; \
} \
pMod->SetClient(pOldClient); \
} catch (CModule::EModException e) { \
if (e == CModule::UNLOAD) { \
UnloadModule((*this)[a]->GetModName()); \
} \
} \
}
#define MODUNLOADCHK(func) _MODUNLOADCHK(func, CModule)
#define GLOBALMODCALL(func) _MODUNLOADCHK(func, CGlobalModule)
#define _MODHALTCHK(func, type) \
bool bHaltCore = false; \
for (unsigned int a = 0; a < size(); a++) { \
try { \
type* pMod = (type*) (*this)[a]; \
CModule::EModRet e = CModule::CONTINUE; \
CClient* pOldClient = pMod->GetClient(); \
pMod->SetClient(m_pClient); \
if (m_pUser) { \
CUser* pOldUser = pMod->GetUser(); \
pMod->SetUser(m_pUser); \
e = pMod->func; \
pMod->SetUser(pOldUser); \
} else { \
e = pMod->func; \
} \
pMod->SetClient(pOldClient); \
if (e == CModule::HALTMODS) { \
break; \
} else if (e == CModule::HALTCORE) { \
bHaltCore = true; \
} else if (e == CModule::HALT) { \
bHaltCore = true; \
break; \
} \
} catch (CModule::EModException e) { \
if (e == CModule::UNLOAD) { \
UnloadModule((*this)[a]->GetModName()); \
} \
} \
} \
#define _MODHALTCHK(func, type) \
bool bHaltCore = false; \
for (unsigned int a = 0; a < size(); a++) { \
try { \
type* pMod = (type*) (*this)[a]; \
CModule::EModRet e = CModule::CONTINUE; \
CClient* pOldClient = pMod->GetClient(); \
pMod->SetClient(m_pClient); \
if (m_pUser) { \
CUser* pOldUser = pMod->GetUser(); \
pMod->SetUser(m_pUser); \
e = pMod->func; \
pMod->SetUser(pOldUser); \
} else { \
e = pMod->func; \
} \
pMod->SetClient(pOldClient); \
if (e == CModule::HALTMODS) { \
break; \
} else if (e == CModule::HALTCORE) { \
bHaltCore = true; \
} else if (e == CModule::HALT) { \
bHaltCore = true; \
break; \
} \
} catch (CModule::EModException e) { \
if (e == CModule::UNLOAD) { \
UnloadModule((*this)[a]->GetModName()); \
} \
} \
} \
return bHaltCore;
#define MODHALTCHK(func) _MODHALTCHK(func, CModule)
@@ -751,7 +751,7 @@ bool CModules::UnloadModule(const CString& sModule) {
}
bool CModules::UnloadModule(const CString& sModule, CString& sRetMsg) {
CString sMod = sModule; // Make a copy incase the reference passed in is from CModule::GetModName()
CString sMod = sModule; // Make a copy incase the reference passed in is from CModule::GetModName()
CModule* pModule = FindModule(sMod);
sRetMsg = "";
@@ -804,7 +804,7 @@ bool CModules::UnloadModule(const CString& sModule, CString& sRetMsg) {
}
bool CModules::ReloadModule(const CString& sModule, const CString& sArgs, CUser* pUser, CString& sRetMsg) {
CString sMod = sModule; // Make a copy incase the reference passed in is from CModule::GetModName()
CString sMod = sModule; // Make a copy incase the reference passed in is from CModule::GetModName()
sRetMsg = "";
if (!UnloadModule(sMod, sRetMsg)) {
return false;
+1 -1
View File
@@ -173,7 +173,7 @@ void CTemplate::RemovePath(const CString& sPath) {
for (list<pair<CString, bool> >::iterator it = m_lsbPaths.begin(); it != m_lsbPaths.end(); ++it) {
if (it->first == sPath) {
m_lsbPaths.remove(*it);
RemovePath(sPath); // @todo probably shouldn't use recursion, being lazy
RemovePath(sPath); // @todo probably shouldn't use recursion, being lazy
return;
}
}
+3 -3
View File
@@ -60,8 +60,8 @@ CUser::CUser(const CString& sUserName) {
m_uBytesRead = 0;
m_uBytesWritten = 0;
m_pModules = new CModules;
m_RawBuffer.SetLineCount(100); // This should be more than enough raws, especially since we are buffering the MOTD separately
m_MotdBuffer.SetLineCount(200); // This should be more than enough motd lines
m_RawBuffer.SetLineCount(100); // This should be more than enough raws, especially since we are buffering the MOTD separately
m_MotdBuffer.SetLineCount(200); // This should be more than enough motd lines
m_bMultiClients = true;
m_bBounceDCCs = true;
m_eHashType = HASH_NONE;
@@ -913,7 +913,7 @@ CServer* CUser::GetNextServer() {
m_uServerIdx = 0;
}
return m_vServers[m_uServerIdx++]; // Todo: cycle through these
return m_vServers[m_uServerIdx++];
}
CServer* CUser::GetCurrentServer() const {
+1 -1
View File
@@ -362,7 +362,7 @@ bool CWebSock::AddModLoop(const CString& sLoopName, CModule& Module) {
bool bActive = (m_sModName == Module.GetModName() && m_sPage == SubPage->GetName());
if (SubPage->RequiresAdmin() && !GetSession()->IsAdmin()) {
continue; // Don't add admin-only subpages to requests from non-admin users
continue; // Don't add admin-only subpages to requests from non-admin users
}
CTemplate& SubRow = Row.AddRow("SubPageLoop");
+5 -5
View File
@@ -194,7 +194,7 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const {
if ((*p == '&') && (strnchr((unsigned char*) p, ';', sizeof(pTmp) - 1, pTmp, &iCounted))) {
// please note that we do not have any Unicode or UTF-8 support here at all.
if ((iCounted >= 3) && (pTmp[1] == '#')) { // do XML and HTML &#97; &#x3c
if ((iCounted >= 3) && (pTmp[1] == '#')) { // do XML and HTML &#97; &#x3c
int base = 10;
if ((pTmp[2] & 0xDF) == 'X') {
@@ -221,7 +221,7 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const {
if (ch > 0) {
a += iCounted;
} else {
ch = *p; // Not a valid escape, just record the &
ch = *p; // Not a valid escape, just record the &
}
} else {
ch = *p;
@@ -884,10 +884,10 @@ CString CString::ToTimeStr(unsigned long s) {
const unsigned long y = d * 365;
CString sRet;
#define TIMESPAN(time, str) \
if (s >= time) { \
#define TIMESPAN(time, str) \
if (s >= time) { \
sRet += CString(s / time) + str " "; \
s = s % time; \
s = s % time; \
}
TIMESPAN(y, "y");
TIMESPAN(w, "w");
+10 -10
View File
@@ -11,18 +11,18 @@
#include <sys/wait.h>
static const struct option g_LongOpts[] = {
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'v' },
{ "debug", no_argument, 0, 'D' },
{ "foreground", no_argument, 0, 'f' },
{ "no-color", no_argument, 0, 'n' },
{ "allow-root", no_argument, 0, 'r' },
{ "makeconf", no_argument, 0, 'c' },
{ "makepass", no_argument, 0, 's' },
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'v' },
{ "debug", no_argument, 0, 'D' },
{ "foreground", no_argument, 0, 'f' },
{ "no-color", no_argument, 0, 'n' },
{ "allow-root", no_argument, 0, 'r' },
{ "makeconf", no_argument, 0, 'c' },
{ "makepass", no_argument, 0, 's' },
#ifdef HAVE_LIBSSL
{ "makepem", no_argument, 0, 'p' },
{ "makepem", no_argument, 0, 'p' },
#endif /* HAVE_LIBSSL */
{ "datadir", required_argument, 0, 'd' },
{ "datadir", required_argument, 0, 'd' },
{ 0, 0, 0, 0 }
};
+3 -3
View File
@@ -614,7 +614,7 @@ class CAdminMod : public CModule {
PutModule("Loading modules has been denied");
return;
}
CModule *pMod = (pUser)->GetModules().FindModule(sModName);
if (!pMod) {
if (!(pUser)->GetModules().LoadModule(sModName, sArgs, pUser, sModRet, false)) {
@@ -647,11 +647,11 @@ class CAdminMod : public CModule {
CUser* pUser = GetUser(sUsername);
if (!pUser)
return;
if (pUser->DenyLoadMod() && !m_pUser->IsAdmin()) {
PutModule("Loading modules has been denied");
return;
}
}
if (!(pUser)->GetModules().UnloadModule(sModName, sModRet)) {
PutModule("Unable to unload module [" + sModName + "] [" + sModRet + "]");
+2 -2
View File
@@ -158,8 +158,8 @@ private:
LOG_TO_SYSLOG = 1 << 1,
LOG_TO_BOTH = LOG_TO_FILE | LOG_TO_SYSLOG
};
LogMode m_eLogMode;
CString m_sLogFile;
LogMode m_eLogMode;
CString m_sLogFile;
};
GLOBALMODULEDEFS(CAdminLogMod, "Log ZNC events to file and/or syslog.")
+2 -2
View File
@@ -212,8 +212,8 @@ public:
return false;
}
private:
vector<CString> m_vsChans;
vector<CString> m_vsNegChans;
vector<CString> m_vsChans;
vector<CString> m_vsNegChans;
};
MODULEDEFS(CChanAttach, "Reattaches you to channels on activity.")
+2 -2
View File
@@ -220,8 +220,8 @@ protected:
}
private:
vector<CString> m_vsChans;
vector<CString> m_vsNegChans;
vector<CString> m_vsChans;
vector<CString> m_vsNegChans;
};
MODULEDEFS(CAutoCycleMod, "Rejoins channels to gain Op if you're the only user left")
+8 -8
View File
@@ -11,7 +11,7 @@
class CAutoOpMod;
#define AUTOOP_CHALLENGE_LENGTH 32
#define AUTOOP_CHALLENGE_LENGTH 32
class CAutoOpTimer : public CTimer {
public:
@@ -27,7 +27,7 @@ private:
protected:
virtual void RunJob();
CAutoOpMod* m_pParent;
CAutoOpMod* m_pParent;
};
class CAutoOpUser {
@@ -121,10 +121,10 @@ public:
}
private:
protected:
CString m_sUsername;
CString m_sUserKey;
CString m_sHostmask;
set<CString> m_ssChans;
CString m_sUsername;
CString m_sUserKey;
CString m_sHostmask;
set<CString> m_ssChans;
};
class CAutoOpMod : public CModule {
@@ -452,8 +452,8 @@ public:
}
}
private:
map<CString, CAutoOpUser*> m_msUsers;
MCString m_msQueue;
map<CString, CAutoOpUser*> m_msUsers;
MCString m_msQueue;
};
void CAutoOpTimer::RunJob() {
+1 -1
View File
@@ -85,7 +85,7 @@ public:
}
private:
TCacheMap<CString> m_Messaged;
TCacheMap<CString> m_Messaged;
};
MODULEDEFS(CAutoReplyMod, "Reply to queries when you are away")
+8 -8
View File
@@ -83,7 +83,7 @@ public:
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
Back(); // ircd seems to remember your away if you killed the client and came back
}
bool BootStrap()
@@ -367,8 +367,8 @@ public:
bool IsAway() { return(m_bIsAway); }
private:
CString m_sPassword;
bool m_bBootError;
CString m_sPassword;
bool m_bBootError;
bool DecryptMessages(CString & sBuffer)
{
CString sMessages = GetPath();
@@ -413,11 +413,11 @@ private:
m_vMessages.push_back(sText);
}
time_t m_iLastSentData;
bool m_bIsAway;
time_t m_iAutoAway;
vector<CString> m_vMessages;
CString m_sReason;
time_t m_iLastSentData;
bool m_bIsAway;
time_t m_iAutoAway;
vector<CString> m_vMessages;
CString m_sReason;
};
+4 -4
View File
@@ -20,7 +20,7 @@ private:
virtual void RunJob();
private:
CAwayNickMod& m_Module;
CAwayNickMod& m_Module;
};
class CBackNickTimer : public CTimer {
@@ -40,7 +40,7 @@ private:
}
private:
CModule& m_Module;
CModule& m_Module;
};
class CAwayNickMod : public CModule {
@@ -170,8 +170,8 @@ public:
}
private:
CString m_sFormat;
CString m_sAwayNick;
CString m_sFormat;
CString m_sAwayNick;
};
CAwayNickTimer::CAwayNickTimer(CAwayNickMod& Module)
+1 -1
View File
@@ -68,7 +68,7 @@ public:
}
private:
bool m_bWriteConf;
bool m_bWriteConf;
};
MODULEDEFS(CChanSaverMod, "Keep config up-to-date when user joins/parts")
+4 -4
View File
@@ -97,9 +97,9 @@ public:
}
private:
protected:
CString m_sUsername;
CString m_sHostmask;
set<CString> m_ssChans;
CString m_sUsername;
CString m_sHostmask;
set<CString> m_ssChans;
};
class CAutoVoiceMod : public CModule {
@@ -271,7 +271,7 @@ public:
}
private:
map<CString, CAutoVoiceUser*> m_msUsers;
map<CString, CAutoVoiceUser*> m_msUsers;
};
MODULEDEFS(CAutoVoiceMod, "Auto voice the good guys")
+18 -18
View File
@@ -18,10 +18,10 @@ using std::stringstream;
struct EmailST
{
CString sFrom;
CString sSubject;
CString sUidl;
u_int iSize;
CString sFrom;
CString sSubject;
CString sUidl;
u_int iSize;
};
class CEmailJob : public CTimer
@@ -114,7 +114,7 @@ public:
ssUidls.insert(vEmails[a].sUidl);
}
m_ssUidls = ssUidls; // keep the list in synch
m_ssUidls = ssUidls; // keep the list in synch
if (Table.size()) {
PutModule(Table);
@@ -127,10 +127,10 @@ public:
}
private:
CString m_sMailPath;
time_t m_iLastCheck;
set<CString> m_ssUidls;
bool m_bInitialized;
CString m_sMailPath;
time_t m_iLastCheck;
set<CString> m_ssUidls;
bool m_bInitialized;
};
class CEmailFolder : public CSocket
@@ -146,7 +146,7 @@ public:
virtual ~CEmailFolder()
{
if (!m_sMailBuffer.empty())
ProcessMail(); // get the last one
ProcessMail(); // get the last one
if (!m_vEmails.empty())
m_pModule->ParseEmails(m_vEmails);
@@ -178,7 +178,7 @@ public:
CString sLine(*it);
sLine.Trim();
if (sLine.empty())
break; // out of the headers
break; // out of the headers
if (sLine.Equals("From: ", false, 6))
tmp.sFrom = sLine.substr(6, CString::npos);
@@ -192,10 +192,10 @@ public:
m_vEmails.push_back(tmp);
}
private:
CEmail *m_pModule;
CString m_sMailbox;
CString m_sMailBuffer;
vector<EmailST> m_vEmails;
CEmail *m_pModule;
CString m_sMailbox;
CString m_sMailBuffer;
vector<EmailST> m_vEmails;
};
void CEmail::OnModCommand(const CString& sCommand)
@@ -222,17 +222,17 @@ void CEmail::StartParser()
CString sParserName = "EMAIL::" + m_pUser->GetUserName();
if (m_pManager->FindSockByName(sParserName))
return; // one at a time sucker
return; // one at a time sucker
CFile cFile(m_sMailPath);
if ((!cFile.Exists()) || (cFile.GetSize() == 0))
{
m_bInitialized = true;
return; // der
return; // der
}
if (cFile.GetMTime() <= m_iLastCheck)
return; // only check if modified
return; // only check if modified
int iFD = open(m_sMailPath.c_str(), O_RDONLY);
if (iFD >= 0)
+12 -12
View File
@@ -32,10 +32,10 @@ public:
virtual void ReadLine(const CString& sLine);
private:
protected:
CIMAPAuthMod* m_pIMAPMod;
bool m_bSentLogin;
bool m_bSentReply;
CSmartPtr<CAuthBase> m_spAuth;
CIMAPAuthMod* m_pIMAPMod;
bool m_bSentLogin;
bool m_bSentReply;
CSmartPtr<CAuthBase> m_spAuth;
};
@@ -56,7 +56,7 @@ public:
virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
if (sArgs.Trim_n().empty()) {
return true; // use defaults
return true; // use defaults
}
m_sServer = sArgs.Token(0);
@@ -80,7 +80,7 @@ public:
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
CUser* pUser = CZNC::Get().FindUser(Auth->GetUsername());
if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future
if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future
Auth->RefuseLogin("Invalid User - Halting IMAP Lookup");
return HALT;
}
@@ -109,13 +109,13 @@ public:
// !Getters
private:
// Settings
CString m_sServer;
unsigned short m_uPort;
bool m_bSSL;
CString m_sUserFormat;
CString m_sServer;
unsigned short m_uPort;
bool m_bSSL;
CString m_sUserFormat;
// !Settings
TCacheMap<CString> m_Cache;
TCacheMap<CString> m_Cache;
};
void CIMAPSock::ReadLine(const CString& sLine) {
@@ -139,7 +139,7 @@ void CIMAPSock::ReadLine(const CString& sLine) {
if (pUser && sLine.Equals("AUTH OK", false, 7)) {
m_spAuth->AcceptLogin(*pUser);
m_pIMAPMod->CacheLogin(CString(m_spAuth->GetUsername() + ":" + m_spAuth->GetPassword()).MD5()); // Use MD5 so passes don't sit in memory in plain text
m_pIMAPMod->CacheLogin(CString(m_spAuth->GetUsername() + ":" + m_spAuth->GetPassword()).MD5()); // Use MD5 so passes don't sit in memory in plain text
DEBUG("+++ Successful IMAP lookup");
} else {
m_spAuth->RefuseLogin("Invalid Password");
+8 -8
View File
@@ -17,12 +17,12 @@
#define STDVAR (ClientData cd, Tcl_Interp *irp, int argc, const char *argv[])
#define BADARGS(nl, nh, example) do { \
if ((argc < (nl)) || (argc > (nh))) { \
Tcl_AppendResult(irp, "wrong # args: should be \"", \
argv[0], (example), "\"", NULL); \
return TCL_ERROR; \
} \
#define BADARGS(nl, nh, example) do { \
if ((argc < (nl)) || (argc > (nh))) { \
Tcl_AppendResult(irp, "wrong # args: should be \"", \
argv[0], (example), "\"", NULL); \
return TCL_ERROR; \
} \
} while (0)
class CModTcl;
@@ -34,7 +34,7 @@ public:
virtual ~CModTclTimer() {}
protected:
virtual void RunJob();
CModTcl* m_pParent;
CModTcl* m_pParent;
};
class CModTclStartTimer : public CTimer {
@@ -44,7 +44,7 @@ public:
virtual ~CModTclStartTimer() {}
protected:
virtual void RunJob();
CModTcl* m_pParent;
CModTcl* m_pParent;
};
+4 -4
View File
@@ -61,7 +61,7 @@ public:
CUser* pUser(CZNC::Get().FindUser(user));
sasl_conn_t *sasl_conn(0);
if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future
if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future
Auth->RefuseLogin("Invalid User - Halting SASL Authentication");
return HALT;
}
@@ -87,10 +87,10 @@ public:
}
private:
TCacheMap<CString> m_Cache;
TCacheMap<CString> m_Cache;
static sasl_callback_t cbs[];
static CString method;
static sasl_callback_t cbs[];
static CString method;
static int getopt(void *context, const char *plugin_name, const char *option, const char **result, unsigned *len) {
if (!method.empty() && strcmp(option, "pwcheck_method") == 0) {
+3 -3
View File
@@ -35,10 +35,10 @@ public:
virtual void ReadLine(const CString& sData);
virtual void Disconnected();
CShellMod* m_pParent;
CShellMod* m_pParent;
private:
CClient* m_pClient;
CClient* m_pClient;
};
class CShellMod : public CModule {
@@ -158,7 +158,7 @@ public:
m_pManager->AddSock(new CShellSock(this, m_pClient, "cd " + m_sPath + " && " + sCommand), "SHELL");
}
private:
CString m_sPath;
CString m_sPath;
};
void CShellSock::ReadLine(const CString& sData) {
+2 -2
View File
@@ -91,8 +91,8 @@ public:
}
private:
TCacheMap<CString, unsigned int> m_Cache;
unsigned int m_uiAllowedFailed;
TCacheMap<CString, unsigned int> m_Cache;
unsigned int m_uiAllowedFailed;
};
GLOBALMODULEDEFS(CFailToBanMod, "Block IPs for some time after a failed login")
+2 -3
View File
@@ -20,7 +20,7 @@ public:
void RunJob();
private:
CKeepNickMod* m_pMod;
CKeepNickMod* m_pMod;
};
class CKeepNickMod : public CModule {
@@ -180,7 +180,7 @@ public:
private:
// If this is NULL, we are turned off for some reason
CKeepNickTimer* m_pTimer;
CKeepNickTimer* m_pTimer;
};
CKeepNickTimer::CKeepNickTimer(CKeepNickMod *pMod) : CTimer(pMod, 30, 0,
@@ -193,4 +193,3 @@ void CKeepNickTimer::RunJob() {
}
MODULEDEFS(CKeepNickMod, "Keep trying for your primary nick")
+13 -13
View File
@@ -89,7 +89,7 @@ public:
}
private:
EType m_eType;
EType m_eType;
};
@@ -163,10 +163,10 @@ public:
private:
CString m_sModuleName;
CString m_sUsername; // NEED these so we can send the signal to the right guy
int m_iParentFD;
VPString m_vArgs;
CString m_sModuleName;
CString m_sUsername; // NEED these so we can send the signal to the right guy
int m_iParentFD;
VPString m_vArgs;
void SetupArgs()
{
@@ -198,9 +198,9 @@ public:
protected:
virtual void RunJob();
CString m_sFuncName;
CString m_sUserName;
CString m_sModuleName;
CString m_sFuncName;
CString m_sUserName;
CString m_sModuleName;
};
class CModPerl : public CGlobalModule
@@ -424,10 +424,10 @@ public:
enum ECBTYPES
{
CB_LOCAL = 1,
CB_ONHOOK = 2,
CB_TIMER = 3,
CB_SOCK = 4
CB_LOCAL = 1,
CB_ONHOOK = 2,
CB_TIMER = 3,
CB_SOCK = 4
};
EModRet CallBack(const PString & sHookName, const VPString & vsArgs,
@@ -503,7 +503,7 @@ public:
void UnloadPerlMod(const CString & sModule);
private:
PerlInterpreter *m_pPerl;
PerlInterpreter *m_pPerl;
};
+1 -1
View File
@@ -73,7 +73,7 @@ public:
}
private:
CString m_sPass;
CString m_sPass;
};
MODULEDEFS(CNickServ, "Auths you with NickServ")
+10 -10
View File
@@ -10,9 +10,9 @@
#include "znc.h"
// If you change these and it breaks, you get to keep the pieces
#define CHAN_PREFIX_1 "~"
#define CHAN_PREFIX_1C '~'
#define CHAN_PREFIX CHAN_PREFIX_1 "#"
#define CHAN_PREFIX_1 "~"
#define CHAN_PREFIX_1C '~'
#define CHAN_PREFIX CHAN_PREFIX_1 "#"
class CPartylineChannel {
public:
@@ -35,10 +35,10 @@ public:
bool IsFixedChan(const CString& s) { return m_ssFixedNicks.find(s) != m_ssFixedNicks.end(); }
protected:
CString m_sTopic;
CString m_sName;
set<CString> m_ssNicks;
set<CString> m_ssFixedNicks;
CString m_sTopic;
CString m_sName;
set<CString> m_ssNicks;
set<CString> m_ssFixedNicks;
};
class CPartylineMod : public CGlobalModule {
@@ -707,9 +707,9 @@ public:
}
private:
set<CPartylineChannel*> m_ssChannels;
set<CUser*> m_spInjectedPrefixes;
set<CString> m_ssDefaultChans;
set<CPartylineChannel*> m_ssChannels;
set<CUser*> m_spInjectedPrefixes;
set<CString> m_ssDefaultChans;
};
GLOBALMODULEDEFS(CPartylineMod, "Internal channels and queries for users connected to znc")
+1 -1
View File
@@ -106,7 +106,7 @@ private:
return true;
}
VCString m_vPerform;
VCString m_vPerform;
};
MODULEDEFS(CPerform, "Adds perform capabilities")
+4 -4
View File
@@ -451,11 +451,11 @@ private:
}
/* Settings */
CString m_sUsername;
CString m_sUsername;
CString m_sPassword;
bool m_bUseCloakedHost;
bool m_bUseChallenge;
bool m_bRequestPerms;
bool m_bUseCloakedHost;
bool m_bUseChallenge;
bool m_bRequestPerms;
void SetUsername(const CString& sUsername) {
m_sUsername = sUsername;
+4 -4
View File
@@ -360,11 +360,11 @@ private:
}
}
CClient *m_pDoing;
const struct reply *m_pReplies;
requestQueue m_vsPending;
CClient *m_pDoing;
const struct reply *m_pReplies;
requestQueue m_vsPending;
// This field is only used for display purpose.
CString m_sLastRequest;
CString m_sLastRequest;
};
void CRouteTimeout::RunJob()
+2 -2
View File
@@ -88,12 +88,12 @@ public:
}
virtual EModRet OnRaw(CString& sLine) {
// PutModule("OnRaw() [" + sLine + "]");
// PutModule("OnRaw() [" + sLine + "]");
return CONTINUE;
}
virtual EModRet OnUserRaw(CString& sLine) {
// PutModule("UserRaw() [" + sLine + "]");
// PutModule("UserRaw() [" + sLine + "]");
return CONTINUE;
}
+3 -3
View File
@@ -294,9 +294,9 @@ public:
#endif /* LEGACY_SAVEBUFF */
private:
bool m_bBootError;
bool m_bFirstLoad;
CString m_sPassword;
bool m_bBootError;
bool m_bFirstLoad;
CString m_sPassword;
bool DecryptChannel(const CString & sChan, CString & sBuffer)
{
CString sChannel = GetPath(sChan);
+7 -7
View File
@@ -35,7 +35,7 @@ public:
protected:
virtual void RunJob();
CString m_sNick;
CString m_sNick;
};
class CSChatSock : public CSocket
@@ -54,7 +54,7 @@ public:
virtual bool ConnectionFrom(const CS_STRING & sHost, u_short iPort)
{
Close(); // close the listener after the first connection
Close(); // close the listener after the first connection
return(true);
}
@@ -92,9 +92,9 @@ public:
}
private:
CSChat *m_pModule;
CString m_sChatNick;
vector<CS_STRING> m_vBuffer;
CSChat *m_pModule;
CString m_sChatNick;
VCString m_vBuffer;
};
class CSChat : public CModule
@@ -393,8 +393,8 @@ public:
}
private:
map< CString,pair< u_long,u_short > > m_siiWaitingChats;
CString m_sPemFile;
map< CString,pair< u_long,u_short > > m_siiWaitingChats;
CString m_sPemFile;
};
+12 -12
View File
@@ -29,8 +29,8 @@ public:
// !Setters
private:
protected:
bool m_bNegated;
CString m_sSource;
bool m_bNegated;
CString m_sSource;
};
class CWatchEntry {
@@ -147,11 +147,11 @@ public:
// !Setters
private:
protected:
CString m_sHostMask;
CString m_sTarget;
CString m_sPattern;
bool m_bDisabled;
vector<CWatchSource> m_vsSources;
CString m_sHostMask;
CString m_sTarget;
CString m_sPattern;
bool m_bDisabled;
vector<CWatchSource> m_vsSources;
};
class CWatcherMod : public CModule {
@@ -312,7 +312,7 @@ private:
return;
}
uIdx--; // "convert" index to zero based
uIdx--; // "convert" index to zero based
if (uIdx >= m_lsWatchers.size()) {
PutModule("Invalid Id");
return;
@@ -388,7 +388,7 @@ private:
}
void SetSources(unsigned int uIdx, const CString& sSources) {
uIdx--; // "convert" index to zero based
uIdx--; // "convert" index to zero based
if (uIdx >= m_lsWatchers.size()) {
PutModule("Invalid Id");
return;
@@ -404,7 +404,7 @@ private:
}
void Remove(unsigned int uIdx) {
uIdx--; // "convert" index to zero based
uIdx--; // "convert" index to zero based
if (uIdx >= m_lsWatchers.size()) {
PutModule("Invalid Id");
return;
@@ -549,8 +549,8 @@ private:
PutModule("WARNING: malformed entry found while loading");
}
list<CWatchEntry> m_lsWatchers;
CBuffer m_Buffer;
list<CWatchEntry> m_lsWatchers;
CBuffer m_Buffer;
};
MODULEDEFS(CWatcherMod, "Copy activity from a specific user into a separate window")
+1 -1
View File
@@ -965,7 +965,7 @@ public:
}
private:
map<CString, unsigned int> m_suSwitchCounters;
map<CString, unsigned int> m_suSwitchCounters;
};
GLOBALMODULEDEFS(CWebAdminMod, "Web based administration module")
+5 -5
View File
@@ -1087,12 +1087,12 @@ bool CZNC::DoRehash(CString& sError)
}
CString sLine;
bool bCommented = false; // support for /**/ style comments
CUser* pUser = NULL; // Used to keep track of which user block we are in
CUser* pRealUser = NULL; // If we rehash a user, this is the real one
CChan* pChan = NULL; // Used to keep track of which chan block we are in
bool bCommented = false; // support for /**/ style comments
CUser* pUser = NULL; // Used to keep track of which user block we are in
CUser* pRealUser = NULL; // If we rehash a user, this is the real one
CChan* pChan = NULL; // Used to keep track of which chan block we are in
unsigned int uLineNum = 0;
MCString msModules; // Modules are queued for later loading
MCString msModules; // Modules are queued for later loading
std::list<CGlobalModuleConfigLine> lGlobalModuleConfigLine;