|
|
|
@ -21,7 +21,9 @@ |
|
|
|
|
|
|
|
|
|
IRCBase::IRCBase() |
|
|
|
|
: mp(new IRCBasePriv(*this)) |
|
|
|
|
{} |
|
|
|
|
{ |
|
|
|
|
std::copy(V3Support.begin(), V3Support.end(), std::back_inserter(mp->ircv3enabled)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IRCBase::IRCBase(IRCBase&& other) noexcept |
|
|
|
|
: mp(std::move(other.mp)) |
|
|
|
@ -369,6 +371,11 @@ const std::vector<std::string>& IRCBase::clientV3Support() |
|
|
|
|
return V3Support; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const std::vector<std::string>& IRCBase::enabledV3Support() const |
|
|
|
|
{ |
|
|
|
|
return mp->ircv3enabled; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const std::vector<std::string>& IRCBase::registeredV3Support() const |
|
|
|
|
{ |
|
|
|
|
return mp->registeredV3support; |
|
|
|
@ -419,3 +426,31 @@ const IRCMessage* IRCBase::getCurrentMessageRaw() const |
|
|
|
|
{ |
|
|
|
|
return mp->currentMessage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void IRCBase::enableIRCv3Features(const std::vector<std::string>& features) |
|
|
|
|
{ |
|
|
|
|
auto isFeatureSupported = [](const std::string& feature) { |
|
|
|
|
return std::find(V3Support.begin(), V3Support.end(), feature) == V3Support.end(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
auto isFeatureEnabled = [this](const std::string& feature) { |
|
|
|
|
return std::find(mp->ircv3enabled.begin(), mp->ircv3enabled.end(), feature) != mp->ircv3enabled.end(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
for (const auto& feature : features) { |
|
|
|
|
if (!isFeatureSupported(feature) || isFeatureEnabled(feature)) |
|
|
|
|
continue; |
|
|
|
|
else |
|
|
|
|
mp->ircv3enabled.emplace_back(feature); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void IRCBase::disableIRCv3Features(const std::vector<std::string>& features) |
|
|
|
|
{ |
|
|
|
|
for (const auto& feature : features) { |
|
|
|
|
auto it = std::find(mp->ircv3enabled.begin(), mp->ircv3enabled.end(), feature); |
|
|
|
|
if (it != mp->ircv3enabled.end()) { |
|
|
|
|
mp->ircv3enabled.erase(it); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|