From f653906f9de8cbcecf5717e18c696d1029fc2c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 11 Dec 2016 16:34:38 +0100 Subject: Add a None type for the Iid class (when the iid is completely empty) --- src/irc/iid.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/irc/iid.cpp') diff --git a/src/irc/iid.cpp b/src/irc/iid.cpp index d442013..6b07793 100644 --- a/src/irc/iid.cpp +++ b/src/irc/iid.cpp @@ -34,9 +34,10 @@ Iid::Iid(const std::string& iid, const Bridge *bridge) void Iid::set_type(const std::set& chantypes) { + if (this->local.empty() && this->server.empty()) + this->type = Iid::Type::None; if (this->local.empty()) return; - if (chantypes.count(this->local[0]) == 1) this->type = Iid::Type::Channel; else @@ -105,6 +106,8 @@ namespace std { { if (iid.type == Iid::Type::Server) return iid.get_server(); + else if (iid.get_local().empty() && iid.get_server().empty()) + return {}; else return iid.get_encoded_local() + iid.separator + iid.get_server(); } -- cgit v1.2.3 From 5402a256d1f0ebbeafa32d250d000cf38fe748fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 7 Apr 2017 18:45:24 +0200 Subject: Apply all the clang-tidy modernize-* fixes --- src/irc/iid.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/irc/iid.cpp') diff --git a/src/irc/iid.cpp b/src/irc/iid.cpp index 6b07793..63c7039 100644 --- a/src/irc/iid.cpp +++ b/src/irc/iid.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -7,10 +8,10 @@ constexpr char Iid::separator[]; -Iid::Iid(const std::string& local, const std::string& server, Iid::Type type): - type(type), - local(local), - server(server) +Iid::Iid(std::string local, std::string server, Iid::Type type): + type(std::move(type)), + local(std::move(local)), + server(std::move(server)) { } -- cgit v1.2.3 From ccb4ee098f0416ab47a46650705dba6495e8bec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 7 Apr 2017 18:53:12 +0200 Subject: Apply all the clang-tidy misc-* fixes --- src/irc/iid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/irc/iid.cpp') diff --git a/src/irc/iid.cpp b/src/irc/iid.cpp index 63c7039..a63a1c3 100644 --- a/src/irc/iid.cpp +++ b/src/irc/iid.cpp @@ -9,7 +9,7 @@ constexpr char Iid::separator[]; Iid::Iid(std::string local, std::string server, Iid::Type type): - type(std::move(type)), + type(type), local(std::move(local)), server(std::move(server)) { -- cgit v1.2.3