# HG changeset patch # User Matthew Wild # Date 1642256727 0 # Node ID c3bf568e3977d29efea9890bd1f6fb0396050fe2 # Parent 57311c54501308337ba27b51cdc93e1e186ee8e7 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 element as an indicator that an account exists, although technically this is not something Prosody itself does, so it's a little weird). diff -r 57311c545013 -r c3bf568e3977 mod_http_xep227/mod_http_xep227.lua --- 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)