mirror of
https://github.com/znc/znc.git
synced 2026-06-11 17:25:04 +02:00
And fix a shitload of trailing whitespaces and space / tab mixups in ZNC
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@959 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ int CBuffer::UpdateLine(const CString& sPre, const CString& sPost, bool bIncNick
|
||||
return size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return AddLine(sPre, sPost, bIncNick);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ CString CChan::GetModeString() const {
|
||||
|
||||
CString CChan::GetModeForNames() const {
|
||||
CString sMode;
|
||||
|
||||
|
||||
for (map<unsigned char, CString>::const_iterator it = m_musModes.begin(); it != m_musModes.end(); it++) {
|
||||
if (it->first == 's') {
|
||||
sMode = "@";
|
||||
@@ -183,7 +183,7 @@ CString CChan::GetModeForNames() const {
|
||||
|
||||
return (sMode.empty() ? "=" : sMode);
|
||||
}
|
||||
|
||||
|
||||
void CChan::SetModes(const CString& sModes) {
|
||||
m_musModes.clear();
|
||||
m_uLimit = 0;
|
||||
|
||||
+44
-44
@@ -145,7 +145,7 @@ void CClient::ReadLine(const CString& sData) {
|
||||
}
|
||||
} else if (sCommand.CaseCmp("PING") == 0) {
|
||||
CString sTarget = sLine.Token(1);
|
||||
|
||||
|
||||
if (sTarget.CaseCmp("irc.znc.com") == 0) {
|
||||
PutClient("PONG " + sLine.substr(5));
|
||||
return;
|
||||
@@ -646,7 +646,7 @@ void CClient::UserCommand(const CString& sLine) {
|
||||
for (unsigned int b = 0; b < sPerms.size(); b++) {
|
||||
if (a->second->HasPerm(sPerms[b])) {
|
||||
CString sPerm;
|
||||
sPerm += sPerms[b];
|
||||
sPerm += sPerms[b];
|
||||
Table.SetCell(sPerm, sPerm);
|
||||
}
|
||||
}
|
||||
@@ -845,7 +845,7 @@ void CClient::UserCommand(const CString& sLine) {
|
||||
PutStatus("Channel [" + sChan + "] not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
pChan->Enable();
|
||||
PutStatus("Channel [" + sChan + "] enabled.");
|
||||
}
|
||||
@@ -1416,50 +1416,50 @@ void CClient::UserCommand(const CString& sLine) {
|
||||
pChan->SetBufferCount(uLineCount);
|
||||
|
||||
PutStatus("BufferCount for [" + sChan + "] set to [" + CString(pChan->GetBufferCount()) + "]");
|
||||
} else if (m_pUser->IsAdmin() && sCommand.CaseCmp("TRAFFIC") == 0) {
|
||||
CZNC::Get().UpdateTrafficStats();
|
||||
const map<CString, CUser*>& msUsers = CZNC::Get().GetUserMap();
|
||||
CTable Table;
|
||||
Table.AddColumn("Username");
|
||||
Table.AddColumn("In");
|
||||
Table.AddColumn("Out");
|
||||
Table.AddColumn("Total");
|
||||
unsigned long long users_total_in = 0;
|
||||
unsigned long long users_total_out = 0;
|
||||
for (map<CString, CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); it++) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", it->first);
|
||||
Table.SetCell("In", CString(it->second->BytesRead()));
|
||||
Table.SetCell("Out", CString(it->second->BytesWritten()));
|
||||
Table.SetCell("Total", CString(it->second->BytesRead() + it->second->BytesWritten()));
|
||||
users_total_in += it->second->BytesRead();
|
||||
users_total_out += it->second->BytesWritten();
|
||||
}
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", "<Users>");
|
||||
Table.SetCell("In", CString(users_total_in));
|
||||
Table.SetCell("Out", CString(users_total_out));
|
||||
Table.SetCell("Total", CString(users_total_in + users_total_out));
|
||||
} else if (m_pUser->IsAdmin() && sCommand.CaseCmp("TRAFFIC") == 0) {
|
||||
CZNC::Get().UpdateTrafficStats();
|
||||
const map<CString, CUser*>& msUsers = CZNC::Get().GetUserMap();
|
||||
CTable Table;
|
||||
Table.AddColumn("Username");
|
||||
Table.AddColumn("In");
|
||||
Table.AddColumn("Out");
|
||||
Table.AddColumn("Total");
|
||||
unsigned long long users_total_in = 0;
|
||||
unsigned long long users_total_out = 0;
|
||||
for (map<CString, CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); it++) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", it->first);
|
||||
Table.SetCell("In", CString(it->second->BytesRead()));
|
||||
Table.SetCell("Out", CString(it->second->BytesWritten()));
|
||||
Table.SetCell("Total", CString(it->second->BytesRead() + it->second->BytesWritten()));
|
||||
users_total_in += it->second->BytesRead();
|
||||
users_total_out += it->second->BytesWritten();
|
||||
}
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", "<Users>");
|
||||
Table.SetCell("In", CString(users_total_in));
|
||||
Table.SetCell("Out", CString(users_total_out));
|
||||
Table.SetCell("Total", CString(users_total_in + users_total_out));
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", "<ZNC>");
|
||||
Table.SetCell("In", CString(CZNC::Get().BytesRead()));
|
||||
Table.SetCell("Out", CString(CZNC::Get().BytesWritten()));
|
||||
Table.SetCell("Total", CString(CZNC::Get().BytesRead() + CZNC::Get().BytesWritten()));
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", "<ZNC>");
|
||||
Table.SetCell("In", CString(CZNC::Get().BytesRead()));
|
||||
Table.SetCell("Out", CString(CZNC::Get().BytesWritten()));
|
||||
Table.SetCell("Total", CString(CZNC::Get().BytesRead() + CZNC::Get().BytesWritten()));
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", "<Total>");
|
||||
Table.SetCell("In", CString(users_total_in + CZNC::Get().BytesRead()));
|
||||
Table.SetCell("Out", CString(users_total_out + CZNC::Get().BytesWritten()));
|
||||
Table.SetCell("Total", CString(users_total_in + CZNC::Get().BytesRead() + users_total_out + CZNC::Get().BytesWritten()));
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", "<Total>");
|
||||
Table.SetCell("In", CString(users_total_in + CZNC::Get().BytesRead()));
|
||||
Table.SetCell("Out", CString(users_total_out + CZNC::Get().BytesWritten()));
|
||||
Table.SetCell("Total", CString(users_total_in + CZNC::Get().BytesRead() + users_total_out + CZNC::Get().BytesWritten()));
|
||||
|
||||
if (Table.size()) {
|
||||
unsigned int uTableIdx = 0;
|
||||
CString sLine;
|
||||
while (Table.GetLine(uTableIdx++, sLine)) {
|
||||
PutStatus(sLine);
|
||||
}
|
||||
}
|
||||
if (Table.size()) {
|
||||
unsigned int uTableIdx = 0;
|
||||
CString sLine;
|
||||
while (Table.GetLine(uTableIdx++, sLine)) {
|
||||
PutStatus(sLine);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
PutStatus("Unknown command [" + sCommand + "] try 'Help'");
|
||||
}
|
||||
|
||||
+1
-1
@@ -367,7 +367,7 @@ int CExecSock::popen2(int & iReadFD, int & iWriteFD, const CString & sCommand) {
|
||||
close(rpipes[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int iPid = fork();
|
||||
|
||||
if (iPid == -1) {
|
||||
|
||||
+1
-1
@@ -884,7 +884,7 @@ bool CModules::GetModInfo(CModInfo& ModInfo, const CString& sModule) {
|
||||
}
|
||||
|
||||
CString sModPath, sTmp;
|
||||
|
||||
|
||||
if (!CZNC::Get().FindModPath(sModule, sModPath, sTmp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@ class CClient;
|
||||
}
|
||||
// !Global Module Macros
|
||||
|
||||
//const char* GetDescription() { static char sz[] = DESCRIPTION; return sz; }
|
||||
// Forward Declarations
|
||||
class CZNC;
|
||||
class CUser;
|
||||
|
||||
@@ -128,7 +128,7 @@ CString CNick::GetPermStr() const {
|
||||
const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();
|
||||
CString sRet;
|
||||
|
||||
for (unsigned int a = 0; a < sChanPerms.size(); a++) {
|
||||
for (unsigned int a = 0; a < sChanPerms.size(); a++) {
|
||||
const unsigned char& c = sChanPerms[a];
|
||||
|
||||
if (HasPerm(c)) {
|
||||
|
||||
@@ -45,7 +45,7 @@ though you don't need to as ZNC supports in-place execution.
|
||||
Setting up znc.conf
|
||||
-------------------
|
||||
|
||||
For setting up a configuration file in ~/.znc you can simply do
|
||||
For setting up a configuration file in ~/.znc you can simply do
|
||||
znc --makeconf
|
||||
or
|
||||
./znc --makeconf
|
||||
|
||||
@@ -156,7 +156,7 @@ CString& CUser::AddTimestamp(const CString& sStr, CString& sRet) const {
|
||||
if (m_bAppendTimestamp) {
|
||||
sRet += " ";
|
||||
sRet += szTimestamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
@@ -527,7 +527,7 @@ bool CUser::PrintLine(CFile& File, const CString& sName, const CString& sValue)
|
||||
}
|
||||
|
||||
bool CUser::WriteConfig(CFile& File) {
|
||||
File.Write("<User " + GetUserName() + ">\r\n");
|
||||
File.Write("<User " + GetUserName() + ">\r\n");
|
||||
|
||||
PrintLine(File, "Pass", GetPass() + ((IsPassHashed()) ? " -" : ""));
|
||||
PrintLine(File, "Nick", GetNick());
|
||||
@@ -919,7 +919,7 @@ bool CUser::SendFile(const CString& sRemoteNick, const CString& sFileName, const
|
||||
|
||||
if (GetNick().CaseCmp(sRemoteNick) == 0) {
|
||||
PutUser(":" + GetStatusPrefix() + "status!znc@znc.com PRIVMSG " + sRemoteNick + " :\001DCC SEND " + pFile->GetShortName() + " " + CString(CUtils::GetLongIP(GetLocalIP())) + " "
|
||||
+ CString(uPort) + " " + CString(pFile->GetSize()) + "\001");
|
||||
+ CString(uPort) + " " + CString(pFile->GetSize()) + "\001");
|
||||
} else {
|
||||
PutIRC("PRIVMSG " + sRemoteNick + " :\001DCC SEND " + pFile->GetShortName() + " " + CString(CUtils::GetLongIP(GetLocalIP())) + " "
|
||||
+ CString(uPort) + " " + CString(pFile->GetSize()) + "\001");
|
||||
|
||||
@@ -76,7 +76,7 @@ void CUtils::GenerateCert(FILE *pOut, bool bEncPrivKey, const CString& sHost) {
|
||||
X509_gmtime_adj( X509_get_notBefore( pCert ), 0 );
|
||||
X509_gmtime_adj( X509_get_notAfter( pCert ), (long)60*60*24*days );
|
||||
X509_set_pubkey( pCert, pKey );
|
||||
|
||||
|
||||
pName = X509_get_subject_name( pCert );
|
||||
|
||||
const char *pLogName = getenv("LOGNAME");
|
||||
|
||||
@@ -77,8 +77,7 @@ int main(int argc, char** argv) {
|
||||
bool bEncPem = false;
|
||||
|
||||
while ((iArg = getopt_long(argc, argv, "hvncsped:", g_LongOpts, &iOptIndex)) != -1) {
|
||||
#else
|
||||
|
||||
#else
|
||||
while ((iArg = getopt_long(argc, argv, "hvncsd:", g_LongOpts, &iOptIndex)) != -1) {
|
||||
#endif /* HAVE_LIBSSL */
|
||||
switch (iArg) {
|
||||
@@ -205,7 +204,7 @@ int main(int argc, char** argv) {
|
||||
CUtils::PrintMessage("Staying open for debugging [pid: " + CString(iPid) + "]");
|
||||
|
||||
pZNC->WritePidFile(iPid);
|
||||
#else
|
||||
#else
|
||||
CUtils::PrintAction("Forking into the background");
|
||||
|
||||
int iPid = fork();
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ PERL := @PERL@
|
||||
MODDIR := @MODDIR@
|
||||
DATADIR := @DATADIR@
|
||||
|
||||
ifeq "@NOSSL@" "1"
|
||||
ifeq "@NOSSL@" "1"
|
||||
FILES := $(foreach file, $(wildcard *.cpp), \
|
||||
$(if $(shell grep REQUIRESSL $(file)), \
|
||||
, \
|
||||
|
||||
+26
-27
@@ -18,10 +18,10 @@
|
||||
|
||||
class CAway;
|
||||
|
||||
class CAwayJob : public CTimer
|
||||
class CAwayJob : public CTimer
|
||||
{
|
||||
public:
|
||||
CAwayJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
CAwayJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
: CTimer( pModule, uInterval, uCycles, sLabel, sDescription) {}
|
||||
|
||||
virtual ~CAwayJob() {}
|
||||
@@ -30,18 +30,18 @@ protected:
|
||||
virtual void RunJob();
|
||||
};
|
||||
|
||||
class CAway : public CModule
|
||||
class CAway : public CModule
|
||||
{
|
||||
public:
|
||||
MODCONSTRUCTOR(CAway)
|
||||
{
|
||||
Ping();
|
||||
Ping();
|
||||
m_bIsAway = false;
|
||||
m_bBootError = false;
|
||||
SetAwayTime( 300 );
|
||||
AddTimer( new CAwayJob( this, 60, 0, "AwayJob", "Checks for idle and saves messages every 1 minute" ) );
|
||||
}
|
||||
virtual ~CAway()
|
||||
virtual ~CAway()
|
||||
{
|
||||
if ( !m_bBootError )
|
||||
SaveBufferToDisk();
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
sMyArgs = sMyArgs.Token(2, true);
|
||||
}
|
||||
if (!sMyArgs.empty())
|
||||
{
|
||||
{
|
||||
m_sPassword = CBlowfish::MD5( sMyArgs );
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
|
||||
*pTmp = 0;
|
||||
}
|
||||
|
||||
|
||||
if ( !BootStrap() )
|
||||
{
|
||||
m_bBootError = true;
|
||||
@@ -117,13 +117,13 @@ public:
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
||||
|
||||
void SaveBufferToDisk()
|
||||
{
|
||||
if ( !m_sPassword.empty() )
|
||||
{
|
||||
CString sFile = CRYPT_VERIFICATION_TOKEN;
|
||||
|
||||
|
||||
for( u_int b = 0; b < m_vMessages.size(); b++ )
|
||||
sFile += m_vMessages[b] + "\n";
|
||||
|
||||
@@ -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" );
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
else
|
||||
sReason = sCommand.Token( 2, true );
|
||||
Away( false, sReason );
|
||||
}
|
||||
}
|
||||
else if ( sCmdName == "back" )
|
||||
{
|
||||
if ( ( m_vMessages.empty() ) && ( sCommand.Token( 1 ) != "-quiet" ) )
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
{
|
||||
for( u_int a = 0; a < m_vMessages.size(); a++ )
|
||||
PutModule( m_vMessages[a], "away" );
|
||||
}
|
||||
}
|
||||
else if ( sCmdName == "delete" )
|
||||
{
|
||||
CString sWhich = sCommand.Token(1);
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
for( u_int a = 0; a < m_vMessages.size(); a++ )
|
||||
m_vMessages.erase( m_vMessages.begin() + a-- );
|
||||
|
||||
}
|
||||
}
|
||||
else if ( sWhich.empty() )
|
||||
{
|
||||
PutModNotice( "USAGE: delete <num|all>", "away" );
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
CString sTime = m_vMessages[a].Token( 0, false, ":" );
|
||||
CString sWhom = m_vMessages[a].Token( 1, false, ":" );
|
||||
CString sMessage = m_vMessages[a].Token( 2, true, ":" );
|
||||
|
||||
|
||||
if ( ( sTime.empty() ) || ( sWhom.empty() ) || ( sMessage.empty() ) )
|
||||
{
|
||||
// illegal format
|
||||
@@ -259,7 +259,6 @@ public:
|
||||
PutModule( it->second[a] );
|
||||
}
|
||||
PutModule( "#--- End Messages", "away" );
|
||||
|
||||
} else if ( sCmdName == "enabletimer")
|
||||
{
|
||||
SetAwayTime(300);
|
||||
@@ -271,9 +270,9 @@ public:
|
||||
} else if ( sCmdName == "settimer")
|
||||
{
|
||||
int iSetting = sCommand.Token(1).ToInt();
|
||||
|
||||
|
||||
SetAwayTime(iSetting);
|
||||
|
||||
|
||||
if(iSetting == 0)
|
||||
PutModule( "Timer disabled" );
|
||||
else
|
||||
@@ -282,8 +281,8 @@ public:
|
||||
} else if ( sCmdName == "timer")
|
||||
{
|
||||
PutModule( "Current timer setting: " + CString(GetAwayTime()) + " seconds" );
|
||||
} else
|
||||
{
|
||||
} else
|
||||
{
|
||||
PutModule( "Commands: away [-quiet], back [-quiet], delete <num|all>, ping, show, save, enabletimer, disabletimer, settimer <secs>, timer", "away" );
|
||||
}
|
||||
}
|
||||
@@ -344,24 +343,24 @@ public:
|
||||
{
|
||||
if ( m_bIsAway )
|
||||
AddMessage( time( NULL ), Nick, sMessage );
|
||||
return( CONTINUE );
|
||||
return( CONTINUE );
|
||||
}
|
||||
|
||||
|
||||
virtual EModRet OnUserNotice(CString& sTarget, CString& sMessage)
|
||||
{
|
||||
Ping();
|
||||
if( m_bIsAway )
|
||||
Back();
|
||||
|
||||
return( CONTINUE );
|
||||
|
||||
return( CONTINUE );
|
||||
}
|
||||
virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage)
|
||||
{
|
||||
Ping();
|
||||
if( m_bIsAway )
|
||||
Back();
|
||||
|
||||
return( CONTINUE );
|
||||
|
||||
return( CONTINUE );
|
||||
}
|
||||
|
||||
time_t GetTimeStamp() const { return( m_iLastSentData ); }
|
||||
@@ -379,7 +378,7 @@ private:
|
||||
CString sMessages = GetPath();
|
||||
CString sFile;
|
||||
sBuffer = "";
|
||||
|
||||
|
||||
if ( ( sMessages.empty() ) || ( !ReadFile( sMessages, sFile ) ) )
|
||||
{
|
||||
PutModule( "Unable to find buffer" );
|
||||
@@ -426,7 +425,7 @@ void CAwayJob::RunJob()
|
||||
{
|
||||
CAway *p = (CAway *)m_pModule;
|
||||
p->SaveBufferToDisk();
|
||||
|
||||
|
||||
if ( !p->IsAway() )
|
||||
{
|
||||
time_t iNow = time( NULL );
|
||||
|
||||
+5
-5
@@ -7,20 +7,20 @@
|
||||
*/
|
||||
|
||||
//! @author prozac@rottenboy.com
|
||||
//
|
||||
//
|
||||
// The encryption here was designed to be compatible with mircryption's CBC mode.
|
||||
//
|
||||
//
|
||||
// TODO:
|
||||
//
|
||||
//
|
||||
// 1) Encrypt key storage file
|
||||
// 2) Secure key exchange using pub/priv keys and the DH algorithm
|
||||
// 3) Some way of notifying the user that the current channel is in "encryption mode" verses plain text
|
||||
// 4) Temporarily disable a target (nick/chan)
|
||||
//
|
||||
//
|
||||
// NOTE: This module is currently NOT intended to secure you from your shell admin.
|
||||
// The keys are currently stored in plain text, so anyone with access to your account (or root) can obtain them.
|
||||
// It is strongly suggested that you enable SSL between znc and your client otherwise the encryption stops at znc and gets sent to your client in plain text.
|
||||
//
|
||||
//
|
||||
|
||||
#include "Chan.h"
|
||||
#include "User.h"
|
||||
|
||||
+11
-11
@@ -24,10 +24,10 @@ struct EmailST
|
||||
u_int iSize;
|
||||
};
|
||||
|
||||
class CEmailJob : public CTimer
|
||||
class CEmailJob : public CTimer
|
||||
{
|
||||
public:
|
||||
CEmailJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
CEmailJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
: CTimer( pModule, uInterval, uCycles, sLabel, sDescription) {}
|
||||
|
||||
virtual ~CEmailJob() {}
|
||||
@@ -36,7 +36,7 @@ protected:
|
||||
virtual void RunJob();
|
||||
};
|
||||
|
||||
class CEmail : public CModule
|
||||
class CEmail : public CModule
|
||||
{
|
||||
public:
|
||||
MODCONSTRUCTOR(CEmail)
|
||||
@@ -44,9 +44,10 @@ public:
|
||||
m_iLastCheck = 0;
|
||||
m_bInitialized = false;
|
||||
}
|
||||
virtual ~CEmail()
|
||||
|
||||
virtual ~CEmail()
|
||||
{
|
||||
vector<Csock*> vSocks = m_pManager->FindSocksByName( "EMAIL::" + m_pUser->GetUserName() );
|
||||
vector<Csock*> vSocks = m_pManager->FindSocksByName( "EMAIL::" + m_pUser->GetUserName() );
|
||||
for( u_int a = 0; a < vSocks.size(); a++ )
|
||||
m_pManager->DelSockByAddr( vSocks[a] );
|
||||
}
|
||||
@@ -119,7 +120,7 @@ public:
|
||||
}
|
||||
|
||||
m_ssUidls = ssUidls; // keep the list in synch
|
||||
|
||||
|
||||
if (Table.size()) {
|
||||
unsigned int uTableIdx = 0;
|
||||
CString sLine;
|
||||
@@ -134,7 +135,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
CString m_sMailPath;
|
||||
u_int m_iLastCheck;
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
m_pModule = pModule;
|
||||
m_sMailbox = sMailbox;
|
||||
EnableReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~CEmailFolder()
|
||||
{
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
if ( !m_vEmails.empty() )
|
||||
m_pModule->ParseEmails( m_vEmails );
|
||||
}
|
||||
|
||||
|
||||
virtual void ReadLine( const CS_STRING & sLine )
|
||||
{
|
||||
if ( sLine.substr( 0, 5 ) == "From " )
|
||||
@@ -201,7 +201,7 @@ private:
|
||||
CEmail *m_pModule;
|
||||
CString m_sMailbox;
|
||||
CString m_sMailBuffer;
|
||||
vector<EmailST> m_vEmails;
|
||||
vector<EmailST> m_vEmails;
|
||||
};
|
||||
|
||||
void CEmail::OnModCommand( const CString& sCommand )
|
||||
@@ -215,7 +215,7 @@ void CEmail::OnModCommand( const CString& sCommand )
|
||||
sCom = sCommand.substr( 0, iPos );
|
||||
sArgs = sCommand.substr( iPos + 1, CString::npos );
|
||||
}
|
||||
|
||||
|
||||
if ( sCom == "timers" )
|
||||
{
|
||||
ListTimers();
|
||||
|
||||
+40
-43
@@ -24,7 +24,7 @@
|
||||
#define ZNCCallSockCB "ZNC::CORECallSock"
|
||||
#define ZNCSOCK ":::ZncSock:::"
|
||||
|
||||
class PString : public CString
|
||||
class PString : public CString
|
||||
{
|
||||
public:
|
||||
enum EType
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
NUM,
|
||||
BOOL
|
||||
};
|
||||
|
||||
|
||||
PString() : CString() { m_eType = STRING; }
|
||||
PString( const char* c ) : CString(c) { m_eType = STRING; }
|
||||
PString( const CString& s ) : CString(s) { m_eType = STRING; }
|
||||
@@ -50,10 +50,9 @@ public:
|
||||
|
||||
virtual ~PString() {}
|
||||
|
||||
|
||||
EType GetType() const { return( m_eType ); }
|
||||
void SetType( EType e ) { m_eType = e; }
|
||||
|
||||
|
||||
SV * GetSV( bool bMakeMortal = true ) const
|
||||
{
|
||||
SV *pSV = NULL;
|
||||
@@ -82,7 +81,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
EType m_eType;
|
||||
};
|
||||
|
||||
@@ -90,7 +88,7 @@ private:
|
||||
class CPerlHash : public map< CString, PString >
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
HV *GetHash()
|
||||
{
|
||||
HV *pHash = newHV();
|
||||
@@ -119,7 +117,7 @@ public:
|
||||
SetSockName( ZNCSOCK );
|
||||
}
|
||||
CPerlSock( const CS_STRING & sHost, u_short iPort, int iTimeout = 60 )
|
||||
: Csock( sHost, iPort, iTimeout )
|
||||
: Csock( sHost, iPort, iTimeout )
|
||||
{
|
||||
m_iParentFD = -1;
|
||||
SetSockName( ZNCSOCK );
|
||||
@@ -177,10 +175,10 @@ private:
|
||||
int CallBack( const PString & sFuncName );
|
||||
};
|
||||
|
||||
class CPerlTimer : public CTimer
|
||||
class CPerlTimer : public CTimer
|
||||
{
|
||||
public:
|
||||
CPerlTimer( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
CPerlTimer( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
: CTimer( pModule, uInterval, uCycles, sLabel, sDescription) {}
|
||||
|
||||
virtual ~CPerlTimer() {}
|
||||
@@ -197,22 +195,22 @@ protected:
|
||||
CString m_sModuleName;
|
||||
};
|
||||
|
||||
class CModPerl : public CGlobalModule
|
||||
class CModPerl : public CGlobalModule
|
||||
{
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR( CModPerl )
|
||||
GLOBALMODCONSTRUCTOR( CModPerl )
|
||||
{
|
||||
g_ModPerl = this;
|
||||
m_pPerl = NULL;
|
||||
}
|
||||
|
||||
virtual ~CModPerl()
|
||||
virtual ~CModPerl()
|
||||
{
|
||||
DestroyAllSocks();
|
||||
if ( m_pPerl )
|
||||
{
|
||||
const map<CString,CUser*> & msUsers = CZNC::Get().GetUserMap();
|
||||
|
||||
|
||||
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;
|
||||
@@ -242,7 +240,7 @@ public:
|
||||
if ( ( cFile.Exists() ) && ( cFile.Open( O_RDONLY ) ) )
|
||||
{
|
||||
while( cFile.ReadLine( sBuffer ) )
|
||||
sScript += sBuffer;
|
||||
sScript += sBuffer;
|
||||
cFile.Close();
|
||||
|
||||
eval_pv( sScript.c_str(), FALSE );
|
||||
@@ -262,7 +260,6 @@ public:
|
||||
return( CONTINUE );
|
||||
}
|
||||
|
||||
|
||||
void DumpError( const CString & sError )
|
||||
{
|
||||
CString sTmp = sError;
|
||||
@@ -278,10 +275,10 @@ public:
|
||||
CSockManager * GetSockManager() { return( m_pManager ); }
|
||||
void DestroyAllSocks( const CString & sModuleName = "" );
|
||||
|
||||
CUser * GetUser( const CString & sUsername = "", bool bSetUserContext = false )
|
||||
{
|
||||
CUser * GetUser( const CString & sUsername = "", bool bSetUserContext = false )
|
||||
{
|
||||
if ( sUsername.empty() )
|
||||
return( m_pUser );
|
||||
return( m_pUser );
|
||||
|
||||
CUser *pUser = CZNC::Get().GetUser( sUsername );
|
||||
if ( bSetUserContext )
|
||||
@@ -297,7 +294,7 @@ public:
|
||||
virtual void OnIRCDisconnected() { CBNone( "OnIRCDisconnected" ); }
|
||||
virtual void OnIRCConnected() { CBNone( "OnIRCConnected" ); }
|
||||
|
||||
virtual EModRet OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort,
|
||||
virtual EModRet OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort,
|
||||
const CString& sFile, unsigned long uFileSize);
|
||||
|
||||
virtual void OnOp(const CNick& OpNick, const CNick& Nick, CChan& Channel, bool bNoChange)
|
||||
@@ -323,8 +320,8 @@ public:
|
||||
virtual EModRet OnUserRaw(CString& sLine) { return( CBSingle( "OnUserRaw", sLine ) ); }
|
||||
virtual EModRet OnRaw(CString& sLine) { return( CBSingle( "OnRaw", sLine ) ); }
|
||||
|
||||
virtual void OnModCommand(const CString& sCommand)
|
||||
{
|
||||
virtual void OnModCommand(const CString& sCommand)
|
||||
{
|
||||
if ( CBSingle( "OnModCommand", sCommand ) == 0 )
|
||||
Eval( sCommand );
|
||||
}
|
||||
@@ -361,21 +358,21 @@ public:
|
||||
virtual void OnJoin(const CNick& Nick, CChan& Channel) { CBDouble( "OnJoin", NICK( Nick ), CHAN( Channel ) ); }
|
||||
virtual void OnPart(const CNick& Nick, CChan& Channel) { CBDouble( "OnPart", NICK( Nick ), CHAN( Channel ) ); }
|
||||
|
||||
virtual EModRet OnUserCTCPReply(CString& sTarget, CString& sMessage)
|
||||
{
|
||||
return CBDouble( "OnUserCTCPReply", sTarget, sMessage );
|
||||
virtual EModRet OnUserCTCPReply(CString& sTarget, CString& sMessage)
|
||||
{
|
||||
return CBDouble( "OnUserCTCPReply", sTarget, sMessage );
|
||||
}
|
||||
virtual EModRet OnCTCPReply(CNick& Nick, CString& sMessage)
|
||||
{
|
||||
return CBDouble( "OnCTCPReply", NICK( Nick ), sMessage );
|
||||
return CBDouble( "OnCTCPReply", NICK( Nick ), sMessage );
|
||||
}
|
||||
virtual EModRet OnUserCTCP(CString& sTarget, CString& sMessage)
|
||||
{
|
||||
return CBDouble( "OnUserCTCP", sTarget, sMessage );
|
||||
return CBDouble( "OnUserCTCP", sTarget, sMessage );
|
||||
}
|
||||
virtual EModRet OnPrivCTCP(CNick& Nick, CString& sMessage)
|
||||
{
|
||||
return CBDouble( "OnPrivCTCP", NICK( Nick ), sMessage );
|
||||
return CBDouble( "OnPrivCTCP", NICK( Nick ), sMessage );
|
||||
}
|
||||
virtual EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage)
|
||||
{
|
||||
@@ -415,7 +412,7 @@ public:
|
||||
CB_SOCK = 4
|
||||
};
|
||||
|
||||
EModRet CallBack( const PString & sHookName, const VPString & vsArgs,
|
||||
EModRet CallBack( const PString & sHookName, const VPString & vsArgs,
|
||||
ECBTYPES eCBType = CB_ONHOOK, const PString & sUsername = "" );
|
||||
|
||||
EModRet CBNone( const PString & sHookName )
|
||||
@@ -592,7 +589,7 @@ XS(XS_ZNC_LoadMod)
|
||||
PUTBACK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XS(XS_ZNC_UnloadMod)
|
||||
{
|
||||
dXSARGS;
|
||||
@@ -651,7 +648,7 @@ XS(XS_ZNC_GetNicks)
|
||||
CChan * pChan = pUser->FindChan( sChan );
|
||||
if ( !pChan )
|
||||
XSRETURN( 0 );
|
||||
|
||||
|
||||
const map< CString,CNick* > & mscNicks = pChan->GetNicks();
|
||||
|
||||
for( map< CString,CNick* >::const_iterator it = mscNicks.begin(); it != mscNicks.end(); it++ )
|
||||
@@ -672,7 +669,7 @@ XS(XS_ZNC_GetNicks)
|
||||
XS(XS_ZNC_GetString)
|
||||
{
|
||||
dXSARGS;
|
||||
|
||||
|
||||
if ( items != 1 )
|
||||
Perl_croak( aTHX_ "Usage: GetString( sName )" );
|
||||
|
||||
@@ -871,7 +868,7 @@ XS(XS_ZNC_COREListen)
|
||||
sReturn = -1;
|
||||
|
||||
XPUSHs( sReturn.GetSV() );
|
||||
|
||||
|
||||
}
|
||||
PUTBACK;
|
||||
}
|
||||
@@ -894,8 +891,8 @@ bool CModPerl::Eval( const CString & sScript, const CString & sFuncName )
|
||||
|
||||
bool bReturn = true;
|
||||
|
||||
if ( SvTRUE( ERRSV ) )
|
||||
{
|
||||
if ( SvTRUE( ERRSV ) )
|
||||
{
|
||||
DumpError( SvPV( ERRSV, PL_na) );
|
||||
bReturn = false;
|
||||
}
|
||||
@@ -905,12 +902,12 @@ bool CModPerl::Eval( const CString & sScript, const CString & sFuncName )
|
||||
return( bReturn );
|
||||
}
|
||||
|
||||
CModPerl::EModRet CModPerl::CallBack( const PString & sHookName, const VPString & vsArgs,
|
||||
CModPerl::EModRet CModPerl::CallBack( const PString & sHookName, const VPString & vsArgs,
|
||||
ECBTYPES eCBType, const PString & sUsername )
|
||||
{
|
||||
if ( !m_pPerl )
|
||||
return( CONTINUE );
|
||||
|
||||
|
||||
dSP;
|
||||
SAVETMPS;
|
||||
|
||||
@@ -948,8 +945,8 @@ CModPerl::EModRet CModPerl::CallBack( const PString & sHookName, const VPString
|
||||
SPAGAIN;
|
||||
int iRet = CONTINUE;
|
||||
|
||||
if ( SvTRUE( ERRSV ) )
|
||||
{
|
||||
if ( SvTRUE( ERRSV ) )
|
||||
{
|
||||
CString sError = SvPV( ERRSV, PL_na);
|
||||
DumpError( sHookName + ": " + sError );
|
||||
|
||||
@@ -972,7 +969,7 @@ CModPerl::EModRet CModPerl::CallBack( const PString & sHookName, const VPString
|
||||
// special case this, required for perl modules that are dynamic
|
||||
EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
|
||||
|
||||
bool CModPerl::OnLoad( const CString & sArgs, CString & sMessage )
|
||||
bool CModPerl::OnLoad( const CString & sArgs, CString & sMessage )
|
||||
{
|
||||
m_pPerl = perl_alloc();
|
||||
perl_construct( m_pPerl );
|
||||
@@ -1006,7 +1003,7 @@ bool CModPerl::OnLoad( const CString & sArgs, CString & sMessage )
|
||||
newXS( "ZNC::WriteSock", XS_ZNC_WriteSock, "modperl" );
|
||||
newXS( "ZNC::CloseSock", XS_ZNC_CloseSock, "modperl" );
|
||||
newXS( "ZNC::SetSockValue", XS_ZNC_SetSockValue, "modperl" );
|
||||
|
||||
|
||||
// this sets up the eval CB that we call from here on out. this way we can grab the error produced
|
||||
SetupZNCScript();
|
||||
|
||||
@@ -1065,7 +1062,7 @@ void CModPerl::UnloadPerlMod( const CString & sModule )
|
||||
}
|
||||
|
||||
|
||||
CModPerl::EModRet CModPerl::OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort,
|
||||
CModPerl::EModRet CModPerl::OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort,
|
||||
const CString& sFile, unsigned long uFileSize)
|
||||
{
|
||||
VPString vsArgs;
|
||||
@@ -1073,7 +1070,7 @@ CModPerl::EModRet CModPerl::OnDCCUserSend(const CNick& RemoteNick, unsigned long
|
||||
vsArgs.push_back( uLongIP );
|
||||
vsArgs.push_back( uPort );
|
||||
vsArgs.push_back( sFile );
|
||||
|
||||
|
||||
return( CallBack( "OnDCCUserSend", vsArgs ) );
|
||||
}
|
||||
|
||||
@@ -1084,7 +1081,7 @@ void CPerlTimer::RunJob()
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
VPString vArgs;
|
||||
vArgs.push_back( m_sModuleName );
|
||||
if ( ((CModPerl *)m_pModule)->CallBack( m_sFuncName, vArgs, CModPerl::CB_TIMER ) != CModPerl::CONTINUE )
|
||||
|
||||
+10
-10
@@ -28,12 +28,12 @@ sub CORECallFunc
|
||||
{
|
||||
return( $Ret );
|
||||
}
|
||||
|
||||
|
||||
if ( $Ret == HALTMODS() )
|
||||
{
|
||||
return( $Ret );
|
||||
}
|
||||
|
||||
|
||||
if ( $Ret == HALTCORE() )
|
||||
{
|
||||
$FinalRet = $Ret;
|
||||
@@ -61,7 +61,7 @@ sub CORELoadMod
|
||||
|
||||
my $DPath = GetString( "SavePath" );
|
||||
my $FileName = $DPath . "/." . $Username . $Module . ".pm";
|
||||
|
||||
|
||||
if ( !open( INMOD, $ModPath ) )
|
||||
{
|
||||
ZNC::PutModule( "Unable to open module $ModPath!" );
|
||||
@@ -82,7 +82,7 @@ sub CORELoadMod
|
||||
return( HALTMODS() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while( <INMOD> )
|
||||
{
|
||||
if ( $_ =~ /^\s*package\s*$Module\s*;/ )
|
||||
@@ -111,12 +111,12 @@ sub CORELoadMod
|
||||
ZNC::PutModule( "$Module Failed to load" );
|
||||
return( HALTMODS() );
|
||||
}
|
||||
|
||||
|
||||
$obj->{ZNC_Username} = $Username;
|
||||
$obj->{ZNC_Name} = $Module;
|
||||
$obj->{ZNC_ModPath} = $FileName;
|
||||
@{$obj->{socks}} = ();
|
||||
|
||||
|
||||
push( @MODS, $obj );
|
||||
ZNC::PutModule( "Loaded $Module" );
|
||||
}
|
||||
@@ -287,7 +287,7 @@ sub PutTarget
|
||||
my ( $target, $line ) = @_;
|
||||
PutIRC( "PRIVMSG $target :$line" );
|
||||
}
|
||||
|
||||
|
||||
sub Connect
|
||||
{
|
||||
my ( $obj, $host, $port, $timeout, $bEnableReadline, $bUseSSL ) = @_;
|
||||
@@ -339,7 +339,7 @@ sub Listen
|
||||
{
|
||||
$bEnableReadline = 0;
|
||||
}
|
||||
|
||||
|
||||
if ( !$bUseSSL )
|
||||
{
|
||||
$bUseSSL = 0;
|
||||
@@ -358,7 +358,7 @@ sub ListenSSL
|
||||
|
||||
|
||||
######################
|
||||
## use this if you really want to have fun. be sure you don't leave a reference to the
|
||||
## use this if you really want to have fun. be sure you don't leave a reference to the
|
||||
## handle laying around! ZNC will deal with that inside your module, so its properly closed
|
||||
package ZNCSocket;
|
||||
|
||||
@@ -425,7 +425,7 @@ sub Listen
|
||||
$me->{fd} = ZNC::Listen( $me->{modobj}, $port, $bindhost, $bEnableReadline, $bUseSSL );
|
||||
return( ( $me->{fd} >= 0 ) );
|
||||
}
|
||||
|
||||
|
||||
sub ListenSSL
|
||||
{
|
||||
my ( $me, $port, $bindhost, $bEnableReadline ) = @_;
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
MODCONSTRUCTOR(CNickServ)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual ~CNickServ()
|
||||
{
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
m_sPass = GetNV("Password");
|
||||
else
|
||||
m_sPass = sArgs;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
PutIRC("PRIVMSG NickServ :IDENTIFY " + m_sPass);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual EModRet OnPrivMsg(CNick& Nick, CString& sMessage)
|
||||
{
|
||||
HandleMessage(Nick, sMessage);
|
||||
|
||||
@@ -79,8 +79,8 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Load() {
|
||||
|
||||
void Load() {
|
||||
VCString vsChannels;
|
||||
for (MCString::iterator it = BeginNV(); it != EndNV(); it++) {
|
||||
CUser* pUser = CZNC::Get().FindUser(it->first);
|
||||
@@ -517,7 +517,7 @@ public:
|
||||
PutModule((*a)->GetName());
|
||||
}
|
||||
}
|
||||
PutModule("--- End of list");
|
||||
PutModule("--- End of list");
|
||||
} else if (sCommand.CaseCmp("LISTFIXUSERS") == 0) {
|
||||
if(!m_pUser->IsAdmin()) {
|
||||
PutModule("Access denied");
|
||||
@@ -526,7 +526,7 @@ public:
|
||||
CString sChan = sLine.Token(1).Left(32);
|
||||
CPartylineChannel* pChan = FindChannel(sChan);
|
||||
|
||||
if(!pChan) {
|
||||
if(!pChan) {
|
||||
PutModule("Channel does not exist!");
|
||||
return;
|
||||
}
|
||||
|
||||
+4
-4
@@ -14,7 +14,7 @@ public:
|
||||
MODCONSTRUCTOR(CPerform)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual ~CPerform()
|
||||
{
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
virtual bool OnLoad(const CString& sArgs, CString& sMessage)
|
||||
{
|
||||
GetNV("Perform").Split("\n", m_vPerform, false);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -94,13 +94,13 @@ private:
|
||||
bool Save()
|
||||
{
|
||||
CString sBuffer = "";
|
||||
|
||||
|
||||
for(VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++)
|
||||
{
|
||||
sBuffer += *it + "\n";
|
||||
}
|
||||
SetNV("Perform", sBuffer);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -8,7 +8,7 @@
|
||||
* Buffer Saving thing, incase your shit goes out while your out
|
||||
* Author: imaginos <imaginos@imaginos.net>
|
||||
*
|
||||
* Its only as secure as your shell, the encryption only offers a slightly
|
||||
* Its only as secure as your shell, the encryption only offers a slightly
|
||||
* better solution then plain text.
|
||||
*/
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
|
||||
class CSaveBuff;
|
||||
|
||||
class CSaveBuffJob : public CTimer
|
||||
class CSaveBuffJob : public CTimer
|
||||
{
|
||||
public:
|
||||
CSaveBuffJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
CSaveBuffJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
: CTimer( pModule, uInterval, uCycles, sLabel, sDescription) {}
|
||||
|
||||
virtual ~CSaveBuffJob() {}
|
||||
@@ -39,7 +39,7 @@ protected:
|
||||
virtual void RunJob();
|
||||
};
|
||||
|
||||
class CSaveBuff : public CModule
|
||||
class CSaveBuff : public CModule
|
||||
{
|
||||
public:
|
||||
MODCONSTRUCTOR(CSaveBuff)
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
// m_sPassword = CBlowfish::MD5( "" );
|
||||
AddTimer( new CSaveBuffJob( this, 60, 0, "SaveBuff", "Saves the current buffer to disk every 1 minute" ) );
|
||||
}
|
||||
virtual ~CSaveBuff()
|
||||
virtual ~CSaveBuff()
|
||||
{
|
||||
if ( !m_bBootError )
|
||||
{
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
|
||||
*pTmp = 0;
|
||||
}
|
||||
|
||||
|
||||
const vector<CChan *>& vChans = m_pUser->GetChans();
|
||||
for( u_int a = 0; a < vChans.size(); a++ )
|
||||
{
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
||||
|
||||
void SaveBufferToDisk()
|
||||
{
|
||||
if ( !m_sPassword.empty() )
|
||||
@@ -136,12 +136,12 @@ public:
|
||||
{
|
||||
if ( !m_sPassword.empty() )
|
||||
BootStrap( vChans[a] );
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
CString sFile = CRYPT_VERIFICATION_TOKEN;
|
||||
|
||||
|
||||
for( u_int b = 0; b < vBuffer.size(); b++ )
|
||||
sFile += vBuffer[b] + "\n";
|
||||
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
{
|
||||
PutModule( "Password set to [" + sArgs + "]" );
|
||||
m_sPassword = CBlowfish::MD5( sArgs );
|
||||
|
||||
|
||||
} else if ( strcasecmp( sCom.c_str(), "dumpbuff" ) == 0 )
|
||||
{
|
||||
CString sFile;
|
||||
@@ -236,16 +236,16 @@ public:
|
||||
{
|
||||
if ( !cChannel.KeepBuffer() )
|
||||
return;
|
||||
|
||||
|
||||
((CChan &)cChannel).AddBuffer( SpoofChanMsg( cChannel.GetName(), cOpNick.GetNickMask() + " MODE " + sModes + " " + sArgs ) );
|
||||
}
|
||||
virtual void OnQuit(const CNick& cNick, const CString& sMessage, const vector<CChan*>& vChans)
|
||||
{
|
||||
{
|
||||
for( u_int a = 0; a < vChans.size(); a++ )
|
||||
{
|
||||
if ( !vChans[a]->KeepBuffer() )
|
||||
continue;
|
||||
vChans[a]->AddBuffer( SpoofChanMsg( vChans[a]->GetName(), cNick.GetNickMask() + " QUIT " + sMessage ) );
|
||||
vChans[a]->AddBuffer( SpoofChanMsg( vChans[a]->GetName(), cNick.GetNickMask() + " QUIT " + sMessage ) );
|
||||
}
|
||||
if ( cNick.GetNick().CaseCmp( m_pUser->GetNick() ) == 0 )
|
||||
SaveBufferToDisk(); // need to force a save here to see this!
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
{
|
||||
if ( !vChans[a]->KeepBuffer() )
|
||||
continue;
|
||||
vChans[a]->AddBuffer( SpoofChanMsg( vChans[a]->GetName(), cNick.GetNickMask() + " NICK " + sNewNick ) );
|
||||
vChans[a]->AddBuffer( SpoofChanMsg( vChans[a]->GetName(), cNick.GetNickMask() + " NICK " + sNewNick ) );
|
||||
}
|
||||
}
|
||||
virtual void OnKick(const CNick& cNick, const CString& sOpNick, CChan& cChannel, const CString& sMessage)
|
||||
@@ -295,7 +295,7 @@ private:
|
||||
CString sChannel = GetPath( sChan );
|
||||
CString sFile;
|
||||
sBuffer = "";
|
||||
|
||||
|
||||
if ( ( sChannel.empty() ) || ( !ReadFile( sChannel, sFile ) ) )
|
||||
return( true ); // gonna be successful here
|
||||
|
||||
|
||||
+29
-32
@@ -20,10 +20,10 @@ using std::stringstream;
|
||||
|
||||
class CSChat;
|
||||
|
||||
class CRemMarkerJob : public CTimer
|
||||
class CRemMarkerJob : public CTimer
|
||||
{
|
||||
public:
|
||||
CRemMarkerJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
CRemMarkerJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
: CTimer( pModule, uInterval, uCycles, sLabel, sDescription) {}
|
||||
|
||||
virtual ~CRemMarkerJob() {}
|
||||
@@ -44,13 +44,13 @@ public:
|
||||
{
|
||||
m_pModule = pMod;
|
||||
}
|
||||
CSChatSock( int itimeout = 60 ) : Csock( itimeout )
|
||||
CSChatSock( int itimeout = 60 ) : Csock( itimeout )
|
||||
{
|
||||
m_pModule = NULL;
|
||||
m_pModule = NULL;
|
||||
EnableReadLine();
|
||||
}
|
||||
CSChatSock( const CS_STRING & sHost, u_short iPort, int iTimeout = 60 )
|
||||
: Csock( sHost, iPort, iTimeout )
|
||||
: Csock( sHost, iPort, iTimeout )
|
||||
{
|
||||
m_pModule = NULL;
|
||||
EnableReadLine();
|
||||
@@ -65,10 +65,10 @@ public:
|
||||
return( p );
|
||||
}
|
||||
|
||||
virtual bool ConnectionFrom( const CS_STRING & sHost, u_short iPort )
|
||||
virtual bool ConnectionFrom( const CS_STRING & sHost, u_short iPort )
|
||||
{
|
||||
Close(); // close the listener after the first connection
|
||||
return( true );
|
||||
Close(); // close the listener after the first connection
|
||||
return( true );
|
||||
}
|
||||
|
||||
virtual void Connected();
|
||||
@@ -104,14 +104,12 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
CSChat *m_pModule;
|
||||
CSChat *m_pModule;
|
||||
CString m_sChatNick;
|
||||
vector<CS_STRING> m_vBuffer;
|
||||
vector<CS_STRING> m_vBuffer;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CSChat : public CModule
|
||||
class CSChat : public CModule
|
||||
{
|
||||
public:
|
||||
MODCONSTRUCTOR(CSChat) {}
|
||||
@@ -134,14 +132,14 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void OnUserAttached()
|
||||
virtual void OnUserAttached()
|
||||
{
|
||||
CString sName = "SCHAT::" + m_pUser->GetUserName();
|
||||
for( u_int a = 0; a < m_pManager->size(); a++ )
|
||||
{
|
||||
if ( ( strncmp( (*m_pManager)[a]->GetSockName().c_str(), sName.c_str(), sName.length() ) != 0 ) || ( (*m_pManager)[a]->GetType() == CSChatSock::LISTENER ) )
|
||||
continue;
|
||||
|
||||
|
||||
CSChatSock *p = (CSChatSock *)(*m_pManager)[a];
|
||||
p->DumpBuffer();
|
||||
}
|
||||
@@ -170,12 +168,12 @@ public:
|
||||
PutModule( "SChat User Area ..." );
|
||||
OnModCommand( "help" );
|
||||
return( HALT );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return( CONTINUE );
|
||||
}
|
||||
virtual void OnModCommand( const CString& sCommand )
|
||||
}
|
||||
virtual void OnModCommand( const CString& sCommand )
|
||||
{
|
||||
CString::size_type iPos = sCommand.find( " " );
|
||||
CString sCom, sArgs;
|
||||
@@ -218,12 +216,12 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
stringstream s;
|
||||
stringstream s;
|
||||
s << "PRIVMSG " << sArgs << " :\001";
|
||||
s << "DCC SCHAT chat ";
|
||||
s << CUtils::GetLongIP( m_pUser->GetLocalIP() );
|
||||
s << " " << iPort << "\001";
|
||||
|
||||
|
||||
PutIRC( s.str() );
|
||||
|
||||
} else if ( strcasecmp( sCom.c_str(), "list" ) == 0 )
|
||||
@@ -254,10 +252,10 @@ public:
|
||||
sTime.Trim();
|
||||
Table.SetCell( "Created", sTime );
|
||||
}
|
||||
|
||||
|
||||
if ( pSock->GetType() != CSChatSock::LISTENER )
|
||||
{
|
||||
Table.SetCell( "Status", "Established" );
|
||||
Table.SetCell( "Status", "Established" );
|
||||
Table.SetCell( "Host", pSock->GetRemoteIP() );
|
||||
Table.SetCell( "Port", CString( pSock->GetRemotePort() ) );
|
||||
SSL_SESSION *pSession = pSock->GetSSLSession();
|
||||
@@ -270,7 +268,7 @@ public:
|
||||
Table.SetCell( "Port", CString( pSock->GetLocalPort() ) );
|
||||
}
|
||||
}
|
||||
if ( Table.size() )
|
||||
if ( Table.size() )
|
||||
{
|
||||
unsigned int uTableIdx = 0;
|
||||
CString sLine;
|
||||
@@ -298,7 +296,6 @@ public:
|
||||
}
|
||||
PutModule( "No Such Chat [" + sArgs + "]" );
|
||||
}
|
||||
|
||||
} else if ( strcasecmp( sCom.c_str(), "showsocks" ) == 0 )
|
||||
{
|
||||
CTable Table;
|
||||
@@ -322,13 +319,13 @@ public:
|
||||
sTime.Trim();
|
||||
Table.SetCell( "Created", sTime );
|
||||
}
|
||||
|
||||
|
||||
if ( pSock->GetType() != Csock::LISTENER )
|
||||
{
|
||||
if ( pSock->GetType() == Csock::OUTBOUND )
|
||||
Table.SetCell( "Type", "Outbound" );
|
||||
Table.SetCell( "Type", "Outbound" );
|
||||
else
|
||||
Table.SetCell( "Type", "Inbound" );
|
||||
Table.SetCell( "Type", "Inbound" );
|
||||
Table.SetCell( "LocalIP:Port", pSock->GetLocalIP() + ":" + CString( pSock->GetLocalPort() ) );
|
||||
Table.SetCell( "RemoteIP:Port", pSock->GetRemoteIP() + ":" + CString( pSock->GetRemotePort() ) );
|
||||
SSL_SESSION *pSession = pSock->GetSSLSession();
|
||||
@@ -344,7 +341,7 @@ public:
|
||||
Table.SetCell( "RemoteIP:Port", "0.0.0.0:0" );
|
||||
}
|
||||
}
|
||||
if ( Table.size() )
|
||||
if ( Table.size() )
|
||||
{
|
||||
unsigned int uTableIdx = 0;
|
||||
CString sLine;
|
||||
@@ -389,7 +386,7 @@ public:
|
||||
return( HALT );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return( CONTINUE );
|
||||
}
|
||||
|
||||
@@ -448,7 +445,7 @@ public:
|
||||
{
|
||||
return( m_pUser->IsUserAttached() );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
map< CString,pair< u_long,u_short > > m_siiWaitingChats;
|
||||
CString m_sPemFile;
|
||||
@@ -464,7 +461,7 @@ void CSChatSock::ReadLine( const CS_STRING & sLine )
|
||||
CString sText = sLine;
|
||||
if ( sText[sText.length()-1] == '\n' )
|
||||
sText.erase( sText.length()-1, 1 );
|
||||
|
||||
|
||||
if ( sText[sText.length()-1] == '\r' )
|
||||
sText.erase( sText.length()-1, 1 );
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
class CSimpleAway;
|
||||
|
||||
class CSimpleAwayJob : public CTimer
|
||||
class CSimpleAwayJob : public CTimer
|
||||
{
|
||||
public:
|
||||
CSimpleAwayJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
CSimpleAwayJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
|
||||
: CTimer( pModule, uInterval, uCycles, sLabel, sDescription) {}
|
||||
|
||||
virtual ~CSimpleAwayJob() {}
|
||||
@@ -22,7 +22,7 @@ protected:
|
||||
virtual void RunJob();
|
||||
};
|
||||
|
||||
class CSimpleAway : public CModule
|
||||
class CSimpleAway : public CModule
|
||||
{
|
||||
public:
|
||||
MODCONSTRUCTOR(CSimpleAway)
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
m_bClientSetAway = false;
|
||||
}
|
||||
|
||||
virtual ~CSimpleAway()
|
||||
virtual ~CSimpleAway()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -83,9 +83,9 @@ public:
|
||||
PutModule( "Timer disabled" );
|
||||
} else if ( sCmdName == "settimer") {
|
||||
int iSetting = sCommand.Token(1).ToInt();
|
||||
|
||||
|
||||
m_iAwayWait = iSetting;
|
||||
|
||||
|
||||
if (iSetting == 0)
|
||||
PutModule("Timer disabled");
|
||||
else
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
PutModule("Reason set (Use %s for away time)");
|
||||
} else
|
||||
PutModule("Current away reason would be: " + GetAway());
|
||||
} else {
|
||||
} else {
|
||||
PutModule("Commands: disabletimer, settimer <x>, timer, reason [text]");
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
if (pTime) {
|
||||
sTime = pTime;
|
||||
sTime.Trim();
|
||||
|
||||
|
||||
sReason.Replace("%s", sTime);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ private:
|
||||
void CSimpleAwayJob::RunJob()
|
||||
{
|
||||
CSimpleAway *p = (CSimpleAway *)m_pModule;
|
||||
|
||||
|
||||
p->Away();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#include "Chan.h"
|
||||
#include "User.h"
|
||||
|
||||
class CStickyChan : public CModule
|
||||
class CStickyChan : public CModule
|
||||
{
|
||||
public:
|
||||
MODCONSTRUCTOR(CStickyChan) {}
|
||||
virtual ~CStickyChan()
|
||||
virtual ~CStickyChan()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -85,8 +85,8 @@ public:
|
||||
|
||||
bool operator ==(const CWatchEntry& WatchEntry) {
|
||||
return (strcasecmp(GetHostMask().c_str(), WatchEntry.GetHostMask().c_str()) == 0
|
||||
&& strcasecmp(GetTarget().c_str(), WatchEntry.GetTarget().c_str()) == 0
|
||||
&& strcasecmp(GetPattern().c_str(), WatchEntry.GetPattern().c_str()) == 0
|
||||
&& strcasecmp(GetTarget().c_str(), WatchEntry.GetTarget().c_str()) == 0
|
||||
&& strcasecmp(GetPattern().c_str(), WatchEntry.GetPattern().c_str()) == 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ private:
|
||||
CString m_sListenHost;
|
||||
map<CString, unsigned int> m_suSwitchCounters;
|
||||
};
|
||||
|
||||
|
||||
CString CWebAdminSock::GetSkinDir() {
|
||||
CString sSkinDir = m_pModule->GetModDataDir() + "/skins/"
|
||||
+ m_pModule->GetSkinName() + "/";
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<tr>
|
||||
<td class="menu<? IF Action != "home" ?>in<? ENDIF ?>active"><a href="/home">Startseite</a></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<? IF IsAdmin ?>
|
||||
<tr>
|
||||
<td class="menu<? IF Action != "settings" ?>in<? ENDIF ?>active"><a href="/settings">Einstellungen</a></td>
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<br><br>
|
||||
<input type="submit" value="Einstellungen speichern" />
|
||||
</form>
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<table width="95%" cellpadding="0" cellspacing="0" style="margin-top: 20px;">
|
||||
@@ -196,7 +196,7 @@
|
||||
<input style="width: 100%;" type="text" name="chanmodes" value="<? VAR DefaultChanModes ESC=HTML ?>" size="32" maxlength="32">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2" class="mainalone">
|
||||
<? IF Edit ?>
|
||||
@@ -253,16 +253,16 @@
|
||||
|
||||
<tr>
|
||||
<td class="mainleft">
|
||||
Zeitstempel:
|
||||
</td>
|
||||
Zeitstempel:
|
||||
</td>
|
||||
|
||||
<td class="mainright">
|
||||
<input style="width: 100%;" type="text" name="timestampformat" value="<? VAR TimestampFormat ESC=HTML ?>" size="32">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="mainleft">
|
||||
<td class="mainright">
|
||||
<input style="width: 100%;" type="text" name="timestampformat" value="<? VAR TimestampFormat ESC=HTML ?>" size="32">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="mainleft">
|
||||
Optionen:
|
||||
</td>
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ a:hover {
|
||||
}
|
||||
|
||||
.mainrow {
|
||||
padding: 5px;
|
||||
padding: 5px;
|
||||
border-right: 1px solid #000000;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<tr>
|
||||
<td class="menu<? IF Action != "home" ?>in<? ENDIF ?>active"><a href="/home">Home</a></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<? IF IsAdmin ?>
|
||||
<tr>
|
||||
<td class="menu<? IF Action != "settings" ?>in<? ENDIF ?>active"><a href="/settings">Settings</a></td>
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<br><br>
|
||||
<input type="submit" value="Save settings" />
|
||||
</form>
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<table width="95%" cellpadding="0" cellspacing="0" style="margin-top: 20px;">
|
||||
@@ -196,7 +196,7 @@
|
||||
<input style="width: 100%;" type="text" name="chanmodes" value="<? VAR DefaultChanModes ESC=HTML ?>" size="32" maxlength="32">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2" class="mainalone">
|
||||
<? IF Edit ?>
|
||||
|
||||
@@ -188,7 +188,7 @@ a:hover {
|
||||
}
|
||||
|
||||
.mainrow {
|
||||
padding: 5px;
|
||||
padding: 5px;
|
||||
border-right: 1px solid #000000;
|
||||
}
|
||||
|
||||
|
||||
@@ -180,10 +180,10 @@
|
||||
<div class="inputlabel">Größe des Wiedergabebuffers:</div>
|
||||
<div><input type="text" name="bufsize" value="<? VAR BufferCount ESC=HTML ?>" class="third" maxlength="9" /></div>
|
||||
</div>
|
||||
<div class="subsection">
|
||||
<div class="inputlabel">Zeitstempel:</div>
|
||||
<div><input type="text" name="timestampformat" value="<? VAR TimestampFormat ESC=HTML ?>" class="half" /></div>
|
||||
</div>
|
||||
<div class="subsection">
|
||||
<div class="inputlabel">Zeitstempel:</div>
|
||||
<div><input type="text" name="timestampformat" value="<? VAR TimestampFormat ESC=HTML ?>" class="half" /></div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
|
||||
<div class="subsection">
|
||||
|
||||
@@ -311,7 +311,7 @@ bool CZNC::DeletePidFile() {
|
||||
bool CZNC::WritePemFile( bool bEncPem ) {
|
||||
#ifndef HAVE_LIBSSL
|
||||
CUtils::PrintError("ZNC was not compiled with ssl support.");
|
||||
return false;
|
||||
return false;
|
||||
#else
|
||||
CString sPemFile = GetPemLocation();
|
||||
const char* pHostName = getenv("HOSTNAME");
|
||||
|
||||
Reference in New Issue
Block a user