diff options
author | louiz’ <louiz@louiz.org> | 2017-01-06 23:45:26 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-01-06 23:45:26 +0100 |
commit | e31ff3e9e94d943d4f307eb6ab8cee7fbd11b565 (patch) | |
tree | 42666bddcfcf827426d3086f6f8e71143a059eb4 | |
parent | 6bf9cedbeb30740c267ea283058c93ed63648fc9 (diff) | |
download | biboumi-e31ff3e9e94d943d4f307eb6ab8cee7fbd11b565.tar.gz biboumi-e31ff3e9e94d943d4f307eb6ab8cee7fbd11b565.tar.bz2 biboumi-e31ff3e9e94d943d4f307eb6ab8cee7fbd11b565.tar.xz biboumi-e31ff3e9e94d943d4f307eb6ab8cee7fbd11b565.zip |
Fix some issues found by sonar cube
-rw-r--r-- | louloulibs/network/dns_handler.hpp | 2 | ||||
-rw-r--r-- | louloulibs/xmpp/adhoc_commands_handler.cpp | 9 | ||||
-rw-r--r-- | src/xmpp/biboumi_component.cpp | 6 |
3 files changed, 6 insertions, 11 deletions
diff --git a/louloulibs/network/dns_handler.hpp b/louloulibs/network/dns_handler.hpp index 0148156..78ffe4d 100644 --- a/louloulibs/network/dns_handler.hpp +++ b/louloulibs/network/dns_handler.hpp @@ -14,7 +14,7 @@ class Poller; class DNSHandler { public: - DNSHandler(std::shared_ptr<Poller> poller); + explicit DNSHandler(std::shared_ptr<Poller> poller); ~DNSHandler() = default; DNSHandler(const DNSHandler&) = delete; diff --git a/louloulibs/xmpp/adhoc_commands_handler.cpp b/louloulibs/xmpp/adhoc_commands_handler.cpp index d3ede2d..040d0ff 100644 --- a/louloulibs/xmpp/adhoc_commands_handler.cpp +++ b/louloulibs/xmpp/adhoc_commands_handler.cpp @@ -62,13 +62,8 @@ XmlNode AdhocCommandsHandler::handle_request(const std::string& executor_jid, co "adhocsession"s + sessionid + executor_jid)); } auto session_it = this->sessions.find(std::make_pair(sessionid, executor_jid)); - if (session_it == this->sessions.end()) - { - XmlSubNode error(command_node, ADHOC_NS":error"); - error["type"] = "modify"; - XmlSubNode condition(error, STANZA_NS":bad-request"); - } - else if (action == "execute" || action == "next" || action == "complete") + if ((session_it != this->sessions.end()) && + (action == "execute" || action == "next" || action == "complete")) { // execute the step AdhocSession& session = session_it->second; diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 6971538..bd6975e 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -136,7 +136,7 @@ void BiboumiComponent::handle_presence(const Stanza& stanza) // stanza_error.disable() call at the end of the function. std::string error_type("cancel"); std::string error_name("internal-server-error"); - utils::ScopeGuard stanza_error([&](){ + utils::ScopeGuard stanza_error([this, &from_str, &to_str, &id, &error_type, &error_name](){ this->send_stanza_error("presence", from_str, to_str, id, error_type, error_name, ""); }); @@ -205,7 +205,7 @@ void BiboumiComponent::handle_message(const Stanza& stanza) std::string error_type("cancel"); std::string error_name("internal-server-error"); - utils::ScopeGuard stanza_error([&](){ + utils::ScopeGuard stanza_error([this, &from_str, &to_str, &id, &error_type, &error_name](){ this->send_stanza_error("message", from_str, to_str, id, error_type, error_name, ""); }); @@ -324,7 +324,7 @@ void BiboumiComponent::handle_iq(const Stanza& stanza) // the scopeguard. std::string error_type("cancel"); std::string error_name("internal-server-error"); - utils::ScopeGuard stanza_error([&](){ + utils::ScopeGuard stanza_error([this, &from, &to_str, &id, &error_type, &error_name](){ this->send_stanza_error("iq", from, to_str, id, error_type, error_name, ""); }); |