Mercurial > prosody-modules
annotate mod_muc_restrict_avatars/mod_muc_restrict_avatars.lua @ 5804:c3eeeb968403
mod_pubsub_serverinfo: Detect existence of pub/sub node
Instead of blindly trying to create the pub/sub node to publish items to, a service discovery query is performed to check if node creation is required.
Added various bits of warn and debug logging, to give a user better feedback if and why something is failing.
author | Guus der Kinderen <guus.der.kinderen@gmail.com> |
---|---|
date | Thu, 04 Jan 2024 11:59:35 +0100 |
parents | 2c69577b28c2 |
children | 66e7d46b1d4b |
rev | line source |
---|---|
5649
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
1 local bare_jid = require"util.jid".bare; |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
2 local mod_muc = module:depends("muc"); |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
3 |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
4 local function filter_avatar_advertisement(tag) |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
5 if tag.attr.xmlns == "vcard-temp:x:update" then |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
6 return nil; |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
7 end |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
8 |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
9 return tag; |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
10 end |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
11 |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
12 module:hook("presence/full", function(event) |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
13 local stanza = event.stanza; |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
14 local room = mod_muc.get_room_from_jid(bare_jid(stanza.attr.to)); |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
15 |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
16 if not room:get_affiliation(stanza.attr.from) then |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
17 stanza:maptags(filter_avatar_advertisement); |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
18 end |
2c69577b28c2
mod_muc_restrict_avatars: Block MUC participant avatars for non-members
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
19 end, 1); |