Software /
code /
prosody-modules
Changeset
4869:c3bf568e3977
mod_http_xep227: Initialize XEP-0227 XML
mod_storage_xep0227 only writes if there is XML already for a user (it uses
the presence of an existing <user> element as an indicator that an account
exists, although technically this is not something Prosody itself does, so
it's a little weird).
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 15 Jan 2022 14:25:27 +0000 |
parents | 4868:57311c545013 |
children | 4870:d8a0a8dcdc0d |
files | mod_http_xep227/mod_http_xep227.lua |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_xep227/mod_http_xep227.lua Sat Jan 15 14:06:19 2022 +0000 +++ b/mod_http_xep227/mod_http_xep227.lua Sat Jan 15 14:25:27 2022 +0000 @@ -1,6 +1,7 @@ local it = require "util.iterators"; local http = require "util.http"; local sm = require "core.storagemanager"; +local st = require "util.stanza"; local xml = require "util.xml"; local tokens = module:depends("tokenauth"); @@ -20,7 +21,9 @@ }; local function new_user_xml(username, host) - local user_xml; + local user_xml = st.stanza("server-data", {xmlns='urn:xmpp:pie:0'}) + :tag("host", { jid = host }) + :tag("user", { name = username }):reset(); return { set_user_xml = function (_, store_username, store_host, new_xml)