From 24f2511d7ba105d65c9684dd5606a57c5af95445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Thu, 20 Jul 2017 21:28:18 +0200 Subject: [PATCH] In fixed mode, fix the iid type of the component JID --- src/irc/iid.cpp | 3 ++- tests/iid.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/irc/iid.cpp b/src/irc/iid.cpp index a63a1c3..131c18c 100644 --- a/src/irc/iid.cpp +++ b/src/irc/iid.cpp @@ -35,7 +35,8 @@ Iid::Iid(const std::string& iid, const Bridge *bridge) void Iid::set_type(const std::set& chantypes) { - if (this->local.empty() && this->server.empty()) + if (this->local.empty() && ( + !Config::get("fixed_irc_server", "").empty() || this->server.empty())) this->type = Iid::Type::None; if (this->local.empty()) return; diff --git a/tests/iid.cpp b/tests/iid.cpp index 3da0396..63b2ba3 100644 --- a/tests/iid.cpp +++ b/tests/iid.cpp @@ -125,4 +125,10 @@ TEST_CASE("Iid creation in fixed_server mode") CHECK(iid6.get_local() == "##channel%"); CHECK(iid6.get_server() == "fixed.example.com"); CHECK(iid6.type == Iid::Type::Channel); + + Iid iid7("", chantypes); + CHECK(std::to_string(iid7) == ""); + CHECK(iid7.get_local() == ""); + CHECK(iid7.get_server() == "fixed.example.com"); + CHECK(iid7.type == Iid::Type::None); } -- 2.45.2