Comparison

mod_csi_muc_priorities/mod_csi_muc_priorities.lua @ 4014:1b68954a743a

mod_csi_muc_priorities: Report reason for importance decision
author Kim Alvefur <zash@zash.se>
date Sat, 09 May 2020 21:14:59 +0200
parent 3992:0233da912ab6
comparison
equal deleted inserted replaced
4013:e1e337dc05b6 4014:1b68954a743a
13 local priorities = user_sessions[username].csi_muc_priorities; 13 local priorities = user_sessions[username].csi_muc_priorities;
14 14
15 if priorities then 15 if priorities then
16 local priority = priorities[room_jid]; 16 local priority = priorities[room_jid];
17 if priority ~= nil then 17 if priority ~= nil then
18 event.reason = "muc priority";
18 return priority; 19 return priority;
19 end 20 end
20 end 21 end
21 22
22 -- Look for mention 23 -- Look for mention
25 local body = stanza:get_child_text("body"); 26 local body = stanza:get_child_text("body");
26 if not body then return end 27 if not body then return end
27 local room_nick = rooms[room_jid]; 28 local room_nick = rooms[room_jid];
28 if room_nick then 29 if room_nick then
29 if body:find(room_nick, 1, true) then 30 if body:find(room_nick, 1, true) then
31 event.reason = "muc mention";
30 return true; 32 return true;
31 end 33 end
32 -- Your own messages 34 -- Your own messages
33 if stanza.attr.from == (room_jid .. "/" .. room_nick) then 35 if stanza.attr.from == (room_jid .. "/" .. room_nick) then
36 event.reason = "muc own message";
34 return true; 37 return true;
35 end 38 end
36 end 39 end
37 end 40 end
38 41