Remove useless spaces inside of braces "( stuff )"

This was generated via the following command:

  cat <file> | \
  tr "\n" "€"| \
  sed -r 's/€[\t ]*\{€/ {€/g; s/\( */(/g; s/ *\)/)/g' | \
  tr "€" "\n"

Thanks to SilverLeo for producing this mess :P


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1029 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-04-20 13:00:19 +00:00
parent 0470977497
commit b0a1714b86
18 changed files with 1017 additions and 1018 deletions
+61 -61
View File
@@ -27,8 +27,8 @@ struct EmailST
class CEmailJob : public CTimer
{
public:
CEmailJob( CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription )
: CTimer( pModule, uInterval, uCycles, sLabel, sDescription) {}
CEmailJob(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription)
: CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {}
virtual ~CEmailJob() {}
@@ -47,16 +47,16 @@ public:
virtual ~CEmail()
{
vector<Csock*> vSocks = m_pManager->FindSocksByName( "EMAIL::" + m_pUser->GetUserName() );
for( u_int a = 0; a < vSocks.size(); a++ )
m_pManager->DelSockByAddr( vSocks[a] );
vector<Csock*> vSocks = m_pManager->FindSocksByName("EMAIL::" + m_pUser->GetUserName());
for(u_int a = 0; a < vSocks.size(); a++)
m_pManager->DelSockByAddr(vSocks[a]);
}
virtual bool OnLoad(const CString & sArgs, CString& sMessage) {
m_sMailPath = sArgs;
StartParser();
if ( m_pUser->IsUserAttached() )
if (m_pUser->IsUserAttached())
StartTimer();
return true;
@@ -66,37 +66,37 @@ public:
{
stringstream s;
s << "You have " << m_ssUidls.size() << " emails.";
PutModule( s.str() );
PutModule(s.str());
StartTimer();
}
virtual void OnUserDetached()
{
RemTimer( "EMAIL::" + m_pUser->GetUserName() );
RemTimer("EMAIL::" + m_pUser->GetUserName());
}
void StartTimer()
{
if ( !FindTimer( "EMAIL::" + m_pUser->GetUserName() ) )
if (!FindTimer("EMAIL::" + m_pUser->GetUserName()))
{
CEmailJob *p = new CEmailJob( this, 60, 0, "EmailMonitor", "Monitors email activity" );
AddTimer( p );
CEmailJob *p = new CEmailJob(this, 60, 0, "EmailMonitor", "Monitors email activity");
AddTimer(p);
}
}
virtual void OnModCommand( const CString& sCommand );
virtual void OnModCommand(const CString& sCommand);
void StartParser();
void ParseEmails( const vector<EmailST> & vEmails )
void ParseEmails(const vector<EmailST> & vEmails)
{
if ( !m_bInitialized )
if (!m_bInitialized)
{
m_bInitialized = true;
for( u_int a = 0; a < vEmails.size(); a++ )
m_ssUidls.insert( vEmails[a].sUidl );
for(u_int a = 0; a < vEmails.size(); a++)
m_ssUidls.insert(vEmails[a].sUidl);
stringstream s;
s << "You have " << vEmails.size() << " emails.";
PutModule( s.str() );
PutModule(s.str());
} else
{
set<CString> ssUidls;
@@ -106,17 +106,17 @@ public:
Table.AddColumn("Size");
Table.AddColumn("Subject");
for( u_int a = 0; a < vEmails.size(); a++ )
for(u_int a = 0; a < vEmails.size(); a++)
{
if ( m_ssUidls.find( vEmails[a].sUidl ) == m_ssUidls.end() )
if (m_ssUidls.find(vEmails[a].sUidl) == m_ssUidls.end())
{
//PutModule( "------------------- New Email -------------------" );
//PutModule("------------------- New Email -------------------");
Table.AddRow();
Table.SetCell( "From", vEmails[a].sFrom.Ellipsize( 32 ) );
Table.SetCell( "Size", CString( vEmails[a].iSize ) );
Table.SetCell( "Subject", vEmails[a].sSubject.Ellipsize( 64 ) );
Table.SetCell("From", vEmails[a].sFrom.Ellipsize(32));
Table.SetCell("Size", CString(vEmails[a].iSize));
Table.SetCell("Subject", vEmails[a].sSubject.Ellipsize(64));
}
ssUidls.insert( vEmails[a].sUidl );
ssUidls.insert(vEmails[a].sUidl);
}
m_ssUidls = ssUidls; // keep the list in synch
@@ -124,13 +124,13 @@ public:
if (Table.size()) {
unsigned int uTableIdx = 0;
CString sLine;
while ( Table.GetLine( uTableIdx++, sLine ) ) {
PutModule( sLine );
while (Table.GetLine(uTableIdx++, sLine)) {
PutModule(sLine);
}
stringstream s;
s << "You have " << vEmails.size() << " emails.";
PutModule( s.str() );
PutModule(s.str());
}
}
}
@@ -145,7 +145,7 @@ private:
class CEmailFolder : public Csock
{
public:
CEmailFolder( CEmail *pModule, const CString & sMailbox ) : Csock()
CEmailFolder(CEmail *pModule, const CString & sMailbox) : Csock()
{
m_pModule = pModule;
m_sMailbox = sMailbox;
@@ -154,18 +154,18 @@ public:
virtual ~CEmailFolder()
{
if ( !m_sMailBuffer.empty() )
if (!m_sMailBuffer.empty())
ProcessMail(); // get the last one
if ( !m_vEmails.empty() )
m_pModule->ParseEmails( m_vEmails );
if (!m_vEmails.empty())
m_pModule->ParseEmails(m_vEmails);
}
virtual void ReadLine( const CS_STRING & sLine )
virtual void ReadLine(const CS_STRING & sLine)
{
if ( sLine.substr( 0, 5 ) == "From " )
if (sLine.substr(0, 5) == "From ")
{
if ( !m_sMailBuffer.empty() )
if (!m_sMailBuffer.empty())
{
ProcessMail();
m_sMailBuffer.clear();
@@ -177,25 +177,25 @@ public:
void ProcessMail()
{
EmailST tmp;
tmp.sUidl = (char *)CMD5( m_sMailBuffer.substr( 0, 255 ) );
tmp.sUidl = (char *)CMD5(m_sMailBuffer.substr(0, 255));
CString sLine;
CString::size_type iPos = 0;
while( ::ReadLine( m_sMailBuffer, sLine, iPos ) )
while(::ReadLine(m_sMailBuffer, sLine, iPos))
{
sLine.Trim();
if ( sLine.empty() )
if (sLine.empty())
break; // out of the headers
if ( strncasecmp( sLine.c_str(), "From: ", 6 ) == 0 )
tmp.sFrom = sLine.substr( 6, CString::npos );
else if ( strncasecmp( sLine.c_str(), "Subject: ", 9 ) == 0 )
tmp.sSubject = sLine.substr( 9, CString::npos );
if (strncasecmp(sLine.c_str(), "From: ", 6) == 0)
tmp.sFrom = sLine.substr(6, CString::npos);
else if (strncasecmp(sLine.c_str(), "Subject: ", 9) == 0)
tmp.sSubject = sLine.substr(9, CString::npos);
if ( ( !tmp.sFrom.empty() ) && ( !tmp.sSubject.empty() ) )
if ((!tmp.sFrom.empty()) && (!tmp.sSubject.empty()))
break;
}
tmp.iSize = m_sMailBuffer.length();
m_vEmails.push_back( tmp );
m_vEmails.push_back(tmp);
}
private:
CEmail *m_pModule;
@@ -204,50 +204,50 @@ private:
vector<EmailST> m_vEmails;
};
void CEmail::OnModCommand( const CString& sCommand )
void CEmail::OnModCommand(const CString& sCommand)
{
CString::size_type iPos = sCommand.find( " " );
CString::size_type iPos = sCommand.find(" ");
CString sCom, sArgs;
if ( iPos == CString::npos )
if (iPos == CString::npos)
sCom = sCommand;
else
{
sCom = sCommand.substr( 0, iPos );
sArgs = sCommand.substr( iPos + 1, CString::npos );
sCom = sCommand.substr(0, iPos);
sArgs = sCommand.substr(iPos + 1, CString::npos);
}
if ( sCom == "timers" )
if (sCom == "timers")
{
ListTimers();
} else
PutModule( "Error, no such command [" + sCom + "]" );
PutModule("Error, no such command [" + sCom + "]");
}
void CEmail::StartParser()
{
CString sParserName = "EMAIL::" + m_pUser->GetUserName();
if ( m_pManager->FindSockByName( sParserName ) )
if (m_pManager->FindSockByName(sParserName))
return; // one at a time sucker
CFile cFile( m_sMailPath );
if ( ( !cFile.Exists() ) || ( cFile.GetSize() == 0 ) )
CFile cFile(m_sMailPath);
if ((!cFile.Exists()) || (cFile.GetSize() == 0))
{
m_bInitialized = true;
return; // der
}
if ( cFile.GetMTime() <= m_iLastCheck )
if (cFile.GetMTime() <= m_iLastCheck)
return; // only check if modified
int iFD = open( m_sMailPath.c_str(), O_RDONLY );
if ( iFD >= 0 )
int iFD = open(m_sMailPath.c_str(), O_RDONLY);
if (iFD >= 0)
{
m_iLastCheck = time( NULL );
CEmailFolder *p = new CEmailFolder( this, m_sMailPath );
p->SetRSock( iFD );
p->SetWSock( iFD );
m_pManager->AddSock( (Csock *)p, "EMAIL::" + m_pUser->GetUserName() );
m_iLastCheck = time(NULL);
CEmailFolder *p = new CEmailFolder(this, m_sMailPath);
p->SetRSock(iFD);
p->SetWSock(iFD);
m_pManager->AddSock((Csock *)p, "EMAIL::" + m_pUser->GetUserName());
}
}