summaryrefslogtreecommitdiff
path: root/noncore/comm/keypebble/krfblogin.cpp
authormickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
committer mickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
commit16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (side-by-side diff)
tree0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/comm/keypebble/krfblogin.cpp
parent8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff)
downloadopie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2
convert to Opie Debugging Framework
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,17 +1,22 @@
-#include <assert.h>
+#include "krfblogin.h"
+#include "krfbconnection.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
+#include <qtimer.h>
+/* STD */
+#include <assert.h>
extern "C" {
#include "vncauth.h"
}
-#include "krfblogin.h"
-#include "krfbconnection.h"
-#include <qtimer.h>
-
// The length of the various messages (used to decide how many bytes to
// wait for).
const int ServerVersionLength = 12;
const int ClientVersionLength = 12;
const int AuthSchemeLength = 4;
const int FailureReasonSizeLength = 4;
@@ -49,13 +54,13 @@ KRFBLogin::KRFBLogin( KRFBConnection *con )
currentState = AwaitingServerVersion;
connect( this, SIGNAL( error(const QString&) ),
con, SIGNAL( error(const QString&) ) );
- qWarning( "Waiting for server version..." );
+ owarn << "Waiting for server version..." << oendl;
static QString statusMsg = tr( "Waiting for server version..." );
emit status( statusMsg );
// Kick off the state machine
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) );
@@ -71,13 +76,13 @@ KRFBLogin::State KRFBLogin::state() const
{
return currentState;
}
void KRFBLogin::gotServerVersion()
{
- qWarning( "Got server version" );
+ owarn << "Got server version" << oendl;
disconnect( con, SIGNAL( gotEnoughData() ),
this, SLOT( gotServerVersion() ) );
// Read the server's version message
char serverVersion[ ServerVersionLength + 1 ];
@@ -89,13 +94,13 @@ void KRFBLogin::gotServerVersion()
QRegExp regexp( "RFB [0-9][0-9][0-9]\\.[0-9][0-9][0-9]\n" );
if ( rfbString.find( regexp ) == -1 ) {
static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString );
- qWarning( msg );
+ owarn << msg << oendl;
emit error( msg );
currentState = Error;
return;
}
// Calculate the actual version number
@@ -103,26 +108,26 @@ void KRFBLogin::gotServerVersion()
+ (serverVersion[5] - '0') * 10
+ (serverVersion[6] - '0');
serverMinor = (serverVersion[8] - '0') * 100
+ (serverVersion[9] - '0') * 10
+ (serverVersion[10] - '0');
- qWarning("Server Version: %03d.%03d", serverMajor, serverMinor );
+ owarn << "Server Version: " << serverMajor << "." << serverMinor << "" << oendl;
if ( serverMajor != 3 ) {
QString msg = tr( "Error: Unsupported server version, %1" )
.arg( rfbString );
- qWarning( msg );
+ owarn << msg << oendl;
emit error( msg );
currentState = Error;
return;
}
if ( serverMinor != 3 ) {
- qWarning( "Minor version mismatch: %d", serverMinor );
+ owarn << "Minor version mismatch: " << serverMinor << "" << oendl;
}
// Setup for the next state
sendClientVersion();
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthScheme() ) );
@@ -140,13 +145,13 @@ void KRFBLogin::gotAuthScheme()
scheme = Swap32IfLE( scheme );
static QString statusMsgOk = tr( "Logged in" );
switch ( scheme ) {
case 0:
- qWarning( "Failed" );
+ owarn << "Failed" << oendl;
// Handle failure
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotFailureReasonSize() ) );
con->waitForData( FailureReasonSizeLength );
break;
case 1:
// Handle no auth
@@ -156,13 +161,13 @@ void KRFBLogin::gotAuthScheme()
case 2:
// Handle VNC auth
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotChallenge() ) );
con->waitForData( ChallengeLength );
break;
default:
- qWarning( "Unknown authentication scheme, 0x%08lx", scheme );
+ owarn << "Unknown authentication scheme, 0x" << scheme << "" << oendl;
currentState = Error;
break;
};
}
void KRFBLogin::gotChallenge()
@@ -178,13 +183,13 @@ void KRFBLogin::getPassword()
// Got data
CARD8 challenge[ ChallengeLength ];
con->read( challenge, ChallengeLength );
// Last chance to enter a password
if ( con->options_->password.isNull() ) {
- qWarning( "krfblogin needs a password" );
+ owarn << "krfblogin needs a password" << oendl;
emit passwordRequired( con );
}
if ( con->options_->password.isNull() ) {
QString msg = tr( "Error: This server requires a password, but none "
"has been specified.\n" );
@@ -213,13 +218,13 @@ void KRFBLogin::gotAuthResult()
SLOT( gotAuthResult() ) );
long result;
con->read( &result, AuthResultLength );
result = Swap32IfLE( result );
- qWarning( "Authentication Result is 0x%08lx", result );
+ owarn << "Authentication Result is 0x" << result << "" << oendl;
static QString failed = tr( "Error: The password you specified was incorrect." );
static QString tooMany = tr( "Error: Too many invalid login attempts have been made\n"
"to this account, please try later." );
static QString statusMsgOk = tr( "Logged in" );
@@ -229,25 +234,25 @@ void KRFBLogin::gotAuthResult()
switch( result ) {
case AuthOk:
emit status( statusMsgOk );
con->gotRFBConnection();
break;
case AuthFailed:
- qWarning( "Dammit" );
+ owarn << "Dammit" << oendl;
emit status( statusMsgFailed );
emit error( failed );
break;
case AuthTooMany:
emit status( statusMsgTooMany );
emit error( tooMany );
break;
default:
- qWarning( "Invalid authentication result, %lx", result );
+ owarn << "Invalid authentication result, " << result << "" << oendl;
break;
}
}
void KRFBLogin::sendClientVersion()
{
- qWarning( "Sending client version" );
+ owarn << "Sending client version" << oendl;
con->write( (void*)"RFB 003.003\n", ClientVersionLength );
}