Fix some issues found by sonar cube
This commit is contained in:
@@ -14,7 +14,7 @@ class Poller;
|
|||||||
class DNSHandler
|
class DNSHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DNSHandler(std::shared_ptr<Poller> poller);
|
explicit DNSHandler(std::shared_ptr<Poller> poller);
|
||||||
~DNSHandler() = default;
|
~DNSHandler() = default;
|
||||||
|
|
||||||
DNSHandler(const DNSHandler&) = delete;
|
DNSHandler(const DNSHandler&) = delete;
|
||||||
|
|||||||
@@ -62,13 +62,8 @@ XmlNode AdhocCommandsHandler::handle_request(const std::string& executor_jid, co
|
|||||||
"adhocsession"s + sessionid + executor_jid));
|
"adhocsession"s + sessionid + executor_jid));
|
||||||
}
|
}
|
||||||
auto session_it = this->sessions.find(std::make_pair(sessionid, executor_jid));
|
auto session_it = this->sessions.find(std::make_pair(sessionid, executor_jid));
|
||||||
if (session_it == this->sessions.end())
|
if ((session_it != this->sessions.end()) &&
|
||||||
{
|
(action == "execute" || action == "next" || action == "complete"))
|
||||||
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")
|
|
||||||
{
|
{
|
||||||
// execute the step
|
// execute the step
|
||||||
AdhocSession& session = session_it->second;
|
AdhocSession& session = session_it->second;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ void BiboumiComponent::handle_presence(const Stanza& stanza)
|
|||||||
// stanza_error.disable() call at the end of the function.
|
// stanza_error.disable() call at the end of the function.
|
||||||
std::string error_type("cancel");
|
std::string error_type("cancel");
|
||||||
std::string error_name("internal-server-error");
|
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,
|
this->send_stanza_error("presence", from_str, to_str, id,
|
||||||
error_type, error_name, "");
|
error_type, error_name, "");
|
||||||
});
|
});
|
||||||
@@ -205,7 +205,7 @@ void BiboumiComponent::handle_message(const Stanza& stanza)
|
|||||||
|
|
||||||
std::string error_type("cancel");
|
std::string error_type("cancel");
|
||||||
std::string error_name("internal-server-error");
|
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,
|
this->send_stanza_error("message", from_str, to_str, id,
|
||||||
error_type, error_name, "");
|
error_type, error_name, "");
|
||||||
});
|
});
|
||||||
@@ -324,7 +324,7 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
|
|||||||
// the scopeguard.
|
// the scopeguard.
|
||||||
std::string error_type("cancel");
|
std::string error_type("cancel");
|
||||||
std::string error_name("internal-server-error");
|
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,
|
this->send_stanza_error("iq", from, to_str, id,
|
||||||
error_type, error_name, "");
|
error_type, error_name, "");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user