~singpolyma/biboumi

24f2511d7ba105d65c9684dd5606a57c5af95445 — louiz’ 5 years ago ffb402f
In fixed mode, fix the iid type of the component JID
2 files changed, 8 insertions(+), 1 deletions(-)

M src/irc/iid.cpp
M tests/iid.cpp
M src/irc/iid.cpp => src/irc/iid.cpp +2 -1
@@ 35,7 35,8 @@ Iid::Iid(const std::string& iid, const Bridge *bridge)

void Iid::set_type(const std::set<char>& 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;

M tests/iid.cpp => tests/iid.cpp +6 -0
@@ 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);
}