Mercurial > prosody-hg
comparison plugins/mod_blocklist.lua @ 13481:1c87c0a7ece6
mod_blocklist: Check JID of mediated MUC invite sender against blocklist
This ensures that someone on your blocklist is unable to invite you to MUC
rooms.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 22 Apr 2024 11:26:20 +0100 |
| parents | a74251a790ed |
| children | 4d697961546d |
comparison
equal
deleted
inserted
replaced
| 13480:3027c2634a44 | 13481:1c87c0a7ece6 |
|---|---|
| 260 local stanza = event.stanza; | 260 local stanza = event.stanza; |
| 261 local attr = stanza.attr; | 261 local attr = stanza.attr; |
| 262 local to, from = attr.to, attr.from; | 262 local to, from = attr.to, attr.from; |
| 263 to = to and jid_split(to); | 263 to = to and jid_split(to); |
| 264 if to and from then | 264 if to and from then |
| 265 return is_blocked(to, from); | 265 if is_blocked(to, from) then |
| 266 return true; | |
| 267 end | |
| 268 | |
| 269 -- Check mediated MUC inviter | |
| 270 if stanza.name == "message" then | |
| 271 local invite = stanza:find("{http://jabber.org/protocol/muc#user}x/invite"); | |
| 272 if invite then | |
| 273 from = jid_prep(invite.attr.from); | |
| 274 if is_blocked(to, from) then | |
| 275 return true; | |
| 276 end | |
| 277 end | |
| 278 end | |
| 279 | |
| 280 return false; | |
| 266 end | 281 end |
| 267 end | 282 end |
| 268 | 283 |
| 269 local function bounce_stanza(event) | 284 local function bounce_stanza(event) |
| 270 local origin, stanza = event.origin, event.stanza; | 285 local origin, stanza = event.origin, event.stanza; |
