From f1ae7fc984489ca779cd5a146fd6fb7a23348431 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 16 Mar 2009 08:43:13 +0000 Subject: [PATCH] do not enable zeroconf if avahi or bonjour is not available. Fixes #4891 --- src/common/gajim.py | 9 +++++++++ src/config.py | 5 ++++- src/gajim.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/common/gajim.py b/src/common/gajim.py index 25798761b..d29ca4873 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -148,6 +148,15 @@ SHOW_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd', # zeroconf account name ZEROCONF_ACC_NAME = 'Local' +HAVE_ZEROCONF = True +try: + import avahi +except ImportError: + try: + import pybonjour + except ImportError: + HAVE_ZEROCONF = False + HAVE_PYCRYPTO = True try: import Crypto diff --git a/src/config.py b/src/config.py index 179c3c62d..bb206843e 100644 --- a/src/config.py +++ b/src/config.py @@ -1499,8 +1499,11 @@ class AccountsWindow: self.notebook.set_current_page(1) def init_zeroconf_account(self): - enable = gajim.config.get('enable_zeroconf') + enable = gajim.config.get('enable_zeroconf') and gajim.HAVE_ZEROCONF self.xml.get_widget('enable_zeroconf_checkbutton2').set_active(enable) + if not gajim.HAVE_ZEROCONF: + self.xml.get_widget('enable_zeroconf_checkbutton2').set_sensitive( + False) self.xml.get_widget('zeroconf_notebook').set_sensitive(enable) # General tab st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, diff --git a/src/gajim.py b/src/gajim.py index e0af6f569..7f153bd55 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -3275,7 +3275,7 @@ class Interface: gajim.proxy65_manager = proxy65_manager.Proxy65Manager(gajim.idlequeue) gajim.default_session_type = ChatControlSession self.register_handlers() - if gajim.config.get('enable_zeroconf'): + if gajim.config.get('enable_zeroconf') and gajim.HAVE_ZEROCONF: gajim.connections[gajim.ZEROCONF_ACC_NAME] = \ connection_zeroconf.ConnectionZeroconf(gajim.ZEROCONF_ACC_NAME) for account in gajim.config.get_per('accounts'):