summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-06-23 22:17:08 +0200
committerlouiz’ <louiz@louiz.org>2016-06-23 22:17:08 +0200
commit11dcae704a8dc84643408ded9397294eec191de1 (patch)
treea1a41154a78f2082851f7f6a8f8fd94cf1341d29 /src/irc
parent57263961b487bd839cbce5fe7547933240792fbc (diff)
parent0391f17f999618decffaf3c9261024ab04a33f63 (diff)
downloadbiboumi-11dcae704a8dc84643408ded9397294eec191de1.tar.gz
biboumi-11dcae704a8dc84643408ded9397294eec191de1.tar.bz2
biboumi-11dcae704a8dc84643408ded9397294eec191de1.tar.xz
biboumi-11dcae704a8dc84643408ded9397294eec191de1.zip
Merge remote-tracking branch 'linkmauve/escaped-iid-support'
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/iid.cpp19
-rw-r--r--src/irc/iid.hpp1
2 files changed, 16 insertions, 4 deletions
diff --git a/src/irc/iid.cpp b/src/irc/iid.cpp
index 66b66b7..0e2841e 100644
--- a/src/irc/iid.cpp
+++ b/src/irc/iid.cpp
@@ -3,6 +3,8 @@
#include <irc/iid.hpp>
+#include <utils/encoding.hpp>
+
Iid::Iid(const std::string& iid):
is_channel(false),
is_user(false)
@@ -59,7 +61,9 @@ Iid::Iid():
void Iid::set_local(const std::string& loc)
{
- this->local = utils::tolower(loc);
+ std::string local(utils::tolower(loc));
+ xep0106::decode(local);
+ this->local = local;
}
void Iid::set_server(const std::string& serv)
@@ -72,6 +76,13 @@ const std::string& Iid::get_local() const
return this->local;
}
+const std::string Iid::get_encoded_local() const
+{
+ std::string local(this->local);
+ xep0106::encode(local);
+ return local;
+}
+
const std::string& Iid::get_server() const
{
return this->server;
@@ -90,13 +101,13 @@ namespace std {
const std::string to_string(const Iid& iid)
{
if (Config::get("fixed_irc_server", "").empty())
- return iid.get_local() + iid.get_sep() + iid.get_server();
+ return iid.get_encoded_local() + iid.get_sep() + iid.get_server();
else
{
if (iid.get_sep() == "!")
- return iid.get_local() + iid.get_sep();
+ return iid.get_encoded_local() + iid.get_sep();
else
- return iid.get_local();
+ return iid.get_encoded_local();
}
}
}
diff --git a/src/irc/iid.hpp b/src/irc/iid.hpp
index 9747595..a55ae21 100644
--- a/src/irc/iid.hpp
+++ b/src/irc/iid.hpp
@@ -53,6 +53,7 @@ public:
void set_local(const std::string& loc);
void set_server(const std::string& serv);
const std::string& get_local() const;
+ const std::string get_encoded_local() const;
const std::string& get_server() const;
bool is_channel;