diff options
author | Oleg Sheikin <olg@tightvnc.com> | 2005-12-07 08:02:52 +0000 |
---|---|---|
committer | Oleg Sheikin <olg@tightvnc.com> | 2005-12-07 08:02:52 +0000 |
commit | ff43bfd57b8d9d2a0abb6f1352384d20bf226447 (patch) | |
tree | 508ac3285b9e4a0838428c3ac26d262042b1fcd2 /rfb | |
parent | 922ee6a01625c9e7c49926520e8f4b0ba0503454 (diff) | |
download | tigervnc-ff43bfd57b8d9d2a0abb6f1352384d20bf226447.tar.gz tigervnc-ff43bfd57b8d9d2a0abb6f1352384d20bf226447.zip |
The code which realizes full functionality ListView Control
in Control Panel has been added.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@435 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'rfb')
-rw-r--r-- | rfb/ListConnInfo.h | 56 | ||||
-rw-r--r-- | rfb/VNCSConnectionST.cxx | 7 | ||||
-rw-r--r-- | rfb/VNCSConnectionST.h | 2 | ||||
-rw-r--r-- | rfb/VNCServerST.cxx | 15 | ||||
-rw-r--r-- | rfb/VNCServerST.h | 2 |
5 files changed, 47 insertions, 35 deletions
diff --git a/rfb/ListConnInfo.h b/rfb/ListConnInfo.h index 4eacadd5..029f2a49 100644 --- a/rfb/ListConnInfo.h +++ b/rfb/ListConnInfo.h @@ -23,21 +23,17 @@ namespace rfb { struct ListConnInfo { - ListConnInfo() { - Clear(); - }; + ListConnInfo() {} void Clear() { conn.clear(); IP_address.clear(); time_conn.clear(); status.clear(); - }; - - bool Empty() { - return conn.empty(); } + bool Empty() { return conn.empty();} + void iBegin() { ci = conn.begin(); Ii = IP_address.begin(); @@ -45,9 +41,7 @@ namespace rfb { si = status.begin(); } - bool iEnd() { - return ci == conn.end(); - } + bool iEnd() { return ci == conn.end();} void iNext() { ci++; @@ -57,17 +51,15 @@ namespace rfb { } void addInfo(DWORD Conn, char* IP, char* Time, int Status) { - conn.push_front(Conn); - IP_address.push_front(IP); - time_conn.push_front(Time); - status.push_front(Status); + conn.push_back(Conn); + IP_address.push_back(strDup(IP)); + time_conn.push_back(strDup(Time)); + status.push_back(Status); } void iGetCharInfo(char* buf[3]) { - if (Empty()) - return; - buf[0] = (*Ii); - buf[1] = (*ti); + buf[0] = *Ii; + buf[1] = *ti; switch (*si) { case 0: buf[2] = strDup("Full control"); @@ -80,23 +72,37 @@ namespace rfb { break; default: buf[2] = strDup("Unknown"); - }; + } } - DWORD iGetConn() { return *ci;}; + DWORD iGetConn() { return *ci;} - int iGetStatus() { return *si;}; + int iGetStatus() { return *si;} + void Copy(ListConnInfo* InputList) { + Clear(); + if (InputList->Empty()) return; + for (InputList->iBegin(); !InputList->iEnd(); InputList->iNext()) { + iAdd(InputList); + } + } + + void iAdd (ListConnInfo* InputList) { + char* buf[3]; + InputList->iGetCharInfo(buf); + addInfo(InputList->iGetConn(), buf[0], buf[1], InputList->iGetStatus()); + } + + private: std::list<DWORD> conn; std::list<char*> IP_address; std::list<char*> time_conn; std::list<int> status; std::list<DWORD>::iterator ci; - std::list<char*>::iterator Ii, ti; + std::list<char*>::iterator Ii; + std::list<char*>::iterator ti; std::list<int>::iterator si; - }; - -} +}; #endif diff --git a/rfb/VNCSConnectionST.cxx b/rfb/VNCSConnectionST.cxx index 514ea10d..dce1a569 100644 --- a/rfb/VNCSConnectionST.cxx +++ b/rfb/VNCSConnectionST.cxx @@ -667,3 +667,10 @@ void VNCSConnectionST::setSocketTimeouts() sock->inStream().setTimeout(timeoutms); sock->outStream().setTimeout(timeoutms); } + +char* VNCSConnectionST::getStartTime() +{ + char* result = ctime(&startTime); + result[24] = '\0'; + return result; +} diff --git a/rfb/VNCSConnectionST.h b/rfb/VNCSConnectionST.h index faf54889..784ac291 100644 --- a/rfb/VNCSConnectionST.h +++ b/rfb/VNCSConnectionST.h @@ -103,7 +103,7 @@ namespace rfb { void approveConnectionOrClose(bool accept, const char* reason); - char* getStartTime() { return ctime(&startTime); } + char* getStartTime(); private: // SConnection callbacks diff --git a/rfb/VNCServerST.cxx b/rfb/VNCServerST.cxx index ae71a377..c25543d0 100644 --- a/rfb/VNCServerST.cxx +++ b/rfb/VNCServerST.cxx @@ -508,15 +508,14 @@ void VNCServerST::checkUpdate() comparer->clear(); } -bool VNCServerST::getConnInfo(ListConnInfo * listConn) +void VNCServerST::getConnInfo(ListConnInfo * listConn) { listConn->Clear(); if (clients.empty()) - return false; - std::list<VNCSConnectionST*>::iterator ci; - for (ci = clients.begin(); ci != clients.end(); ci++) { - listConn->addInfo((DWORD)(*ci), (*ci)->getSock()->getPeerAddress(), - (*ci)->getStartTime(), 4); - } - return true; + 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++); }
\ No newline at end of file diff --git a/rfb/VNCServerST.h b/rfb/VNCServerST.h index b3e62a97..596eaab9 100644 --- a/rfb/VNCServerST.h +++ b/rfb/VNCServerST.h @@ -189,7 +189,7 @@ namespace rfb { // are used, to save memory. void setEconomicTranslate(bool et) { useEconomicTranslate = et; } - bool getConnInfo(ListConnInfo * listConn); + void getConnInfo(ListConnInfo * listConn); protected: |