diff options
author | Florent Le Coz <louiz@louiz.org> | 2015-09-18 21:55:21 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2015-09-18 22:09:26 +0200 |
commit | 45e8fe56a688ec03201cdfc3dfea6ae186af682d (patch) | |
tree | 7b390546b414f077bec00219d60755d8a7a47c46 /louloulibs/xmpp | |
parent | 19666d2ffd3ce36b7edd4044143fe535ef85dbd9 (diff) | |
download | biboumi-45e8fe56a688ec03201cdfc3dfea6ae186af682d.tar.gz biboumi-45e8fe56a688ec03201cdfc3dfea6ae186af682d.tar.bz2 biboumi-45e8fe56a688ec03201cdfc3dfea6ae186af682d.tar.xz biboumi-45e8fe56a688ec03201cdfc3dfea6ae186af682d.zip |
Add an AdhocCommandsHandler to store commands specific to IRC servers
Diffstat (limited to 'louloulibs/xmpp')
-rw-r--r-- | louloulibs/xmpp/xmpp_component.cpp | 8 | ||||
-rw-r--r-- | louloulibs/xmpp/xmpp_component.hpp | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/louloulibs/xmpp/xmpp_component.cpp b/louloulibs/xmpp/xmpp_component.cpp index 2214ecf..3017c0b 100644 --- a/louloulibs/xmpp/xmpp_component.cpp +++ b/louloulibs/xmpp/xmpp_component.cpp @@ -587,22 +587,22 @@ 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, const bool with_admin_only) +void XmppComponent::send_adhoc_commands_list(const std::string& id, const std::string& requester_jid, const std::string& from_jid, const bool with_admin_only, const AdhocCommandsHandler& adhoc_handler) { Stanza iq("iq"); iq["type"] = "result"; iq["id"] = id; iq["to"] = requester_jid; - iq["from"] = this->served_hostname; + iq["from"] = from_jid; XmlNode query("query"); query["xmlns"] = DISCO_ITEMS_NS; query["node"] = ADHOC_NS; - for (const auto& kv: this->adhoc_commands_handler.get_commands()) + for (const auto& kv: adhoc_handler.get_commands()) { if (kv.second.is_admin_only() && !with_admin_only) continue; XmlNode item("item"); - item["jid"] = this->served_hostname; + item["jid"] = from_jid; item["node"] = kv.first; item["name"] = kv.second.name; query.add_child(std::move(item)); diff --git a/louloulibs/xmpp/xmpp_component.hpp b/louloulibs/xmpp/xmpp_component.hpp index e45bb36..06236fe 100644 --- a/louloulibs/xmpp/xmpp_component.hpp +++ b/louloulibs/xmpp/xmpp_component.hpp @@ -184,8 +184,8 @@ public: * Send the list of all available ad-hoc commands to that JID. The list is * different depending on what JID made the request. */ - void send_adhoc_commands_list(const std::string& id, const std::string& requester_jid, - const bool with_admin_only); + void send_adhoc_commands_list(const std::string& id, const std::string& requester_jid, const std::string& from_jid, + const bool with_admin_only, const AdhocCommandsHandler& adhoc_handler); /** * Send an iq version request */ |