From bfcd0faef69fbf3f566581be60947108916c5dfa Mon Sep 17 00:00:00 2001 From: sha512sum Date: Fri, 15 Nov 2024 13:16:40 +0000 Subject: [PATCH] Fix --- main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) {