Skip to content
Snippets Groups Projects
Commit 3873fb4b authored by ubermanu's avatar ubermanu
Browse files

add debug infos

parent 546581d0
No related branches found
No related tags found
2 merge requests!113History, Reply to messages and RAI,!110History loading
...@@ -37,6 +37,7 @@ converse.plugins.add('sib-history-improved', { ...@@ -37,6 +37,7 @@ converse.plugins.add('sib-history-improved', {
}, },
initialize() { initialize() {
const { api } = this._converse; const { api } = this._converse;
const { log } = converse.env;
let counter = 0; let counter = 0;
// Forces the loading of the real number of messages (or more) // Forces the loading of the real number of messages (or more)
...@@ -53,10 +54,13 @@ converse.plugins.add('sib-history-improved', { ...@@ -53,10 +54,13 @@ converse.plugins.add('sib-history-improved', {
// Stop if there are less messages available than the page size // Stop if there are less messages available than the page size
// Stop if the counter registers more messages than the max value // Stop if the counter registers more messages than the max value
if (!max || messages.length < max || counter >= max) { if (!max || messages.length < max || counter >= max) {
log.debug(`Chatbox has enough messages or cannot get more, count: ${counter}`);
counter = 0; counter = 0;
return; return;
} }
log.debug(`Chatbox needs more messages, count: ${counter}`);
const is_groupchat = data.chatbox.get('type') === converse.CHATROOMS_TYPE; const is_groupchat = data.chatbox.get('type') === converse.CHATROOMS_TYPE;
const oldest_message = messages.pop(); const oldest_message = messages.pop();
...@@ -65,10 +69,12 @@ converse.plugins.add('sib-history-improved', { ...@@ -65,10 +69,12 @@ converse.plugins.add('sib-history-improved', {
const stanza_id = oldest_message && oldest_message['stanza_id '.concat(by_jid)]; const stanza_id = oldest_message && oldest_message['stanza_id '.concat(by_jid)];
if (stanza_id) { if (stanza_id) {
log.debug(`Loading messages before stanza: ${stanza_id}`);
await data.chatbox.fetchArchivedMessages({ await data.chatbox.fetchArchivedMessages({
'before': stanza_id, 'before': stanza_id,
}); });
} else { } else {
log.debug(`Loading messages before time: ${oldest_message['time']}`);
await data.chatbox.fetchArchivedMessages({ await data.chatbox.fetchArchivedMessages({
'end': oldest_message['time'], 'end': oldest_message['time'],
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment