diff --git a/gajim/common/zeroconf/connection_zeroconf.py b/gajim/common/zeroconf/connection_zeroconf.py index 8b1cb3493..26513e97c 100644 --- a/gajim/common/zeroconf/connection_zeroconf.py +++ b/gajim/common/zeroconf/connection_zeroconf.py @@ -76,24 +76,6 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf): Get name, host, port from config, or create zeroconf account with default values """ - if not app.config.get_per('accounts', app.ZEROCONF_ACC_NAME, 'name'): - log.debug('Creating zeroconf account') - app.config.add_per('accounts', app.ZEROCONF_ACC_NAME) - app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, - 'autoconnect', True) - app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, 'no_log_for', - '') - app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, 'password', - 'zeroconf') - app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, - 'sync_with_global_status', True) - - app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, - 'custom_port', 5298) - app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, - 'is_zeroconf', True) - app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, - 'use_ft_proxies', False) self.host = socket.gethostname() app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, 'hostname', self.host) diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py index 9b0af1665..15f2a1428 100644 --- a/gajim/gui_interface.py +++ b/gajim/gui_interface.py @@ -2659,6 +2659,29 @@ class Interface: log.info('Disconnect %s', connection.name) connection.disconnectedReconnCB() + def create_zeroconf_default_config(self): + if app.config.get_per('accounts', app.ZEROCONF_ACC_NAME, 'name'): + return + log.info('Creating zeroconf account') + app.config.add_per('accounts', app.ZEROCONF_ACC_NAME) + app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, + 'autoconnect', True) + app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, 'no_log_for', + '') + app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, 'password', + 'zeroconf') + app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, + 'sync_with_global_status', True) + + app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, + 'custom_port', 5298) + app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, + 'is_zeroconf', True) + app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, + 'use_ft_proxies', False) + app.config.set_per('accounts', app.ZEROCONF_ACC_NAME, + 'active', False) + def run(self, application): if app.config.get('trayicon') != 'never': self.show_systray() @@ -2840,6 +2863,7 @@ class Interface: self.create_core_handlers_list() self.register_core_handlers() + self.create_zeroconf_default_config() if app.config.get_per('accounts', app.ZEROCONF_ACC_NAME, 'active') \ and app.HAVE_ZEROCONF: app.connections[app.ZEROCONF_ACC_NAME] = \ diff --git a/gajim/roster_window.py b/gajim/roster_window.py index 1c9a2c421..05bf7eaf4 100644 --- a/gajim/roster_window.py +++ b/gajim/roster_window.py @@ -5886,10 +5886,6 @@ class RosterWindow: # Open wizard only after roster is created, so we can make it # transient for the roster window GLib.idle_add(_open_wizard) - if not app.ZEROCONF_ACC_NAME in app.config.get_per('accounts'): - # Create zeroconf in config file - from gajim.common.zeroconf import connection_zeroconf - connection_zeroconf.ConnectionZeroconf(app.ZEROCONF_ACC_NAME) # Setting CTRL+J to be the shortcut for bringing up the dialog to join a # conference.