From ba0258fc5bc7697ada157f77538eadf667690cd2 Mon Sep 17 00:00:00 2001 From: titanism <101466223+titanism@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:26:57 -0500 Subject: [PATCH] fix: fixed XAPPLEPUSHSERVICE command (needs to return topic) (#719) --- imap-core/lib/commands/xapplepushservice.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/imap-core/lib/commands/xapplepushservice.js b/imap-core/lib/commands/xapplepushservice.js index 1c37f4e4..e71b9aa2 100644 --- a/imap-core/lib/commands/xapplepushservice.js +++ b/imap-core/lib/commands/xapplepushservice.js @@ -159,7 +159,8 @@ module.exports = { _sess: this.id }; - this._server.onXAPPLEPUSHSERVICE(accountID, deviceToken, subTopic, mailboxes, this.session, error => { + // + this._server.onXAPPLEPUSHSERVICE(accountID, deviceToken, subTopic, mailboxes, this.session, (error, topic) => { if (error) { logdata._error = error.message; logdata._code = error.code; @@ -172,9 +173,16 @@ module.exports = { }); } + // this is a developer bug, they forgot to return a topic in callback + if (typeof topic !== 'string' || !topic) + return callback(null, { + response: 'NO', + code: 'TEMPFAIL' + }); + // // - this.send(`* XAPPLEPUSHSERVICE aps-version "${version}" aps-topic "${subTopic}"`); + this.send(`* XAPPLEPUSHSERVICE aps-version "${version}" aps-topic "${topic}"`); callback(null, { response: 'OK', message: 'XAPPLEPUSHSERVICE Registration successful.'