Buddy::JIDToLegacyName

This commit is contained in:
Jan Kaluza 2011-04-06 14:32:03 +02:00
parent 5797b554ea
commit 62f3fbf99c
3 changed files with 18 additions and 2 deletions

View file

@ -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();

View file

@ -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;
}
}

View file

@ -120,7 +120,7 @@ void RosterManager::sendRIE() {
}
void RosterManager::handleSubscription(Swift::Presence::ref presence) {
std::string legacyName = Buddy::JIDToLegacyName(presence->getTo());
}
}
}