Philipp Hörist pushed to branch master at gajim / gajim
Commits:
d0e602bd by lovetox at 2021-02-12T21:27:43+01:00
Add setting for GSSAPI authentication
- - - - -
739ead2b by lovetox at 2021-02-12T21:27:43+01:00
Client: Determine some Settings right before connecting
- - - - -
3 changed files:
- gajim/common/client.py
- gajim/common/setting_values.py
- gajim/gtk/accounts.py
Changes:
=====================================
gajim/common/client.py
=====================================
@@ -157,33 +157,16 @@ def _create_client(self):
self._client.set_username(self._user)
self._client.set_resource(get_resource(self._account))
- custom_host = get_custom_host(self._account)
- if custom_host is not None:
- self._client.set_custom_host(*custom_host)
-
pass_saved = app.settings.get_account_setting(self._account,
'savepass')
if pass_saved:
# Request password from keyring only if the user chose to save
# his password
self.password = passwords.get_password(self._account)
- anonymous = app.settings.get_account_setting(self._account,
- 'anonymous_auth')
- if anonymous:
- self._client.set_mechs(['ANONYMOUS'])
-
self._client.set_password(self.password)
self._client.set_accepted_certificates(
app.cert_store.get_certificates())
- if app.settings.get_account_setting(self._account,
- 'use_plain_connection'):
- self._client.set_connection_types([ConnectionType.PLAIN])
-
- proxy = get_user_proxy(self._account)
- if proxy is not None:
- self._client.set_proxy(proxy)
-
self._client.subscribe('resume-failed', self._on_resume_failed)
self._client.subscribe('resume-successful', self._on_resume_successful)
self._client.subscribe('disconnected', self._on_disconnected)
@@ -272,7 +255,7 @@ def _on_disconnected(self, _client, _signal_name):
def _on_password(password):
self.password = password
self._client.set_password(password)
- self.connect()
+ self._prepare_for_connect()
app.nec.push_incoming_event(NetworkEvent(
'password-required', conn=self, on_password=_on_password))
@@ -367,7 +350,7 @@ def change_status(self, show, message):
if show == 'offline':
return
- self.connect()
+ self._prepare_for_connect()
return
if self._state.is_connecting:
@@ -382,7 +365,7 @@ def change_status(self, show, message):
self._destroy_client = True
self._abort_reconnect()
else:
- self.connect()
+ self._prepare_for_connect()
return
# We are connected
@@ -517,6 +500,31 @@ def send_messages(self, jids, message):
message.stanza = stanza
self._send_message(message)
+ def _prepare_for_connect(self):
+ custom_host = get_custom_host(self._account)
+ if custom_host is not None:
+ self._client.set_custom_host(*custom_host)
+
+ gssapi = app.settings.get_account_setting(self._account,
+ 'enable_gssapi')
+ if gssapi:
+ self._client.set_mechs(['GSSAPI'])
+
+ anonymous = app.settings.get_account_setting(self._account,
+ 'anonymous_auth')
+ if anonymous:
+ self._client.set_mechs(['ANONYMOUS'])
+
+ if app.settings.get_account_setting(self._account,
+ 'use_plain_connection'):
+ self._client.set_connection_types([ConnectionType.PLAIN])
+
+ proxy = get_user_proxy(self._account)
+ if proxy is not None:
+ self._client.set_proxy(proxy)
+
+ self.connect()
+
def connect(self, ignored_tls_errors=None):
if self._state not in (ClientState.DISCONNECTED,
ClientState.RECONNECT_SCHEDULED):
@@ -545,7 +553,7 @@ def _schedule_reconnect(self):
self._set_state(ClientState.RECONNECT_SCHEDULED)
log.info("Reconnect to %s in 3s", self._account)
self._reconnect_timer_source = GLib.timeout_add_seconds(
- 3, self.connect)
+ 3, self._prepare_for_connect)
def _abort_reconnect(self):
self._set_state(ClientState.DISCONNECTED)
=====================================
gajim/common/setting_values.py
=====================================
@@ -258,6 +258,7 @@ class _ACCOUNT_DEFAULT:
'gc_send_marker_private_default': True,
'gc_send_marker_public_default': False,
'chat_history_max_age': -1,
+ 'enable_gssapi': False,
},
'contact': {
=====================================
gajim/gtk/accounts.py
=====================================
@@ -994,6 +994,9 @@ def __init__(self, account, parent):
Setting(SettingKind.CHANGEPASSWORD, _('Change Password'),
SettingType.DIALOG, callback=self.on_password_change,
props={'dialog': None}),
+
+ Setting(SettingKind.SWITCH, _('Use GSSAPI'),
+ SettingType.ACCOUNT_CONFIG, 'enable_gssapi'),
]
SettingsDialog.__init__(self, parent, _('Login Settings'),
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/c6fd3959f81de8f412e49ba49076ba10cc708640...739ead2b45c09545aabfa1ed76f2de0537f6d11f
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/c6fd3959f81de8f412e49ba49076ba10cc708640...739ead2b45c09545aabfa1ed76f2de0537f6d11f
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits