From ad0465b32051e224f6a234f3ed36494905e59cbf Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Mon, 20 Apr 2015 20:33:02 +0200 Subject: Decode incoming JIDs local part according to xep 0106 This let users send message to nicks such as Q@CServe.quakenet.org fix #3047 --- louloulibs | 2 +- src/irc/iid.cpp | 2 ++ src/test.cpp | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/louloulibs b/louloulibs index 99757a4..88d2b13 160000 --- a/louloulibs +++ b/louloulibs @@ -1 +1 @@ -Subproject commit 99757a44b49619ff59cae9e6d983a3b7c20c56bf +Subproject commit 88d2b136e5f133f0d0dc01f59449284f663d53ea diff --git a/src/irc/iid.cpp b/src/irc/iid.cpp index 9d39129..5d8dc0a 100644 --- a/src/irc/iid.cpp +++ b/src/irc/iid.cpp @@ -1,5 +1,6 @@ #include #include +#include #include @@ -68,6 +69,7 @@ Iid::Iid(): void Iid::set_local(const std::string& loc) { this->local = utils::tolower(loc); + xep0106::decode(local); } void Iid::set_server(const std::string& serv) diff --git a/src/test.cpp b/src/test.cpp index 553140f..a46bfd1 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -396,7 +396,15 @@ int main() assert(iid6.get_server() == "fixed.example.com"); assert(iid6.is_channel); assert(!iid6.is_user); + + Config::set("fixed_irc_server", "", false); } + std::cout << color << "Testing JID (xep 0106) decoding…" << reset << std::endl; + assert(Iid{"space\\20cadet!"}.get_local() == "space cadet"); + assert(Iid{"call\\20me\\20\\22ishmael\\22!"}.get_local() == "call me \"ishmael\""); + assert(Iid{"\\2f.fanboy!"}.get_local() == "/.fanboy"); + assert(Iid{"Q\\40CServe.quakenet.org!"}.get_local() == "q@cserve.quakenet.org"); + return 0; } -- cgit v1.2.3