make a myirc namespace
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
struct Bot : std::enable_shared_from_this<Bot>
|
||||
{
|
||||
struct Command
|
||||
@@ -34,3 +36,5 @@ struct Bot : std::enable_shared_from_this<Bot>
|
||||
|
||||
auto shutdown() -> void;
|
||||
};
|
||||
|
||||
} // namespace myirc
|
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace myirc {
|
||||
|
||||
template <typename> struct CCallback_;
|
||||
template <typename F, typename R, typename... Ts>
|
||||
struct CCallback_<R (F::*) (Ts...) const>
|
||||
@@ -14,3 +16,5 @@ struct CCallback_<R (F::*) (Ts...) const>
|
||||
/// @tparam F Type of the closure
|
||||
template <typename F>
|
||||
using CCallback = CCallback_<decltype(&F::operator())>;
|
||||
|
||||
} // namespace myirc
|
@@ -8,6 +8,8 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
/// @brief Implements the CHALLENGE command protocol to identify as an operator.
|
||||
class Challenge : std::enable_shared_from_this<Challenge>
|
||||
{
|
||||
@@ -29,3 +31,5 @@ public:
|
||||
/// @return Handle to the challenge object.
|
||||
static auto start(std::shared_ptr<Connection>, std::string_view user, Ref<EVP_PKEY> key) -> std::shared_ptr<Challenge>;
|
||||
};
|
||||
|
||||
} // namespace myirc
|
@@ -1,13 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "connection.hpp"
|
||||
#include "sasl_mechanism.hpp"
|
||||
#include "myirc/connection.hpp"
|
||||
#include "myirc/sasl_mechanism.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <span>
|
||||
|
||||
struct Connection;
|
||||
namespace myirc {
|
||||
|
||||
struct IrcMsg;
|
||||
|
||||
enum class Casemap
|
||||
@@ -101,3 +102,5 @@ public:
|
||||
|
||||
auto shutdown() -> void;
|
||||
};
|
||||
|
||||
} // namespace myirc
|
@@ -4,7 +4,6 @@
|
||||
#include "ircmsg.hpp"
|
||||
#include "ratelimit.hpp"
|
||||
#include "ref.hpp"
|
||||
#include "snote.hpp"
|
||||
#include "stream.hpp"
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
@@ -14,6 +13,10 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
struct SnoteMatch;
|
||||
|
||||
class Connection : public std::enable_shared_from_this<Connection>
|
||||
{
|
||||
public:
|
||||
@@ -136,3 +139,5 @@ auto Connection::write_irc(std::string front, std::string_view next, Args... res
|
||||
front += next;
|
||||
write_irc(std::move(front), rest...);
|
||||
}
|
||||
|
||||
} // namespace myirc
|
@@ -1,3 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace myirc {
|
||||
|
||||
enum class IrcCommand
|
||||
{
|
||||
UNKNOWN,
|
||||
@@ -280,3 +284,5 @@ enum class IrcCommand
|
||||
TOPIC,
|
||||
WALLOPS,
|
||||
};
|
||||
|
||||
} // namespace myirc
|
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "connection.hpp"
|
||||
#include "myirc/connection.hpp"
|
||||
#include "myirc/snote.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <coroutine>
|
||||
@@ -8,6 +9,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
struct irc_promise;
|
||||
|
||||
/// A coroutine that can co_await on various IRC events
|
||||
@@ -275,3 +278,5 @@ inline auto irc_coroutine::exception() -> std::exception_ptr
|
||||
{
|
||||
return promise().exception_;
|
||||
}
|
||||
|
||||
} // namespace myirc
|
@@ -4,6 +4,8 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
struct irctag
|
||||
{
|
||||
std::string_view key;
|
||||
@@ -72,3 +74,5 @@ struct irc_parse_error : public std::exception
|
||||
auto parse_irc_message(char *msg) -> IrcMsg;
|
||||
|
||||
auto parse_irc_tags(char *msg) -> std::vector<irctag>;
|
||||
|
||||
} // namespace myirc
|
@@ -16,6 +16,8 @@
|
||||
#include <concepts>
|
||||
#include <vector>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
/**
|
||||
* @brief Fixed-size buffer with line-oriented dispatch
|
||||
*
|
||||
@@ -99,3 +101,5 @@ public:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace myirc
|
@@ -4,6 +4,10 @@
|
||||
|
||||
#include <string_view>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
auto log_openssl_errors(const std::string_view prefix) -> void;
|
||||
auto key_from_file(const std::string &filename, const std::string_view password) -> Ref<EVP_PKEY>;
|
||||
auto cert_from_file(const std::string &filename) -> Ref<X509>;
|
||||
|
||||
} // namespace myirc
|
@@ -3,6 +3,8 @@
|
||||
#include <chrono>
|
||||
#include <utility>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
struct RateLimit {
|
||||
virtual ~RateLimit();
|
||||
auto virtual query(size_t want_to_send) -> std::pair<std::chrono::milliseconds, size_t> = 0;
|
||||
@@ -18,3 +20,5 @@ struct Rfc1459RateLimit final : RateLimit
|
||||
|
||||
auto query(size_t want_to_send) -> std::pair<std::chrono::milliseconds, size_t> override;
|
||||
};
|
||||
|
||||
} // namespace myirc
|
@@ -5,6 +5,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
// Specializations must Free to release a reference
|
||||
// Specializations can implement UpRef to increase a reference count on copy
|
||||
template <typename> struct RefTraits {};
|
||||
@@ -56,3 +58,5 @@ struct Ref : std::unique_ptr<T, RefDeleter<T>>
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace myirc
|
@@ -7,6 +7,8 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
class Registration : public std::enable_shared_from_this<Registration>
|
||||
{
|
||||
public:
|
||||
@@ -44,3 +46,5 @@ public:
|
||||
std::shared_ptr<Client>
|
||||
) -> std::shared_ptr<Registration>;
|
||||
};
|
||||
|
||||
} // namespace myirc
|
@@ -10,6 +10,8 @@
|
||||
#include <string_view>
|
||||
#include <variant>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
class SaslMechanism
|
||||
{
|
||||
public:
|
||||
@@ -108,3 +110,5 @@ public:
|
||||
return stage_ == 2;;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace myirc
|
@@ -12,6 +12,8 @@
|
||||
struct hs_database;
|
||||
struct hs_scratch;
|
||||
|
||||
namespace myirc {
|
||||
|
||||
enum class SnoteTag
|
||||
{
|
||||
ClientConnecting,
|
||||
@@ -95,3 +97,5 @@ struct SnoteCore
|
||||
};
|
||||
|
||||
extern SnoteCore snoteCore;
|
||||
|
||||
} // namespace myirc
|
@@ -6,6 +6,8 @@
|
||||
#include <cstddef>
|
||||
#include <variant>
|
||||
|
||||
namespace myirc {
|
||||
|
||||
/// @brief Abstraction over plain-text and TLS streams.
|
||||
class Stream : private
|
||||
std::variant<
|
||||
@@ -112,3 +114,5 @@ public:
|
||||
socket.lowest_layer().close(err);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace myirc
|
Reference in New Issue
Block a user