source: epoptes/trunk/fuentes/epoptes/daemon/exchange.py

Last change on this file was 295, checked in by mabarracus, 4 years ago

copy trusty epoptes code

File size: 1.6 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4###########################################################################
5# Global registry type stuff.
6#
7# Copyright (C) 2010 Fotis Tsamis <ftsamis@gmail.com>
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FINESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program.  If not, see <http://www.gnu.org/licenses/>.
21#
22# On Debian GNU/Linux systems, the complete text of the GNU General
23# Public License can be found in `/usr/share/common-licenses/GPL".
24###########################################################################
25
26"""
27Global registry type stuff
28"""
29
30knownClients = {}
31knownGUIs = []
32
33
34def clientConnected(handle, client):
35#    print "Client connected: %s" % handle.encode("utf-8")
36    knownClients[handle] = client
37    for gui in knownGUIs:
38        gui.clientConnected(handle)
39
40
41def clientDisconnected(handle):
42    if handle not in knownClients:
43        print "Disconnect from unknown client: %s" % handle.encode("utf-8")
44        return
45
46#    print "Client disconnected: %s" % handle.encode("utf-8")
47    del knownClients[handle]
48    for gui in knownGUIs:
49        gui.clientDisconnected(handle)
Note: See TracBrowser for help on using the repository browser.