annotate mod_muc_auto_reserve_nicks/mod_muc_auto_reserve_nicks.lua @ 5796:93d6e9026c1b

mod_http_oauth2: Do not enforce PKCE on Device and OOB flows PKCE does not appear to be used with the Device flow. I have found no mention of any interaction between those standards. Since no data is delivered via redirects in these cases, PKCE may not serve any purpose. This is mostly a problem because we reuse the authorization code to implement the Device and OOB flows.
author Kim Alvefur <zash@zash.se>
date Fri, 15 Dec 2023 12:10:07 +0100
parents c83bc703825d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4772
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local jid = require "util.jid";
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 local set = require "util.set";
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 local active_affiliations = set.new({ "member", "admin", "owner" });
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 module:hook("muc-occupant-joined", function (event)
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 local room, occupant = event.room, event.occupant;
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 local user_jid = occupant.bare_jid;
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 local user_affiliation = room:get_affiliation(user_jid);
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 if not active_affiliations:contains(user_affiliation) then
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 return;
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 end
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 local aff_data = event.room:get_affiliation_data(user_jid);
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 if not aff_data then
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 local reserved_nick = jid.resource(occupant.nick);
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 module:log("debug", "Automatically reserving nickname '%s' for <%s>", reserved_nick, user_jid);
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 room:set_affiliation_data(user_jid, "reserved_nickname", reserved_nick);
4951
c83bc703825d mod_muc_auto_reserve_nicks: Force refresh of nickname (thanks phryk)
Kim Alvefur <zash@zash.se>
parents: 4772
diff changeset
18 room._reserved_nicks = nil; -- force refresh of nickname map
4772
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 end
85d4ab318d66 mod_muc_auto_reserve_nicks: Automatically reserve nicknames of MUC occupants
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 end);