aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rfb/ListConnInfo.h56
-rw-r--r--rfb/VNCSConnectionST.cxx7
-rw-r--r--rfb/VNCSConnectionST.h2
-rw-r--r--rfb/VNCServerST.cxx15
-rw-r--r--rfb/VNCServerST.h2
-rw-r--r--rfb_win32/ListViewControl.cxx4
-rw-r--r--rfb_win32/ListViewControl.h2
-rw-r--r--winvnc/ControlPanel.cxx26
-rw-r--r--winvnc/ControlPanel.h5
-rw-r--r--winvnc/STrayIcon.cxx2
10 files changed, 75 insertions, 46 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:
diff --git a/rfb_win32/ListViewControl.cxx b/rfb_win32/ListViewControl.cxx
index 492aa8b0..12e04003 100644
--- a/rfb_win32/ListViewControl.cxx
+++ b/rfb_win32/ListViewControl.cxx
@@ -14,14 +14,14 @@ ListViewControl::ListViewControl()
{
}
-int ListViewControl::IsSelectedLVItem(DWORD idListView,
+bool ListViewControl::IsSelectedLVItem(DWORD idListView,
HWND hDlg, int numberItem)
{
return (ListView_GetItemState(GetDlgItem(hDlg, idListView),
numberItem, LVIS_SELECTED) == LVIS_SELECTED);
}
-void SelectLVItem(DWORD idListView, HWND hDlg, int numberItem)
+void ListViewControl::SelectLVItem(DWORD idListView, HWND hDlg, int numberItem)
{
ListView_SetItemState(GetDlgItem(hDlg, idListView),
numberItem, LVIS_SELECTED, LVIS_SELECTED);
diff --git a/rfb_win32/ListViewControl.h b/rfb_win32/ListViewControl.h
index aef916e0..8a163738 100644
--- a/rfb_win32/ListViewControl.h
+++ b/rfb_win32/ListViewControl.h
@@ -15,7 +15,7 @@ namespace rfb {
{
public:
ListViewControl();
- int IsSelectedLVItem(DWORD idListView, HWND hDlg, int numberItem);
+ bool IsSelectedLVItem(DWORD idListView, HWND hDlg, int numberItem);
void SelectLVItem(DWORD idListView, HWND hDlg, int numberItem);
BOOL InitLVColumns(DWORD idListView, HWND hDlg, int width, int columns,
TCHAR * title[], DWORD mask, DWORD style, DWORD format);
diff --git a/winvnc/ControlPanel.cxx b/winvnc/ControlPanel.cxx
index 134cc211..fb379d6c 100644
--- a/winvnc/ControlPanel.cxx
+++ b/winvnc/ControlPanel.cxx
@@ -63,15 +63,24 @@ bool ControlPanel::onCommand(int cmd)
void ControlPanel::UpdateListView(rfb::ListConnInfo* LCInfo)
{
+ getSelConnInfo();
DeleteAllLVItem(IDC_LIST_CONNECTIONS, handle);
- if(LCInfo->Empty()) return;
+
+ if(LCInfo->Empty())
+ return;
+
+ ListConn.Copy(LCInfo);
char* ItemString[3];
int i = 0;
- for (LCInfo->iBegin(); !LCInfo->iEnd(); LCInfo->iNext()) {
- LCInfo->iGetCharInfo(ItemString);
+ for (ListConn.iBegin(); !ListConn.iEnd(); ListConn.iNext()) {
+ ListConn.iGetCharInfo(ItemString);
InsertLVItem(IDC_LIST_CONNECTIONS, handle, i, ItemString, 3);
+ for (ListSelConn.iBegin(); !ListSelConn.iEnd(); ListSelConn.iNext()) {
+ if (ListSelConn.iGetConn() == ListConn.iGetConn())
+ SelectLVItem(IDC_LIST_CONNECTIONS, handle, i);
+ }
i++;
}
}
@@ -96,9 +105,16 @@ BOOL ControlPanel::dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
-void ControlPanel::getSelConnInfo(std::list<DWORD>* conn, std::list<int>* status)
+void ControlPanel::getSelConnInfo()
{
-
+ int i = 0;
+ ListSelConn.Clear();
+ if(ListConn.Empty()) return;
+ for (ListConn.iBegin(); !ListConn.iEnd(); ListConn.iNext()) {
+ if (IsSelectedLVItem(IDC_LIST_CONNECTIONS, handle, i))
+ ListSelConn.iAdd(&ListConn);
+ i++;
+ }
}
ControlPanel::~ControlPanel()
diff --git a/winvnc/ControlPanel.h b/winvnc/ControlPanel.h
index 51eb4213..f291b9e6 100644
--- a/winvnc/ControlPanel.h
+++ b/winvnc/ControlPanel.h
@@ -31,9 +31,10 @@ namespace winvnc {
~ControlPanel();
protected:
virtual BOOL dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- void getSelConnInfo(std::list<DWORD>* conn, std::list<int>* status);
+ void getSelConnInfo();
HWND m_hSTIcon;
- std::list<DWORD> Conn;
+ rfb::ListConnInfo ListConn;
+ rfb::ListConnInfo ListSelConn;
};
};
diff --git a/winvnc/STrayIcon.cxx b/winvnc/STrayIcon.cxx
index a883caba..533c6a71 100644
--- a/winvnc/STrayIcon.cxx
+++ b/winvnc/STrayIcon.cxx
@@ -183,8 +183,8 @@ public:
}
setIcon(thread.server.isServerInUse() ? thread.activeIcon : thread.inactiveIcon);
- thread.server.getClientsInfo(&LCInfo);
CPanel->UpdateListView(&LCInfo);
+ thread.server.getClientsInfo(&LCInfo);
return 0;