Commit b32e8ca7 authored by Philipp Hörist's avatar Philipp Hörist

Accounts: Add connection type setting for custom host

parent 720b0c50
Pipeline #5234 passed with stages
in 2 minutes and 58 seconds
......@@ -308,6 +308,7 @@ class Config:
'use_custom_host': [opt_bool, False, '', True],
'custom_port': [opt_int, 5222, '', True],
'custom_host': [opt_str, '', '', True],
'custom_type': [opt_str, 'START TLS', _('ConnectionType: START TLS, DIRECT TLS or PLAIN'), True],
'sync_with_global_status': [opt_bool, False, ],
'no_log_for': [opt_str, '', _('List of XMPP Addresses (space separated) for which you do not want to store chat history. You can also add the name of an account to disable storing chat history for this account.')],
'attached_gpg_keys': [opt_str, ''],
......
......@@ -1775,9 +1775,10 @@ def get_custom_host(account):
return
host = app.config.get_per('accounts', account, 'custom_host')
port = app.config.get_per('accounts', account, 'custom_port')
type_ = app.config.get_per('accounts', account, 'custom_type')
return ('%s:%s' % (host, port),
ConnectionProtocol.TCP,
ConnectionType.DIRECT_TLS)
ConnectionType(type_))
def warn_about_plain_connection(account, connection_types):
......
......@@ -764,6 +764,8 @@ class PriorityDialog(SettingsDialog):
class CutstomHostnameDialog(SettingsDialog):
def __init__(self, account, parent):
type_values = ('START TLS', 'DIRECT TLS', 'PLAIN')
settings = [
Setting(SettingKind.SWITCH, _('Enable'),
SettingType.ACCOUNT_CONFIG,
......@@ -776,6 +778,11 @@ class CutstomHostnameDialog(SettingsDialog):
Setting(SettingKind.ENTRY, _('Port'),
SettingType.ACCOUNT_CONFIG, 'custom_port',
enabledif=('custom', True)),
Setting(SettingKind.COMBO, _('Type'),
SettingType.ACCOUNT_CONFIG, 'custom_type',
enabledif=('custom', True),
props={'combo_items': type_values}),
]
SettingsDialog.__init__(self, parent, _('Connection Settings'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment