Skip to content
Snippets Groups Projects
Commit 2a0bce4e authored by sb's avatar sb
Browse files

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

display notification
parent d07dc398
No related branches found
No related tags found
No related merge requests found
......@@ -86,9 +86,18 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
gajim.config.set('usegpg', False)
self.get_config_values_or_default()
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.avahi_error = False
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.vcard_supported = False
......@@ -283,6 +292,14 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
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'
if show != 'offline' and not self.connected:
self.connect(None, show, msg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment