# HG changeset patch # User Kim Alvefur # Date 1613920521 -3600 # Node ID 89e54247ade6ff436a77678fed25f0a853a7a2f3 # Parent 8862a80cbd0087369d5b13b80087e383f09db624 mod_muc_http_defaults: Add template filters to let you extract room JID parts diff -r 8862a80cbd00 -r 89e54247ade6 mod_muc_http_defaults/README.markdown --- a/mod_muc_http_defaults/README.markdown Mon Jan 25 08:41:37 2021 +0100 +++ b/mod_muc_http_defaults/README.markdown Sun Feb 21 16:15:21 2021 +0100 @@ -21,6 +21,11 @@ : The value of the Authorization header to authenticate against the API. E.g. `"Bearer /rXU4tkQTYQMgdHfMLH6"`{.lua} +In the URL template variable, the room JID is available as `{room.jid}`, +which would be turned into `room@muc.host`. To only get the room +localpart, `{room.jid|jid_node}` can be used, and `{room.jid|jid_host}` +splits out the `muc.host` part. + ## Example ``` {.lua} diff -r 8862a80cbd00 -r 89e54247ade6 mod_muc_http_defaults/mod_muc_http_defaults.lua --- a/mod_muc_http_defaults/mod_muc_http_defaults.lua Mon Jan 25 08:41:37 2021 +0100 +++ b/mod_muc_http_defaults/mod_muc_http_defaults.lua Sun Feb 21 16:15:21 2021 +0100 @@ -11,7 +11,8 @@ local json = require "util.json"; local st = require "util.stanza"; -local render = require "util.interpolation".new("%b{}", uh.urlencode); +local funcs = {jid_bare = jid.bare; jid_host = jid.host; jid_node = jid.node}; +local render = require"util.interpolation".new("%b{}", uh.urlencode, funcs); module:depends"muc";