summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/transferserver.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index a20df2f..f9204ab 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -67,68 +67,68 @@ TransferServer::TransferServer( Q_UINT16 port, QObject *parent ,
67 : QServerSocket( port, 1, parent, name ) 67 : QServerSocket( port, 1, parent, name )
68{ 68{
69 if ( !ok() ) 69 if ( !ok() )
70 qWarning( "Failed to bind to port %d", port ); 70 qWarning( "Failed to bind to port %d", port );
71} 71}
72 72
73TransferServer::~TransferServer() 73TransferServer::~TransferServer()
74{ 74{
75 75
76} 76}
77 77
78void TransferServer::newConnection( int socket ) 78void TransferServer::newConnection( int socket )
79{ 79{
80 (void) new ServerPI( socket, this ); 80 (void) new ServerPI( socket, this );
81} 81}
82 82
83/* 83/*
84 * small class in anonymous namespace 84 * small class in anonymous namespace
85 * to generate a QUUid for us 85 * to generate a QUUid for us
86 */ 86 */
87namespace { 87namespace {
88 struct UidGen { 88 struct UidGen {
89 QString uuid(); 89 QString uuid();
90 }; 90 };
91#if defined(_OS_LINUX_) 91#if !defined(_OS_LINUX_)
92 QString UidGen::uuid() {
93 uuid_t uuid;
94 uuid_generate( uuid );
95 return QUUid( uuid ).toString();
96 }
97#else
92 /* 98 /*
93 * linux got a /proc/sys/kernel/random/uuid file 99 * linux got a /proc/sys/kernel/random/uuid file
94 * it'll generate the uuids for us 100 * it'll generate the uuids for us
95 */ 101 */
96 QString UidGen::uuid() { 102 QString UidGen::uuid() {
97 QFile file( "/proc/sys/kernel/random/uuid" ); 103 QFile file( "/proc/sys/kernel/random/uuid" );
98 if (!file.open(IO_ReadOnly ) ) 104 if (!file.open(IO_ReadOnly ) )
99 return QString::null; 105 return QString::null;
100 106
101 QTextStream stream(&file); 107 QTextStream stream(&file);
102 108
103 return "{" + stream.read().stripWhiteSpace() + "}"; 109 return "{" + stream.read().stripWhiteSpace() + "}";
104 } 110 }
105#else
106 QString UidGen::uuid() {
107 uuid_t uuid;
108 uuid_generate( uuid );
109 return QUUid( uuid ).toString();
110 }
111#endif 111#endif
112} 112}
113 113
114QString SyncAuthentication::serverId() 114QString SyncAuthentication::serverId()
115{ 115{
116 Config cfg("Security"); 116 Config cfg("Security");
117 cfg.setGroup("Sync"); 117 cfg.setGroup("Sync");
118 QString r=cfg.readEntry("serverid"); 118 QString r=cfg.readEntry("serverid");
119 if ( r.isEmpty() ) { 119 if ( r.isEmpty() ) {
120 UidGen gen; 120 UidGen gen;
121 r = gen.uuid(); 121 r = gen.uuid();
122 cfg.writeEntry("serverid", r ); 122 cfg.writeEntry("serverid", r );
123 } 123 }
124 return r; 124 return r;
125} 125}
126 126
127QString SyncAuthentication::ownerName() 127QString SyncAuthentication::ownerName()
128{ 128{
129 QString vfilename = Global::applicationFileName("addressbook", 129 QString vfilename = Global::applicationFileName("addressbook",
130 "businesscard.vcf"); 130 "businesscard.vcf");
131 if (QFile::exists(vfilename)) { 131 if (QFile::exists(vfilename)) {
132 Contact c; 132 Contact c;
133 c = Contact::readVCard( vfilename )[0]; 133 c = Contact::readVCard( vfilename )[0];
134 return c.fullName(); 134 return c.fullName();