startTLS: separate not-supported messages for client and server
This commit is contained in:
parent
ff3e49b87d
commit
e6912dc659
@ -716,9 +716,10 @@ class SyncplayClient(object):
|
|||||||
self._endpoint = HostnameEndpoint(reactor, host, port)
|
self._endpoint = HostnameEndpoint(reactor, host, port)
|
||||||
try:
|
try:
|
||||||
self.protocolFactory.options = optionsForClientTLS(hostname=host)
|
self.protocolFactory.options = optionsForClientTLS(hostname=host)
|
||||||
|
self._clientSupportsTLS = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.protocolFactory.options = None
|
self.protocolFactory.options = None
|
||||||
self._serverSupportsTLS = False
|
self._clientSupportsTLS = False
|
||||||
|
|
||||||
def retry(retries):
|
def retry(retries):
|
||||||
self._lastGlobalUpdate = None
|
self._lastGlobalUpdate = None
|
||||||
|
|||||||
@ -313,7 +313,7 @@ de = {
|
|||||||
# startTLS messages - TODO: Translate
|
# startTLS messages - TODO: Translate
|
||||||
"startTLS-initiated": "Attempting secure connection",
|
"startTLS-initiated": "Attempting secure connection",
|
||||||
"startTLS-secure-connection-ok": "Secure connection established ({})",
|
"startTLS-secure-connection-ok": "Secure connection established ({})",
|
||||||
"startTLS-not-supported-client": "TLS is not supported",
|
"startTLS-not-supported-client": "This client does not support TLS",
|
||||||
"startTLS-not-supported-server": "This server does not support TLS",
|
"startTLS-not-supported-server": "This server does not support TLS",
|
||||||
|
|
||||||
# About dialog - TODO: Translate
|
# About dialog - TODO: Translate
|
||||||
|
|||||||
@ -314,7 +314,7 @@ en = {
|
|||||||
|
|
||||||
"startTLS-initiated": "Attempting secure connection",
|
"startTLS-initiated": "Attempting secure connection",
|
||||||
"startTLS-secure-connection-ok": "Secure connection established ({})",
|
"startTLS-secure-connection-ok": "Secure connection established ({})",
|
||||||
"startTLS-not-supported-client": "TLS is not supported",
|
"startTLS-not-supported-client": "This client does not support TLS",
|
||||||
"startTLS-not-supported-server": "This server does not support TLS",
|
"startTLS-not-supported-server": "This server does not support TLS",
|
||||||
|
|
||||||
# About dialog
|
# About dialog
|
||||||
|
|||||||
@ -314,7 +314,7 @@ it = {
|
|||||||
|
|
||||||
"startTLS-initiated": "Tentativo di connessione sicura in corso",
|
"startTLS-initiated": "Tentativo di connessione sicura in corso",
|
||||||
"startTLS-secure-connection-ok": "Connessione sicura stabilita ({})",
|
"startTLS-secure-connection-ok": "Connessione sicura stabilita ({})",
|
||||||
"startTLS-not-supported-client": "TLS non è supportato",
|
"startTLS-not-supported-client": "Questo client non supporta TLS",
|
||||||
"startTLS-not-supported-server": "Questo server non supporta TLS",
|
"startTLS-not-supported-server": "Questo server non supporta TLS",
|
||||||
|
|
||||||
# About dialog
|
# About dialog
|
||||||
|
|||||||
@ -316,7 +316,7 @@ ru = {
|
|||||||
# startTLS messages - TODO: Translate
|
# startTLS messages - TODO: Translate
|
||||||
"startTLS-initiated": "Attempting secure connection",
|
"startTLS-initiated": "Attempting secure connection",
|
||||||
"startTLS-secure-connection-ok": "Secure connection established ({})",
|
"startTLS-secure-connection-ok": "Secure connection established ({})",
|
||||||
"startTLS-not-supported-client": "TLS is not supported",
|
"startTLS-not-supported-client": "This client does not support TLS",
|
||||||
"startTLS-not-supported-server": "This server does not support TLS",
|
"startTLS-not-supported-server": "This server does not support TLS",
|
||||||
|
|
||||||
# About dialog - TODO: Translate
|
# About dialog - TODO: Translate
|
||||||
|
|||||||
@ -77,11 +77,15 @@ class SyncClientProtocol(JSONCommandProtocol):
|
|||||||
|
|
||||||
def connectionMade(self):
|
def connectionMade(self):
|
||||||
self._client.initProtocol(self)
|
self._client.initProtocol(self)
|
||||||
if self._client._serverSupportsTLS:
|
if self._client._clientSupportsTLS:
|
||||||
self.sendTLS({"startTLS": "send"})
|
if self._client._serverSupportsTLS:
|
||||||
self._client.ui.showMessage(getMessage("startTLS-initiated"))
|
self.sendTLS({"startTLS": "send"})
|
||||||
|
self._client.ui.showMessage(getMessage("startTLS-initiated"))
|
||||||
|
else:
|
||||||
|
self._client.ui.showErrorMessage(getMessage("startTLS-not-supported-server"))
|
||||||
|
self.sendHello()
|
||||||
else:
|
else:
|
||||||
self._client.ui.showErrorMessage(getMessage("startTLS-not-supported-client"))
|
self._client.ui.showMessage(getMessage("startTLS-not-supported-client"))
|
||||||
self.sendHello()
|
self.sendHello()
|
||||||
|
|
||||||
def connectionLost(self, reason):
|
def connectionLost(self, reason):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user