Mercurial > prosody-hg
comparison plugins/mod_invites.lua @ 12834:dcbff9f038a0 0.12
mod_invites: Prefer landing page over xmpp URI in shell command
To mirror behavior of prosodyctl invocation
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 10 Jan 2023 21:10:58 +0100 |
| parents | 669d93f1db6a |
| children | 74b9e05af71e 0b6af170617b |
comparison
equal
deleted
inserted
replaced
| 12831:1cdaf21584da | 12834:dcbff9f038a0 |
|---|---|
| 215 local username, host = jid_split(user_jid); | 215 local username, host = jid_split(user_jid); |
| 216 local mod_invites, err = get_module(host, "invites"); | 216 local mod_invites, err = get_module(host, "invites"); |
| 217 if not mod_invites then return nil, err or "mod_invites not loaded on this host"; end | 217 if not mod_invites then return nil, err or "mod_invites not loaded on this host"; end |
| 218 local invite, err = mod_invites.create_account(username); | 218 local invite, err = mod_invites.create_account(username); |
| 219 if not invite then return nil, err; end | 219 if not invite then return nil, err; end |
| 220 return true, invite.uri; | 220 return true, invite.landing_page or invite.uri; |
| 221 end | 221 end |
| 222 | 222 |
| 223 function console_env.invite:create_contact(user_jid, allow_registration) | 223 function console_env.invite:create_contact(user_jid, allow_registration) |
| 224 local username, host = jid_split(user_jid); | 224 local username, host = jid_split(user_jid); |
| 225 local mod_invites, err = get_module(host, "invites"); | 225 local mod_invites, err = get_module(host, "invites"); |
| 226 if not mod_invites then return nil, err or "mod_invites not loaded on this host"; end | 226 if not mod_invites then return nil, err or "mod_invites not loaded on this host"; end |
| 227 local invite, err = mod_invites.create_contact(username, allow_registration); | 227 local invite, err = mod_invites.create_contact(username, allow_registration); |
| 228 if not invite then return nil, err; end | 228 if not invite then return nil, err; end |
| 229 return true, invite.uri; | 229 return true, invite.landing_page or invite.uri; |
| 230 end | 230 end |
| 231 end | 231 end |
| 232 | 232 |
| 233 --- prosodyctl command | 233 --- prosodyctl command |
| 234 function module.command(arg) | 234 function module.command(arg) |
