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
+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")