Buddy::JIDToLegacyName
This commit is contained in:
parent
5797b554ea
commit
62f3fbf99c
3 changed files with 18 additions and 2 deletions
|
@ -129,6 +129,8 @@ class Buddy {
|
|||
/// \return avatar hash or empty string.
|
||||
virtual std::string getIconHash() = 0;
|
||||
|
||||
static std::string JIDToLegacyName(const Swift::JID &jid);
|
||||
|
||||
private:
|
||||
void generateJID();
|
||||
|
||||
|
|
|
@ -153,4 +153,18 @@ void Buddy::buddyChanged() {
|
|||
}
|
||||
}
|
||||
|
||||
std::string Buddy::JIDToLegacyName(const Swift::JID &jid) {
|
||||
std::string name;
|
||||
if (jid.getUnescapedNode() == jid.getNode()) {
|
||||
name = jid.getNode();
|
||||
if (name.find_last_of("%") != std::string::npos) {
|
||||
name.replace(name.find_last_of("%"), 1, "@");
|
||||
}
|
||||
}
|
||||
else {
|
||||
name = jid.getUnescapedNode();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ void RosterManager::sendRIE() {
|
|||
}
|
||||
|
||||
void RosterManager::handleSubscription(Swift::Presence::ref presence) {
|
||||
|
||||
std::string legacyName = Buddy::JIDToLegacyName(presence->getTo());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue