Package common :: Package zeroconf :: Module zeroconf
[hide private]
[frames] | no frames]

Source Code for Module common.zeroconf.zeroconf

 1  ##      common/zeroconf/zeroconf.py 
 2  ## 
 3  ## Copyright (C) 2006 Stefan Bethge <stefan@lanpartei.de> 
 4  ## 
 5  ## This file is part of Gajim. 
 6  ## 
 7  ## Gajim is free software; you can redistribute it and/or modify 
 8  ## it under the terms of the GNU General Public License as published 
 9  ## by the Free Software Foundation; version 3 only. 
10  ## 
11  ## Gajim is distributed in the hope that it will be useful, 
12  ## but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
14  ## GNU General Public License for more details. 
15  ## 
16  ## You should have received a copy of the GNU General Public License 
17  ## along with Gajim.  If not, see <http://www.gnu.org/licenses/>. 
18  ## 
19   
20  C_NAME, C_DOMAIN, C_INTERFACE, C_PROTOCOL, C_HOST, \ 
21  C_ADDRESS, C_PORT, C_BARE_NAME, C_TXT = range(9) 
22   
23 -def test_avahi():
24 try: 25 import avahi 26 except ImportError: 27 return False 28 return True
29
30 -def test_bonjour():
31 try: 32 import pybonjour 33 except ImportError: 34 return False 35 except WindowsError: 36 return False 37 return True
38
39 -def test_zeroconf():
40 return test_avahi() or test_bonjour()
41 42 if test_avahi(): 43 from common.zeroconf import zeroconf_avahi 44 Zeroconf = zeroconf_avahi.Zeroconf 45 elif test_bonjour(): 46 from common.zeroconf import zeroconf_bonjour 47 Zeroconf = zeroconf_bonjour.Zeroconf 48