+13
-1
@@ -317,9 +317,21 @@ IrcChannel* IrcClient::get_channel(const std::string& n)
|
||||
}
|
||||
catch (const std::out_of_range& exception)
|
||||
{
|
||||
this->channels.emplace(name, std::make_unique<IrcChannel>());
|
||||
return this->channels.emplace(name, std::make_unique<IrcChannel>()).first->second.get();
|
||||
}
|
||||
}
|
||||
|
||||
const IrcChannel* IrcClient::find_channel(const std::string& n) const
|
||||
{
|
||||
const std::string name = utils::tolower(n);
|
||||
try
|
||||
{
|
||||
return this->channels.at(name).get();
|
||||
}
|
||||
catch (const std::out_of_range& exception)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool IrcClient::is_channel_joined(const std::string& name)
|
||||
|
||||
@@ -67,6 +67,10 @@ public:
|
||||
* Return the channel with this name, create it if it does not yet exist
|
||||
*/
|
||||
IrcChannel* get_channel(const std::string& name);
|
||||
/**
|
||||
* Return the channel with this name. Nullptr if it is not found
|
||||
*/
|
||||
const IrcChannel* find_channel(const std::string& name) const;
|
||||
/**
|
||||
* Returns true if the channel is joined
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user