40 lines
1.5 KiB
C++
40 lines
1.5 KiB
C++
#pragma once
|
|
#include <larra/proxy.hpp>
|
|
#include <larra/utils.hpp>
|
|
|
|
namespace larra::xmpp::client {
|
|
|
|
struct Options {
|
|
enum UseTls { kNever, kWhenAvailable, kRequire };
|
|
UseTls useTls = kWhenAvailable;
|
|
bool allowPlainWithoutTls = false;
|
|
std::optional<std::string> hostname = std::nullopt;
|
|
std::optional<std::uint16_t> port = std::nullopt;
|
|
Proxy proxy = SystemConfiguredProxy{};
|
|
|
|
template <typename Self>
|
|
constexpr auto UseTls(this Self&& self, UseTls value) -> Options {
|
|
return utils::FieldSetHelper::With<"useTls", Options>(std::forward<Self>(self), std::move(value));
|
|
}
|
|
template <typename Self>
|
|
constexpr auto AllowPlainWithoutTls(this Self&& self, bool value) -> Options {
|
|
return utils::FieldSetHelper::With<"allowPlainWithoutTls", Options>(std::forward<Self>(self), std::move(value));
|
|
}
|
|
|
|
template <typename Self>
|
|
constexpr auto Hostname(this Self&& self, std::optional<std::string> value) -> Options {
|
|
return utils::FieldSetHelper::With<"hostname", Options>(std::forward<Self>(self), std::move(value));
|
|
}
|
|
|
|
template <typename Self>
|
|
constexpr auto Port(this Self&& self, std::optional<std::uint16_t> value) -> Options {
|
|
return utils::FieldSetHelper::With<"port", Options>(std::forward<Self>(self), std::move(value));
|
|
}
|
|
|
|
template <typename Self>
|
|
constexpr auto Proxy(this Self&& self, Proxy value) -> Options {
|
|
return utils::FieldSetHelper::With<"proxy", Options>(std::forward<Self>(self), std::move(value));
|
|
}
|
|
};
|
|
|
|
} // namespace larra::xmpp::client
|