diff options
Diffstat (limited to 'Swiften/JID/JID.cpp')
-rw-r--r-- | Swiften/JID/JID.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Swiften/JID/JID.cpp b/Swiften/JID/JID.cpp index c82674d..e8a4700 100644 --- a/Swiften/JID/JID.cpp +++ b/Swiften/JID/JID.cpp @@ -104,12 +104,12 @@ void JID::initializeFromString(const std::string& jid) { hasResource_ = false; bare = jid; } - std::pair<std::string,std::string> nodeAndDomain = String::getSplittedAtFirst(bare, '@'); - if (nodeAndDomain.second.empty()) { - nameprepAndSetComponents("", nodeAndDomain.first, resource); + auto firstMatch = bare.find('@'); + if (firstMatch != bare.npos) { + nameprepAndSetComponents(bare.substr(0, firstMatch), bare.substr(firstMatch + 1), resource); } else { - nameprepAndSetComponents(nodeAndDomain.first, nodeAndDomain.second, resource); + nameprepAndSetComponents("", bare, resource); } } |