The code which realizes functionality " Control of selected clients "
control group in Control Panel has been added.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@436 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb/ListConnInfo.h b/rfb/ListConnInfo.h
index 029f2a4..e8ca60a 100644
--- a/rfb/ListConnInfo.h
+++ b/rfb/ListConnInfo.h
@@ -79,6 +79,8 @@
int iGetStatus() { return *si;}
+ void iSetStatus( int status) { *si = status;}
+
void Copy(ListConnInfo* InputList) {
Clear();
if (InputList->Empty()) return;
diff --git a/rfb/VNCSConnectionST.cxx b/rfb/VNCSConnectionST.cxx
index dce1a56..41e4eb3 100644
--- a/rfb/VNCSConnectionST.cxx
+++ b/rfb/VNCSConnectionST.cxx
@@ -34,7 +34,8 @@
: sock(s), reverseConnection(reverse), server(server_),
image_getter(server->useEconomicTranslate),
drawRenderedCursor(false), removeRenderedCursor(false),
- pointerEventTime(0), accessRights(AccessDefault)
+ pointerEventTime(0), accessRights(AccessDefault),
+ startTime(time(0))
{
setStreams(&sock->inStream(), &sock->outStream());
peerEndpoint.buf = sock->getPeerEndpoint();
@@ -56,7 +57,6 @@
}
server->clients.push_front(this);
- startTime = time(0);
}
@@ -341,6 +341,7 @@
// - Mark the entire display as "dirty"
updates.add_changed(server->pb->getRect());
+ startTime = time(0);
}
void VNCSConnectionST::queryConnection(const char* userName)
@@ -674,3 +675,28 @@
result[24] = '\0';
return result;
}
+
+void VNCSConnectionST::setStatus(int status)
+{
+ switch (status) {
+ case 0:
+ accessRights = accessRights | AccessPtrEvents | AccessKeyEvents | AccessView;
+ break;
+ case 1:
+ accessRights = accessRights & !(AccessPtrEvents | AccessKeyEvents) | AccessView;
+ break;
+ case 2:
+ accessRights = accessRights & !(AccessPtrEvents | AccessKeyEvents | AccessView);
+ break;
+ }
+}
+int VNCSConnectionST::getStatus()
+{
+ if ((accessRights & (AccessPtrEvents | AccessKeyEvents | AccessView)) == 0x0007)
+ return 0;
+ if ((accessRights & (AccessPtrEvents | AccessKeyEvents | AccessView)) == 0x0001)
+ return 1;
+ if ((accessRights & (AccessPtrEvents | AccessKeyEvents | AccessView)) == 0x0000)
+ return 2;
+ return 4;
+}
\ No newline at end of file
diff --git a/rfb/VNCSConnectionST.h b/rfb/VNCSConnectionST.h
index 784ac29..b81c3a5 100644
--- a/rfb/VNCSConnectionST.h
+++ b/rfb/VNCSConnectionST.h
@@ -105,6 +105,9 @@
char* getStartTime();
+ void setStatus(int status);
+ int getStatus();
+
private:
// SConnection callbacks
diff --git a/rfb/VNCServerST.cxx b/rfb/VNCServerST.cxx
index c25543d..9e6c480 100644
--- a/rfb/VNCServerST.cxx
+++ b/rfb/VNCServerST.cxx
@@ -513,9 +513,28 @@
listConn->Clear();
if (clients.empty())
return;
- int s=0;
std::list<VNCSConnectionST*>::iterator i;
for (i = clients.begin(); i != clients.end(); i++)
listConn->addInfo((DWORD)(*i), (*i)->getSock()->getPeerAddress(),
- (*i)->getStartTime(), s++);
+ (*i)->getStartTime(), (*i)->getStatus());
+}
+
+void VNCServerST::setConnStatus(ListConnInfo* listConn)
+{
+ if (listConn->Empty() || clients.empty()) return;
+ for (listConn->iBegin(); !listConn->iEnd(); listConn->iNext()) {
+ VNCSConnectionST* conn = (VNCSConnectionST*)listConn->iGetConn();
+ std::list<VNCSConnectionST*>::iterator i;
+ for (i = clients.begin(); i != clients.end(); i++) {
+ if ((*i) == conn) {
+ int status = listConn->iGetStatus();
+ if (status == 3) {
+ (*i)->close(0);
+ } else {
+ (*i)->setStatus(status);
+ }
+ break;
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/rfb/VNCServerST.h b/rfb/VNCServerST.h
index 596eaab..1cd2089 100644
--- a/rfb/VNCServerST.h
+++ b/rfb/VNCServerST.h
@@ -190,6 +190,7 @@
void setEconomicTranslate(bool et) { useEconomicTranslate = et; }
void getConnInfo(ListConnInfo * listConn);
+ void setConnStatus(ListConnInfo* listConn);
protected: