diff --git a/src/wx/api/sieve/SieveAccountsApi.js b/src/wx/api/sieve/SieveAccountsApi.js index be264dc2c5..70452555ae 100644 --- a/src/wx/api/sieve/SieveAccountsApi.js +++ b/src/wx/api/sieve/SieveAccountsApi.js @@ -61,11 +61,23 @@ }, async getUsername(id) { - return await getIncomingServer(id).realUsername; + const server = getIncomingServer(id); + let username = await server.username; + if (username) { + return username; + } + // old API property + return await server.realUsername; }, async getHostname(id) { - return await getIncomingServer(id).realHostName; + const server = getIncomingServer(id); + let hostName = await server.hostName; + if (hostName) { + return hostName; + } + // old API property + return await server.realHostName; } } } diff --git a/src/wx/api/sieve/SieveSocketApi.js b/src/wx/api/sieve/SieveSocketApi.js index 428776f002..66ddaf62ca 100644 --- a/src/wx/api/sieve/SieveSocketApi.js +++ b/src/wx/api/sieve/SieveSocketApi.js @@ -13,8 +13,7 @@ /* global ExtensionCommon */ /* global Components */ - /* global ChromeUtils */ - const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); + /* global Services */ // Input & output stream constants. const STREAM_BUFFERED = 0; @@ -242,6 +241,13 @@ if (this.state !== STATE_OPEN) throw new Error("Socket not in open state"); + // test for Thunderbird 128 Socket API + if (this.socket.tlsSocketControl) { + // return the promise returned by the async API call to be awaited + return this.socket.tlsSocketControl.asyncStartTLS(); + } + + // logic for older socket API const control = this.socket.securityInfo .QueryInterface(Ci.nsISSLSocketControl);