summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-03-29 23:32:43 +0200
committerlouiz’ <louiz@louiz.org>2017-03-29 23:32:43 +0200
commit1a09c965eb3723cdaab9ea556f30ffbc7f09a6dd (patch)
tree8da20afbb4520f71bbdd9ed6fc2ff301bb7be992 /src/xmpp
parent52b795d11976802cfec12d886fca508047ffed89 (diff)
downloadbiboumi-1a09c965eb3723cdaab9ea556f30ffbc7f09a6dd.tar.gz
biboumi-1a09c965eb3723cdaab9ea556f30ffbc7f09a6dd.tar.bz2
biboumi-1a09c965eb3723cdaab9ea556f30ffbc7f09a6dd.tar.xz
biboumi-1a09c965eb3723cdaab9ea556f30ffbc7f09a6dd.zip
Remove two sneaky log_debug
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/adhoc_command.hpp2
-rw-r--r--src/xmpp/adhoc_session.cpp2
-rw-r--r--src/xmpp/biboumi_adhoc_commands.cpp14
-rw-r--r--src/xmpp/biboumi_component.cpp2
-rw-r--r--src/xmpp/jid.cpp3
-rw-r--r--src/xmpp/xmpp_component.cpp8
-rw-r--r--src/xmpp/xmpp_component.hpp6
7 files changed, 17 insertions, 20 deletions
diff --git a/src/xmpp/adhoc_command.hpp b/src/xmpp/adhoc_command.hpp
index 7c4de47..ced4549 100644
--- a/src/xmpp/adhoc_command.hpp
+++ b/src/xmpp/adhoc_command.hpp
@@ -17,7 +17,7 @@ class AdhocCommand
{
friend class AdhocSession;
public:
- AdhocCommand(std::vector<AdhocStep>&& callback, const std::string& name, const bool admin_only);
+ AdhocCommand(std::vector<AdhocStep>&& callbacks, const std::string& name, const bool admin_only);
~AdhocCommand() = default;
AdhocCommand(const AdhocCommand&) = default;
AdhocCommand(AdhocCommand&&) = default;
diff --git a/src/xmpp/adhoc_session.cpp b/src/xmpp/adhoc_session.cpp
index dda4bea..e2d6c0e 100644
--- a/src/xmpp/adhoc_session.cpp
+++ b/src/xmpp/adhoc_session.cpp
@@ -1,7 +1,7 @@
#include <xmpp/adhoc_session.hpp>
#include <xmpp/adhoc_command.hpp>
-#include <assert.h>
+#include <cassert>
AdhocSession::AdhocSession(const AdhocCommand& command, const std::string& owner_jid,
const std::string& to_jid):
diff --git a/src/xmpp/biboumi_adhoc_commands.cpp b/src/xmpp/biboumi_adhoc_commands.cpp
index 5ec11da..85f945d 100644
--- a/src/xmpp/biboumi_adhoc_commands.cpp
+++ b/src/xmpp/biboumi_adhoc_commands.cpp
@@ -24,7 +24,7 @@ using namespace std::string_literals;
void DisconnectUserStep1(XmppComponent& xmpp_component, AdhocSession&, XmlNode& command_node)
{
- auto& biboumi_component = static_cast<BiboumiComponent&>(xmpp_component);
+ auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
XmlSubNode x(command_node, "jabber:x:data:x");
x["type"] = "form";
@@ -55,7 +55,7 @@ void DisconnectUserStep1(XmppComponent& xmpp_component, AdhocSession&, XmlNode&
void DisconnectUserStep2(XmppComponent& xmpp_component, AdhocSession& session, XmlNode& command_node)
{
- auto& biboumi_component = static_cast<BiboumiComponent&>(xmpp_component);
+ auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
// Find out if the jids, and the quit message are provided in the form.
std::string quit_message;
@@ -151,7 +151,7 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman
void ConfigureGlobalStep2(XmppComponent& xmpp_component, AdhocSession& session, XmlNode& command_node)
{
- BiboumiComponent& biboumi_component = static_cast<BiboumiComponent&>(xmpp_component);
+ auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
const XmlNode* x = command_node.get_child("x", "jabber:x:data");
if (x)
@@ -533,7 +533,7 @@ void DisconnectUserFromServerStep1(XmppComponent& xmpp_component, AdhocSession&
}
else
{ // Send a form to select the user to disconnect
- auto& biboumi_component = static_cast<BiboumiComponent&>(xmpp_component);
+ auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
XmlSubNode x(command_node, "jabber:x:data:x");
x["type"] = "form";
@@ -578,7 +578,7 @@ void DisconnectUserFromServerStep2(XmppComponent& xmpp_component, AdhocSession&
// Send a data form to let the user choose which server to disconnect the
// user from
command_node.delete_all_children();
- auto& biboumi_component = static_cast<BiboumiComponent&>(xmpp_component);
+ auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
XmlSubNode x(command_node, "jabber:x:data:x");
x["type"] = "form";
@@ -643,7 +643,7 @@ void DisconnectUserFromServerStep3(XmppComponent& xmpp_component, AdhocSession&
}
}
- auto& biboumi_component = static_cast<BiboumiComponent&>(xmpp_component);
+ auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
Bridge* bridge = biboumi_component.find_user_bridge(jid_to_disconnect);
auto& clients = bridge->get_irc_clients();
@@ -671,7 +671,7 @@ void DisconnectUserFromServerStep3(XmppComponent& xmpp_component, AdhocSession&
void GetIrcConnectionInfoStep1(XmppComponent& component, AdhocSession& session, XmlNode& command_node)
{
- BiboumiComponent& biboumi_component = static_cast<BiboumiComponent&>(component);
+ auto& biboumi_component = dynamic_cast<BiboumiComponent&>(component);
const Jid owner(session.get_owner_jid());
const Jid target(session.get_target_jid());
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index 6dc8ce9..df96d62 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -422,7 +422,6 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
}
else if (iid.type == Iid::Type::Channel)
{
- log_debug("type_channel");
if (node.empty())
{
this->send_irc_channel_disco_info(id, from, to_str);
@@ -763,7 +762,6 @@ void BiboumiComponent::send_irc_channel_muc_traffic_info(const std::string& id,
void BiboumiComponent::send_irc_channel_disco_info(const std::string& id, const std::string& jid_to, const std::string& jid_from)
{
- log_debug("jid_from: ", jid_from);
Jid from(jid_from);
Iid iid(from.local, {});
Stanza iq("iq");
diff --git a/src/xmpp/jid.cpp b/src/xmpp/jid.cpp
index 0751387..ba8d70b 100644
--- a/src/xmpp/jid.cpp
+++ b/src/xmpp/jid.cpp
@@ -68,8 +68,7 @@ std::string jidprep(const std::string& original)
// Using getaddrinfo, check if the domain part is a valid IPv4 (then use
// it as is), or IPv6 (surround it with []), or a domain name (run
// nameprep)
- struct addrinfo hints;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints{};
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
index 1453b18..6829cef 100644
--- a/src/xmpp/xmpp_component.cpp
+++ b/src/xmpp/xmpp_component.cpp
@@ -39,14 +39,14 @@ static std::set<std::string> kickable_errors{
"malformed-error"
};
-XmppComponent::XmppComponent(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& secret):
+XmppComponent::XmppComponent(std::shared_ptr<Poller>& poller, std::string hostname, std::string secret):
TCPClientSocketHandler(poller),
ever_auth(false),
first_connection_try(true),
- secret(secret),
+ secret(std::move(secret)),
authenticated(false),
doc_open(false),
- served_hostname(hostname),
+ served_hostname(std::move(hostname)),
stanza_handlers{},
adhoc_commands_handler(*this)
{
@@ -429,7 +429,7 @@ void XmppComponent::send_history_message(const std::string& muc_name, const std:
this->send_stanza(message);
}
-void XmppComponent::send_muc_leave(const std::string& muc_name, std::string&& nick, Xmpp::body&& message, const std::string& jid_to, const bool self)
+void XmppComponent::send_muc_leave(const std::string& muc_name, const std::string& nick, Xmpp::body&& message, const std::string& jid_to, const bool self)
{
Stanza presence("presence");
{
diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp
index d808fd5..250f0a8 100644
--- a/src/xmpp/xmpp_component.hpp
+++ b/src/xmpp/xmpp_component.hpp
@@ -43,7 +43,7 @@
class XmppComponent: public TCPClientSocketHandler
{
public:
- explicit XmppComponent(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& secret);
+ explicit XmppComponent(std::shared_ptr<Poller>& poller, std::string hostname, std::string secret);
virtual ~XmppComponent() = default;
XmppComponent(const XmppComponent&) = delete;
@@ -91,7 +91,7 @@ public:
* stanza, and explanation being a short human-readable sentence
* describing the error.
*/
- void send_stream_error(const std::string& message, const std::string& explanation);
+ void send_stream_error(const std::string& name, const std::string& explanation);
/**
* Send error stanza, described in http://xmpp.org/rfcs/rfc6120.html#stanzas-error
*/
@@ -143,7 +143,7 @@ public:
/**
* Send an unavailable presence for this nick
*/
- void send_muc_leave(const std::string& muc_name, std::string&& nick, Xmpp::body&& message, const std::string& jid_to, const bool self);
+ void send_muc_leave(const std::string& muc_name, const std::string& nick, Xmpp::body&& message, const std::string& jid_to, const bool self);
/**
* Indicate that a participant changed his nick
*/