Force common flow of connection queries
Force queryConnection() to always call back to approveConnection()
rather than return special values. This makes the flow easier to
follow as it will be the same in all cases.
diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx
index 9f6a954..93bf5c0 100644
--- a/win/winvnc/VNCServerWin32.cxx
+++ b/win/winvnc/VNCServerWin32.cxx
@@ -249,19 +249,19 @@
return queueCommand(SetClientsStatus, LCInfo, 0);
}
-VNCServerST::queryResult VNCServerWin32::queryConnection(network::Socket* sock,
- const char* userName,
- char** reason)
+void VNCServerWin32::queryConnection(network::Socket* sock,
+ const char* userName)
{
- if (queryOnlyIfLoggedOn && CurrentUserToken().noUserLoggedOn())
- return VNCServerST::ACCEPT;
+ if (queryOnlyIfLoggedOn && CurrentUserToken().noUserLoggedOn()) {
+ vncServer.approveConnection(sock, true, NULL);
+ return;
+ }
if (queryConnectDialog) {
- *reason = rfb::strDup("Another connection is currently being queried.");
- return VNCServerST::REJECT;
+ vncServer.approveConnection(sock, false, "Another connection is currently being queried.");
+ return;
}
queryConnectDialog = new QueryConnectDialog(sock, userName, this);
queryConnectDialog->startDialog();
- return VNCServerST::PENDING;
}
void VNCServerWin32::queryConnectionComplete() {
diff --git a/win/winvnc/VNCServerWin32.h b/win/winvnc/VNCServerWin32.h
index 271cb76..58c3f6c 100644
--- a/win/winvnc/VNCServerWin32.h
+++ b/win/winvnc/VNCServerWin32.h
@@ -81,9 +81,8 @@
// VNCServerST::QueryConnectionHandler interface
// Callback used to prompt user to accept or reject a connection.
// CALLBACK IN VNCServerST "HOST" THREAD
- virtual rfb::VNCServerST::queryResult queryConnection(network::Socket* sock,
- const char* userName,
- char** reason);
+ virtual void queryConnection(network::Socket* sock,
+ const char* userName);
// SocketManager::AddressChangeNotifier interface
// Used to keep tray icon up to date