summaryrefslogtreecommitdiffstats
path: root/src/server/net/client.cpp
diff options
context:
space:
mode:
authorChristian Klinger2016-09-27 15:38:39 +0200
committerChristian Klinger2016-09-27 15:38:39 +0200
commit1f6493e319016f8c375b62f2109ee57f5cea828d (patch)
treeac1635d23eaaf7090f6cc21767536ddcc9c76dae /src/server/net/client.cpp
parentclients in exam-mode no longer send a screenshot. Also some refactoring. (diff)
downloadpvs2-1f6493e319016f8c375b62f2109ee57f5cea828d.tar.gz
pvs2-1f6493e319016f8c375b62f2109ee57f5cea828d.tar.xz
pvs2-1f6493e319016f8c375b62f2109ee57f5cea828d.zip
Implemented 'majority vote' to determine the toolbar options.
clients in exam-mode are also displayed differently.
Diffstat (limited to 'src/server/net/client.cpp')
-rw-r--r--src/server/net/client.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp
index 5086ea1..84c45a9 100644
--- a/src/server/net/client.cpp
+++ b/src/server/net/client.cpp
@@ -150,7 +150,6 @@ void Client::handleMsg()
qDebug("Received message with empty ID field. ignored.");
return;
}
- //qDebug() << "Received message " << id;
if (_authed == 2)
{
@@ -159,13 +158,16 @@ void Client::handleMsg()
{
QPixmap pixmap;
const QByteArray& rawImage = _fromClient.getFieldBytes("IMG");
- if (!pixmap.loadFromData(rawImage))
- {
- qDebug("Could not decode thumbnail image from client.");
- return;
+ /* size 0 means the client is in exam-mode and therefore doesn't send any thumbnail */
+ if (rawImage.size() > 0) {
+ if (!pixmap.loadFromData(rawImage))
+ {
+ qDebug("Could not decode thumbnail image from client.");
+ return;
+ }
+ _rawRemoteScreen = QByteArray(rawImage);
+ emit thumbUpdated(this, pixmap, rawImage);
}
- _rawRemoteScreen = QByteArray(rawImage);
- emit thumbUpdated(this, pixmap, rawImage);
}
else if (id == _VNCSERVER)
{
@@ -225,8 +227,10 @@ void Client::handleMsg()
request.accept = true;
request.host = _fromClient.getFieldString("HOST");
request.name = _fromClient.getFieldString("NAME");
+ request.examMode = _fromClient.getFieldString(_EXAMMODE) == __TRUE;
request.ip = _socket->peerAddress().toString();
- qDebug() << "Login request by " << request.name;
+
+ qDebug() << "Login request by " << request.name << (request.examMode ? "(in exam mode)" : "");
// emit event, see if request is accepted
emit authenticating(this, &request);
if (!request.accept)