don't attempt to do zeroconf things if avahi is not found,
display notification
This commit is contained in:
parent
d07dc39830
commit
2a0bce4e04
|
@ -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.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.zeroconf = zeroconf.Zeroconf(self._on_new_service,
|
||||||
self._on_remove_service, self._on_name_conflictCB,
|
self._on_remove_service, self._on_name_conflictCB,
|
||||||
self._on_disconnected, self.username, self.host, self.port)
|
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):
|
||||||
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue