Commit 2a0bce4e authored by sb's avatar sb

don't attempt to do zeroconf things if avahi is not found,

display notification
parent d07dc398
...@@ -86,9 +86,18 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): ...@@ -86,9 +86,18 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
gajim.config.set('usegpg', False) gajim.config.set('usegpg', False)
self.get_config_values_or_default() self.get_config_values_or_default()
self.zeroconf = zeroconf.Zeroconf(self._on_new_service,
self._on_remove_service, self._on_name_conflictCB, self.avahi_error = False
self._on_disconnected, self.username, self.host, self.port) try:
import avahi
except ImportError:
self.avahi_error = True
if not self.avahi_error:
self.zeroconf = zeroconf.Zeroconf(self._on_new_service,
self._on_remove_service, self._on_name_conflictCB,
self._on_disconnected, self.username, self.host, self.port)
self.muc_jid = {} # jid of muc server for each transport type self.muc_jid = {} # jid of muc server for each transport type
self.vcard_supported = False self.vcard_supported = False
...@@ -283,6 +292,14 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): ...@@ -283,6 +292,14 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
check = True #to check for errors from zeroconf check = True #to check for errors from zeroconf
if self.avahi_error:
self.dispatch('STATUS', 'offline')
self.status = 'offline'
self.dispatch('CONNECTION_LOST',
(_('Could not connect "%s"') % self.name,
_('Please check if avahi is installed.')))
return
# 'connect' # 'connect'
if show != 'offline' and not self.connected: if show != 'offline' and not self.connected:
self.connect(None, show, msg) self.connect(None, show, msg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment