unify with snowcone

This commit is contained in:
2025-02-05 09:24:47 -08:00
parent 5f2439e5af
commit 2b4bb1f071
20 changed files with 589 additions and 483 deletions

View File

@@ -61,8 +61,8 @@ static auto start_irc(
// Configure CHALLENGE on registration if applicable
if (not settings.challenge_username.empty() && not settings.challenge_key_file.empty()) {
if (auto key = myirc::key_from_file(settings.challenge_key_file, settings.challenge_key_password)) {
client->sig_registered.connect([&settings, connection, key = std::move(key)]() {
Challenge::start(connection, settings.challenge_username, key);
client->sig_registered.connect([&settings, client, key = std::move(key)]() {
Challenge::start(client, settings.challenge_username, key);
});
}
}
@@ -74,7 +74,7 @@ static auto start_irc(
// On disconnect reconnect in 5 seconds
// connection is captured in the disconnect handler so it can keep itself alive
connection->sig_disconnect.connect(
[&io, &settings, connection, webhook]() {
[&io, &settings, connection, webhook](auto) {
webhook->clear_client();
auto timer = std::make_shared<boost::asio::steady_timer>(io);
timer->expires_after(5s);

View File

@@ -64,7 +64,7 @@ auto compute_signature(const std::string_view secret, const std::string_view bod
unsigned int digest_length = EVP_MAX_MD_SIZE;
unsigned char digest[EVP_MAX_MD_SIZE];
HMAC(EVP_sha256(), secret.data(), secret.size(), reinterpret_cast<const unsigned char *>(body.data()), body.size(), digest, &digest_length);
HMAC(EVP_sha256(), secret.data(), static_cast<int>(secret.size()), reinterpret_cast<const unsigned char *>(body.data()), body.size(), digest, &digest_length);
std::stringstream ss;
ss << "sha256=";
@@ -415,7 +415,7 @@ auto Webhooks::send_notice(std::string_view target, std::string message) -> void
{
if (client_)
{
client_->get_connection().send_notice(target, message);
client_->send_notice(target, message);
}
else
{
@@ -428,7 +428,7 @@ auto Webhooks::set_client(std::shared_ptr<myirc::Client> client) -> void
client_ = std::move(client);
for (auto &&[target, message] : std::move(events_))
{
client_->get_connection().send_notice(target, message);
client_->send_notice(target, message);
}
events_.clear();
}