From afcec676c4b6dff934c8adbe4763f58a512d9c8f Mon Sep 17 00:00:00 2001
From: lovetox <philipp@hoerist.com>
Date: Fri, 12 Feb 2021 21:01:58 +0100
Subject: [PATCH] Add setting for GSSAPI authentication

---
 gajim/common/client.py         | 5 +++++
 gajim/common/setting_values.py | 1 +
 gajim/gtk/accounts.py          | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/gajim/common/client.py b/gajim/common/client.py
index 58b6825048..619f29358d 100644
--- a/gajim/common/client.py
+++ b/gajim/common/client.py
@@ -167,6 +167,11 @@ def _create_client(self):
             # his password
             self.password = passwords.get_password(self._account)
 
+        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:
diff --git a/gajim/common/setting_values.py b/gajim/common/setting_values.py
index 388f4da7a7..e28dc1ec5c 100644
--- a/gajim/common/setting_values.py
+++ b/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': {
diff --git a/gajim/gtk/accounts.py b/gajim/gtk/accounts.py
index f817a5ca3a..f59856c751 100644
--- a/gajim/gtk/accounts.py
+++ b/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'),
-- 
GitLab