author | zecke <zecke> | 2002-09-06 21:35:13 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-06 21:35:13 (UTC) |
commit | e95e14f056ce6be658a4fd0d4737168431e92d88 (patch) (side-by-side diff) | |
tree | 732f0a69b2063dc6c54444486223fd99879da72c /core | |
parent | 5536f65e60b3c662d2da3636e617faaad02522db (diff) | |
download | opie-e95e14f056ce6be658a4fd0d4737168431e92d88.zip opie-e95e14f056ce6be658a4fd0d4737168431e92d88.tar.gz opie-e95e14f056ce6be658a4fd0d4737168431e92d88.tar.bz2 |
Remove the libuuid dependency for Linux targets...
-rw-r--r-- | core/launcher/launcher.pro | 2 | ||||
-rw-r--r-- | core/launcher/opie-taskbar.control | 2 | ||||
-rw-r--r-- | core/launcher/transferserver.cpp | 59 |
3 files changed, 49 insertions, 14 deletions
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro index bae5c51..5b32bc3 100644 --- a/core/launcher/launcher.pro +++ b/core/launcher/launcher.pro @@ -101,3 +101,3 @@ DEPENDPATH += ../../rsync TARGET = qpe -LIBS += -lqpe -lcrypt -lopie -luuid +LIBS += -lqpe -lcrypt -lopie diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control index ce73d8b..e9338fb 100644 --- a/core/launcher/opie-taskbar.control +++ b/core/launcher/opie-taskbar.control @@ -6,3 +6,3 @@ Architecture: arm Version: $QPE_VERSION-$SUB_VERSION.1 -Depends: qt-embedded (>=$QTE_VERSION), libuuid1 +Depends: qt-embedded (>=$QTE_VERSION) Description: Launcher for Opie diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index 9d18b7b..a20df2f 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp @@ -27,2 +27,4 @@ +#ifndef _OS_LINUX_ + extern "C" { @@ -32,2 +34,4 @@ extern "C" { +#endif // not defined linux + #if defined(_OS_LINUX_) @@ -78,2 +82,33 @@ void TransferServer::newConnection( int socket ) +/* + * small class in anonymous namespace + * to generate a QUUid for us + */ +namespace { + struct UidGen { + QString uuid(); + }; +#if defined(_OS_LINUX_) + /* + * linux got a /proc/sys/kernel/random/uuid file + * it'll generate the uuids for us + */ + QString UidGen::uuid() { + QFile file( "/proc/sys/kernel/random/uuid" ); + if (!file.open(IO_ReadOnly ) ) + return QString::null; + + QTextStream stream(&file); + + return "{" + stream.read().stripWhiteSpace() + "}"; + } +#else + QString UidGen::uuid() { + uuid_t uuid; + uuid_generate( uuid ); + return QUUid( uuid ).toString(); + } +#endif +} + QString SyncAuthentication::serverId() @@ -84,5 +119,5 @@ QString SyncAuthentication::serverId() if ( r.isEmpty() ) { - uuid_t uuid; - uuid_generate( uuid ); - cfg.writeEntry("serverid",(r = QUuid( uuid ).toString())); + UidGen gen; + r = gen.uuid(); + cfg.writeEntry("serverid", r ); } @@ -117,3 +152,3 @@ int SyncAuthentication::isAuthorized(QHostAddress peeraddress) uint auth_peer = cfg.readNumEntry("auth_peer",0xc0a80100); - + // QHostAddress allowed; @@ -175,3 +210,3 @@ bool SyncAuthentication::checkPassword( const QString& password ) QString pass = password.left(6); - /* old QtopiaDesktops are sending + /* old QtopiaDesktops are sending * rootme newer versions got a Qtopia @@ -182,3 +217,3 @@ bool SyncAuthentication::checkPassword( const QString& password ) if ( pass == "rootme" || pass == "Qtopia") { - + QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), "qp" ) ); @@ -226,3 +261,3 @@ ServerPI::ServerPI( int socket, QObject *parent , const char* name ) } else -#endif +#endif { @@ -230,3 +265,3 @@ ServerPI::ServerPI( int socket, QObject *parent , const char* name ) connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); - + passiv = FALSE; @@ -629,3 +664,3 @@ void ServerPI::process( const QString& message ) } - } + } } @@ -1179,3 +1214,3 @@ void ServerDTP::readyRead() gzipProc->start(); - + QByteArray s; @@ -1262,3 +1297,3 @@ void ServerDTP::sendGzipFile( const QString &fn, - gzipProc->setArguments( "gzip" ); + gzipProc->setArguments( "gzip" ); connect( gzipProc, SIGNAL( readyReadStdout() ), @@ -1308,3 +1343,3 @@ void ServerDTP::retrieveGzipFile( const QString &fn ) - gzipProc->setArguments( "gunzip" ); + gzipProc->setArguments( "gunzip" ); connect( gzipProc, SIGNAL( readyReadStdout() ), |