From 39d4a3929108ab080c6a221ab082abf276443f72 Mon Sep 17 00:00:00 2001 From: Sergei Ilinykh Date: Sat, 12 Oct 2024 01:00:50 +0300 Subject: [PATCH] Limit message groupping to 30 sec --- themes/chatview/adium/adapter.js | 3 ++- themes/chatview/psi/adapter.js | 3 ++- themes/chatview/util.js | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/themes/chatview/adium/adapter.js b/themes/chatview/adium/adapter.js index ca4015244..9b8768baf 100644 --- a/themes/chatview/adium/adapter.js +++ b/themes/chatview/adium/adapter.js @@ -459,7 +459,8 @@ chat.util.updateObject(adapter, function(chat){ (prevGrouppingData.mtype == cdata.mtype) && (prevGrouppingData.userid == cdata.userid) && (prevGrouppingData.emote == cdata.emote) && - (prevGrouppingData.local == cdata.local)); + (prevGrouppingData.local == cdata.local) && + (cdata.time - prevGrouppingData.time) < 30000); data.messageClasses += data.nextOfGroup? " consecutive" : ""; if (data.nextOfGroup) { diff --git a/themes/chatview/psi/adapter.js b/themes/chatview/psi/adapter.js index d3916b74b..e290a0872 100644 --- a/themes/chatview/psi/adapter.js +++ b/themes/chatview/psi/adapter.js @@ -189,7 +189,8 @@ function psiThemeAdapter(chat) { (shared.prevGrouppingData.mtype == shared.cdata.mtype) && (shared.prevGrouppingData.userid == shared.cdata.userid) && (shared.prevGrouppingData.emote == shared.cdata.emote) && - (shared.prevGrouppingData.local == shared.cdata.local)); + (shared.prevGrouppingData.local == shared.cdata.local) && + (shared.cdata.time - shared.prevGrouppingData.time) < 30000); return shared.cdata.nextOfGroup; }, diff --git a/themes/chatview/util.js b/themes/chatview/util.js index 65d3390a9..8e222ba6c 100644 --- a/themes/chatview/util.js +++ b/themes/chatview/util.js @@ -981,6 +981,10 @@ ${info} } } + if (data.time) { + data.time = new Date(data.time); + } + if (data.type == "message") { if (data.mtype == "join") { usersMap[data.sender] = {avatar:data.avatar, nickcolor:data.nickcolor, msgs:{}};