summaryrefslogtreecommitdiff
path: root/src/xmpp
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 /src/xmpp
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 'src/xmpp')
-rw-r--r--src/xmpp/biboumi_component.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index b7613d3..c1fa339 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -50,7 +50,7 @@ BiboumiComponent::BiboumiComponent(std::shared_ptr<Poller> poller, const std::st
this->stanza_handlers.emplace("iq",
std::bind(&BiboumiComponent::handle_iq, this,std::placeholders::_1));
- this->adhoc_commands_handler.get_commands()= {
+ this->adhoc_commands_handler.get_commands() = {
{"ping", AdhocCommand({&PingStep1}, "Do a ping", false)},
{"hello", AdhocCommand({&HelloStep1, &HelloStep2}, "Receive a custom greeting", false)},
{"disconnect-user", AdhocCommand({&DisconnectUserStep1, &DisconnectUserStep2}, "Disconnect a user from the gateway", true)},
@@ -370,7 +370,10 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
const std::string node = query->get_tag("node");
if (node == ADHOC_NS)
{
- this->send_adhoc_commands_list(id, from);
+ Jid from_jid(from);
+ this->send_adhoc_commands_list(id, from,
+ (Config::get("admin", "") ==
+ from_jid.local + "@" + from_jid.domain));
stanza_error.disable();
}
else if (node.empty() && !iid.is_user && !iid.is_channel)