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) {