Software /
code /
prosody
Comparison
plugins/mod_mam/mod_mam.lua @ 10751:4db4bd8a7822
mod_mam: Don't store any groupchat messages
The intent was to not store MUC groupchat messages, which are sent from
the MUC to local full JIDs, while allowing for potential future
account based group chat. However, since this function handles messages
in both directions and outgoing MUC messages are sent to the bare room
JID, those were stored.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 23 Apr 2020 00:55:34 +0200 |
parent | 10746:2e31d67b9a29 |
child | 10752:930f38939f1e |
comparison
equal
deleted
inserted
replaced
10750:ff087f2d4cb6 | 10751:4db4bd8a7822 |
---|---|
267 local st_type = stanza.attr.type or "normal"; | 267 local st_type = stanza.attr.type or "normal"; |
268 local st_to_full = (stanza.attr.to or ""):find("/"); | 268 local st_to_full = (stanza.attr.to or ""):find("/"); |
269 if st_type == "error" then | 269 if st_type == "error" then |
270 st_to_full = (stanza.attr.from or ""):find("/"); | 270 st_to_full = (stanza.attr.from or ""):find("/"); |
271 end | 271 end |
272 -- FIXME pass direction of stanza and use that along with bare/full JID addressing | |
273 -- for more accurate MUC / type=groupchat check | |
272 | 274 |
273 if st_type == "headline" then | 275 if st_type == "headline" then |
274 -- Headline messages are ephemeral by definition | 276 -- Headline messages are ephemeral by definition |
275 return false, "headline"; | 277 return false, "headline"; |
276 end | 278 end |
277 if st_type == "error" then | 279 if st_type == "error" then |
278 return true, "bounce"; | 280 return true, "bounce"; |
279 end | 281 end |
280 if st_type == "groupchat" and st_to_full then | 282 if st_type == "groupchat" then |
281 -- MUC messages always go to the full JID, usually archived by the MUC | 283 -- MUC messages always go to the full JID, usually archived by the MUC |
282 return false, "groupchat"; | 284 return false, "groupchat"; |
283 end | 285 end |
284 if stanza:get_child("no-store", "urn:xmpp:hints") | 286 if stanza:get_child("no-store", "urn:xmpp:hints") |
285 or stanza:get_child("no-permanent-store", "urn:xmpp:hints") then | 287 or stanza:get_child("no-permanent-store", "urn:xmpp:hints") then |