diff options
Diffstat (limited to 'src/xmpp/jid.cpp')
-rw-r--r-- | src/xmpp/jid.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/xmpp/jid.cpp b/src/xmpp/jid.cpp index 4f9917b..e3b0c8f 100644 --- a/src/xmpp/jid.cpp +++ b/src/xmpp/jid.cpp @@ -59,7 +59,22 @@ std::string jidprep(const std::string& original) return ""; } - return std::string(local) + "@" + domain; + // If there is no resource, stop here + if (jid.resource.empty()) + return std::string(local) + "@" + domain; + + // Otherwise, also process the resource part + char resource[max_jid_part_len] = {}; + memcpy(resource, jid.resource.data(), jid.resource.size()); + rc = static_cast<Stringprep_rc>(::stringprep(resource, max_jid_part_len, + static_cast<Stringprep_profile_flags>(0), stringprep_xmpp_resourceprep)); + if (rc != STRINGPREP_OK) + { + log_error(error_msg + stringprep_strerror(rc)); + return ""; + } + return std::string(local) + "@" + domain + "/" + resource; + #else (void)original; return ""; |