Software /
code /
prosody
Changeset
12015:b4db17aeff01
mod_disco: Advertise admin accounts as such via disco identity
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 04 Jul 2020 20:09:18 +0200 |
parents | 12014:efbf288b529e |
children | 12016:b7e15abde27f |
files | plugins/mod_disco.lua |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_disco.lua Mon Dec 06 21:56:19 2021 +0100 +++ b/plugins/mod_disco.lua Sat Jul 04 20:09:18 2020 +0200 @@ -8,6 +8,7 @@ local get_children = require "core.hostmanager".get_children; local is_contact_subscribed = require "core.rostermanager".is_contact_subscribed; +local um_is_admin = require "core.usermanager".is_admin; local jid_split = require "util.jid".split; local jid_bare = require "util.jid".bare; local st = require "util.stanza" @@ -181,7 +182,11 @@ end local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info'}); if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account - reply:tag('identity', {category='account', type='registered'}):up(); + if um_is_admin(stanza.attr.to or origin.full_jid, module.host) then + reply:tag('identity', {category='account', type='admin'}):up(); + else + reply:tag('identity', {category='account', type='registered'}):up(); + end module:fire_event("account-disco-info", { origin = origin, reply = reply }); origin.send(reply); return true;