diff --git a/main.cpp b/main.cpp index e0f6180..0e1e05f 100644 --- a/main.cpp +++ b/main.cpp @@ -134,6 +134,11 @@ auto SendHeader(auto& sock, larra::xmpp::ServerStream stream) -> boost::cobalt:: co_await boost::asio::async_write(sock, boost::asio::buffer(data), boost::cobalt::use_op); } +constexpr auto GetAddress(std::string_view addr) { + auto pos = addr.find(".xmpp"); + return pos != std::string_view::npos ? addr.substr(pos + 1) : addr; +}; + // NOLINTNEXTLINE auto Process(auto socket, auto transform, const Options& options) -> boost::cobalt::detached { try { @@ -141,7 +146,7 @@ auto Process(auto socket, auto transform, const Options& options) -> boost::coba larra::xmpp::ServerStream header = (co_await Cobaltify(stream.ReadOne()), co_await Cobaltify(stream.template ReadOne())); - std::string_view address = header.to.value(); + std::string_view address = GetAddress(header.to.value()); auto domain = Domain::Parse(address); spdlog::debug("Got domain address {}. Tld: {}", address, domain.tld); for(const auto& [tld, proxy] : options.data) {