aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-07-04 20:09:18 +0200
committerKim Alvefur <zash@zash.se>2020-07-04 20:09:18 +0200
commit182816c1ae2392ec3a715fc4d6873996f0c73945 (patch)
tree8603547790ff33a8b1c2189c6bc6bf209fc5a107 /plugins
parentcf137f99020a2f1ac67b761861a7baa4ef2cfe07 (diff)
downloadprosody-182816c1ae2392ec3a715fc4d6873996f0c73945.tar.gz
prosody-182816c1ae2392ec3a715fc4d6873996f0c73945.zip
mod_disco: Advertise admin accounts as such via disco identity
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_disco.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/mod_disco.lua b/plugins/mod_disco.lua
index 12e4357b..b05629b5 100644
--- a/plugins/mod_disco.lua
+++ b/plugins/mod_disco.lua
@@ -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 @@ module:hook("iq-get/bare/http://jabber.org/protocol/disco#info:query", function(
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;