summaryrefslogtreecommitdiff
path: root/noncore/comm/keypebble/krfblogin.cpp
Unidiff
Diffstat (limited to 'noncore/comm/keypebble/krfblogin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/krfblogin.cpp41
1 files changed, 23 insertions, 18 deletions
diff --git a/noncore/comm/keypebble/krfblogin.cpp b/noncore/comm/keypebble/krfblogin.cpp
index 2bbd110..92005d2 100644
--- a/noncore/comm/keypebble/krfblogin.cpp
+++ b/noncore/comm/keypebble/krfblogin.cpp
@@ -1,14 +1,19 @@
1#include <assert.h> 1#include "krfblogin.h"
2#include "krfbconnection.h"
2 3
4/* OPIE */
5#include <opie2/odebug.h>
6using namespace Opie::Core;
7
8/* QT */
9#include <qtimer.h>
3 10
11/* STD */
12#include <assert.h>
4extern "C" { 13extern "C" {
5#include "vncauth.h" 14#include "vncauth.h"
6} 15}
7 16
8#include "krfblogin.h"
9#include "krfbconnection.h"
10#include <qtimer.h>
11
12// The length of the various messages (used to decide how many bytes to 17// The length of the various messages (used to decide how many bytes to
13// wait for). 18// wait for).
14const int ServerVersionLength = 12; 19const int ServerVersionLength = 12;
@@ -52,7 +57,7 @@ KRFBLogin::KRFBLogin( KRFBConnection *con )
52 con, SIGNAL( error(const QString&) ) ); 57 con, SIGNAL( error(const QString&) ) );
53 58
54 59
55 qWarning( "Waiting for server version..." ); 60 owarn << "Waiting for server version..." << oendl;
56 61
57 static QString statusMsg = tr( "Waiting for server version..." ); 62 static QString statusMsg = tr( "Waiting for server version..." );
58 emit status( statusMsg ); 63 emit status( statusMsg );
@@ -74,7 +79,7 @@ KRFBLogin::State KRFBLogin::state() const
74 79
75void KRFBLogin::gotServerVersion() 80void KRFBLogin::gotServerVersion()
76{ 81{
77 qWarning( "Got server version" ); 82 owarn << "Got server version" << oendl;
78 83
79 disconnect( con, SIGNAL( gotEnoughData() ), 84 disconnect( con, SIGNAL( gotEnoughData() ),
80 this, SLOT( gotServerVersion() ) ); 85 this, SLOT( gotServerVersion() ) );
@@ -92,7 +97,7 @@ void KRFBLogin::gotServerVersion()
92 if ( rfbString.find( regexp ) == -1 ) { 97 if ( rfbString.find( regexp ) == -1 ) {
93 static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString ); 98 static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString );
94 99
95 qWarning( msg ); 100 owarn << msg << oendl;
96 emit error( msg ); 101 emit error( msg );
97 currentState = Error; 102 currentState = Error;
98 return; 103 return;
@@ -106,20 +111,20 @@ void KRFBLogin::gotServerVersion()
106 + (serverVersion[9] - '0') * 10 111 + (serverVersion[9] - '0') * 10
107 + (serverVersion[10] - '0'); 112 + (serverVersion[10] - '0');
108 113
109 qWarning("Server Version: %03d.%03d", serverMajor, serverMinor ); 114 owarn << "Server Version: " << serverMajor << "." << serverMinor << "" << oendl;
110 115
111 if ( serverMajor != 3 ) { 116 if ( serverMajor != 3 ) {
112 QString msg = tr( "Error: Unsupported server version, %1" ) 117 QString msg = tr( "Error: Unsupported server version, %1" )
113 .arg( rfbString ); 118 .arg( rfbString );
114 119
115 qWarning( msg ); 120 owarn << msg << oendl;
116 emit error( msg ); 121 emit error( msg );
117 currentState = Error; 122 currentState = Error;
118 return; 123 return;
119 } 124 }
120 125
121 if ( serverMinor != 3 ) { 126 if ( serverMinor != 3 ) {
122 qWarning( "Minor version mismatch: %d", serverMinor ); 127 owarn << "Minor version mismatch: " << serverMinor << "" << oendl;
123 } 128 }
124 129
125 // Setup for the next state 130 // Setup for the next state
@@ -143,7 +148,7 @@ void KRFBLogin::gotAuthScheme()
143 148
144 switch ( scheme ) { 149 switch ( scheme ) {
145 case 0: 150 case 0:
146 qWarning( "Failed" ); 151 owarn << "Failed" << oendl;
147 // Handle failure 152 // Handle failure
148 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotFailureReasonSize() ) ); 153 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotFailureReasonSize() ) );
149 con->waitForData( FailureReasonSizeLength ); 154 con->waitForData( FailureReasonSizeLength );
@@ -159,7 +164,7 @@ void KRFBLogin::gotAuthScheme()
159 con->waitForData( ChallengeLength ); 164 con->waitForData( ChallengeLength );
160 break; 165 break;
161 default: 166 default:
162 qWarning( "Unknown authentication scheme, 0x%08lx", scheme ); 167 owarn << "Unknown authentication scheme, 0x" << scheme << "" << oendl;
163 currentState = Error; 168 currentState = Error;
164 break; 169 break;
165 }; 170 };
@@ -181,7 +186,7 @@ void KRFBLogin::getPassword()
181 186
182 // Last chance to enter a password 187 // Last chance to enter a password
183 if ( con->options_->password.isNull() ) { 188 if ( con->options_->password.isNull() ) {
184 qWarning( "krfblogin needs a password" ); 189 owarn << "krfblogin needs a password" << oendl;
185 emit passwordRequired( con ); 190 emit passwordRequired( con );
186 } 191 }
187 192
@@ -216,7 +221,7 @@ void KRFBLogin::gotAuthResult()
216 con->read( &result, AuthResultLength ); 221 con->read( &result, AuthResultLength );
217 result = Swap32IfLE( result ); 222 result = Swap32IfLE( result );
218 223
219 qWarning( "Authentication Result is 0x%08lx", result ); 224 owarn << "Authentication Result is 0x" << result << "" << oendl;
220 225
221 static QString failed = tr( "Error: The password you specified was incorrect." ); 226 static QString failed = tr( "Error: The password you specified was incorrect." );
222 static QString tooMany = tr( "Error: Too many invalid login attempts have been made\n" 227 static QString tooMany = tr( "Error: Too many invalid login attempts have been made\n"
@@ -232,7 +237,7 @@ void KRFBLogin::gotAuthResult()
232 con->gotRFBConnection(); 237 con->gotRFBConnection();
233 break; 238 break;
234 case AuthFailed: 239 case AuthFailed:
235 qWarning( "Dammit" ); 240 owarn << "Dammit" << oendl;
236 emit status( statusMsgFailed ); 241 emit status( statusMsgFailed );
237 emit error( failed ); 242 emit error( failed );
238 break; 243 break;
@@ -241,13 +246,13 @@ void KRFBLogin::gotAuthResult()
241 emit error( tooMany ); 246 emit error( tooMany );
242 break; 247 break;
243 default: 248 default:
244 qWarning( "Invalid authentication result, %lx", result ); 249 owarn << "Invalid authentication result, " << result << "" << oendl;
245 break; 250 break;
246 } 251 }
247} 252}
248 253
249void KRFBLogin::sendClientVersion() 254void KRFBLogin::sendClientVersion()
250{ 255{
251 qWarning( "Sending client version" ); 256 owarn << "Sending client version" << oendl;
252 con->write( (void*)"RFB 003.003\n", ClientVersionLength ); 257 con->write( (void*)"RFB 003.003\n", ClientVersionLength );
253} 258}