The description of structure ListConnInfo has been added in library rfb.
Also, codes which pass the information on connections for
Control Panel have been added.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@410 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/winvnc/ControlPanel.cxx b/winvnc/ControlPanel.cxx
index 60624ce..134cc21 100644
--- a/winvnc/ControlPanel.cxx
+++ b/winvnc/ControlPanel.cxx
@@ -44,7 +44,11 @@
     }
   case IDC_KILL_ALL:
     {
-      m_server->disconnectClients();
+      COPYDATASTRUCT copyData;
+      copyData.dwData = 2;
+      copyData.lpData = 0;
+      copyData.cbData = 0;
+      SendMessage(m_hSTIcon, WM_COPYDATA, 0, (LPARAM)&copyData);
       return false;
     }
   case IDC_DISABLE_CLIENTS:
@@ -57,9 +61,19 @@
   
 }
 
-void ControlPanel::UpdateListView()
+void ControlPanel::UpdateListView(rfb::ListConnInfo* LCInfo)
 {
-  
+  DeleteAllLVItem(IDC_LIST_CONNECTIONS, handle);
+  if(LCInfo->Empty()) return;
+
+  char* ItemString[3];
+  int i = 0;
+
+  for (LCInfo->iBegin(); !LCInfo->iEnd(); LCInfo->iNext()) {
+    LCInfo->iGetCharInfo(ItemString);
+    InsertLVItem(IDC_LIST_CONNECTIONS, handle, i, ItemString, 3);
+    i++;
+  } 
 }
 
 BOOL ControlPanel::dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -82,7 +96,7 @@
   return FALSE;
 }
 
-void ControlPanel::getSelectedConn(std::list<network::Socket*>* selsockets)
+void ControlPanel::getSelConnInfo(std::list<DWORD>* conn, std::list<int>* status)
 {
   
 }
diff --git a/winvnc/ControlPanel.h b/winvnc/ControlPanel.h
index 5f9bc24..51eb421 100644
--- a/winvnc/ControlPanel.h
+++ b/winvnc/ControlPanel.h
@@ -10,33 +10,30 @@
 
 
 #include <list>
-
-#include <winvnc/VNCServerWin32.h>
 #include <winvnc/resource.h>
 #include <rfb_win32/Dialog.h>
 #include <rfb_win32/ListViewControl.h>
 #include <rfb_win32/Win32Util.h>
+#include <rfb/ListConnInfo.h>
 
 namespace winvnc {
   
   class ControlPanel : rfb::win32::Dialog, rfb::win32::ListViewControl {
   public:
-    ControlPanel(VNCServerWin32 * server, HWND hSTIcon) : Dialog(GetModuleHandle(0)), ListViewControl(){
-      m_server = server;
+    ControlPanel(HWND hSTIcon) : Dialog(GetModuleHandle(0)), ListViewControl(){
       m_hSTIcon = hSTIcon;
     };
     virtual bool showDialog();
     virtual void initDialog();
     virtual bool onCommand(int cmd);
-    void UpdateListView();
+    void UpdateListView(rfb::ListConnInfo* LCInfo);
     HWND GetHandle() {return handle;};
     ~ControlPanel();
   protected: 
     virtual BOOL dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-    void getSelectedConn(std::list<network::Socket*>* selsockets);
-    VNCServerWin32 * m_server;
-    std::list<network::Socket*> sockets;
+    void getSelConnInfo(std::list<DWORD>* conn, std::list<int>* status);
     HWND m_hSTIcon;
+    std::list<DWORD> Conn;
   };
 };
 
diff --git a/winvnc/STrayIcon.cxx b/winvnc/STrayIcon.cxx
index 448f08f..a883cab 100644
--- a/winvnc/STrayIcon.cxx
+++ b/winvnc/STrayIcon.cxx
@@ -71,7 +71,7 @@
     SetTimer(getHandle(), 1, 3000, 0);
     PostMessage(getHandle(), WM_TIMER, 1, 0);
     PostMessage(getHandle(), WM_SET_TOOLTIP, 0, 0);
-    CPanel = new ControlPanel(&thread.server, getHandle());
+    CPanel = new ControlPanel(getHandle());
   }
 
   virtual LRESULT processMessage(UINT msg, WPARAM wParam, LPARAM lParam) {
@@ -182,6 +182,10 @@
         return 0;
       }
       setIcon(thread.server.isServerInUse() ? thread.activeIcon : thread.inactiveIcon);
+
+      thread.server.getClientsInfo(&LCInfo);
+      CPanel->UpdateListView(&LCInfo);
+
       return 0;
 
     case WM_SET_TOOLTIP:
@@ -202,6 +206,7 @@
   LaunchProcess vncConnect;
   STrayIconThread& thread;
   ControlPanel * CPanel;
+  rfb::ListConnInfo LCInfo;
 };
 
 
diff --git a/winvnc/VNCServerWin32.cxx b/winvnc/VNCServerWin32.cxx
index a24df12..7e56270 100644
--- a/winvnc/VNCServerWin32.cxx
+++ b/winvnc/VNCServerWin32.cxx
@@ -270,6 +270,9 @@
   return false;
 }
 
+bool VNCServerWin32::getClientsInfo(rfb::ListConnInfo* LCInfo) {
+  return queueCommand(GetClientsInfo, LCInfo, 0);
+}
 
 VNCServerST::queryResult VNCServerWin32::queryConnection(network::Socket* sock,
                                             const char* userName,
@@ -330,6 +333,9 @@
                                 "Connection rejected by user");
     queryConnectDialog = 0;
     break;
+  case GetClientsInfo:
+    vncServer.getConnInfo((ListConnInfo*)commandData); 
+    break;
 
   default:
     vlog.error("unknown command %d queued", command);
diff --git a/winvnc/VNCServerWin32.h b/winvnc/VNCServerWin32.h
index c824d54..f6c6723 100644
--- a/winvnc/VNCServerWin32.h
+++ b/winvnc/VNCServerWin32.h
@@ -28,6 +28,7 @@
 #include <rfb_win32/TCharArray.h>
 #include <winvnc/QueryConnectDialog.h>
 #include <winvnc/JavaViewer.h>
+//#include <rfb/ListConnInfo.h>
 
 namespace winvnc {
 
@@ -66,13 +67,15 @@
                                                           const char* userName,
                                                           char** reason);
 
+    bool getClientsInfo(rfb::ListConnInfo* LCInfo);
+
     // Where to read the configuration settings from
     static const TCHAR* RegConfigPath;
 
   protected:
 
     // Perform a particular internal function in the server thread
-    typedef enum {NoCommand, DisconnectClients, AddClient, QueryConnectionComplete} Command;
+    typedef enum {NoCommand, DisconnectClients, AddClient, QueryConnectionComplete, GetClientsInfo} Command;
     bool queueCommand(Command cmd, const void* data, int len);
     void doCommand();
     Command command;