Mercurial > prosody-modules
view mod_roster_allinall/mod_roster_allinall.lua @ 4515:2e33eeafe962
mod_muc_markers: Prevent any markers from reaching the archive, even if untracked
Original intention was to leave alone things that this module isn't
handling. However markers in archives are just problematic without
more advanced logic about what is markable and what is not. It also
requires a more advanced query in mod_muc_rai to determine the latest
markable message instead of the latest archived message.
I'd rather keep the "is archivable" and "is markable" definition the
same for simplicity. I don't want to introduce yet another set of rules
for no reason.
No markers in MAM.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 22 Mar 2021 15:55:02 +0000 |
parents | 3ae8c81a348b |
children |
line wrap: on
line source
local rostermanager = require"core.rostermanager"; local jid_join = require"util.jid".join; local host = module.host; local sessions = prosody.hosts[host].sessions; -- Make a *one-way* subscription. User will see when contact is online, -- contact will not see when user is online. local function subscribe(user, contact) local user_jid, contact_jid = jid_join(user, host), jid_join(contact, host); -- Update user's roster to say subscription request is pending... rostermanager.set_contact_pending_out(user, host, contact_jid); -- Update contact's roster to say subscription request is pending... rostermanager.set_contact_pending_in(contact, host, user_jid); -- Update contact's roster to say subscription request approved... rostermanager.subscribed(contact, host, user_jid); -- Update user's roster to say subscription request approved... rostermanager.process_inbound_subscription_approval(user, host, contact_jid); -- Push updates to both rosters rostermanager.roster_push(user, host, contact_jid); rostermanager.roster_push(contact, host, user_jid); end module:hook("resource-bind", function(event) local session = event.session; local user = session.username; local user_jid = jid_join(user, host); for contact in pairs(sessions) do if contact ~= user then local contact_jid = jid_join(contact, host); if not rostermanager.is_contact_subscribed(user, host, contact_jid) then subscribe(contact, user); end if not rostermanager.is_contact_subscribed(contact, host, user_jid) then subscribe(user, contact); end end end end);