瀏覽代碼

Ignore XEP-0437 indicators and forwarded mentions in a joined MUC

Otherwise the mentions will be counted twice.
JC Brand 4 年之前
父節點
當前提交
bb8c7423b6
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/headless/plugins/muc/muc.js

+ 8 - 0
src/headless/plugins/muc/muc.js

@@ -438,6 +438,14 @@ const ChatRoomMixin = {
      * @param { XMLElement } stanza
      * @param { XMLElement } stanza
      */
      */
     handleMessageFromMUCHost (stanza) {
     handleMessageFromMUCHost (stanza) {
+        const conn_status = this.session.get('connection_status');
+        if (conn_status === converse.ROOMSTATUS.ENTERED) {
+            // We're not interested in activity indicators or forwarded
+            // mentions when already joined to the room.
+            // Also prevents forwarded mentions from being counted twice.
+            return;
+        }
+
         const rai = sizzle(`rai[xmlns="${Strophe.NS.RAI}"]`, stanza).pop();
         const rai = sizzle(`rai[xmlns="${Strophe.NS.RAI}"]`, stanza).pop();
         const active_mucs = Array.from(rai?.querySelectorAll('activity') || []).map(m => m.textContent);
         const active_mucs = Array.from(rai?.querySelectorAll('activity') || []).map(m => m.textContent);
         if (active_mucs.includes(this.get('jid'))) {
         if (active_mucs.includes(this.get('jid'))) {