annotate mod_block_subscriptions/mod_block_subscriptions.lua @ 3656:3e0f4d727825

mod_vcard_muc: Add an alternative method of signaling avatar change When the avatar has been changed, a signal is sent that the room configuration has changed. Clients then do a disco#info query to find the SHA-1 of the new avatar. They can then fetch it as before, or not if they have it cached already. This is meant to be less disruptive than signaling via presence, which caused problems for some clients. If clients transition to the new method, the old one can eventually be removed. The namespace is made up while waiting for standardization. Otherwise it is very close to what's described in https://xmpp.org/extensions/inbox/muc-avatars.html
author Kim Alvefur <zash@zash.se>
date Sun, 25 Aug 2019 20:46:43 +0200
parents 107eb83aa732
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
773
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local allowed_presence_types = { probe = true, unavailable = true };
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 function filter_presence(event)
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 local stanza = event.stanza;
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 local presence_type = stanza.attr.type;
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 if presence_type == nil or allowed_presence_types[presence_type] then
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 return;
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 end
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 return true; -- Drop
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 end
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 module:hook("pre-presence/bare", filter_presence, 200); -- Client sending
107eb83aa732 mod_block_subscriptions: Block incoming and outgoing presence subscriptions (useful in conjunction with mod_readonly)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 module:hook("presence/bare", filter_presence, 200); -- Client receiving