Only save the messages into the db if we are actually using a db
This commit is contained in:
@@ -225,10 +225,11 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body)
|
|||||||
else
|
else
|
||||||
irc->send_channel_message(iid.get_local(), line);
|
irc->send_channel_message(iid.get_local(), line);
|
||||||
|
|
||||||
|
#ifdef USE_DATABASE
|
||||||
const auto xmpp_body = this->make_xmpp_body(line);
|
const auto xmpp_body = this->make_xmpp_body(line);
|
||||||
Database::store_muc_message(this->get_bare_jid(), iid, std::chrono::system_clock::now(),
|
Database::store_muc_message(this->get_bare_jid(), iid, std::chrono::system_clock::now(),
|
||||||
std::get<0>(xmpp_body), irc->get_own_nick());
|
std::get<0>(xmpp_body), irc->get_own_nick());
|
||||||
|
#endif
|
||||||
for (const auto& resource: this->resources_in_chan[iid.to_tuple()])
|
for (const auto& resource: this->resources_in_chan[iid.to_tuple()])
|
||||||
this->xmpp.send_muc_message(std::to_string(iid), irc->get_own_nick(),
|
this->xmpp.send_muc_message(std::to_string(iid), irc->get_own_nick(),
|
||||||
this->make_xmpp_body(line), this->user_jid + "/" + resource);
|
this->make_xmpp_body(line), this->user_jid + "/" + resource);
|
||||||
@@ -583,10 +584,11 @@ void Bridge::send_message(const Iid& iid, const std::string& nick, const std::st
|
|||||||
const auto encoding = in_encoding_for(*this, iid);
|
const auto encoding = in_encoding_for(*this, iid);
|
||||||
if (muc)
|
if (muc)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_DATABASE
|
||||||
const auto xmpp_body = this->make_xmpp_body(body, encoding);
|
const auto xmpp_body = this->make_xmpp_body(body, encoding);
|
||||||
Database::store_muc_message(this->get_bare_jid(), iid, std::chrono::system_clock::now(),
|
Database::store_muc_message(this->get_bare_jid(), iid, std::chrono::system_clock::now(),
|
||||||
std::get<0>(xmpp_body), nick);
|
std::get<0>(xmpp_body), nick);
|
||||||
|
#endif
|
||||||
for (const auto& resource: this->resources_in_chan[iid.to_tuple()])
|
for (const auto& resource: this->resources_in_chan[iid.to_tuple()])
|
||||||
{
|
{
|
||||||
this->xmpp.send_muc_message(std::to_string(iid), nick,
|
this->xmpp.send_muc_message(std::to_string(iid), nick,
|
||||||
|
|||||||
Reference in New Issue
Block a user