diff options
Diffstat (limited to 'src/irc/iid.cpp')
-rw-r--r-- | src/irc/iid.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/irc/iid.cpp b/src/irc/iid.cpp index d442013..a63a1c3 100644 --- a/src/irc/iid.cpp +++ b/src/irc/iid.cpp @@ -1,3 +1,4 @@ +#include <utility> #include <utils/tolower.hpp> #include <config/config.hpp> #include <bridge/bridge.hpp> @@ -7,10 +8,10 @@ constexpr char Iid::separator[]; -Iid::Iid(const std::string& local, const std::string& server, Iid::Type type): +Iid::Iid(std::string local, std::string server, Iid::Type type): type(type), - local(local), - server(server) + local(std::move(local)), + server(std::move(server)) { } @@ -34,9 +35,10 @@ 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()) + 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 +107,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(); } |