-rw-r--r-- | core/qws/qcopbridge.cpp | 18 | ||||
-rw-r--r-- | core/qws/transferserver.cpp | 82 |
2 files changed, 54 insertions, 46 deletions
diff --git a/core/qws/qcopbridge.cpp b/core/qws/qcopbridge.cpp index 4fd0807..822efb7 100644 --- a/core/qws/qcopbridge.cpp +++ b/core/qws/qcopbridge.cpp @@ -22,8 +22,11 @@ #include "transferserver.h" +/* OPIE */ #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/version.h> +#include <opie2/odebug.h> +/* QT */ #include <qtextstream.h> #ifdef QWS @@ -31,4 +34,5 @@ #endif +/* STD */ #define _XOPEN_SOURCE #include <pwd.h> @@ -51,5 +55,5 @@ QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent , { if ( !ok() ) - qWarning( "Failed to bind to port %d", port ); + owarn << "Failed to bind to port " << port << "" << oendl; else { #ifndef QT_NO_COP @@ -111,5 +115,5 @@ void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args int paren = command.find( "(" ); if ( paren <= 0 ) { - qDebug("DesktopMessage: bad qcop syntax"); + odebug << "DesktopMessage: bad qcop syntax" << oendl; return; } @@ -117,5 +121,5 @@ void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args QString params = command.mid( paren + 1 ); if ( params[params.length()-1] != ')' ) { - qDebug("DesktopMessage: bad qcop syntax"); + odebug << "DesktopMessage: bad qcop syntax" << oendl; return; } @@ -144,5 +148,5 @@ void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args str = QString::number( i ); } else { - qDebug(" cannot route the argument type %s throught the qcop bridge", (*it).latin1() ); + odebug << " cannot route the argument type " << (*it) << " throught the qcop bridge" << oendl; return; } @@ -236,5 +240,5 @@ void QCopBridgePI::connectionClosed() { emit connectionClosed( this ); - // qDebug( "Debug: Connection closed" ); + // odebug << "Debug: Connection closed" << oendl; delete this; } @@ -251,5 +255,5 @@ void QCopBridgePI::send( const QString& msg ) QTextStream os( this ); os << msg << endl; - //qDebug( "sending qcop message: %s", msg.latin1() ); + //odebug << "sending qcop message: " << msg << "" << oendl; } @@ -262,5 +266,5 @@ void QCopBridgePI::read() void QCopBridgePI::process( const QString& message ) { - //qDebug( "Command: %s", message.latin1() ); + //odebug << "Command: " << message << "" << oendl; // split message using "," as separator diff --git a/core/qws/transferserver.cpp b/core/qws/transferserver.cpp index d0fec89..777c384 100644 --- a/core/qws/transferserver.cpp +++ b/core/qws/transferserver.cpp @@ -18,4 +18,8 @@ ** **********************************************************************/ + +/* OPIE */ +#include <opie2/odebug.h> + #define _XOPEN_SOURCE #include <pwd.h> @@ -75,5 +79,5 @@ TransferServer::TransferServer( Q_UINT16 port, QObject *parent , { if ( !ok() ) - qWarning( "Failed to bind to port %d", port ); + owarn << "Failed to bind to port " << port << "" << oendl; } @@ -318,5 +322,5 @@ ServerPI::~ServerPI() void ServerPI::connectionClosed() { - // qDebug( "Debug: Connection closed" ); + // odebug << "Debug: Connection closed" << oendl; delete this; } @@ -326,5 +330,5 @@ void ServerPI::send( const QString& msg ) QTextStream os( this ); os << msg << endl; - //qDebug( "Reply: %s", msg.latin1() ); + //odebug << "Reply: " << msg << "" << oendl; } @@ -367,5 +371,5 @@ bool ServerPI::checkWriteFile( const QString& file ) void ServerPI::process( const QString& message ) { - //qDebug( "Command: %s", message.latin1() ); + //odebug << "Command: " << message << "" << oendl; // split message using "," as separator @@ -392,5 +396,5 @@ void ServerPI::process( const QString& message ) } - //qDebug( "args: %s", args.latin1() ); + //odebug << "args: " << args << "" << oendl; // we always respond to QUIT, regardless of state @@ -528,5 +532,5 @@ void ServerPI::process( const QString& message ) } else { - qDebug("550 Requested action not taken"); + odebug << "550 Requested action not taken" << oendl; send( "550 Requested action not taken" ); } @@ -634,5 +638,5 @@ void ServerPI::process( const QString& message ) else if ( cmd == "MKD" ) { if ( args.isEmpty() ) { - qDebug(" Error: no arg"); + odebug << " Error: no arg" << oendl; send( "500 Syntax error, command unrecognized" ); } @@ -674,5 +678,5 @@ void ServerPI::process( const QString& message ) QString in, out; if ( !duproc.exec(in, out) ) { - qDebug("du process failed; just sending back 1K"); + odebug << "du process failed; just sending back 1K" << oendl; send( "213 1024"); } @@ -682,5 +686,5 @@ void ServerPI::process( const QString& message ) if ( filePath.contains("doc") ) guess *= 1000; - qDebug("sending back gzip guess of %d", guess); + odebug << "sending back gzip guess of " << guess << "" << oendl; send( "213 " + QString::number(guess) ); } @@ -737,6 +741,6 @@ bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets ) QFileInfo info( file ); targets = info.dirPath( TRUE ); - qDebug("ServerPI::backupRestoreGzip for %s = %s", file.latin1(), - targets.join(" ").latin1() ); + odebug << "ServerPI::backupRestoreGzip for " << file.latin1() << " = " + << targets.join(" ").latin1() << oendl; return true; } @@ -985,5 +989,5 @@ QString ServerPI::permissionString( QFileInfo *info ) void ServerPI::newConnection( int socket ) { - //qDebug( "New incomming connection" ); + //odebug << "New incomming connection" << oendl; if ( !passiv ) @@ -999,5 +1003,5 @@ void ServerPI::newConnection( int socket ) } else if ( wait[RetrieveFile] ) { - qDebug("check retrieve file"); + odebug << "check retrieve file" << oendl; if ( backupRestoreGzip( waitfile ) ) dtp->retrieveGzipFile( waitfile ); @@ -1011,5 +1015,5 @@ void ServerPI::newConnection( int socket ) } else if ( wait[RetrieveByteArray] ) { - qDebug("retrieve byte array"); + odebug << "retrieve byte array" << oendl; dtp->retrieveByteArray(); dtp->setSocket( socket ); @@ -1076,5 +1080,5 @@ ServerDTP::~ServerDTP() void ServerDTP::extractTarDone() { - qDebug("extract done"); + odebug << "extract done" << oendl; #ifndef QT_NO_COP @@ -1095,5 +1099,5 @@ void ServerDTP::connected() } - //qDebug( "Debug: Sending file '%s'", file.name().latin1() ); + //odebug << "Debug: Sending file '" << file.name() << "'" << oendl; bytes_written = 0; @@ -1117,10 +1121,10 @@ void ServerDTP::connected() if ( createTargzProc->isRunning() ) { // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY - qWarning("Previous tar --gzip process is still running; killing it..."); + owarn << "Previous tar --gzip process is still running; killing it..." << oendl; createTargzProc->kill(); } bytes_written = 0; - qDebug("==>start send tar process"); + odebug << "==>start send tar process" << oendl; if ( !createTargzProc->start(Opie::Core::OProcess::NotifyOnExit, Opie::Core::OProcess::Stdout) ) qWarning("Error starting %s or %s", @@ -1135,5 +1139,5 @@ void ServerDTP::connected() } - // qDebug( "Debug: Sending byte array" ); + // odebug << "Debug: Sending byte array" << oendl; bytes_written = 0; while ( !buf.atEnd() ) @@ -1154,8 +1158,8 @@ void ServerDTP::connected() return ; } - // qDebug( "Debug: Retrieving file %s", file.name().latin1() ); + // odebug << "Debug: Retrieving file " << file.name() << "" << oendl; break; case RetrieveGzipFile: - qDebug("=-> starting tar process to receive .tgz file"); + odebug << "=-> starting tar process to receive .tgz file" << oendl; break; case RetrieveBuffer: @@ -1166,8 +1170,8 @@ void ServerDTP::connected() return ; } - // qDebug( "Debug: Retrieving byte array" ); + // odebug << "Debug: Retrieving byte array" << oendl; break; case Idle: - qDebug("connection established but mode set to Idle; BUG!"); + odebug << "connection established but mode set to Idle; BUG!" << oendl; break; } @@ -1176,5 +1180,5 @@ void ServerDTP::connected() void ServerDTP::connectionClosed() { - //qDebug( "Debug: Data connection closed %ld bytes written", bytes_written ); + //odebug << "Debug: Data connection closed " << bytes_written << " bytes written" << oendl; // send file mode @@ -1201,5 +1205,5 @@ void ServerDTP::connectionClosed() else if ( RetrieveGzipFile == mode ) { - qDebug("Done writing ungzip file; closing input"); + odebug << "Done writing ungzip file; closing input" << oendl; gzipProc->flushStdin(); gzipProc->closeStdin(); @@ -1223,5 +1227,5 @@ void ServerDTP::bytesWritten( int bytes ) if ( bytes_written == file.size() ) { - // qDebug( "Debug: Sending complete: %d bytes", file.size() ); + // odebug << "Debug: Sending complete: " << file.size() << " bytes" << oendl; file.close(); emit completed(); @@ -1240,5 +1244,5 @@ void ServerDTP::bytesWritten( int bytes ) if ( bytes_written == buf.size() ) { - // qDebug( "Debug: Sending complete: %d bytes", buf.size() ); + // odebug << "Debug: Sending complete: " << buf.size() << " bytes" << oendl; emit completed(); mode = Idle; @@ -1264,5 +1268,5 @@ void ServerDTP::readyRead() readBlock( s.data(), bytesAvailable() ); gzipProc->writeStdin( s.data(), s.size() ); - qDebug("wrote %d bytes to ungzip ", s.size() ); + odebug << "wrote " << s.size() << " bytes to ungzip " << oendl; } // retrieve buffer mode @@ -1278,7 +1282,7 @@ void ServerDTP::writeTargzBlock(Opie::Core::OProcess *, char *buffer, int buflen { writeBlock( buffer, buflen ); - qDebug("writeTargzBlock %d", buflen); + odebug << "writeTargzBlock " << buflen << "" << oendl; if ( !createTargzProc->isRunning() ) { - qDebug("tar and gzip done"); + odebug << "tar and gzip done" << oendl; emit completed(); mode = Idle; @@ -1290,5 +1294,5 @@ void ServerDTP::writeTargzBlock(Opie::Core::OProcess *, char *buffer, int buflen void ServerDTP::targzDone() { - //qDebug("targz done"); + //odebug << "targz done" << oendl; disconnect( createTargzProc, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT( gzipTarBlock(Opie::Core::OProcess*,char*,int) ) ); @@ -1298,7 +1302,7 @@ void ServerDTP::targzDone() void ServerDTP::gzipTarBlock(Opie::Core::OProcess *, char *buffer, int buflen) { - //qDebug("gzipTarBlock"); + //odebug << "gzipTarBlock" << oendl; if ( !gzipProc->isRunning() ) { - //qDebug("auto start gzip proc"); + //odebug << "auto start gzip proc" << oendl; gzipProc->start(Opie::Core::OProcess::NotifyOnExit, (Opie::Core::OProcess::Communication) ( Opie::Core::OProcess::Stdin | Opie::Core::OProcess::Stdout )); } @@ -1336,5 +1340,5 @@ void ServerDTP::sendGzipFile( const QString &fn, args += "-cv"; args += archiveTargets; - qDebug("sendGzipFile %s", args.join(" ").latin1() ); + odebug << "sendGzipFile " << args.join(" ") << "" << oendl; createTargzProc->clearArguments( ); *createTargzProc << args; @@ -1350,5 +1354,5 @@ void ServerDTP::sendGzipFile( const QString &fn, void ServerDTP::gunzipDone() { - qDebug("gunzipDone"); + odebug << "gunzipDone" << oendl; disconnect( gzipProc, SIGNAL( processExited() ), this, SLOT( gunzipDone() ) ); @@ -1360,9 +1364,9 @@ void ServerDTP::gunzipDone() void ServerDTP::tarExtractBlock(Opie::Core::OProcess *, char *buffer, int buflen) { - qDebug("tarExtractBlock"); + odebug << "tarExtractBlock" << oendl; if ( !retrieveTargzProc->isRunning() ) { - qDebug("auto start ungzip proc"); + odebug << "auto start ungzip proc" << oendl; if ( !retrieveTargzProc->start(Opie::Core::OProcess::NotifyOnExit, Opie::Core::OProcess::Stdin) ) - qWarning(" failed to start tar -x process"); + owarn << " failed to start tar -x process" << oendl; } retrieveTargzProc->writeStdin( buffer, buflen ); @@ -1385,5 +1389,5 @@ void ServerDTP::retrieveFile( const QString fn ) void ServerDTP::retrieveGzipFile( const QString &fn ) { - qDebug("retrieveGzipFile %s", fn.latin1()); + odebug << "retrieveGzipFile " << fn << "" << oendl; file.setName( fn ); mode = RetrieveGzipFile; |