diff options
author | Simon Ser <contact@emersion.fr> | 2023-11-10 18:11:34 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-11-10 18:11:34 +0100 |
commit | 68cb6c56c41c553a1f77b3574b7f8e2a8d04733a (patch) | |
tree | 31f1b209f738cdefaa39aeda4905821af8e9c753 | |
parent | e0de4d1b367fe09822d35230bbf858b587064607 (diff) | |
download | gamja-68cb6c56c41c553a1f77b3574b7f8e2a8d04733a.tar.gz gamja-68cb6c56c41c553a1f77b3574b7f8e2a8d04733a.zip |
components/buffer: drop duplicate MONITOR events
-rw-r--r-- | components/buffer.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/components/buffer.js b/components/buffer.js index 901310d..77f3dd1 100644 --- a/components/buffer.js +++ b/components/buffer.js @@ -660,7 +660,7 @@ export default class Buffer extends Component { let hasUnreadSeparator = false; let prevDate = new Date(); let foldMessages = []; - let hasMonitor = false; + let lastMonitor = null; buf.messages.forEach((msg) => { let sep = []; @@ -668,9 +668,12 @@ export default class Buffer extends Component { return; } - if (!hasMonitor && (msg.command === irc.RPL_MONONLINE || msg.command === irc.RPL_MONOFFLINE)) { - hasMonitor = true; - return; + if (msg.command === irc.RPL_MONONLINE || msg.command === irc.RPL_MONOFFLINE) { + let skip = !lastMonitor || msg.command === lastMonitor; + lastMonitor = msg.command; + if (skip) { + return; + } } if (!hasUnreadSeparator && buf.type != BufferType.SERVER && !isMessageBeforeReceipt(msg, buf.prevReadReceipt)) { |