diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
commit | c663b6440964f6ac48027143ac9e63298991f9d0 (patch) | |
tree | 6d8b0c5a5f9db1ee16acf98b1397cea9126b281d /kioslave/smtp | |
parent | a061f7191beebb0e4a3b0c0a7c534ec5f22f2dc7 (diff) | |
download | tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.tar.gz tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kioslave/smtp')
-rw-r--r-- | kioslave/smtp/capabilities.cc | 48 | ||||
-rw-r--r-- | kioslave/smtp/capabilities.h | 30 | ||||
-rw-r--r-- | kioslave/smtp/command.cc | 60 | ||||
-rw-r--r-- | kioslave/smtp/command.h | 58 | ||||
-rw-r--r-- | kioslave/smtp/interactivesmtpserver.cc | 74 | ||||
-rw-r--r-- | kioslave/smtp/interactivesmtpserver.h | 38 | ||||
-rw-r--r-- | kioslave/smtp/request.cc | 36 | ||||
-rw-r--r-- | kioslave/smtp/request.h | 42 | ||||
-rw-r--r-- | kioslave/smtp/response.cc | 16 | ||||
-rw-r--r-- | kioslave/smtp/response.h | 8 | ||||
-rw-r--r-- | kioslave/smtp/smtp.cc | 56 | ||||
-rw-r--r-- | kioslave/smtp/smtp.h | 32 | ||||
-rw-r--r-- | kioslave/smtp/test_commands.cc | 26 | ||||
-rw-r--r-- | kioslave/smtp/test_headergeneration.cc | 4 | ||||
-rw-r--r-- | kioslave/smtp/test_responseparser.cc | 6 | ||||
-rw-r--r-- | kioslave/smtp/transactionstate.cc | 14 | ||||
-rw-r--r-- | kioslave/smtp/transactionstate.h | 26 |
17 files changed, 287 insertions, 287 deletions
diff --git a/kioslave/smtp/capabilities.cc b/kioslave/smtp/capabilities.cc index a26626ce1..5b2856837 100644 --- a/kioslave/smtp/capabilities.cc +++ b/kioslave/smtp/capabilities.cc @@ -35,7 +35,7 @@ #include "response.h" -#include <qstrlist.h> +#include <tqstrlist.h> namespace KioSMTP { @@ -56,24 +56,24 @@ namespace KioSMTP { return c; } - void Capabilities::add( const QString & cap, bool replace ) { - QStringList tokens = QStringList::split( ' ', cap.upper() ); + void Capabilities::add( const TQString & cap, bool replace ) { + TQStringList tokens = TQStringList::split( ' ', cap.upper() ); if ( tokens.empty() ) return; - QString name = tokens.front(); tokens.pop_front(); + TQString name = tokens.front(); tokens.pop_front(); add( name, tokens, replace ); } - void Capabilities::add( const QString & name, const QStringList & args, bool replace ) { + void Capabilities::add( const TQString & name, const TQStringList & args, bool replace ) { if ( replace ) mCapabilities[name] = args; else mCapabilities[name] += args; } - QString Capabilities::asMetaDataString() const { - QString result; - for ( QMap<QString,QStringList>::const_iterator it = mCapabilities.begin() ; it != mCapabilities.end() ; ++it ) { + TQString Capabilities::asMetaDataString() const { + TQString result; + for ( TQMap<TQString,TQStringList>::const_iterator it = mCapabilities.begin() ; it != mCapabilities.end() ; ++it ) { result += it.key(); if ( !it.data().empty() ) result += ' ' + it.data().join( " " ); @@ -82,24 +82,24 @@ namespace KioSMTP { return result; } - QString Capabilities::authMethodMetaData() const { - QStringList sl = saslMethodsQSL(); - QString result; - for ( QStringList::const_iterator it = sl.begin() ; it != sl.end() ; ++it ) + TQString Capabilities::authMethodMetaData() const { + TQStringList sl = saslMethodsQSL(); + TQString result; + for ( TQStringList::const_iterator it = sl.begin() ; it != sl.end() ; ++it ) result += "SASL/" + *it + '\n'; return result; } - QStrIList Capabilities::saslMethods() const { - QStrIList result( true ); // deep copies to be safe - QStringList sl = saslMethodsQSL(); - for ( QStringList::const_iterator it = sl.begin() ; it != sl.end() ; ++it ) + TQStrIList Capabilities::saslMethods() const { + TQStrIList result( true ); // deep copies to be safe + TQStringList sl = saslMethodsQSL(); + for ( TQStringList::const_iterator it = sl.begin() ; it != sl.end() ; ++it ) result.append( (*it).latin1() ); return result; } - QString Capabilities::createSpecialResponse( bool tls ) const { - QStringList result; + TQString Capabilities::createSpecialResponse( bool tls ) const { + TQStringList result; if ( tls ) result.push_back( "STARTTLS" ); result += saslMethodsQSL(); @@ -113,16 +113,16 @@ namespace KioSMTP { if ( ok && !size ) result.push_back( "SIZE=*" ); // any size else if ( ok ) - result.push_back( "SIZE=" + QString::number( size ) ); // fixed max + result.push_back( "SIZE=" + TQString::number( size ) ); // fixed max else result.push_back( "SIZE" ); // indetermined } return result.join( " " ); } - QStringList Capabilities::saslMethodsQSL() const { - QStringList result; - for ( QMap<QString,QStringList>::const_iterator it = mCapabilities.begin() ; it != mCapabilities.end() ; ++it ) { + TQStringList Capabilities::saslMethodsQSL() const { + TQStringList result; + for ( TQMap<TQString,TQStringList>::const_iterator it = mCapabilities.begin() ; it != mCapabilities.end() ; ++it ) { if ( it.key() == "AUTH" ) result += it.data(); else if ( it.key().startsWith( "AUTH=" ) ) { @@ -131,8 +131,8 @@ namespace KioSMTP { } } result.sort(); - QStringList::iterator it = result.begin(); - for (QStringList::iterator ot = it++; it != result.end(); ot = it++) + TQStringList::iterator it = result.begin(); + for (TQStringList::iterator ot = it++; it != result.end(); ot = it++) if (*ot == *it) result.remove(ot); return result; } diff --git a/kioslave/smtp/capabilities.h b/kioslave/smtp/capabilities.h index 1ae5972aa..d9a9de39a 100644 --- a/kioslave/smtp/capabilities.h +++ b/kioslave/smtp/capabilities.h @@ -32,10 +32,10 @@ #ifndef __KIOSMTP_CAPABILITIES_H__ #define __KIOSMTP_CAPABILITIES_H__ -#include <qmap.h> -#include <qcstring.h> -#include <qstring.h> -#include <qstringlist.h> +#include <tqmap.h> +#include <tqcstring.h> +#include <tqstring.h> +#include <tqstringlist.h> class QStrIList; @@ -49,27 +49,27 @@ namespace KioSMTP { static Capabilities fromResponse( const Response & response ); - void add( const QString & cap, bool replace=false ); - void add( const QString & name, const QStringList & args, bool replace=false ); + void add( const TQString & cap, bool replace=false ); + void add( const TQString & name, const TQStringList & args, bool replace=false ); void clear() { mCapabilities.clear(); } - bool have( const QString & cap ) const { + bool have( const TQString & cap ) const { return mCapabilities.find( cap.upper() ) != mCapabilities.end(); } - bool have( const QCString & cap ) const { return have( QString( cap.data() ) ); } - bool have( const char * cap ) const { return have( QString::fromLatin1( cap ) ); } + bool have( const TQCString & cap ) const { return have( TQString( cap.data() ) ); } + bool have( const char * cap ) const { return have( TQString::fromLatin1( cap ) ); } - QString asMetaDataString() const; + TQString asMetaDataString() const; - QString authMethodMetaData() const; - QStrIList saslMethods() const; + TQString authMethodMetaData() const; + TQStrIList saslMethods() const; - QString createSpecialResponse( bool tls ) const; + TQString createSpecialResponse( bool tls ) const; - QStringList saslMethodsQSL() const; + TQStringList saslMethodsQSL() const; private: - QMap<QString,QStringList> mCapabilities; + TQMap<TQString,TQStringList> mCapabilities; }; } // namespace KioSMTP diff --git a/kioslave/smtp/command.cc b/kioslave/smtp/command.cc index 9fb7281c9..2771baf82 100644 --- a/kioslave/smtp/command.cc +++ b/kioslave/smtp/command.cc @@ -79,7 +79,7 @@ static sasl_callback_t callbacks[] = { return r.isOk(); } - void Command::ungetCommandLine( const QCString &, TransactionState * ) { + void Command::ungetCommandLine( const TQCString &, TransactionState * ) { mComplete = false; } @@ -122,7 +122,7 @@ static sasl_callback_t callbacks[] = { // EHLO / HELO // - QCString EHLOCommand::nextCommandLine( TransactionState * ) { + TQCString EHLOCommand::nextCommandLine( TransactionState * ) { mNeedResponse = true; mComplete = mEHLONotSupported; const char * cmd = mEHLONotSupported ? "HELO " : "EHLO " ; @@ -159,7 +159,7 @@ static sasl_callback_t callbacks[] = { // STARTTLS - rfc 3207 // - QCString StartTLSCommand::nextCommandLine( TransactionState * ) { + TQCString StartTLSCommand::nextCommandLine( TransactionState * ) { mComplete = true; mNeedResponse = true; return "STARTTLS\r\n"; @@ -195,14 +195,14 @@ static sasl_callback_t callbacks[] = { #define SASLERROR mSMTP->error(KIO::ERR_COULD_NOT_AUTHENTICATE, \ i18n("An error occured during authentication: %1").arg \ - ( QString::fromUtf8( sasl_errdetail( conn ) ))); + ( TQString::fromUtf8( sasl_errdetail( conn ) ))); // // AUTH - rfc 2554 // AuthCommand::AuthCommand( SMTPProtocol * smtp, const char *mechanisms, - const QString &aFQDN, + const TQString &aFQDN, KIO::AuthInfo &ai ) : Command( smtp, CloseConnectionOnError|OnlyLastInPipeline ), mAi( &ai ), @@ -306,29 +306,29 @@ static sasl_callback_t callbacks[] = { return !mMechusing; } - void AuthCommand::ungetCommandLine( const QCString & s, TransactionState * ) { + void AuthCommand::ungetCommandLine( const TQCString & s, TransactionState * ) { mUngetSASLResponse = s; mComplete = false; } - QCString AuthCommand::nextCommandLine( TransactionState * ) { + TQCString AuthCommand::nextCommandLine( TransactionState * ) { mNeedResponse = true; - QCString cmd; + TQCString cmd; #ifdef HAVE_LIBSASL2 - QByteArray tmp, challenge; + TQByteArray tmp, challenge; if ( !mUngetSASLResponse.isNull() ) { // implement un-ungetCommandLine cmd = mUngetSASLResponse; mUngetSASLResponse = 0; } else if ( mFirstTime ) { - QString firstCommand = "AUTH " + QString::fromLatin1( mMechusing ); + TQString firstCommand = "AUTH " + TQString::fromLatin1( mMechusing ); tmp.setRawData( mOut, mOutlen ); KCodecs::base64Encode( tmp, challenge ); tmp.resetRawData( mOut, mOutlen ); if ( !challenge.isEmpty() ) { firstCommand += " "; - firstCommand += QString::fromLatin1( challenge.data(), challenge.size() ); + firstCommand += TQString::fromLatin1( challenge.data(), challenge.size() ); } cmd = firstCommand.latin1(); @@ -394,14 +394,14 @@ static sasl_callback_t callbacks[] = { // MAIL FROM: // - QCString MailFromCommand::nextCommandLine( TransactionState * ) { + TQCString MailFromCommand::nextCommandLine( TransactionState * ) { mComplete = true; mNeedResponse = true; - QCString cmdLine = "MAIL FROM:<" + mAddr + '>'; + TQCString cmdLine = "MAIL FROM:<" + mAddr + '>'; if ( m8Bit && haveCapability("8BITMIME") ) cmdLine += " BODY=8BITMIME"; if ( mSize && haveCapability("SIZE") ) - cmdLine += " SIZE=" + QCString().setNum( mSize ); + cmdLine += " SIZE=" + TQCString().setNum( mSize ); return cmdLine + "\r\n"; } @@ -420,7 +420,7 @@ static sasl_callback_t callbacks[] = { // RCPT TO: // - QCString RcptToCommand::nextCommandLine( TransactionState * ) { + TQCString RcptToCommand::nextCommandLine( TransactionState * ) { mComplete = true; mNeedResponse = true; return "RCPT TO:<" + mAddr + ">\r\n"; @@ -443,7 +443,7 @@ static sasl_callback_t callbacks[] = { // DATA (only initial processing!) // - QCString DataCommand::nextCommandLine( TransactionState * ts ) { + TQCString DataCommand::nextCommandLine( TransactionState * ts ) { assert( ts ); mComplete = true; mNeedResponse = true; @@ -451,7 +451,7 @@ static sasl_callback_t callbacks[] = { return "DATA\r\n"; } - void DataCommand::ungetCommandLine( const QCString &, TransactionState * ts ) { + void DataCommand::ungetCommandLine( const TQCString &, TransactionState * ts ) { assert( ts ); mComplete = false; ts->setDataCommandIssued( false ); @@ -473,7 +473,7 @@ static sasl_callback_t callbacks[] = { // // DATA (data transfer) // - void TransferCommand::ungetCommandLine( const QCString & cmd, TransactionState * ) { + void TransferCommand::ungetCommandLine( const TQCString & cmd, TransactionState * ) { if ( cmd.isEmpty() ) return; // don't change state when we can't detect the unget in // the next nextCommandLine !! @@ -488,16 +488,16 @@ static sasl_callback_t callbacks[] = { return ts->failed(); } - QCString TransferCommand::nextCommandLine( TransactionState * ts ) { + TQCString TransferCommand::nextCommandLine( TransactionState * ts ) { assert( ts ); // let's rely on it ( at least for the moment ) assert( !isComplete() ); assert( !ts->failed() ); - static const QCString dotCRLF = ".\r\n"; - static const QCString CRLFdotCRLF = "\r\n.\r\n"; + static const TQCString dotCRLF = ".\r\n"; + static const TQCString CRLFdotCRLF = "\r\n.\r\n"; if ( !mUngetBuffer.isEmpty() ) { - const QCString ret = mUngetBuffer; + const TQCString ret = mUngetBuffer; mUngetBuffer = 0; if ( mWasComplete ) { mComplete = true; @@ -510,7 +510,7 @@ static sasl_callback_t callbacks[] = { kdDebug(7112) << "requesting data" << endl; mSMTP->dataReq(); - QByteArray ba; + TQByteArray ba; int result = mSMTP->readData( ba ); kdDebug(7112) << "got " << result << " bytes" << endl; if ( result > 0 ) @@ -541,8 +541,8 @@ static sasl_callback_t callbacks[] = { return true; } - static QCString dotstuff_lf2crlf( const QByteArray & ba, char & last ) { - QCString result( ba.size() * 2 + 1 ); // worst case: repeated "[.]\n" + static TQCString dotstuff_lf2crlf( const TQByteArray & ba, char & last ) { + TQCString result( ba.size() * 2 + 1 ); // worst case: repeated "[.]\n" const char * s = ba.data(); const char * const send = ba.data() + ba.size(); char * d = result.data(); @@ -560,7 +560,7 @@ static sasl_callback_t callbacks[] = { return result; } - QCString TransferCommand::prepare( const QByteArray & ba ) { + TQCString TransferCommand::prepare( const TQByteArray & ba ) { if ( ba.isEmpty() ) return 0; if ( mSMTP->metaData("lf2crlf+dotstuff") == "slave" ) { @@ -568,7 +568,7 @@ static sasl_callback_t callbacks[] = { return dotstuff_lf2crlf( ba, mLastChar ); } else { mLastChar = ba[ ba.size() - 1 ]; - return QCString( ba.data(), ba.size() + 1 ); + return TQCString( ba.data(), ba.size() + 1 ); } } @@ -576,7 +576,7 @@ static sasl_callback_t callbacks[] = { // NOOP // - QCString NoopCommand::nextCommandLine( TransactionState * ) { + TQCString NoopCommand::nextCommandLine( TransactionState * ) { mComplete = true; mNeedResponse = true; return "NOOP\r\n"; @@ -586,7 +586,7 @@ static sasl_callback_t callbacks[] = { // RSET // - QCString RsetCommand::nextCommandLine( TransactionState * ) { + TQCString RsetCommand::nextCommandLine( TransactionState * ) { mComplete = true; mNeedResponse = true; return "RSET\r\n"; @@ -596,7 +596,7 @@ static sasl_callback_t callbacks[] = { // QUIT // - QCString QuitCommand::nextCommandLine( TransactionState * ) { + TQCString QuitCommand::nextCommandLine( TransactionState * ) { mComplete = true; mNeedResponse = true; return "QUIT\r\n"; diff --git a/kioslave/smtp/command.h b/kioslave/smtp/command.h index e67f02556..bd6b6aa85 100644 --- a/kioslave/smtp/command.h +++ b/kioslave/smtp/command.h @@ -33,8 +33,8 @@ #define __KIOSMTP_COMMAND_H__ -#include <qstring.h> -#include <qcstring.h> +#include <tqstring.h> +#include <tqcstring.h> #ifdef HAVE_LIBSASL2 extern "C" { @@ -101,11 +101,11 @@ namespace KioSMTP { static Command * createSimpleCommand( int which, SMTPProtocol * smtp ); - virtual QCString nextCommandLine( TransactionState * ts=0 ) = 0; + virtual TQCString nextCommandLine( TransactionState * ts=0 ) = 0; /* Reimplement this if your @ref #nextCommandLine() implementation changes state other than @ref mComplete. The default implementation just resets @ref mComplete to false. */ - virtual void ungetCommandLine( const QCString & cmdLine, TransactionState * ts=0 ); + virtual void ungetCommandLine( const TQCString & cmdLine, TransactionState * ts=0 ); /* Reimplement this if your command need more sophisicated response processing than just checking for @ref Response::isOk(). The default implementation sets @ref @@ -152,16 +152,16 @@ namespace KioSMTP { class EHLOCommand : public Command { public: - EHLOCommand( SMTPProtocol * smtp, const QString & hostname ) + EHLOCommand( SMTPProtocol * smtp, const TQString & hostname ) : Command( smtp, CloseConnectionOnError|OnlyLastInPipeline ), mEHLONotSupported( false ), mHostname( hostname.stripWhiteSpace() ) {} - QCString nextCommandLine( TransactionState * ); + TQCString nextCommandLine( TransactionState * ); bool processResponse( const Response & response, TransactionState * ); private: bool mEHLONotSupported; - QString mHostname; + TQString mHostname; }; class StartTLSCommand : public Command { @@ -169,18 +169,18 @@ namespace KioSMTP { StartTLSCommand( SMTPProtocol * smtp ) : Command( smtp, CloseConnectionOnError|OnlyLastInPipeline ) {} - QCString nextCommandLine( TransactionState * ); + TQCString nextCommandLine( TransactionState * ); bool processResponse( const Response & response, TransactionState * ); }; class AuthCommand : public Command { public: AuthCommand( SMTPProtocol * smtp, const char *mechanisms, - const QString &aFQDN, KIO::AuthInfo &ai ); + const TQString &aFQDN, KIO::AuthInfo &ai ); ~AuthCommand(); bool doNotExecute( const TransactionState * ts ) const; - QCString nextCommandLine( TransactionState * ); - void ungetCommandLine( const QCString & cmdLine, TransactionState * ); + TQCString nextCommandLine( TransactionState * ); + void ungetCommandLine( const TQCString & cmdLine, TransactionState * ); bool processResponse( const Response & response, TransactionState * ); private: bool saslInteract( void *in ); @@ -194,34 +194,34 @@ namespace KioSMTP { bool mOneStep; KIO::AuthInfo *mAi; - QCString mLastChallenge; - QCString mUngetSASLResponse; + TQCString mLastChallenge; + TQCString mUngetSASLResponse; bool mFirstTime; }; class MailFromCommand : public Command { public: - MailFromCommand( SMTPProtocol * smtp, const QCString & addr, + MailFromCommand( SMTPProtocol * smtp, const TQCString & addr, bool eightBit=false, unsigned int size=0 ) : Command( smtp ), mAddr( addr ), m8Bit( eightBit ), mSize( size ) {} - QCString nextCommandLine( TransactionState * ); + TQCString nextCommandLine( TransactionState * ); bool processResponse( const Response & response, TransactionState * ); private: - QCString mAddr; + TQCString mAddr; bool m8Bit; unsigned int mSize; }; class RcptToCommand : public Command { public: - RcptToCommand( SMTPProtocol * smtp, const QCString & addr ) + RcptToCommand( SMTPProtocol * smtp, const TQCString & addr ) : Command( smtp ), mAddr( addr ) {} - QCString nextCommandLine( TransactionState * ); + TQCString nextCommandLine( TransactionState * ); bool processResponse( const Response & response, TransactionState * ); private: - QCString mAddr; + TQCString mAddr; }; /** Handles only the initial intermediate response and compltetes at @@ -231,25 +231,25 @@ namespace KioSMTP { DataCommand( SMTPProtocol * smtp ) : Command( smtp, OnlyLastInPipeline ) {} - QCString nextCommandLine( TransactionState * ); - void ungetCommandLine( const QCString & cmd, TransactionState * ts ); + TQCString nextCommandLine( TransactionState * ); + void ungetCommandLine( const TQCString & cmd, TransactionState * ts ); bool processResponse( const Response & response, TransactionState * ); }; /** Handles the data transfer following a successful DATA command */ class TransferCommand : public Command { public: - TransferCommand( SMTPProtocol * smtp, const QCString & initialBuffer ) + TransferCommand( SMTPProtocol * smtp, const TQCString & initialBuffer ) : Command( smtp, OnlyFirstInPipeline ), mUngetBuffer( initialBuffer ), mLastChar( '\n' ), mWasComplete( false ) {} bool doNotExecute( const TransactionState * ts ) const; - QCString nextCommandLine( TransactionState * ); - void ungetCommandLine( const QCString & cmd, TransactionState * ts ); + TQCString nextCommandLine( TransactionState * ); + void ungetCommandLine( const TQCString & cmd, TransactionState * ts ); bool processResponse( const Response & response, TransactionState * ); private: - QCString prepare( const QByteArray & ba ); - QCString mUngetBuffer; + TQCString prepare( const TQByteArray & ba ); + TQCString mUngetBuffer; char mLastChar; bool mWasComplete; // ... before ungetting }; @@ -259,7 +259,7 @@ namespace KioSMTP { NoopCommand( SMTPProtocol * smtp ) : Command( smtp, OnlyLastInPipeline ) {} - QCString nextCommandLine( TransactionState * ); + TQCString nextCommandLine( TransactionState * ); }; class RsetCommand : public Command { @@ -267,7 +267,7 @@ namespace KioSMTP { RsetCommand( SMTPProtocol * smtp ) : Command( smtp, CloseConnectionOnError ) {} - QCString nextCommandLine( TransactionState * ); + TQCString nextCommandLine( TransactionState * ); }; class QuitCommand : public Command { @@ -275,7 +275,7 @@ namespace KioSMTP { QuitCommand( SMTPProtocol * smtp ) : Command( smtp, CloseConnectionOnError|OnlyLastInPipeline ) {} - QCString nextCommandLine( TransactionState * ); + TQCString nextCommandLine( TransactionState * ); }; } // namespace KioSMTP diff --git a/kioslave/smtp/interactivesmtpserver.cc b/kioslave/smtp/interactivesmtpserver.cc index 4deddd3ca..50cd6f036 100644 --- a/kioslave/smtp/interactivesmtpserver.cc +++ b/kioslave/smtp/interactivesmtpserver.cc @@ -33,30 +33,30 @@ #include <config.h> -#include <qserversocket.h> -#include <qsocket.h> -#include <qwidget.h> -#include <qapplication.h> -#include <qhostaddress.h> -#include <qtextedit.h> -#include <qlineedit.h> -#include <qlabel.h> -#include <qstring.h> -#include <qlayout.h> -#include <qpushbutton.h> +#include <tqserversocket.h> +#include <tqsocket.h> +#include <tqwidget.h> +#include <tqapplication.h> +#include <tqhostaddress.h> +#include <tqtextedit.h> +#include <tqlineedit.h> +#include <tqlabel.h> +#include <tqstring.h> +#include <tqlayout.h> +#include <tqpushbutton.h> #include <cassert> #include "interactivesmtpserver.h" -static const QHostAddress localhost( 0x7f000001 ); // 127.0.0.1 +static const TQHostAddress localhost( 0x7f000001 ); // 127.0.0.1 InteractiveSMTPServerWindow::~InteractiveSMTPServerWindow() { if ( mSocket ) { mSocket->close(); - if ( mSocket->state() == QSocket::Closing ) - connect( mSocket, SIGNAL(delayedCloseFinished()), - mSocket, SLOT(deleteLater()) ); + if ( mSocket->state() == TQSocket::Closing ) + connect( mSocket, TQT_SIGNAL(delayedCloseFinished()), + mSocket, TQT_SLOT(deleteLater()) ); else mSocket->deleteLater(); mSocket = 0; @@ -65,20 +65,20 @@ InteractiveSMTPServerWindow::~InteractiveSMTPServerWindow() { void InteractiveSMTPServerWindow::slotSendResponse() { - const QString line = mLineEdit->text(); + const TQString line = mLineEdit->text(); mLineEdit->clear(); - QTextStream s( mSocket ); + TQTextStream s( mSocket ); s << line + "\r\n"; slotDisplayServer( line ); } -InteractiveSMTPServer::InteractiveSMTPServer( QObject* parent ) - : QServerSocket( localhost, 2525, 1, parent ) +InteractiveSMTPServer::InteractiveSMTPServer( TQObject* parent ) + : TQServerSocket( localhost, 2525, 1, parent ) { } int main( int argc, char * argv[] ) { - QApplication app( argc, argv ); + TQApplication app( argc, argv ); InteractiveSMTPServer server; @@ -88,37 +88,37 @@ int main( int argc, char * argv[] ) { }; -InteractiveSMTPServerWindow::InteractiveSMTPServerWindow( QSocket * socket, QWidget * parent, const char * name, WFlags f ) - : QWidget( parent, name, f ), mSocket( socket ) +InteractiveSMTPServerWindow::InteractiveSMTPServerWindow( TQSocket * socket, TQWidget * parent, const char * name, WFlags f ) + : TQWidget( parent, name, f ), mSocket( socket ) { - QPushButton * but; + TQPushButton * but; assert( socket ); - QVBoxLayout * vlay = new QVBoxLayout( this, 6 ); + TQVBoxLayout * vlay = new TQVBoxLayout( this, 6 ); - mTextEdit = new QTextEdit( this ); - mTextEdit->setTextFormat( QTextEdit::LogText ); + mTextEdit = new TQTextEdit( this ); + mTextEdit->setTextFormat( TQTextEdit::LogText ); vlay->addWidget( mTextEdit, 1 ); - QHBoxLayout * hlay = new QHBoxLayout( vlay ); + TQHBoxLayout * hlay = new TQHBoxLayout( vlay ); - mLineEdit = new QLineEdit( this ); - but = new QPushButton( "&Send", this ); - hlay->addWidget( new QLabel( mLineEdit, "&Response:", this ) ); + mLineEdit = new TQLineEdit( this ); + but = new TQPushButton( "&Send", this ); + hlay->addWidget( new TQLabel( mLineEdit, "&Response:", this ) ); hlay->addWidget( mLineEdit, 1 ); hlay->addWidget( but ); - connect( mLineEdit, SIGNAL(returnPressed()), SLOT(slotSendResponse()) ); - connect( but, SIGNAL(clicked()), SLOT(slotSendResponse()) ); + connect( mLineEdit, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotSendResponse()) ); + connect( but, TQT_SIGNAL(clicked()), TQT_SLOT(slotSendResponse()) ); - but = new QPushButton( "&Close Connection", this ); + but = new TQPushButton( "&Close Connection", this ); vlay->addWidget( but ); - connect( but, SIGNAL(clicked()), SLOT(slotConnectionClosed()) ); + connect( but, TQT_SIGNAL(clicked()), TQT_SLOT(slotConnectionClosed()) ); - connect( socket, SIGNAL(connectionClosed()), SLOT(slotConnectionClosed()) ); - connect( socket, SIGNAL(error(int)), SLOT(slotError(int)) ); - connect( socket, SIGNAL(readyRead()), SLOT(slotReadyRead()) ); + connect( socket, TQT_SIGNAL(connectionClosed()), TQT_SLOT(slotConnectionClosed()) ); + connect( socket, TQT_SIGNAL(error(int)), TQT_SLOT(slotError(int)) ); + connect( socket, TQT_SIGNAL(readyRead()), TQT_SLOT(slotReadyRead()) ); mLineEdit->setText( "220 hi there" ); mLineEdit->setFocus(); diff --git a/kioslave/smtp/interactivesmtpserver.h b/kioslave/smtp/interactivesmtpserver.h index 3ae210a74..39a07f6a9 100644 --- a/kioslave/smtp/interactivesmtpserver.h +++ b/kioslave/smtp/interactivesmtpserver.h @@ -34,20 +34,20 @@ your version. */ -#include <qwidget.h> +#include <tqwidget.h> -static QString err2str( int err ) { +static TQString err2str( int err ) { switch ( err ) { - case QSocket::ErrConnectionRefused: return "Connection refused"; - case QSocket::ErrHostNotFound: return "Host not found"; - case QSocket::ErrSocketRead: return "Failed to read from socket"; + case TQSocket::ErrConnectionRefused: return "Connection refused"; + case TQSocket::ErrHostNotFound: return "Host not found"; + case TQSocket::ErrSocketRead: return "Failed to read from socket"; default: return "Unknown error"; } } -static QString escape( QString s ) { +static TQString escape( TQString s ) { return s .replace( '&', "&" ) .replace( '>', ">" ) @@ -57,7 +57,7 @@ static QString escape( QString s ) { } -static QString trim( const QString & s ) { +static TQString trim( const TQString & s ) { if ( s.endsWith( "\r\n" ) ) return s.left( s.length() - 2 ); if ( s.endsWith( "\r" ) || s.endsWith( "\n" ) ) @@ -66,21 +66,21 @@ static QString trim( const QString & s ) { } -class InteractiveSMTPServerWindow : public QWidget { +class InteractiveSMTPServerWindow : public TQWidget { Q_OBJECT public: - InteractiveSMTPServerWindow( QSocket * socket, QWidget * parent=0, const char * name=0, WFlags f=0 ); + InteractiveSMTPServerWindow( TQSocket * socket, TQWidget * parent=0, const char * name=0, WFlags f=0 ); ~InteractiveSMTPServerWindow(); public slots: void slotSendResponse(); - void slotDisplayClient( const QString & s ) { + void slotDisplayClient( const TQString & s ) { mTextEdit->append( "C:" + escape(s) ); } - void slotDisplayServer( const QString & s ) { + void slotDisplayServer( const TQString & s ) { mTextEdit->append( "S:" + escape(s) ); } - void slotDisplayMeta( const QString & s ) { + void slotDisplayMeta( const TQString & s ) { mTextEdit->append( "<font color=\"red\">" + escape(s) + "</font>" ); } void slotReadyRead() { @@ -88,7 +88,7 @@ public slots: slotDisplayClient( trim( mSocket->readLine() ) ); } void slotError( int err ) { - slotDisplayMeta( QString( "E: %1 (%2)" ).arg( err2str( err ) ).arg( err ) ); + slotDisplayMeta( TQString( "E: %1 (%2)" ).arg( err2str( err ) ).arg( err ) ); } void slotConnectionClosed() { slotDisplayMeta( "Connection closed by peer" ); @@ -97,20 +97,20 @@ public slots: mSocket->close(); } private: - QSocket * mSocket; - QTextEdit * mTextEdit; - QLineEdit * mLineEdit; + TQSocket * mSocket; + TQTextEdit * mTextEdit; + TQLineEdit * mLineEdit; }; -class InteractiveSMTPServer : public QServerSocket { +class InteractiveSMTPServer : public TQServerSocket { Q_OBJECT public: - InteractiveSMTPServer( QObject * parent=0 ); + InteractiveSMTPServer( TQObject * parent=0 ); ~InteractiveSMTPServer() {} /*! \reimp */ void newConnection( int fd ) { - QSocket * socket = new QSocket(); + TQSocket * socket = new TQSocket(); socket->setSocket( fd ); InteractiveSMTPServerWindow * w = new InteractiveSMTPServerWindow( socket ); w->show(); diff --git a/kioslave/smtp/request.cc b/kioslave/smtp/request.cc index 566d2c758..ab02abc1c 100644 --- a/kioslave/smtp/request.cc +++ b/kioslave/smtp/request.cc @@ -45,17 +45,17 @@ namespace KioSMTP { Request Request::fromURL( const KURL & url ) { Request request; - const QStringList query = QStringList::split( '&', url.query().mid(1) ); + const TQStringList query = TQStringList::split( '&', url.query().mid(1) ); #ifndef NDEBUG kdDebug(7112) << "Parsing request from query:\n" + query.join("\n" ) << endl; #endif - for ( QStringList::const_iterator it = query.begin() ; it != query.end() ; ++it ) { + for ( TQStringList::const_iterator it = query.begin() ; it != query.end() ; ++it ) { int equalsPos = (*it).find( '=' ); if ( equalsPos <= 0 ) continue; - const QString key = (*it).left( equalsPos ).lower(); - const QString value = KURL::decode_string( (*it).mid( equalsPos + 1 ) ); + const TQString key = (*it).left( equalsPos ).lower(); + const TQString value = KURL::decode_string( (*it).mid( equalsPos + 1 ) ); if ( key == "to" ) request.addTo( value ); @@ -87,11 +87,11 @@ namespace KioSMTP { return request; } - QCString Request::heloHostnameCString() const { + TQCString Request::heloHostnameCString() const { return KIDNA::toAsciiCString( heloHostname() ); } - static bool isUsAscii( const QString & s ) { + static bool isUsAscii( const TQString & s ) { for ( uint i = 0 ; i < s.length() ; ++i ) if ( s[i].unicode() > 127 ) return false; return true; @@ -100,7 +100,7 @@ namespace KioSMTP { static inline bool isSpecial( char ch ) { - static const QCString specials = "()<>[]:;@\\,.\""; + static const TQCString specials = "()<>[]:;@\\,.\""; return specials.find( ch ) >= 0; } @@ -112,17 +112,17 @@ namespace KioSMTP { - static inline QCString rfc2047Encode( const QString & s ) { - QCString r = KCodecs::base64Encode( s.stripWhiteSpace().utf8(), false ); + static inline TQCString rfc2047Encode( const TQString & s ) { + TQCString r = KCodecs::base64Encode( s.stripWhiteSpace().utf8(), false ); return "=?utf-8?b?" + r + "?=" ; // use base64 since that always gives a valid encoded-word } - static QCString quote( const QString & s ) { + static TQCString quote( const TQString & s ) { assert( isUsAscii( s ) ); - QCString r( s.length() * 2 ); + TQCString r( s.length() * 2 ); bool needsQuotes = false; unsigned int j = 0; @@ -145,19 +145,19 @@ namespace KioSMTP { - static QCString formatFromAddress( const QString & fromRealName, const QString & fromAddress ) { + static TQCString formatFromAddress( const TQString & fromRealName, const TQString & fromAddress ) { if ( fromRealName.isEmpty() ) return fromAddress.latin1(); // no real name: return "[email protected]" // return "Joe User <[email protected]>", "\"User, Joe\" <[email protected]>" // or "=?utf-8?q?Joe_User?= <[email protected]>", depending on real name's nature. - QCString r = isUsAscii( fromRealName ) ? quote( fromRealName ) : rfc2047Encode( fromRealName ); + TQCString r = isUsAscii( fromRealName ) ? quote( fromRealName ) : rfc2047Encode( fromRealName ); return r + " <" + fromAddress.latin1() + '>'; } - static QCString formatSubject( QString s ) { + static TQCString formatSubject( TQString s ) { if ( isUsAscii( s ) ) return s.remove( '\n' ).latin1(); // don't break header folding, // so remove any line break @@ -168,21 +168,21 @@ namespace KioSMTP { - QCString Request::headerFields( const QString & fromRealName ) const { + TQCString Request::headerFields( const TQString & fromRealName ) const { if ( !emitHeaders() ) return 0; assert( hasFromAddress() ); // should have been checked for by // caller (MAIL FROM comes before DATA) - QCString result = "From: " + formatFromAddress( fromRealName, fromAddress() ) + "\r\n"; + TQCString result = "From: " + formatFromAddress( fromRealName, fromAddress() ) + "\r\n"; if ( !subject().isEmpty() ) result += "Subject: " + formatSubject( subject() ) + "\r\n"; if ( !to().empty() ) - result += QCString( "To: " ) + to().join( ",\r\n\t" /* line folding */ ).latin1() + "\r\n"; + result += TQCString( "To: " ) + to().join( ",\r\n\t" /* line folding */ ).latin1() + "\r\n"; if ( !cc().empty() ) - result += QCString( "Cc: " ) + cc().join( ",\r\n\t" /* line folding */ ).latin1() + "\r\n"; + result += TQCString( "Cc: " ) + cc().join( ",\r\n\t" /* line folding */ ).latin1() + "\r\n"; return result; } diff --git a/kioslave/smtp/request.h b/kioslave/smtp/request.h index 15bbd76b9..e1b3acda8 100644 --- a/kioslave/smtp/request.h +++ b/kioslave/smtp/request.h @@ -32,8 +32,8 @@ #ifndef __KIOSMTP_REQUEST_H__ #define __KIOSMTP_REQUEST_H__ -#include <qstring.h> -#include <qstringlist.h> +#include <tqstring.h> +#include <tqstringlist.h> class KURL; @@ -47,30 +47,30 @@ namespace KioSMTP { static Request fromURL( const KURL & url ); - QString profileName() const { return mProfileName; } - void setProfileName( const QString & profileName ) { mProfileName = profileName; } + TQString profileName() const { return mProfileName; } + void setProfileName( const TQString & profileName ) { mProfileName = profileName; } bool hasProfile() const { return !profileName().isNull(); } - QString subject() const { return mSubject; } - void setSubject( const QString & subject ) { mSubject = subject; } + TQString subject() const { return mSubject; } + void setSubject( const TQString & subject ) { mSubject = subject; } - QString fromAddress() const { return mFromAddress; } - void setFromAddress( const QString & fromAddress ) { mFromAddress = fromAddress; } + TQString fromAddress() const { return mFromAddress; } + void setFromAddress( const TQString & fromAddress ) { mFromAddress = fromAddress; } bool hasFromAddress() const { return !mFromAddress.isEmpty(); } - QStringList recipients() const { return to() + cc() + bcc() ; } + TQStringList recipients() const { return to() + cc() + bcc() ; } bool hasRecipients() const { return !to().empty() || !cc().empty() || !bcc().empty() ; } - QStringList to() const { return mTo; } - QStringList cc() const { return mCc; } - QStringList bcc() const { return mBcc; } - void addTo( const QString & to ) { mTo.push_back( to ); } - void addCc( const QString & cc ) { mCc.push_back( cc ); } - void addBcc( const QString & bcc ) { mBcc.push_back( bcc ); } + TQStringList to() const { return mTo; } + TQStringList cc() const { return mCc; } + TQStringList bcc() const { return mBcc; } + void addTo( const TQString & to ) { mTo.push_back( to ); } + void addCc( const TQString & cc ) { mCc.push_back( cc ); } + void addBcc( const TQString & bcc ) { mBcc.push_back( bcc ); } - QString heloHostname() const { return mHeloHostname; } - QCString heloHostnameCString() const; - void setHeloHostname( const QString & hostname ) { mHeloHostname = hostname; } + TQString heloHostname() const { return mHeloHostname; } + TQCString heloHostnameCString() const; + void setHeloHostname( const TQString & hostname ) { mHeloHostname = hostname; } bool emitHeaders() const { return mEmitHeaders; } void setEmitHeaders( bool emitHeaders ) { mEmitHeaders = emitHeaders; } @@ -85,11 +85,11 @@ namespace KioSMTP { serialization of the header fields "To", "Cc", "Subject" and "From", as determined by the respective settings. If @ref #emitHeaders() is false, returns a null string. */ - QCString headerFields( const QString & fromRealName=QString::null ) const; + TQCString headerFields( const TQString & fromRealName=TQString::null ) const; private: - QStringList mTo, mCc, mBcc; - QString mProfileName, mSubject, mFromAddress, mHeloHostname; + TQStringList mTo, mCc, mBcc; + TQString mProfileName, mSubject, mFromAddress, mHeloHostname; bool mEmitHeaders; bool m8Bit; unsigned int mSize; diff --git a/kioslave/smtp/response.cc b/kioslave/smtp/response.cc index b1745865a..ec5067871 100644 --- a/kioslave/smtp/response.cc +++ b/kioslave/smtp/response.cc @@ -36,7 +36,7 @@ #include <klocale.h> #include <kio/global.h> -#include <qstring.h> +#include <tqstring.h> namespace KioSMTP { @@ -59,7 +59,7 @@ namespace KioSMTP { } bool ok = false; - unsigned int code = QCString( line, 3+1 ).toUInt( &ok ); + unsigned int code = TQCString( line, 3+1 ).toUInt( &ok ); if ( !ok || code < 100 || code > 559 ) { // not a number or number out of range mValid = false; @@ -85,22 +85,22 @@ namespace KioSMTP { return; } - mLines.push_back( len > 4 ? QCString( line+4, len-4+1 ).stripWhiteSpace() : QCString() ); + mLines.push_back( len > 4 ? TQCString( line+4, len-4+1 ).stripWhiteSpace() : TQCString() ); } // hackishly fixing QCStringList flaws... - static QCString join( char sep, const QCStringList & list ) { + static TQCString join( char sep, const QCStringList & list ) { if ( list.empty() ) - return QCString(); - QCString result = list.front(); + return TQCString(); + TQCString result = list.front(); for ( QCStringList::const_iterator it = ++list.begin() ; it != list.end() ; ++it ) result += sep + *it; return result; } - QString Response::errorMessage() const { - QString msg; + TQString Response::errorMessage() const { + TQString msg; if ( lines().count() > 1 ) msg = i18n("The server responded:\n%1") .arg( join( '\n', lines() ) ); diff --git a/kioslave/smtp/response.h b/kioslave/smtp/response.h index 22835690a..1e5f722ab 100644 --- a/kioslave/smtp/response.h +++ b/kioslave/smtp/response.h @@ -32,9 +32,9 @@ #ifndef __KIOSMTP_RESPONSE_H__ #define __KIOSMTP_RESPONSE_H__ -#include <qcstring.h> -#include <qvaluelist.h> -typedef QValueList<QCString> QCStringList; +#include <tqcstring.h> +#include <tqvaluelist.h> +typedef TQValueList<TQCString> QCStringList; class QString; @@ -55,7 +55,7 @@ namespace KioSMTP { /** Return an internationalized error message according to the response's code. */ - QString errorMessage() const; + TQString errorMessage() const; /** Translate the SMTP error code into a KIO one */ int errorCode() const; diff --git a/kioslave/smtp/smtp.cc b/kioslave/smtp/smtp.cc index dc621f533..e493f5132 100644 --- a/kioslave/smtp/smtp.cc +++ b/kioslave/smtp/smtp.cc @@ -61,9 +61,9 @@ using KioSMTP::TransactionState; #include <kio/slaveinterface.h> #include <klocale.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qcstring.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqcstring.h> #include <memory> using std::auto_ptr; @@ -117,7 +117,7 @@ int kdemain(int argc, char **argv) return 0; } -SMTPProtocol::SMTPProtocol(const QCString & pool, const QCString & app, +SMTPProtocol::SMTPProtocol(const TQCString & pool, const TQCString & app, bool useSSL) : TCPSlaveBase(useSSL ? 465 : 25, useSSL ? "smtps" : "smtp", @@ -157,8 +157,8 @@ void SMTPProtocol::closeConnection() { smtp_close(); } -void SMTPProtocol::special( const QByteArray & aData ) { - QDataStream s( aData, IO_ReadOnly ); +void SMTPProtocol::special( const TQByteArray & aData ) { + TQDataStream s( aData, IO_ReadOnly ); int what; s >> what; if ( what == 'c' ) { @@ -208,9 +208,9 @@ void SMTPProtocol::put(const KURL & url, int /*permissions */ , m_sPass = mset.getSetting(KEMailSettings::OutServerPass); if (m_sUser.isEmpty()) - m_sUser = QString::null; + m_sUser = TQString::null; if (m_sPass.isEmpty()) - m_sPass = QString::null; + m_sPass = TQString::null; open_url.setUser(m_sUser); open_url.setPass(m_sPass); m_sServer = open_url.host(); @@ -229,7 +229,7 @@ void SMTPProtocol::put(const KURL & url, int /*permissions */ , // and then format accordingly (either: [email protected] or // Real Name <[email protected]>) if ( !request.hasFromAddress() ) { - const QString from = mset.getSetting( KEMailSettings::EmailAddress ); + const TQString from = mset.getSetting( KEMailSettings::EmailAddress ); if ( !from.isNull() ) request.setFromAddress( from ); else if ( request.emitHeaders() ) { @@ -259,8 +259,8 @@ void SMTPProtocol::put(const KURL & url, int /*permissions */ , // Loop through our To and CC recipients, and send the proper // SMTP commands, for the benefit of the server. - QStringList recipients = request.recipients(); - for ( QStringList::const_iterator it = recipients.begin() ; it != recipients.end() ; ++it ) + TQStringList recipients = request.recipients(); + for ( TQStringList::const_iterator it = recipients.begin() ; it != recipients.end() ; ++it ) queueCommand( new RcptToCommand( this, (*it).latin1() ) ); queueCommand( Command::DATA ); @@ -275,8 +275,8 @@ void SMTPProtocol::put(const KURL & url, int /*permissions */ , } -void SMTPProtocol::setHost(const QString & host, int port, - const QString & user, const QString & pass) +void SMTPProtocol::setHost(const TQString & host, int port, + const TQString & user, const TQString & pass) { m_sServer = host; m_iPort = port; @@ -284,7 +284,7 @@ void SMTPProtocol::setHost(const QString & host, int port, m_sPass = pass; } -bool SMTPProtocol::sendCommandLine( const QCString & cmdline ) { +bool SMTPProtocol::sendCommandLine( const TQCString & cmdline ) { //kdDebug( cmdline.length() < 4096, 7112) << "C: " << cmdline.data(); //kdDebug( cmdline.length() >= 4096, 7112) << "C: <" << cmdline.length() << " bytes>" << endl; kdDebug( 7112) << "C: <" << cmdline.length() << " bytes>" << endl; @@ -319,7 +319,7 @@ Response SMTPProtocol::getResponse( bool * ok ) { return response; } - kdDebug(7112) << "S: " << QCString( buf, recv_len + 1 ).data(); + kdDebug(7112) << "S: " << TQCString( buf, recv_len + 1 ).data(); // ...and parse lines... response.parseLine( buf, recv_len ); @@ -344,7 +344,7 @@ bool SMTPProtocol::executeQueuedCommands( TransactionState * ts ) { kdDebug( canPipelineCommands(), 7112 ) << "using pipelining" << endl; while( !mPendingCommandQueue.isEmpty() ) { - QCString cmdline = collectPipelineCommands( ts ); + TQCString cmdline = collectPipelineCommands( ts ); if ( ts->failedFatally() ) { smtp_close( false ); // _hard_ shutdown return false; @@ -369,10 +369,10 @@ bool SMTPProtocol::executeQueuedCommands( TransactionState * ts ) { return true; } -QCString SMTPProtocol::collectPipelineCommands( TransactionState * ts ) { +TQCString SMTPProtocol::collectPipelineCommands( TransactionState * ts ) { assert( ts ); - QCString cmdLine; + TQCString cmdLine; unsigned int cmdLine_len = 0; while ( mPendingCommandQueue.head() ) { @@ -394,7 +394,7 @@ QCString SMTPProtocol::collectPipelineCommands( TransactionState * ts ) { break; while ( !cmd->isComplete() && !cmd->needsResponse() ) { - const QCString currentCmdLine = cmd->nextCommandLine( ts ); + const TQCString currentCmdLine = cmd->nextCommandLine( ts ); if ( ts->failedFatally() ) return cmdLine; const unsigned int currentCmdLine_len = currentCmdLine.length(); @@ -464,7 +464,7 @@ bool SMTPProtocol::execute( Command * cmd, TransactionState * ts ) do { while ( !cmd->isComplete() && !cmd->needsResponse() ) { - const QCString cmdLine = cmd->nextCommandLine( ts ); + const TQCString cmdLine = cmd->nextCommandLine( ts ); if ( ts && ts->failedFatally() ) { smtp_close( false ); return false; @@ -495,7 +495,7 @@ bool SMTPProtocol::execute( Command * cmd, TransactionState * ts ) return true; } -bool SMTPProtocol::smtp_open(const QString& fakeHostname) +bool SMTPProtocol::smtp_open(const TQString& fakeHostname) { if (m_opened && m_iOldPort == port(m_iPort) && @@ -527,7 +527,7 @@ bool SMTPProtocol::smtp_open(const QString& fakeHostname) } else { - QString tmpPort; + TQString tmpPort; KSocketAddress* addr = KExtendedSocket::localAddress(m_iSock); // perform name lookup. NI_NAMEREQD means: don't return a numeric // value (we need to know when we get have the IP address, so we @@ -592,7 +592,7 @@ bool SMTPProtocol::authenticate() authInfo.password = m_sPass; authInfo.prompt = i18n("Username and password for your SMTP account:"); - QStringList strList; + TQStringList strList; if (!metaData("sasl").isEmpty()) strList.append(metaData("sasl").latin1()); @@ -609,7 +609,7 @@ bool SMTPProtocol::authenticate() void SMTPProtocol::parseFeatures( const Response & ehloResponse ) { mCapabilities = Capabilities::fromResponse( ehloResponse ); - QString category = usingTLS() ? "TLS" : usingSSL() ? "SSL" : "PLAIN" ; + TQString category = usingTLS() ? "TLS" : usingSSL() ? "SSL" : "PLAIN" ; setMetaData( category + " AUTH METHODS", mCapabilities.authMethodMetaData() ); setMetaData( category + " CAPABILITIES", mCapabilities.asMetaDataString() ); #ifndef NDEBUG @@ -628,9 +628,9 @@ void SMTPProtocol::smtp_close( bool nice ) { execute( Command::QUIT ); kdDebug( 7112 ) << "closing connection" << endl; closeDescriptor(); - m_sOldServer = QString::null; - m_sOldUser = QString::null; - m_sOldPass = QString::null; + m_sOldServer = TQString::null; + m_sOldUser = TQString::null; + m_sOldPass = TQString::null; mCapabilities.clear(); mPendingCommandQueue.clear(); @@ -641,7 +641,7 @@ void SMTPProtocol::smtp_close( bool nice ) { void SMTPProtocol::stat(const KURL & url) { - QString path = url.path(); + TQString path = url.path(); error(KIO::ERR_DOES_NOT_EXIST, url.path()); } diff --git a/kioslave/smtp/smtp.h b/kioslave/smtp/smtp.h index 571375bd4..435fea8b1 100644 --- a/kioslave/smtp/smtp.h +++ b/kioslave/smtp/smtp.h @@ -33,13 +33,13 @@ #include "capabilities.h" -#include <qstring.h> -#include <qptrqueue.h> +#include <tqstring.h> +#include <tqptrqueue.h> class KURL; class QCString; template <typename T> class QMemArray; -typedef QMemArray<char> QByteArray; +typedef TQMemArray<char> QByteArray; namespace KioSMTP { class Response; @@ -50,13 +50,13 @@ namespace KioSMTP { class SMTPProtocol : public KIO::TCPSlaveBase { friend class KioSMTP::Command; public: - SMTPProtocol(const QCString & pool, const QCString & app, bool useSSL); + SMTPProtocol(const TQCString & pool, const TQCString & app, bool useSSL); virtual ~ SMTPProtocol(); - virtual void setHost(const QString & host, int port, - const QString & user, const QString & pass); + virtual void setHost(const TQString & host, int port, + const TQString & user, const TQString & pass); - virtual void special(const QByteArray & aData); + virtual void special(const TQByteArray & aData); virtual void put(const KURL & url, int permissions, bool overwrite, bool resume); virtual void stat(const KURL & url); @@ -65,7 +65,7 @@ public: protected: - bool smtp_open(const QString& fakeHostname = QString::null); + bool smtp_open(const TQString& fakeHostname = TQString::null); /** Closes the connection. If @p nice is true (default), then QUIT is sent and it's reponse waited for. */ @@ -100,8 +100,8 @@ protected: bool authenticate(); void parseFeatures( const KioSMTP::Response & ehloResponse ); - bool sendCommandLine( const QCString & cmd ); - QCString collectPipelineCommands( KioSMTP::TransactionState * ts ); + bool sendCommandLine( const TQCString & cmd ); + TQCString collectPipelineCommands( KioSMTP::TransactionState * ts ); bool batchProcessResponses( KioSMTP::TransactionState * ts ); /** This is a pure convenience wrapper around @@ -120,7 +120,7 @@ protected: /** This is a pure convenience wrapper around @ref KioSMTP::Capabilities::createSpecialResponse */ - QString createSpecialResponse() const { + TQString createSpecialResponse() const { return mCapabilities.createSpecialResponse( usingTLS() || haveCapability( "STARTTLS" ) ); } @@ -131,14 +131,14 @@ protected: unsigned short m_iOldPort; bool m_opened; - QString m_sServer, m_sOldServer; - QString m_sUser, m_sOldUser; - QString m_sPass, m_sOldPass; - QString m_hostname; + TQString m_sServer, m_sOldServer; + TQString m_sUser, m_sOldUser; + TQString m_sPass, m_sOldPass; + TQString m_hostname; KioSMTP::Capabilities mCapabilities; - typedef QPtrQueue<KioSMTP::Command> CommandQueue; + typedef TQPtrQueue<KioSMTP::Command> CommandQueue; CommandQueue mPendingCommandQueue; CommandQueue mSentCommandQueue; }; diff --git a/kioslave/smtp/test_commands.cc b/kioslave/smtp/test_commands.cc index a6969490f..680514b10 100644 --- a/kioslave/smtp/test_commands.cc +++ b/kioslave/smtp/test_commands.cc @@ -1,9 +1,9 @@ #include <kio/global.h> #include <kdebug.h> -#include <qstring.h> -#include <qcstring.h> -#include <qstringlist.h> +#include <tqstring.h> +#include <tqcstring.h> +#include <tqstringlist.h> //#include <iostream> //using std::cout; @@ -25,19 +25,19 @@ public: bool usesSSL; bool usesTLS; int lastErrorCode; - QString lastErrorMessage; + TQString lastErrorMessage; int lastMessageBoxCode; - QString lastMessageBoxText; - QByteArray nextData; + TQString lastMessageBoxText; + TQByteArray nextData; int nextDataReturnCode; - QStringList caps; + TQStringList caps; KIO::MetaData metadata; void clear() { startTLSReturnCode = 1; usesSSL = usesTLS = false; lastErrorCode = lastMessageBoxCode = 0; - lastErrorMessage = lastMessageBoxText = QString::null; + lastErrorMessage = lastMessageBoxText = TQString::null; nextData.resize( 0 ); nextDataReturnCode = -1; caps.clear(); @@ -56,17 +56,17 @@ public: bool usingSSL() const { return usesSSL; } bool usingTLS() const { return usesTLS; } bool haveCapability( const char * cap ) const { return caps.contains( cap ); } - void error( int id, const QString & msg ) { + void error( int id, const TQString & msg ) { lastErrorCode = id; lastErrorMessage = msg; } - void messageBox( int id, const QString & msg, const QString & ) { + void messageBox( int id, const TQString & msg, const TQString & ) { lastMessageBoxCode = id; lastMessageBoxText = msg; } void dataReq() { /* noop */ } - int readData( QByteArray & ba ) { ba = nextData; return nextDataReturnCode; } - QString metaData( const QString & key ) const { return metadata[key]; } + int readData( TQByteArray & ba ) { ba = nextData; return nextDataReturnCode; } + TQString metaData( const TQString & key ) const { return metadata[key]; } }; @@ -236,7 +236,7 @@ int main( int, char** ) { // smtp.clear(); - QStrIList mechs; + TQStrIList mechs; mechs.append( "PLAIN" ); smtp.metadata["sasl"] = "PLAIN"; AuthCommand auth( &smtp, mechs, "user", "pass" ); diff --git a/kioslave/smtp/test_headergeneration.cc b/kioslave/smtp/test_headergeneration.cc index bdf8b251f..83d999c4a 100644 --- a/kioslave/smtp/test_headergeneration.cc +++ b/kioslave/smtp/test_headergeneration.cc @@ -6,7 +6,7 @@ //using std::endl; int main( int , char ** ) { - static QCString expected = + static TQCString expected = "From: [email protected]\r\n" "Subject: missing subject\r\n" "To: [email protected],\r\n" @@ -57,7 +57,7 @@ int main( int , char ** ) { "\n"; KioSMTP::Request request; - QCString result; + TQCString result; request.setEmitHeaders( true ); request.setFromAddress( "[email protected]" ); diff --git a/kioslave/smtp/test_responseparser.cc b/kioslave/smtp/test_responseparser.cc index 5daa2fb3b..e251aa291 100644 --- a/kioslave/smtp/test_responseparser.cc +++ b/kioslave/smtp/test_responseparser.cc @@ -1,10 +1,10 @@ #include "response.h" #include <assert.h> -static const QCString singleLineResponseCRLF = "250 OK\r\n"; -static const QCString singleLineResponse = "250 OK"; +static const TQCString singleLineResponseCRLF = "250 OK\r\n"; +static const TQCString singleLineResponse = "250 OK"; -static const QCString multiLineResponse[] = { +static const TQCString multiLineResponse[] = { "250-ktown.kde.org\r\n", "250-STARTTLS\r\n", "250-AUTH PLAIN DIGEST-MD5\r\n", diff --git a/kioslave/smtp/transactionstate.cc b/kioslave/smtp/transactionstate.cc index 3bf3c7614..67d61486a 100644 --- a/kioslave/smtp/transactionstate.cc +++ b/kioslave/smtp/transactionstate.cc @@ -36,17 +36,17 @@ #include <kio/global.h> #include <klocale.h> -#include <qstringlist.h> +#include <tqstringlist.h> namespace KioSMTP { - void TransactionState::setFailedFatally( int code, const QString & msg ) { + void TransactionState::setFailedFatally( int code, const TQString & msg ) { mFailed = mFailedFatally = true; mErrorCode = code; mErrorMessage = msg; } - void TransactionState::setMailFromFailed( const QString & addr, const Response & r ) { + void TransactionState::setMailFromFailed( const TQString & addr, const Response & r ) { setFailed(); mErrorCode = KIO::ERR_NO_CONTENT; if ( addr.isEmpty() ) @@ -86,17 +86,17 @@ namespace KioSMTP { return KIO::ERR_INTERNAL; } - QString TransactionState::errorMessage() const { + TQString TransactionState::errorMessage() const { if ( !failed() ) - return QString::null; + return TQString::null; if ( !mErrorMessage.isEmpty() ) return mErrorMessage; if ( haveRejectedRecipients() ) { - QString msg = i18n("Message sending failed since the following recipients were rejected by the server:\n" + TQString msg = i18n("Message sending failed since the following recipients were rejected by the server:\n" "%1"); - QStringList recip; + TQStringList recip; for ( RejectedRecipientList::const_iterator it = mRejectedRecipients.begin() ; it != mRejectedRecipients.end() ; ++it ) recip.push_back( (*it).recipient + " (" + (*it).reason + ')' ); diff --git a/kioslave/smtp/transactionstate.h b/kioslave/smtp/transactionstate.h index 96376718e..d2f9ef797 100644 --- a/kioslave/smtp/transactionstate.h +++ b/kioslave/smtp/transactionstate.h @@ -34,8 +34,8 @@ #include "response.h" -#include <qstring.h> -#include <qvaluelist.h> +#include <tqstring.h> +#include <tqvaluelist.h> namespace KioSMTP { @@ -63,18 +63,18 @@ namespace KioSMTP { class TransactionState { public: struct RecipientRejection { - RecipientRejection( const QString & who=QString::null, - const QString & why=QString::null ) + RecipientRejection( const TQString & who=TQString::null, + const TQString & why=TQString::null ) : recipient( who ), reason( why ) {} - QString recipient; - QString reason; + TQString recipient; + TQString reason; #ifdef KIOSMTP_COMPARATORS bool operator==( const RecipientRejection & other ) const { return recipient == other.recipient && reason == other.reason; } #endif }; - typedef QValueList<RecipientRejection> RejectedRecipientList; + typedef TQValueList<RecipientRejection> RejectedRecipientList; TransactionState( bool rcptToDenyIsFailure=true ) : mErrorCode( 0 ), @@ -96,7 +96,7 @@ namespace KioSMTP { untidy connection shutdown is in order (ie. @ref smtp_close(false)). Fatal failure is handled immediately */ bool failedFatally() const { return mFailedFatally; } - void setFailedFatally( int code=0, const QString & msg=QString::null ); + void setFailedFatally( int code=0, const TQString & msg=TQString::null ); /** @return whether the transaction was completed successfully */ bool complete() const { return mComplete; } @@ -106,10 +106,10 @@ namespace KioSMTP { failed, or 0 otherwise */ int errorCode() const; /** @return an appropriate error message in case the transaction - failed or QString::null otherwise */ - QString errorMessage() const; + failed or TQString::null otherwise */ + TQString errorMessage() const; - void setMailFromFailed( const QString & addr, const Response & r ); + void setMailFromFailed( const TQString & addr, const Response & r ); bool dataCommandIssued() const { return mDataCommandIssued; } void setDataCommandIssued( bool issued ) { mDataCommandIssued = issued; } @@ -137,7 +137,7 @@ namespace KioSMTP { return mRejectedRecipients; } void addRejectedRecipient( const RecipientRejection & r ); - void addRejectedRecipient( const QString & who, const QString & why ) { + void addRejectedRecipient( const TQString & who, const TQString & why ) { addRejectedRecipient( RecipientRejection( who, why ) ); } @@ -169,7 +169,7 @@ namespace KioSMTP { private: RejectedRecipientList mRejectedRecipients; Response mDataResponse; - QString mErrorMessage; + TQString mErrorMessage; int mErrorCode; bool mRcptToDenyIsFailure; bool mAtLeastOneRecipientWasAccepted; |