mirror of
https://github.com/znc/znc.git
synced 2026-08-07 09:22:55 +02:00
Moved CUtils::Trim() into CString class
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@247 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+2
-2
@@ -258,7 +258,7 @@ void CIRCSock::ReadLine(const CString& sData) {
|
||||
break;
|
||||
}
|
||||
case 324: { // MODE
|
||||
CUtils::Trim(sRest);
|
||||
sRest.Trim();
|
||||
CChan* pChan = m_pUser->FindChan(sRest.Token(0));
|
||||
|
||||
if (pChan) {
|
||||
@@ -267,7 +267,7 @@ void CIRCSock::ReadLine(const CString& sData) {
|
||||
}
|
||||
break;
|
||||
case 353: { // NAMES
|
||||
CUtils::Trim(sRest);
|
||||
sRest.Trim();
|
||||
// Todo: allow for non @+= server msgs
|
||||
CChan* pChan = m_pUser->FindChan(sRest.Token(1));
|
||||
if (pChan) {
|
||||
|
||||
+2
-2
@@ -123,7 +123,7 @@ bool CString::Trim(const CString& s) {
|
||||
bool CString::LeftTrim(const CString& s) {
|
||||
bool bRet = false;
|
||||
|
||||
while ((Left(1) == " ") || (Left(1) == "\t") || (Left(1) == "\r") || (Left(1) == "\n")) {
|
||||
while (s.find(Left(1)) != CString::npos) {
|
||||
LeftChomp();
|
||||
bRet = true;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ bool CString::LeftTrim(const CString& s) {
|
||||
bool CString::RightTrim(const CString& s) {
|
||||
bool bRet = false;
|
||||
|
||||
while ((Right(1) == " ") || (Right(1) == "\t") || (Right(1) == "\r") || (Right(1) == "\n")) {
|
||||
while (s.find(Right(1)) != CString::npos) {
|
||||
RightChomp();
|
||||
bRet = true;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ bool CUser::AddServer(const CString& sName) {
|
||||
|
||||
bool bSSL = false;
|
||||
CString sLine = sName;
|
||||
CUtils::Trim(sLine);
|
||||
sLine.Trim();
|
||||
|
||||
CString sHost = sLine.Token(0);
|
||||
CString sPort = sLine.Token(1);
|
||||
|
||||
@@ -392,18 +392,6 @@ CString CUtils::ToKBytes(double d) {
|
||||
return szRet;
|
||||
}
|
||||
|
||||
CString& CUtils::Trim(CString& s) {
|
||||
while ((s.Right(1) == " ") || (s.Right(1) == "\t") || (s.Right(1) == "\r") || (s.Right(1) == "\n")) {
|
||||
s.RightChomp();
|
||||
}
|
||||
|
||||
while ((s.Left(1) == " ") || (s.Left(1) == "\t") || (s.Left(1) == "\r") || (s.Left(1) == "\n")) {
|
||||
s.LeftChomp();
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
bool CUtils::wildcmp(const CString& sWild, const CString& sString) {
|
||||
// Written by Jack Handy - jakkhandy@hotmail.com
|
||||
const char *wild = sWild.c_str(), *CString = sString.c_str();
|
||||
|
||||
@@ -54,7 +54,6 @@ public:
|
||||
static CString ToPercent(double d);
|
||||
static CString ToKBytes(double d);
|
||||
|
||||
static CString& Trim(CString& s);
|
||||
static bool wildcmp(const CString& sWild, const CString& sString);
|
||||
|
||||
static unsigned long long GetMillTime() {
|
||||
|
||||
@@ -65,6 +65,7 @@ int main(int argc, char** argv) {
|
||||
if (iOptIndex >= 0) {
|
||||
CString sOption = Lower(g_LongOpts[iOptIndex].name);
|
||||
if (sOption == "version") {
|
||||
cout << "---[" << CString(" test ").RightTrim() << "]" << endl;
|
||||
cout << CZNC::GetTag() << endl;
|
||||
return 0;
|
||||
} else if (sOption == "makepass") {
|
||||
|
||||
+5
-2
@@ -20,6 +20,9 @@
|
||||
*
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.11 2005/05/08 04:30:13 prozacx
|
||||
* Moved CUtils::Trim() into CString class
|
||||
*
|
||||
* Revision 1.10 2005/05/07 09:18:49 prozacx
|
||||
* Moved CUtils::Token() into CString class
|
||||
*
|
||||
@@ -131,7 +134,7 @@ public:
|
||||
u_int iPos = 0;
|
||||
while( ReadLine( sFile, sLine, iPos ) )
|
||||
{
|
||||
CUtils::Trim( sLine );
|
||||
sLine.Trim();
|
||||
AddMessage( sLine );
|
||||
}
|
||||
} else
|
||||
@@ -314,7 +317,7 @@ public:
|
||||
if ( pTime )
|
||||
{
|
||||
sTime = pTime;
|
||||
CUtils::Trim( sTime );
|
||||
sTime.Trim();
|
||||
}
|
||||
if ( m_sReason.empty() )
|
||||
m_sReason = "away :Auto Away at " + sTime;
|
||||
|
||||
+4
-1
@@ -15,6 +15,9 @@
|
||||
* Author: imaginos <imaginos@imaginos.net>
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.6 2005/05/08 04:30:14 prozacx
|
||||
* Moved CUtils::Trim() into CString class
|
||||
*
|
||||
* Revision 1.5 2005/05/07 09:43:26 prozacx
|
||||
* Moved CUtils::Ellipsize() into CString class
|
||||
*
|
||||
@@ -207,7 +210,7 @@ public:
|
||||
u_int iPos = 0;
|
||||
while( ::ReadLine( m_sMailBuffer, sLine, iPos ) )
|
||||
{
|
||||
CUtils::Trim( sLine );
|
||||
sLine.Trim();
|
||||
if ( sLine.empty() )
|
||||
break; // out of the headers
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
* better solution then plain text.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.20 2005/05/08 04:30:14 prozacx
|
||||
* Moved CUtils::Trim() into CString class
|
||||
*
|
||||
* Revision 1.19 2005/05/05 18:11:04 prozacx
|
||||
* Changed all references to std::string over to CString
|
||||
*
|
||||
@@ -177,7 +180,7 @@ public:
|
||||
u_int iPos = 0;
|
||||
while( ReadLine( sFile, sLine, iPos ) )
|
||||
{
|
||||
CUtils::Trim( sLine );
|
||||
sLine.Trim();
|
||||
pChan->AddBuffer( sLine );
|
||||
}
|
||||
} else
|
||||
@@ -258,7 +261,7 @@ public:
|
||||
u_int iPos = 0;
|
||||
while( ReadLine( sFile, sLine, iPos ) )
|
||||
{
|
||||
CUtils::Trim( sLine );
|
||||
sLine.Trim();
|
||||
PutModule( "[" + sLine + "]" );
|
||||
}
|
||||
}
|
||||
@@ -273,7 +276,7 @@ public:
|
||||
u_int iPos = 0;
|
||||
while( ReadLine( sFile, sLine, iPos ) )
|
||||
{
|
||||
CUtils::Trim( sLine );
|
||||
sLine.Trim();
|
||||
PutUser( sLine );
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -16,6 +16,9 @@
|
||||
* Author: imaginos <imaginos@imaginos.net>
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.11 2005/05/08 04:30:14 prozacx
|
||||
* Moved CUtils::Trim() into CString class
|
||||
*
|
||||
* Revision 1.10 2005/05/07 09:18:56 prozacx
|
||||
* Moved CUtils::Token() into CString class
|
||||
*
|
||||
@@ -300,7 +303,7 @@ public:
|
||||
if ( pTime )
|
||||
{
|
||||
CString sTime = pTime;
|
||||
CUtils::Trim( sTime );
|
||||
sTime.Trim();
|
||||
Table.SetCell( "Created", sTime );
|
||||
}
|
||||
|
||||
@@ -368,7 +371,7 @@ public:
|
||||
if ( pTime )
|
||||
{
|
||||
CString sTime = pTime;
|
||||
CUtils::Trim( sTime );
|
||||
sTime.Trim();
|
||||
Table.SetCell( "Created", sTime );
|
||||
}
|
||||
|
||||
|
||||
@@ -449,7 +449,7 @@ bool CZNC::ParseConfig(const CString& sConfig) {
|
||||
|
||||
while (File.ReadLine(sLine)) {
|
||||
while ((sLine.Right(1) == "\r") || (sLine.Right(1) == "\n")) {
|
||||
CUtils::Trim(sLine);
|
||||
sLine.Trim();
|
||||
}
|
||||
|
||||
if ((sLine.empty()) || (sLine[0] == '#') || (sLine.Left(2) == "//")) {
|
||||
@@ -480,8 +480,8 @@ bool CZNC::ParseConfig(const CString& sConfig) {
|
||||
CString sTag = sLine.substr(0, sLine.find_first_of(" \t\r\n"));
|
||||
CString sValue = (sTag.size() < sLine.size()) ? sLine.substr(sTag.size() +1) : "";
|
||||
|
||||
CUtils::Trim(sTag);
|
||||
CUtils::Trim(sValue);
|
||||
sTag.Trim();
|
||||
sValue.Trim();
|
||||
|
||||
if (sLine.Left(1) == "/") {
|
||||
CString sTag = sLine.substr(1);
|
||||
@@ -554,8 +554,8 @@ bool CZNC::ParseConfig(const CString& sConfig) {
|
||||
// If we have a regular line, figure out where it goes
|
||||
CString sName = sLine.Token(0, false, '=');
|
||||
CString sValue = sLine.Token(1, true, '=');
|
||||
CUtils::Trim(sName);
|
||||
CUtils::Trim(sValue);
|
||||
sName.Trim();
|
||||
sValue.Trim();
|
||||
|
||||
if ((!sName.empty()) && (!sValue.empty())) {
|
||||
if (pUser) {
|
||||
|
||||
Reference in New Issue
Block a user