summaryrefslogtreecommitdiff
path: root/louloulibs/xmpp/xmpp_component.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-06-09 14:52:46 +0200
committerFlorent Le Coz <louiz@louiz.org>2015-06-09 14:52:46 +0200
commit7f7c429ae4c49e856a43816138991135ffb7f840 (patch)
treec053e2c425245ba4cb366aecdf9a3663f9ab803b /louloulibs/xmpp/xmpp_component.cpp
parent8da03f98307e03a767cb68659c8473c896cbd325 (diff)
downloadbiboumi-7f7c429ae4c49e856a43816138991135ffb7f840.tar.gz
biboumi-7f7c429ae4c49e856a43816138991135ffb7f840.tar.bz2
biboumi-7f7c429ae4c49e856a43816138991135ffb7f840.tar.xz
biboumi-7f7c429ae4c49e856a43816138991135ffb7f840.zip
Do not send the admin-only adhoc commands to non-admin users
They were not able to execute them anyway, so this was just a little usability issue.
Diffstat (limited to 'louloulibs/xmpp/xmpp_component.cpp')
-rw-r--r--louloulibs/xmpp/xmpp_component.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/louloulibs/xmpp/xmpp_component.cpp b/louloulibs/xmpp/xmpp_component.cpp
index 1048f86..8e89208 100644
--- a/louloulibs/xmpp/xmpp_component.cpp
+++ b/louloulibs/xmpp/xmpp_component.cpp
@@ -651,7 +651,7 @@ void XmppComponent::send_version(const std::string& id, const std::string& jid_t
this->send_stanza(iq);
}
-void XmppComponent::send_adhoc_commands_list(const std::string& id, const std::string& requester_jid)
+void XmppComponent::send_adhoc_commands_list(const std::string& id, const std::string& requester_jid, const bool with_admin_only)
{
Stanza iq("iq");
iq["type"] = "result";
@@ -663,6 +663,8 @@ void XmppComponent::send_adhoc_commands_list(const std::string& id, const std::s
query["node"] = ADHOC_NS;
for (const auto& kv: this->adhoc_commands_handler.get_commands())
{
+ if (kv.second.is_admin_only() && !with_admin_only)
+ continue;
XmlNode item("item");
item["jid"] = this->served_hostname;
item["node"] = kv.first;