Remove two sneaky log_debug

This commit is contained in:
louiz’
2017-03-29 23:32:43 +02:00
parent 52b795d119
commit 1a09c965eb
22 changed files with 63 additions and 66 deletions
+17 -16
View File
@@ -1,4 +1,5 @@
#include <bridge/bridge.hpp> #include <bridge/bridge.hpp>
#include <utility>
#include <xmpp/biboumi_component.hpp> #include <xmpp/biboumi_component.hpp>
#include <network/poller.hpp> #include <network/poller.hpp>
#include <utils/empty_if_fixed_server.hpp> #include <utils/empty_if_fixed_server.hpp>
@@ -29,8 +30,8 @@ static std::string in_encoding_for(const Bridge& bridge, const Iid& iid)
#endif #endif
} }
Bridge::Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller>& poller): Bridge::Bridge(std::string user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller>& poller):
user_jid(user_jid), user_jid(std::move(user_jid)),
xmpp(xmpp), xmpp(xmpp),
poller(poller) poller(poller)
{ {
@@ -59,10 +60,10 @@ static std::tuple<std::string, std::string> get_role_affiliation_from_irc_mode(c
void Bridge::shutdown(const std::string& exit_message) void Bridge::shutdown(const std::string& exit_message)
{ {
for (auto it = this->irc_clients.begin(); it != this->irc_clients.end(); ++it) for (auto& pair: this->irc_clients)
{ {
it->second->send_quit_command(exit_message); pair.second->send_quit_command(exit_message);
it->second->leave_dummy_channel(exit_message, {}); pair.second->leave_dummy_channel(exit_message, {});
} }
} }
@@ -168,7 +169,7 @@ IrcClient* Bridge::find_irc_client(const std::string& hostname) const
bool Bridge::join_irc_channel(const Iid& iid, const std::string& nickname, const std::string& password, bool Bridge::join_irc_channel(const Iid& iid, const std::string& nickname, const std::string& password,
const std::string& resource) const std::string& resource)
{ {
const auto hostname = iid.get_server(); const auto& hostname = iid.get_server();
this->cancel_linger_timer(hostname); this->cancel_linger_timer(hostname);
IrcClient* irc = this->make_irc_client(hostname, nickname); IrcClient* irc = this->make_irc_client(hostname, nickname);
this->add_resource_to_server(hostname, resource); this->add_resource_to_server(hostname, resource);
@@ -439,7 +440,7 @@ void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, con
#endif #endif
if (channel->joined && !channel->parting && !persistent) if (channel->joined && !channel->parting && !persistent)
{ {
const auto chan_name = iid.get_local(); const auto& chan_name = iid.get_local();
if (chan_name.empty()) if (chan_name.empty())
irc->leave_dummy_channel(status_message, resource); irc->leave_dummy_channel(status_message, resource);
else else
@@ -447,7 +448,7 @@ void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, con
} }
else else
{ {
this->send_muc_leave(std::move(iid), std::move(nick), "", true, resource); this->send_muc_leave(iid, std::move(nick), "", true, resource);
} }
// Since there are no resources left in that channel, we don't // Since there are no resources left in that channel, we don't
// want to receive private messages using this room's JID // want to receive private messages using this room's JID
@@ -456,7 +457,7 @@ void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, con
else else
{ {
if (channel) if (channel)
this->send_muc_leave(std::move(iid), std::move(nick), this->send_muc_leave(iid, std::move(nick),
"Biboumi note: "s + std::to_string(resources - 1) + " resources are still in this channel.", "Biboumi note: "s + std::to_string(resources - 1) + " resources are still in this channel.",
true, resource); true, resource);
this->remove_resource_from_chan(key, resource); this->remove_resource_from_chan(key, resource);
@@ -870,16 +871,16 @@ void Bridge::send_presence_error(const Iid& iid, const std::string& nick,
this->xmpp.send_presence_error(std::to_string(iid), nick, this->user_jid, type, condition, error_code, text); this->xmpp.send_presence_error(std::to_string(iid), nick, this->user_jid, type, condition, error_code, text);
} }
void Bridge::send_muc_leave(Iid&& iid, std::string&& nick, const std::string& message, const bool self, void Bridge::send_muc_leave(const Iid &iid, std::string&& nick, const std::string& message, const bool self,
const std::string& resource) const std::string& resource)
{ {
if (!resource.empty()) if (!resource.empty())
this->xmpp.send_muc_leave(std::to_string(iid), std::move(nick), this->make_xmpp_body(message), this->xmpp.send_muc_leave(std::to_string(iid), nick, this->make_xmpp_body(message),
this->user_jid + "/" + resource, self); this->user_jid + "/" + resource, self);
else else
{ {
for (const auto &res: this->resources_in_chan[iid.to_tuple()]) for (const auto &res: this->resources_in_chan[iid.to_tuple()])
this->xmpp.send_muc_leave(std::to_string(iid), std::move(nick), this->make_xmpp_body(message), this->xmpp.send_muc_leave(std::to_string(iid), nick, this->make_xmpp_body(message),
this->user_jid + "/" + res, self); this->user_jid + "/" + res, self);
if (self) if (self)
this->remove_all_resources_from_chan(iid.to_tuple()); this->remove_all_resources_from_chan(iid.to_tuple());
@@ -1157,9 +1158,9 @@ bool Bridge::is_resource_in_chan(const Bridge::ChannelKey& channel, const std::s
return false; return false;
} }
void Bridge::remove_all_resources_from_chan(const Bridge::ChannelKey& channel_key) void Bridge::remove_all_resources_from_chan(const Bridge::ChannelKey& channel)
{ {
this->resources_in_chan.erase(channel_key); this->resources_in_chan.erase(channel);
} }
void Bridge::add_resource_to_server(const Bridge::IrcHostname& irc_hostname, const std::string& resource) void Bridge::add_resource_to_server(const Bridge::IrcHostname& irc_hostname, const std::string& resource)
@@ -1191,9 +1192,9 @@ bool Bridge::is_resource_in_server(const Bridge::IrcHostname& irc_hostname, cons
return false; return false;
} }
std::size_t Bridge::number_of_resources_in_chan(const Bridge::ChannelKey& channel_key) const std::size_t Bridge::number_of_resources_in_chan(const Bridge::ChannelKey& channel) const
{ {
auto it = this->resources_in_chan.find(channel_key); auto it = this->resources_in_chan.find(channel);
if (it == this->resources_in_chan.end()) if (it == this->resources_in_chan.end())
return 0; return 0;
return it->second.size(); return it->second.size();
+7 -7
View File
@@ -38,7 +38,7 @@ using irc_responder_callback_t = std::function<bool(const std::string& irc_hostn
class Bridge class Bridge
{ {
public: public:
explicit Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller>& poller); explicit Bridge(std::string user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller>& poller);
~Bridge() = default; ~Bridge() = default;
Bridge(const Bridge&) = delete; Bridge(const Bridge&) = delete;
@@ -169,7 +169,7 @@ public:
/** /**
* Send an unavailable presence from this participant * Send an unavailable presence from this participant
*/ */
void send_muc_leave(Iid&& iid, std::string&& nick, const std::string& message, const bool self, const std::string& resource=""); void send_muc_leave(const Iid& iid, std::string&& nick, const std::string& message, const bool self, const std::string& resource = "");
/** /**
* Send presences to indicate that an user old_nick (ourself if self == * Send presences to indicate that an user old_nick (ourself if self ==
* true) changed his nick to new_nick. The user_mode is needed because * true) changed his nick to new_nick. The user_mode is needed because
@@ -309,11 +309,11 @@ private:
/** /**
* Manage which resource is in which channel * Manage which resource is in which channel
*/ */
void add_resource_to_chan(const ChannelKey& channel_key, const std::string& resource); void add_resource_to_chan(const ChannelKey& channel, const std::string& resource);
void remove_resource_from_chan(const ChannelKey& channel_key, const std::string& resource); void remove_resource_from_chan(const ChannelKey& channel, const std::string& resource);
bool is_resource_in_chan(const ChannelKey& channel_key, const std::string& resource) const; bool is_resource_in_chan(const ChannelKey& channel, const std::string& resource) const;
void remove_all_resources_from_chan(const ChannelKey& channel_key); void remove_all_resources_from_chan(const ChannelKey& channel);
std::size_t number_of_resources_in_chan(const ChannelKey& channel_key) const; std::size_t number_of_resources_in_chan(const ChannelKey& channel) const;
void add_resource_to_server(const IrcHostname& irc_hostname, const std::string& resource); void add_resource_to_server(const IrcHostname& irc_hostname, const std::string& resource);
void remove_resource_from_server(const IrcHostname& irc_hostname, const std::string& resource); void remove_resource_from_server(const IrcHostname& irc_hostname, const std::string& resource);
+1 -1
View File
@@ -51,6 +51,6 @@ static const char irc_format_char[] = {
* Returns the body cleaned from any IRC formatting (but without any xhtml), * Returns the body cleaned from any IRC formatting (but without any xhtml),
* and the body as XHTML-IM * and the body as XHTML-IM
*/ */
Xmpp::body irc_format_to_xhtmlim(const std::string& str); Xmpp::body irc_format_to_xhtmlim(const std::string& s);
+1 -1
View File
@@ -37,7 +37,7 @@ void Config::set(const std::string& option, const std::string& value, bool save)
} }
} }
void Config::connect(t_config_changed_callback callback) void Config::connect(const t_config_changed_callback& callback)
{ {
Config::callbacks.push_back(callback); Config::callbacks.push_back(callback);
} }
+1 -1
View File
@@ -54,7 +54,7 @@ public:
* configuration change occurs (when set() is called, or when the initial * configuration change occurs (when set() is called, or when the initial
* conf is read) * conf is read)
*/ */
static void connect(t_config_changed_callback); static void connect(const t_config_changed_callback&);
/** /**
* Destroy the instance, forcing it to be recreated (with potentially * Destroy the instance, forcing it to be recreated (with potentially
* different parameters) the next time it’s needed. * different parameters) the next time it’s needed.
+1 -1
View File
@@ -20,7 +20,7 @@ void Database::open(const std::string& filename, const std::string& db_type)
"database="s + filename); "database="s + filename);
if (new_db->needsUpgrade()) if (new_db->needsUpgrade())
new_db->upgrade(); new_db->upgrade();
Database::db.reset(new_db.release()); Database::db = std::move(new_db);
} catch (const litesql::DatabaseError& e) { } catch (const litesql::DatabaseError& e) {
log_error("Failed to open database ", filename, ". ", e.what()); log_error("Failed to open database ", filename, ". ", e.what());
throw; throw;
+1 -1
View File
@@ -49,7 +49,7 @@ public:
const std::string& server, const std::string& server,
const std::string& channel); const std::string& channel);
static std::vector<db::MucLogLine> get_muc_logs(const std::string& owner, const std::string& chan_name, const std::string& server, static std::vector<db::MucLogLine> get_muc_logs(const std::string& owner, const std::string& chan_name, const std::string& server,
int limit=-1, const std::string& before="", const std::string& after=""); int limit=-1, const std::string& start="", const std::string& end="");
static void store_muc_message(const std::string& owner, const Iid& iid, static void store_muc_message(const std::string& owner, const Iid& iid,
time_point date, const std::string& body, const std::string& nick); time_point date, const std::string& body, const std::string& nick);
+3 -3
View File
@@ -888,7 +888,7 @@ void IrcClient::on_part(const IrcMessage& message)
// channel pointer is now invalid // channel pointer is now invalid
channel = nullptr; channel = nullptr;
} }
this->bridge.send_muc_leave(std::move(iid), std::move(nick), std::move(txt), self); this->bridge.send_muc_leave(iid, std::move(nick), std::move(txt), self);
} }
} }
@@ -906,7 +906,7 @@ void IrcClient::on_error(const IrcMessage& message)
if (!channel->joined) if (!channel->joined)
continue; continue;
std::string own_nick = channel->get_self()->nick; std::string own_nick = channel->get_self()->nick;
this->bridge.send_muc_leave(std::move(iid), std::move(own_nick), leave_message, true); this->bridge.send_muc_leave(iid, std::move(own_nick), leave_message, true);
} }
this->channels.clear(); this->channels.clear();
this->send_gateway_message("ERROR: "s + leave_message); this->send_gateway_message("ERROR: "s + leave_message);
@@ -930,7 +930,7 @@ void IrcClient::on_quit(const IrcMessage& message)
iid.set_local(chan_name); iid.set_local(chan_name);
iid.set_server(this->hostname); iid.set_server(this->hostname);
iid.type = Iid::Type::Channel; iid.type = Iid::Type::Channel;
this->bridge.send_muc_leave(std::move(iid), std::move(nick), txt, false); this->bridge.send_muc_leave(iid, std::move(nick), txt, false);
} }
} }
} }
+1 -1
View File
@@ -52,7 +52,7 @@ public:
/** /**
* Close the connection, remove us from the poller * Close the connection, remove us from the poller
*/ */
void on_connection_close(const std::string& error) override final; void on_connection_close(const std::string& error_msg) override final;
/** /**
* Parse the data we have received so far and try to get one or more * Parse the data we have received so far and try to get one or more
* complete messages from it. * complete messages from it.
+3 -3
View File
@@ -8,12 +8,12 @@ IrcMessage::IrcMessage(std::string&& line)
// optional prefix // optional prefix
if (line[0] == ':') if (line[0] == ':')
{ {
pos = line.find(" "); pos = line.find(' ');
this->prefix = line.substr(1, pos - 1); this->prefix = line.substr(1, pos - 1);
line = line.substr(pos + 1, std::string::npos); line = line.substr(pos + 1, std::string::npos);
} }
// command // command
pos = line.find(" "); pos = line.find(' ');
this->command = line.substr(0, pos); this->command = line.substr(0, pos);
line = line.substr(pos + 1, std::string::npos); line = line.substr(pos + 1, std::string::npos);
// arguments // arguments
@@ -24,7 +24,7 @@ IrcMessage::IrcMessage(std::string&& line)
this->arguments.emplace_back(line.substr(1, std::string::npos)); this->arguments.emplace_back(line.substr(1, std::string::npos));
break ; break ;
} }
pos = line.find(" "); pos = line.find(' ');
this->arguments.emplace_back(line.substr(0, pos)); this->arguments.emplace_back(line.substr(0, pos));
line = line.substr(pos + 1, std::string::npos); line = line.substr(pos + 1, std::string::npos);
} while (pos != std::string::npos); } while (pos != std::string::npos);
+1 -1
View File
@@ -21,7 +21,7 @@ IrcUser::IrcUser(const std::string& name,
name_begin++; name_begin++;
} }
const std::string::size_type sep = name.find("!", name_begin); const std::string::size_type sep = name.find('!', name_begin);
if (sep == std::string::npos) if (sep == std::string::npos)
this->nick = name.substr(name_begin); this->nick = name.substr(name_begin);
else else
+1 -1
View File
@@ -23,7 +23,7 @@ public:
void add_mode(const char mode); void add_mode(const char mode);
void remove_mode(const char mode); void remove_mode(const char mode);
char get_most_significant_mode(const std::vector<char>& sorted_user_modes) const; char get_most_significant_mode(const std::vector<char>& modes) const;
std::string nick; std::string nick;
std::string host; std::string host;
+6 -7
View File
@@ -1,7 +1,7 @@
#include <network/dns_handler.hpp> #include <network/dns_handler.hpp>
#include <utils/timed_events.hpp> #include <utils/timed_events.hpp>
#include <network/resolver.hpp> #include <network/resolver.hpp>
#include <string.h> #include <cstring>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netinet/in.h> #include <netinet/in.h>
#ifdef UDNS_FOUND #ifdef UDNS_FOUND
@@ -41,8 +41,8 @@ Resolver::Resolver():
void Resolver::resolve(const std::string& hostname, const std::string& port, void Resolver::resolve(const std::string& hostname, const std::string& port,
SuccessCallbackType success_cb, ErrorCallbackType error_cb) SuccessCallbackType success_cb, ErrorCallbackType error_cb)
{ {
this->error_cb = error_cb; this->error_cb = std::move(error_cb);
this->success_cb = success_cb; this->success_cb = std::move(success_cb);
#ifdef UDNS_FOUND #ifdef UDNS_FOUND
this->port = port; this->port = port;
#endif #endif
@@ -52,8 +52,7 @@ void Resolver::resolve(const std::string& hostname, const std::string& port,
int Resolver::call_getaddrinfo(const char *name, const char* port, int flags) int Resolver::call_getaddrinfo(const char *name, const char* port, int flags)
{ {
struct addrinfo hints; struct addrinfo hints{};
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_flags = flags; hints.ai_flags = flags;
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
@@ -111,7 +110,7 @@ void Resolver::start_resolving(const std::string& hostname, const std::string& p
// And finally, we try a DNS resolution // And finally, we try a DNS resolution
auto hostname6_resolved = [](dns_ctx*, dns_rr_a6* result, void* data) auto hostname6_resolved = [](dns_ctx*, dns_rr_a6* result, void* data)
{ {
Resolver* resolver = static_cast<Resolver*>(data); auto resolver = static_cast<Resolver*>(data);
resolver->on_hostname6_resolved(result); resolver->on_hostname6_resolved(result);
resolver->after_resolved(); resolver->after_resolved();
std::free(result); std::free(result);
@@ -119,7 +118,7 @@ void Resolver::start_resolving(const std::string& hostname, const std::string& p
auto hostname4_resolved = [](dns_ctx*, dns_rr_a4* result, void* data) auto hostname4_resolved = [](dns_ctx*, dns_rr_a4* result, void* data)
{ {
Resolver* resolver = static_cast<Resolver*>(data); auto resolver = static_cast<Resolver*>(data);
resolver->on_hostname4_resolved(result); resolver->on_hostname4_resolved(result);
resolver->after_resolved(); resolver->after_resolved();
std::free(result); std::free(result);
+1 -1
View File
@@ -28,7 +28,7 @@ namespace utils
* Convert the given string (encoded is "encoding") into valid utf-8. * Convert the given string (encoded is "encoding") into valid utf-8.
* If some decoding fails, insert an utf-8 placeholder character instead. * If some decoding fails, insert an utf-8 placeholder character instead.
*/ */
std::string convert_to_utf8(const std::string& str, const char* encoding); std::string convert_to_utf8(const std::string& str, const char* charset);
} }
namespace xep0106 namespace xep0106
+1 -1
View File
@@ -1,5 +1,5 @@
#include <utils/time.hpp> #include <utils/time.hpp>
#include <time.h> #include <ctime>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
+1 -1
View File
@@ -17,7 +17,7 @@ class AdhocCommand
{ {
friend class AdhocSession; friend class AdhocSession;
public: 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() = default;
AdhocCommand(const AdhocCommand&) = default; AdhocCommand(const AdhocCommand&) = default;
AdhocCommand(AdhocCommand&&) = default; AdhocCommand(AdhocCommand&&) = default;
+1 -1
View File
@@ -1,7 +1,7 @@
#include <xmpp/adhoc_session.hpp> #include <xmpp/adhoc_session.hpp>
#include <xmpp/adhoc_command.hpp> #include <xmpp/adhoc_command.hpp>
#include <assert.h> #include <cassert>
AdhocSession::AdhocSession(const AdhocCommand& command, const std::string& owner_jid, AdhocSession::AdhocSession(const AdhocCommand& command, const std::string& owner_jid,
const std::string& to_jid): const std::string& to_jid):
+7 -7
View File
@@ -24,7 +24,7 @@ using namespace std::string_literals;
void DisconnectUserStep1(XmppComponent& xmpp_component, AdhocSession&, XmlNode& command_node) 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"); XmlSubNode x(command_node, "jabber:x:data:x");
x["type"] = "form"; x["type"] = "form";
@@ -55,7 +55,7 @@ void DisconnectUserStep1(XmppComponent& xmpp_component, AdhocSession&, XmlNode&
void DisconnectUserStep2(XmppComponent& xmpp_component, AdhocSession& session, XmlNode& command_node) 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. // Find out if the jids, and the quit message are provided in the form.
std::string quit_message; 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) 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"); const XmlNode* x = command_node.get_child("x", "jabber:x:data");
if (x) if (x)
@@ -533,7 +533,7 @@ void DisconnectUserFromServerStep1(XmppComponent& xmpp_component, AdhocSession&
} }
else else
{ // Send a form to select the user to disconnect { // 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"); XmlSubNode x(command_node, "jabber:x:data:x");
x["type"] = "form"; 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 // Send a data form to let the user choose which server to disconnect the
// user from // user from
command_node.delete_all_children(); 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"); XmlSubNode x(command_node, "jabber:x:data:x");
x["type"] = "form"; 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); Bridge* bridge = biboumi_component.find_user_bridge(jid_to_disconnect);
auto& clients = bridge->get_irc_clients(); 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) 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 owner(session.get_owner_jid());
const Jid target(session.get_target_jid()); const Jid target(session.get_target_jid());
-2
View File
@@ -422,7 +422,6 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
} }
else if (iid.type == Iid::Type::Channel) else if (iid.type == Iid::Type::Channel)
{ {
log_debug("type_channel");
if (node.empty()) if (node.empty())
{ {
this->send_irc_channel_disco_info(id, from, to_str); 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) 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); Jid from(jid_from);
Iid iid(from.local, {}); Iid iid(from.local, {});
Stanza iq("iq"); Stanza iq("iq");
+1 -2
View File
@@ -68,8 +68,7 @@ std::string jidprep(const std::string& original)
// Using getaddrinfo, check if the domain part is a valid IPv4 (then use // 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 // it as is), or IPv6 (surround it with []), or a domain name (run
// nameprep) // nameprep)
struct addrinfo hints; struct addrinfo hints{};
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST; hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;
+4 -4
View File
@@ -39,14 +39,14 @@ static std::set<std::string> kickable_errors{
"malformed-error" "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), TCPClientSocketHandler(poller),
ever_auth(false), ever_auth(false),
first_connection_try(true), first_connection_try(true),
secret(secret), secret(std::move(secret)),
authenticated(false), authenticated(false),
doc_open(false), doc_open(false),
served_hostname(hostname), served_hostname(std::move(hostname)),
stanza_handlers{}, stanza_handlers{},
adhoc_commands_handler(*this) adhoc_commands_handler(*this)
{ {
@@ -429,7 +429,7 @@ void XmppComponent::send_history_message(const std::string& muc_name, const std:
this->send_stanza(message); 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"); Stanza presence("presence");
{ {
+3 -3
View File
@@ -43,7 +43,7 @@
class XmppComponent: public TCPClientSocketHandler class XmppComponent: public TCPClientSocketHandler
{ {
public: 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; virtual ~XmppComponent() = default;
XmppComponent(const XmppComponent&) = delete; XmppComponent(const XmppComponent&) = delete;
@@ -91,7 +91,7 @@ public:
* stanza, and explanation being a short human-readable sentence * stanza, and explanation being a short human-readable sentence
* describing the error. * 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 * 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 * 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 * Indicate that a participant changed his nick
*/ */