From c8115e22acf4a6e34a1546fd2fc273c76cbb7e86 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Thu, 28 Apr 2022 14:26:24 +0200 Subject: [PATCH] enable znc/playback even without message storage Fixes: https://github.com/thelounge/thelounge/issues/4464 --- src/models/chan.js | 12 +++++++++++- src/models/network.js | 7 +------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/models/chan.js b/src/models/chan.js index c581bb7d..5191d898 100644 --- a/src/models/chan.js +++ b/src/models/chan.js @@ -237,7 +237,7 @@ Chan.prototype.writeUserLog = function (client, msg) { }; Chan.prototype.loadMessages = function (client, network) { - if (!this.isLoggable() || !client.messageProvider) { + if (!this.isLoggable()) { return; } @@ -249,6 +249,16 @@ Chan.prototype.loadMessages = function (client, network) { return; } + if (!client.messageProvider) { + if (network.irc.network.cap.isEnabled("znc.in/playback")) { + // if we do have a message provider we might be able to only fetch partial history, + // so delay the cap in this case. + requestZncPlayback(this, network, 0); + } + + return; + } + client.messageProvider .getMessages(network, this) .then((messages) => { diff --git a/src/models/network.js b/src/models/network.js index a5632788..b882b181 100644 --- a/src/models/network.js +++ b/src/models/network.js @@ -196,13 +196,8 @@ Network.prototype.createIrcFramework = function (client) { this.irc.requestCap([ "znc.in/self-message", // Legacy echo-message for ZNC + "znc.in/playback", // See http://wiki.znc.in/Playback ]); - - // Request only new messages from ZNC if we have sqlite logging enabled - // See http://wiki.znc.in/Playback - if (client.messageProvider) { - this.irc.requestCap("znc.in/playback"); - } }; Network.prototype.setIrcFrameworkOptions = function (client) {