Revert "Replace a useless shared_ptr by a unique_ptr"
This reverts commit 248e25c22f.
In preparation for the botan 3 update `IrcClient` must be made into a
`shared_ptr`, which will then allow us to pass a `shared_ptr` of
callbacks to `Botan::TLS::Client`
This commit is contained in:
@@ -63,7 +63,7 @@ void Bridge::shutdown(const std::string& exit_message)
|
||||
{
|
||||
for (auto& pair: this->irc_clients)
|
||||
{
|
||||
std::unique_ptr<IrcClient>& irc = pair.second;
|
||||
std::shared_ptr<IrcClient>& irc = pair.second;
|
||||
irc->send_quit_command(exit_message);
|
||||
}
|
||||
}
|
||||
@@ -134,11 +134,11 @@ IrcClient* Bridge::make_irc_client(const std::string& hostname, const std::strin
|
||||
realname = this->get_bare_jid();
|
||||
}
|
||||
this->irc_clients.emplace(hostname,
|
||||
std::make_unique<IrcClient>(this->poller, hostname,
|
||||
std::make_shared<IrcClient>(this->poller, hostname,
|
||||
nickname, username,
|
||||
realname, jid.domain,
|
||||
*this));
|
||||
std::unique_ptr<IrcClient>& irc = this->irc_clients.at(hostname);
|
||||
std::shared_ptr<IrcClient> irc = this->irc_clients.at(hostname);
|
||||
return irc.get();
|
||||
}
|
||||
}
|
||||
@@ -1146,12 +1146,12 @@ void Bridge::trigger_on_irc_message(const std::string& irc_hostname, const IrcMe
|
||||
}
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, std::unique_ptr<IrcClient>>& Bridge::get_irc_clients()
|
||||
std::unordered_map<std::string, std::shared_ptr<IrcClient>>& Bridge::get_irc_clients()
|
||||
{
|
||||
return this->irc_clients;
|
||||
}
|
||||
|
||||
const std::unordered_map<std::string, std::unique_ptr<IrcClient>>& Bridge::get_irc_clients() const
|
||||
const std::unordered_map<std::string, std::shared_ptr<IrcClient>>& Bridge::get_irc_clients() const
|
||||
{
|
||||
return this->irc_clients;
|
||||
}
|
||||
|
||||
@@ -226,8 +226,8 @@ public:
|
||||
* iq_responder_callback_t and remove the callback from the list.
|
||||
*/
|
||||
void trigger_on_irc_message(const std::string& irc_hostname, const IrcMessage& message);
|
||||
std::unordered_map<std::string, std::unique_ptr<IrcClient>>& get_irc_clients();
|
||||
const std::unordered_map<std::string, std::unique_ptr<IrcClient>>& get_irc_clients() const;
|
||||
std::unordered_map<std::string, std::shared_ptr<IrcClient>>& get_irc_clients();
|
||||
const std::unordered_map<std::string, std::shared_ptr<IrcClient>>& get_irc_clients() const;
|
||||
std::set<char> get_chantypes(const std::string& hostname) const;
|
||||
#ifdef USE_DATABASE
|
||||
void set_record_history(const bool val);
|
||||
@@ -260,7 +260,7 @@ private:
|
||||
* One IrcClient for each IRC server we need to be connected to.
|
||||
* The pointer is shared by the bridge and the poller.
|
||||
*/
|
||||
std::unordered_map<std::string, std::unique_ptr<IrcClient>> irc_clients;
|
||||
std::unordered_map<std::string, std::shared_ptr<IrcClient>> irc_clients;
|
||||
/**
|
||||
* To communicate back with the XMPP component
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user