Migrated away from CString::ToString() in favor of explicit constructors

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@669 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2006-02-25 09:43:35 +00:00
parent acb9012540
commit a9e60b43c5
24 changed files with 127 additions and 114 deletions
+8 -5
View File
@@ -18,6 +18,9 @@
*
*
* $Log$
* Revision 1.21 2006/02/25 09:43:35 prozacx
* Migrated away from CString::ToString() in favor of explicit constructors
*
* Revision 1.20 2006/02/11 11:55:55 imaginos
* fixed wrong type being used on 64bit
*
@@ -225,7 +228,7 @@ public:
CString sWhich = sCommand.Token(1);
if ( sWhich == "all" )
{
PutModNotice( "Deleted " + CString::ToString( m_vMessages.size() ) + " Messages.", "away" );
PutModNotice( "Deleted " + CString( m_vMessages.size() ) + " Messages.", "away" );
for( u_int a = 0; a < m_vMessages.size(); a++ )
m_vMessages.erase( m_vMessages.begin() + a-- );
@@ -293,7 +296,7 @@ public:
m_vMessages.erase( m_vMessages.begin() + a-- );
continue;
}
CString sTmp = " " + CString::ToString( a ) + ") [";
CString sTmp = " " + CString( a ) + ") [";
sTmp.append( szFormat, iCount );
sTmp += "] ";
sTmp += sMessage;
@@ -354,12 +357,12 @@ public:
if ( bUsePrivMessage )
{
PutModule( "Welcome Back!", "away" );
PutModule( "You have " + CString::ToString( m_vMessages.size() ) + " messages!", "away" );
PutModule( "You have " + CString( m_vMessages.size() ) + " messages!", "away" );
}
else
{
PutModNotice( "Welcome Back!", "away" );
PutModNotice( "You have " + CString::ToString( m_vMessages.size() ) + " messages!", "away" );
PutModNotice( "You have " + CString( m_vMessages.size() ) + " messages!", "away" );
}
}
m_sReason = "";
@@ -427,7 +430,7 @@ private:
void AddMessage( time_t iTime, const CNick & Nick, CString & sMessage )
{
AddMessage( CString::ToString( iTime ) + ":" + Nick.GetNickMask() + ":" + sMessage );
AddMessage( CString( iTime ) + ":" + Nick.GetNickMask() + ":" + sMessage );
}
void AddMessage( const CString & sText )
+4 -1
View File
@@ -16,6 +16,9 @@
* Author: imaginos <imaginos@imaginos.net>
*
* $Log$
* Revision 1.12 2006/02/25 09:43:35 prozacx
* Migrated away from CString::ToString() in favor of explicit constructors
*
* Revision 1.11 2006/02/12 21:00:59 prozacx
* Wrapped TSocketManager into CSockManager
*
@@ -151,7 +154,7 @@ public:
//PutModule( "------------------- New Email -------------------" );
Table.AddRow();
Table.SetCell( "From", vEmails[a].sFrom.Ellipsize( 32 ) );
Table.SetCell( "Size", CString::ToString( vEmails[a].iSize ) );
Table.SetCell( "Size", CString( vEmails[a].iSize ) );
Table.SetCell( "Subject", vEmails[a].sSubject.Ellipsize( 64 ) );
}
ssUidls.insert( vEmails[a].sUidl );
+7 -7
View File
@@ -36,13 +36,13 @@ public:
PString() : CString() { m_eType = STRING; }
PString( const char* c ) : CString(c) { m_eType = STRING; }
PString( const CString& s ) : CString(s) { m_eType = STRING; }
PString( int i ) : CString( PString::ToString( i ) ) { m_eType = INT; }
PString( u_int i ) : CString( PString::ToString( i ) ) { m_eType = UINT; }
PString( long i ) : CString( PString::ToString( i ) ) { m_eType = INT; }
PString( u_long i ) : CString( PString::ToString( i ) ) { m_eType = UINT; }
PString( long long i ) : CString( PString::ToString( (long long)i ) ) { m_eType = INT; }
PString( unsigned long long i ) : CString( PString::ToString( i ) ) { m_eType = UINT; }
PString( double i ) : CString( PString::ToString( i ) ) { m_eType = NUM; }
PString( int i ) : CString( i ) { m_eType = INT; }
PString( u_int i ) : CString( i ) { m_eType = UINT; }
PString( long i ) : CString( i ) { m_eType = INT; }
PString( u_long i ) : CString( i ) { m_eType = UINT; }
PString( long long i ) : CString( i ) { m_eType = INT; }
PString( unsigned long long i ) : CString( i ) { m_eType = UINT; }
PString( double i ) : CString( i ) { m_eType = NUM; }
PString( bool b ) : CString( ( b ? "1" : "0" ) ) { m_eType = BOOL; }
virtual ~PString() {}
+1 -1
View File
@@ -226,7 +226,7 @@ public:
Table.AddRow();
Table.SetCell("Channel", a->first);
Table.SetCell("Users", CString::ToString(a->second.size()));
Table.SetCell("Users", CString(a->second.size()));
}
unsigned int uTableIdx = 0;
+1 -1
View File
@@ -53,7 +53,7 @@ public:
}
virtual void OnChanPermission(const CNick& OpNick, const CNick& Nick, CChan& Channel, unsigned char uMode, bool bAdded, bool bNoChange) {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] set mode [" + Channel.GetName() + ((bAdded) ? "] +" : "] -") + CString::ToString(uMode) + " " + Nick.GetNick());
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] set mode [" + Channel.GetName() + ((bAdded) ? "] +" : "] -") + CString(uMode) + " " + Nick.GetNick());
}
virtual void OnOp(const CNick& OpNick, const CNick& Nick, CChan& Channel, bool bNoChange) {
+4 -1
View File
@@ -24,6 +24,9 @@
* better solution then plain text.
*
* $Log$
* Revision 1.29 2006/02/25 09:43:35 prozacx
* Migrated away from CString::ToString() in favor of explicit constructors
*
* Revision 1.28 2006/02/11 11:55:55 imaginos
* fixed wrong type being used on 64bit
*
@@ -323,7 +326,7 @@ public:
CString SpoofChanMsg( const CString & sChannel, const CString & sMesg )
{
CString sReturn = ":*" + GetModName() + "!znc@znc.com PRIVMSG " + sChannel + " :" + CString::ToString( time( NULL ) ) + " " + sMesg;
CString sReturn = ":*" + GetModName() + "!znc@znc.com PRIVMSG " + sChannel + " :" + CString( time( NULL ) ) + " " + sMesg;
return( sReturn );
}
+8 -5
View File
@@ -21,6 +21,9 @@ using std::pair;
* Author: imaginos <imaginos@imaginos.net>
*
* $Log$
* Revision 1.23 2006/02/25 09:43:35 prozacx
* Migrated away from CString::ToString() in favor of explicit constructors
*
* Revision 1.22 2006/02/13 06:01:57 imaginos
* use u_short
*
@@ -340,7 +343,7 @@ public:
{
Table.SetCell( "Status", "Established" );
Table.SetCell( "Host", pSock->GetRemoteIP() );
Table.SetCell( "Port", CString::ToString( pSock->GetRemotePort() ) );
Table.SetCell( "Port", CString( pSock->GetRemotePort() ) );
SSL_SESSION *pSession = pSock->GetSSLSession();
if ( ( pSession ) && ( pSession->cipher ) && ( pSession->cipher->name ) )
Table.SetCell( "Cipher", pSession->cipher->name );
@@ -348,7 +351,7 @@ public:
} else
{
Table.SetCell( "Status", "Waiting" );
Table.SetCell( "Port", CString::ToString( pSock->GetLocalPort() ) );
Table.SetCell( "Port", CString( pSock->GetLocalPort() ) );
}
}
if ( Table.size() )
@@ -410,8 +413,8 @@ public:
Table.SetCell( "Type", "Outbound" );
else
Table.SetCell( "Type", "Inbound" );
Table.SetCell( "LocalIP:Port", pSock->GetLocalIP() + ":" + CString::ToString( pSock->GetLocalPort() ) );
Table.SetCell( "RemoteIP:Port", pSock->GetRemoteIP() + ":" + CString::ToString( pSock->GetRemotePort() ) );
Table.SetCell( "LocalIP:Port", pSock->GetLocalIP() + ":" + CString( pSock->GetLocalPort() ) );
Table.SetCell( "RemoteIP:Port", pSock->GetRemoteIP() + ":" + CString( pSock->GetRemotePort() ) );
SSL_SESSION *pSession = pSock->GetSSLSession();
if ( ( pSession ) && ( pSession->cipher ) && ( pSession->cipher->name ) )
Table.SetCell( "Cipher", pSession->cipher->name );
@@ -421,7 +424,7 @@ public:
} else
{
Table.SetCell( "Type", "Listener" );
Table.SetCell( "LocalIP:Port", pSock->GetLocalIP() + ":" + CString::ToString( pSock->GetLocalPort() ) );
Table.SetCell( "LocalIP:Port", pSock->GetLocalIP() + ":" + CString( pSock->GetLocalPort() ) );
Table.SetCell( "RemoteIP:Port", "0.0.0.0:0" );
}
}
+7 -7
View File
@@ -275,7 +275,7 @@ public:
m_Buffer.SetLineCount(atoi(sCount.c_str()));
}
PutModule("Buffer count is set to [" + CString::ToString(m_Buffer.GetLineCount()) + "]");
PutModule("Buffer count is set to [" + CString(m_Buffer.GetLineCount()) + "]");
} else if (strcasecmp(sCmdName.c_str(), "DEL") == 0) {
Remove(atoi(sCommand.Token(1).c_str()));
} else {
@@ -318,7 +318,7 @@ private:
for (unsigned int a = 0; a < uIdx; a++, it++);
(*it).SetDisabled(bDisabled);
PutModule("Id " + CString::ToString(uIdx +1) + ((bDisabled) ? " Disabled" : " Enabled"));
PutModule("Id " + CString(uIdx +1) + ((bDisabled) ? " Disabled" : " Enabled"));
}
void List() {
@@ -336,7 +336,7 @@ private:
CWatchEntry& WatchEntry = *it;
Table.AddRow();
Table.SetCell("Id", CString::ToString(uIdx));
Table.SetCell("Id", CString(uIdx));
Table.SetCell("HostMask", WatchEntry.GetHostMask());
Table.SetCell("Target", WatchEntry.GetTarget());
Table.SetCell("Pattern", WatchEntry.GetPattern());
@@ -373,11 +373,11 @@ private:
PutModule("/msg " + GetModNick() + " ADD " + WatchEntry.GetHostMask() + " " + WatchEntry.GetTarget() + " " + WatchEntry.GetPattern());
if (WatchEntry.GetSourcesStr().size()) {
PutModule("/msg " + GetModNick() + " SETSOURCES " + CString::ToString(uIdx) + " " + WatchEntry.GetSourcesStr());
PutModule("/msg " + GetModNick() + " SETSOURCES " + CString(uIdx) + " " + WatchEntry.GetSourcesStr());
}
if (WatchEntry.IsDisabled()) {
PutModule("/msg " + GetModNick() + " DISABLE " + CString::ToString(uIdx));
PutModule("/msg " + GetModNick() + " DISABLE " + CString(uIdx));
}
}
@@ -395,7 +395,7 @@ private:
for (unsigned int a = 0; a < uIdx; a++, it++);
(*it).SetSources(sSources);
PutModule("Sources set for Id " + CString::ToString(uIdx +1) + ".");
PutModule("Sources set for Id " + CString(uIdx +1) + ".");
}
void Remove(unsigned int uIdx) {
@@ -409,7 +409,7 @@ private:
for (unsigned int a = 0; a < uIdx; a++, it++);
m_lsWatchers.erase(it);
PutModule("Id " + CString::ToString(uIdx +1) + " Removed.");
PutModule("Id " + CString(uIdx +1) + " Removed.");
}
void Help() {
+6 -6
View File
@@ -242,7 +242,7 @@ void CWebAdminSock::ListUsersPage(CString& sPageRet) {
CUser& User = *it->second;
l["Username"] = User.GetUserName();
l["Clients"] = CString::ToString(User.GetClients().size());
l["Clients"] = CString(User.GetClients().size());
l["IRCNick"] = User.GetIRCNick().GetNick();
if (pServer) {
@@ -333,7 +333,7 @@ bool CWebAdminSock::OnPageRequest(const CString& sURI, CString& sPageRet) {
unsigned int uCounter = m_pModule->GetSwitchCounter(GetRemoteIP());
if (!uCurCnt) {
Redirect("/switchuser?cnt=" + CString::ToString(uCounter));
Redirect("/switchuser?cnt=" + CString(uCounter));
return false;
}
@@ -462,7 +462,7 @@ bool CWebAdminSock::SettingsPage(CString& sPageRet) {
CListener* pListener = vpListeners[c];
CTemplate& l = m_Template.AddRow("ListenLoop");
l["Port"] = CString::ToString(pListener->GetPort());
l["Port"] = CString(pListener->GetPort());
l["BindHost"] = pListener->GetBindHost();
#ifdef HAVE_LIBSSL
@@ -609,7 +609,7 @@ bool CWebAdminSock::ChanPage(CString& sPageRet, CChan* pChan) {
m_Template["Edit"] = "true";
m_Template["Title"] = "Edit Channel" + CString(" [" + pChan->GetName() + "]");
m_Template["ChanName"] = pChan->GetName();
m_Template["BufferCount"] = CString::ToString(pChan->GetBufferCount());
m_Template["BufferCount"] = CString(pChan->GetBufferCount());
m_Template["DefModes"] = pChan->GetDefaultModes();
if (pChan->InConfig()) {
@@ -728,7 +728,7 @@ bool CWebAdminSock::UserPage(CString& sPageRet, CUser* pUser) {
m_Template["RealName"] = pUser->GetRealName();
m_Template["QuitMsg"] = pUser->GetQuitMsg();
m_Template["DefaultChanModes"] = pUser->GetDefaultChanModes();
m_Template["BufferCount"] = CString::ToString(pUser->GetBufferCount());
m_Template["BufferCount"] = CString(pUser->GetBufferCount());
const set<CString>& ssAllowedHosts = pUser->GetAllowedHosts();
for (set<CString>::const_iterator it = ssAllowedHosts.begin(); it != ssAllowedHosts.end(); it++) {
@@ -778,7 +778,7 @@ bool CWebAdminSock::UserPage(CString& sPageRet, CUser* pUser) {
l["Perms"] = pChan->GetPermStr();
l["CurModes"] = pChan->GetModeString();
l["DefModes"] = pChan->GetDefaultModes();
l["BufferCount"] = CString::ToString(pChan->GetBufferCount());
l["BufferCount"] = CString(pChan->GetBufferCount());
l["Options"] = pChan->GetOptions();
if (pChan->InConfig()) {