-rw-r--r-- | core/qws/transferserver.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/core/qws/transferserver.cpp b/core/qws/transferserver.cpp index 0337a94..239c824 100644 --- a/core/qws/transferserver.cpp +++ b/core/qws/transferserver.cpp | |||
@@ -22,25 +22,37 @@ | |||
22 | #include <sys/types.h> | 22 | #include <sys/types.h> |
23 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | #include <time.h> | 25 | #include <time.h> |
26 | |||
27 | #ifndef Q_OS_MACX | ||
26 | #include <shadow.h> | 28 | #include <shadow.h> |
29 | #endif /* Q_OS_MACX */ | ||
27 | 30 | ||
28 | /* we need the _OS_LINUX stuff first ! */ | 31 | /* we need the _OS_LINUX stuff first ! */ |
29 | #include <qglobal.h> | 32 | #include <qglobal.h> |
30 | 33 | ||
31 | #ifndef _OS_LINUX_ | 34 | #ifndef _OS_LINUX_ |
35 | // Is anybody able to review this ? The include "uuid/uuid.h" couldn't be found | ||
36 | // anywhere ? Therfore I removed it completely.. | ||
37 | // I think it should be made permanentyl !? (eilers) | ||
38 | #warning "Where should uuid/uuid.h be found ? Removed this part .. (eilers)" | ||
39 | #if 0 | ||
32 | 40 | ||
33 | extern "C" | 41 | extern "C" |
34 | { | 42 | { |
35 | #include <uuid/uuid.h> | 43 | #include <uuid/uuid.h> |
36 | #define UUID_H_INCLUDED | 44 | #define UUID_H_INCLUDED |
37 | } | 45 | } |
38 | 46 | ||
47 | #endif | ||
48 | |||
39 | #endif // not defined linux | 49 | #endif // not defined linux |
40 | 50 | ||
41 | #if defined(_OS_LINUX_) | 51 | #if defined(_OS_LINUX_) |
42 | #include <shadow.h> | 52 | #include <shadow.h> |
53 | #elif defined(Q_OS_MACX) | ||
54 | #include <stdlib.h> | ||
43 | #endif | 55 | #endif |
44 | 56 | ||
45 | #include <qdir.h> | 57 | #include <qdir.h> |
46 | #include <qfile.h> | 58 | #include <qfile.h> |
@@ -90,17 +102,17 @@ namespace | |||
90 | struct UidGen | 102 | struct UidGen |
91 | { | 103 | { |
92 | QString uuid(); | 104 | QString uuid(); |
93 | }; | 105 | }; |
94 | #if !defined(_OS_LINUX_) | 106 | #if defined(Q_OS_MACX) |
95 | |||
96 | QString UidGen::uuid() | 107 | QString UidGen::uuid() |
97 | { | 108 | { |
98 | uuid_t uuid; | 109 | srandom( random() ); |
99 | uuid_generate( uuid ); | 110 | QString numStr = QString::number( random() ); |
100 | return QUUid( uuid ).toString(); | 111 | |
112 | return "{" + numStr + "}"; | ||
101 | } | 113 | } |
102 | #else | 114 | #elif defined(_OS_LINUX_) |
103 | /* | 115 | /* |
104 | * linux got a /proc/sys/kernel/random/uuid file | 116 | * linux got a /proc/sys/kernel/random/uuid file |
105 | * it'll generate the uuids for us | 117 | * it'll generate the uuids for us |
106 | */ | 118 | */ |
@@ -113,8 +125,15 @@ QString UidGen::uuid() | |||
113 | QTextStream stream(&file); | 125 | QTextStream stream(&file); |
114 | 126 | ||
115 | return "{" + stream.read().stripWhiteSpace() + "}"; | 127 | return "{" + stream.read().stripWhiteSpace() + "}"; |
116 | } | 128 | } |
129 | #else | ||
130 | QString UidGen::uuid() | ||
131 | { | ||
132 | uuid_t uuid; | ||
133 | ::uuid_generate( uuid ); | ||
134 | return QUUid( uuid ).toString(); | ||
135 | } | ||
117 | #endif | 136 | #endif |
118 | } | 137 | } |
119 | 138 | ||
120 | QString SyncAuthentication::serverId() | 139 | QString SyncAuthentication::serverId() |