diff options
Diffstat (limited to 'Swift/Controllers/NickResolver.cpp')
-rw-r--r-- | Swift/Controllers/NickResolver.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Swift/Controllers/NickResolver.cpp b/Swift/Controllers/NickResolver.cpp index 0886079..5198069 100644 --- a/Swift/Controllers/NickResolver.cpp +++ b/Swift/Controllers/NickResolver.cpp @@ -2,16 +2,27 @@ #include <boost/shared_ptr.hpp> +#include "Swiften/MUC/MUCRegistry.h" #include "Swiften/Roster/XMPPRoster.h" namespace Swift { NickResolver::NickResolver(boost::shared_ptr<XMPPRoster> xmppRoster) { xmppRoster_ = xmppRoster; + mucRegistry_ = NULL; +} + +void NickResolver::setMUCRegistry(MUCRegistry* mucRegistry) { + mucRegistry_ = mucRegistry; } String NickResolver::jidToNick(const JID& jid) { String nick; + + if (mucRegistry_ && mucRegistry_->isMUC(jid.toBare()) ) { + return jid.getResource(); + } + if (xmppRoster_->containsJID(jid) && xmppRoster_->getNameForJID(jid) != "") { return xmppRoster_->getNameForJID(jid); } |