blob: 088607997978cf1d1b2f5ce83f8668dfeb9a0d51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "Swift/Controllers/NickResolver.h"
#include <boost/shared_ptr.hpp>
#include "Swiften/Roster/XMPPRoster.h"
namespace Swift {
NickResolver::NickResolver(boost::shared_ptr<XMPPRoster> xmppRoster) {
xmppRoster_ = xmppRoster;
}
String NickResolver::jidToNick(const JID& jid) {
String nick;
if (xmppRoster_->containsJID(jid) && xmppRoster_->getNameForJID(jid) != "") {
return xmppRoster_->getNameForJID(jid);
}
std::map<JID, String>::const_iterator it = map_.find(jid);
return (it == map_.end()) ? jid.toBare() : it->second;
}
}
|