author | mickeyl <mickeyl> | 2004-04-07 13:36:16 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-07 13:36:16 (UTC) |
commit | 4f1d28a25ce6180850c3d26bac9b638f0f25532b (patch) (side-by-side diff) | |
tree | 59b4879b1065086c9a2e28f16f7d48540c8a9456 /core/launcher/transferserver.cpp | |
parent | 8af35b63a277ec14dcc4a0a6ca5bbe228e276b98 (diff) | |
download | opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.zip opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.tar.gz opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.tar.bz2 |
use Opie debugging framework
Diffstat (limited to 'core/launcher/transferserver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/transferserver.cpp | 107 |
1 files changed, 48 insertions, 59 deletions
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index e32cf41..4b764e3 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp @@ -19,7 +19,21 @@ **********************************************************************/ -//#define _XOPEN_SOURCE +#include "transferserver.h" +/* OPIE */ +#include <opie2/odebug.h> #include <opie2/oglobal.h> +#include <qtopia/qprocess.h> +#include <qtopia/process.h> +#include <qtopia/private/contact.h> +#include <qtopia/version.h> +#ifdef Q_WS_QWS +#include <qtopia/qcopenvelope_qws.h> +#endif +using namespace Opie::Core; -#ifndef Q_OS_WIN32 +/* QT */ +#include <qtextstream.h> +#include <qmessagebox.h> + +/* STD */ #include <pwd.h> @@ -35,29 +49,4 @@ -#else -#include <stdlib.h> -#include <time.h> -#endif - - -#if defined(_OS_LINUX_) -#include <shadow.h> -#endif - -#include <qtextstream.h> -#include <qmessagebox.h> -//#include <qtopia/qcopchannel_qws.h> -#include <qtopia/process.h> -#include <qtopia/private/contact.h> -#include <qtopia/version.h> -#ifdef Q_WS_QWS -#include <qtopia/qcopenvelope_qws.h> -#endif - - -#include "transferserver.h" -#include <qtopia/qprocess.h> - const int block_size = 51200; -using namespace Opie::Core; TransferServer::TransferServer( Q_UINT16 port, QObject *parent, @@ -68,3 +57,3 @@ 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; } @@ -373,3 +362,3 @@ void ServerPI::connectionClosed() { - // qDebug( "Debug: Connection closed" ); + // odebug << "Debug: Connection closed" << oendl; emit connectionClosed(this); @@ -381,3 +370,3 @@ void ServerPI::send( const QString& msg ) os << msg << endl; - //qDebug( "Reply: %s", msg.latin1() ); + //odebug << "Reply: " << msg << "" << oendl; } @@ -422,3 +411,3 @@ void ServerPI::process( const QString& message ) { - //qDebug( "Command: %s", message.latin1() ); + //odebug << "Command: " << message << "" << oendl; @@ -446,3 +435,3 @@ void ServerPI::process( const QString& message ) - //qDebug( "args: %s", args.latin1() ); + //odebug << "args: " << args << "" << oendl; @@ -585,3 +574,3 @@ 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" ); // No tr @@ -691,3 +680,3 @@ void ServerPI::process( const QString& message ) if ( args.isEmpty() ) { - qDebug(" Error: no arg"); + odebug << " Error: no arg" << oendl; send( "500 Syntax error, command unrecognized" ); // No tr @@ -731,3 +720,3 @@ void ServerPI::process( const QString& message ) 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"); @@ -739,3 +728,3 @@ void ServerPI::process( const QString& message ) guess *= 1000; - qDebug("sending back gzip guess of %d", guess); + odebug << "sending back gzip guess of " << guess << "" << oendl; send( "213 " + QString::number(guess) ); @@ -1028,3 +1017,3 @@ void ServerPI::newConnection( int socket ) { - //qDebug( "New incomming connection" ); + //odebug << "New incomming connection" << oendl; @@ -1041,3 +1030,3 @@ void ServerPI::newConnection( int socket ) else if ( wait[RetrieveFile] ) { - qDebug("check retrieve file"); + odebug << "check retrieve file" << oendl; if ( backupRestoreGzip( waitfile ) ) @@ -1053,3 +1042,3 @@ void ServerPI::newConnection( int socket ) else if ( wait[RetrieveByteArray] ) { - qDebug("retrieve byte array"); + odebug << "retrieve byte array" << oendl; dtp->retrieveByteArray(); @@ -1113,3 +1102,3 @@ ServerDTP::~ServerDTP() if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { - qDebug( "STOR incomplete" ); + odebug << "STOR incomplete" << oendl; file.remove(); @@ -1124,3 +1113,3 @@ void ServerDTP::extractTarDone() { - qDebug("extract done"); + odebug << "extract done" << oendl; #ifndef QT_NO_COP @@ -1142,3 +1131,3 @@ void ServerDTP::connected() - //qDebug( "Debug: Sending file '%s'", file.name().latin1() ); + //odebug << "Debug: Sending file '" << file.name() << "'" << oendl; @@ -1163,3 +1152,3 @@ void ServerDTP::connected() // 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(); @@ -1168,3 +1157,3 @@ void ServerDTP::connected() bytes_written = 0; - qDebug("==>start send tar process"); + odebug << "==>start send tar process" << oendl; if ( !createTargzProc->start() ) @@ -1180,3 +1169,3 @@ void ServerDTP::connected() - // qDebug( "Debug: Sending byte array" ); + // odebug << "Debug: Sending byte array" << oendl; bytes_written = 0; @@ -1199,6 +1188,6 @@ void ServerDTP::connected() } - // 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; @@ -1211,6 +1200,6 @@ void ServerDTP::connected() } - // 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; @@ -1221,3 +1210,3 @@ void ServerDTP::connectionClosed() { - //qDebug( "Debug: Data connection closed %ld bytes written", bytes_written ); + //odebug << "Debug: Data connection closed " << bytes_written << " bytes written" << oendl; @@ -1243,3 +1232,3 @@ void ServerDTP::connectionClosed() if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { - qDebug( "STOR incomplete" ); + odebug << "STOR incomplete" << oendl; file.remove(); @@ -1252,3 +1241,3 @@ void ServerDTP::connectionClosed() else if ( RetrieveGzipFile == mode ) { - qDebug("Done writing ungzip file; closing input"); + odebug << "Done writing ungzip file; closing input" << oendl; retrieveTargzProc->flushStdin(); @@ -1274,3 +1263,3 @@ 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(); @@ -1291,3 +1280,3 @@ 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(); @@ -1315,3 +1304,3 @@ void ServerDTP::readyRead() retrieveTargzProc->writeToStdin( s ); - qDebug("wrote %d bytes to ungzip ", s.size() ); + odebug << "wrote " << s.size() << " bytes to ungzip " << oendl; } @@ -1330,3 +1319,3 @@ void ServerDTP::writeTargzBlock() writeBlock( block.data(), block.size() ); - qDebug("writeTargzBlock %d", block.size()); + odebug << "writeTargzBlock " << block.size() << "" << oendl; } @@ -1335,3 +1324,3 @@ void ServerDTP::targzDone() { - qDebug("tar and gzip done"); + odebug << "tar and gzip done" << oendl; emit completed(); @@ -1372,3 +1361,3 @@ void ServerDTP::sendGzipFile( const QString &fn, args += archiveTargets; - qDebug("sendGzipFile %s", args.join(" ").latin1() ); + odebug << "sendGzipFile " << args.join(" ") << "" << oendl; createTargzProc->setArguments( args ); @@ -1395,3 +1384,3 @@ void ServerDTP::retrieveGzipFile( const QString &fn ) { - qDebug("retrieveGzipFile %s", fn.latin1()); + odebug << "retrieveGzipFile " << fn << "" << oendl; file.setName( fn ); |