annotate mod_drop_chatstates/mod_drop_chatstates.lua @ 6319:04c3273cb81f

mod_auth_cyrus: Add empty 'profile' table to SASL handler objects This is for compatibility with Prosody's built-in util.sasl objects. A SASL profile table usually includes methods supported by the backend, which can be used by SASL mechanism handlers to perform operations (such as testing the password). It also optionally contains a 'cb' field with channel binding method handlers. The Cyrus backend doesn't support channel binding, and doesn't have the same concept of auth backend methods (it handles all that internally, and Prosody has no insight or control over it). Thus, we create an empty profile which informs Prosody that the SASL handler does not support any of the auth or channel binding methods. Some features will not work, but they didn't work anyway. This just makes it explicit. This fixes a traceback in mod_sasl2_fast, which expected SASL handlers to always contain a 'profile' field.
author Matthew Wild <mwild1@gmail.com>
date Thu, 04 Sep 2025 10:14:46 +0100
parents 2525f247084c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6310
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
1 local jid = require "util.jid"
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
2 local st = require "util.stanza"
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
3
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
4 local CHATSTATES_NS = "http://jabber.org/protocol/chatstates"
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
5 local domains = module:get_option_set("drop_chatstates_domains", {})
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
6
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
7 local function handle_pre_message(event)
6311
2525f247084c mod_drop_chatstates: Fix bug using stanza before its defined
Chaz Kettleson <chaz@pyr3x.com>
parents: 6310
diff changeset
8 local stanza = event.stanza
6310
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
9 local to_host = jid.host(stanza.attr.to)
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
10 if not to_host or not domains:contains(to_host) then return end
6311
2525f247084c mod_drop_chatstates: Fix bug using stanza before its defined
Chaz Kettleson <chaz@pyr3x.com>
parents: 6310
diff changeset
11 if stanza:get_child(nil, CHATSTATES_NS) then return true end
6310
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
12 end
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
13
92e2dcf039d9 mod_drop_chatstates: New module to drop chatstates for specific domains
Chaz Kettleson <chaz@pyr3x.com>
parents:
diff changeset
14 module:hook("pre-message/bare", handle_pre_message)