Mercurial > prosody-hg
comparison plugins/mod_message.lua @ 11815:df1d3df2204a
mod_message: Fire event for groupchat messages sent to bare JID
This is becoming more common in XMPP as people experiment with a MIX-like
model where the bare JID joins a group chat instead of a full JID.
Specifically right now this is being added to help with processing
notifications from mod_muc_offline_delivery.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 22 Sep 2021 13:31:13 +0100 |
| parents | 72a2b85c0537 |
| children | 74b9e05af71e |
comparison
equal
deleted
inserted
replaced
| 11814:f27b9319e0da | 11815:df1d3df2204a |
|---|---|
| 20 | 20 |
| 21 local t = stanza.attr.type; | 21 local t = stanza.attr.type; |
| 22 if t == "error" then | 22 if t == "error" then |
| 23 return true; -- discard | 23 return true; -- discard |
| 24 elseif t == "groupchat" then | 24 elseif t == "groupchat" then |
| 25 local node, host = jid_split(bare); | |
| 26 if user_exists(node, host) then | |
| 27 if module:fire_event("message/bare/groupchat", { | |
| 28 origin = origin, stanza = stanza; | |
| 29 }) then | |
| 30 return true; | |
| 31 end | |
| 32 end | |
| 33 | |
| 25 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 34 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
| 26 elseif t == "headline" then | 35 elseif t == "headline" then |
| 27 if user and stanza.attr.to == bare then | 36 if user and stanza.attr.to == bare then |
| 28 for _, session in pairs(user.sessions) do | 37 for _, session in pairs(user.sessions) do |
| 29 if session.presence and session.priority >= 0 then | 38 if session.presence and session.priority >= 0 then |
