Comparison

mod_csi_muc_priorities/mod_csi_muc_priorities.lua @ 3532:85c357b69eec

mod_csi_muc_priorities: Reduce importance of group chat messages This helps if you are in more noisy public channels than small private group chats. The short term plan is to give users the ability to set MUC JIDs as either high or low priority and use that. Long term it would be great to be able to automatically classify MUCs as public channels vs private group chats.
author Kim Alvefur <zash@zash.se>
date Mon, 01 Apr 2019 00:15:13 +0200
child 3533:d8c4543f1b19
comparison
equal deleted inserted replaced
3531:3bece2db869c 3532:85c357b69eec
1 local jid = require "util.jid";
2
3 module:depends"track_muc_joins"
4
5 module:hook("csi-is-stanza-important", function (event)
6 local stanza, session = event.stanza, event.session;
7 if stanza.name == "message" then
8 if stanza.attr.type == "groupchat" then
9 local body = stanza:get_child_text("body");
10 if not body then return end
11
12 local rooms = session.rooms_joined;
13 if not rooms then return false; end
14
15 -- TODO optional?
16 local room_nick = rooms[jid.bare(stanza.attr.from)];
17 if room_nick and body:find(room_nick, 1, true) then return true; end
18
19 return false;
20 end
21 end
22 end);
23