summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-04-05 20:44:58 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-04-05 20:44:58 (GMT)
commita8ac900bfd39f36749b25d97b55f5a08a1020de5 (patch)
tree48b67fa97a075ff942848638ff195ff366ae91dd /Swift/Controllers
parent90eab2990dc087ebe2b91181f14ca452e5b31697 (diff)
downloadswift-a8ac900bfd39f36749b25d97b55f5a08a1020de5.zip
swift-a8ac900bfd39f36749b25d97b55f5a08a1020de5.tar.bz2
Resolve MUC nicks.
Resolves: #245
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/MainController.cpp1
-rw-r--r--Swift/Controllers/NickResolver.cpp11
-rw-r--r--Swift/Controllers/NickResolver.h4
3 files changed, 15 insertions, 1 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 8aeca97..8c43921 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -143,6 +143,7 @@ void MainController::handleConnected() {
rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this));
chatsManager_ = new ChatsManager(jid_, client_, client_, eventController_, chatWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_, uiEventStream_, chatListWindowFactory_);
+ nickResolver_->setMUCRegistry(chatsManager_);
client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
chatsManager_->setAvatarManager(avatarManager_);
rosterController_->onStartChatRequest.connect(boost::bind(&ChatsManager::handleChatRequest, chatsManager_, _1));
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);
}
diff --git a/Swift/Controllers/NickResolver.h b/Swift/Controllers/NickResolver.h
index b7dc005..cf6104d 100644
--- a/Swift/Controllers/NickResolver.h
+++ b/Swift/Controllers/NickResolver.h
@@ -9,14 +9,16 @@
namespace Swift {
class XMPPRoster;
+ class MUCRegistry;
class NickResolver {
public:
NickResolver(boost::shared_ptr<XMPPRoster> xmppRoster);
String jidToNick(const JID& jid);
-
+ void setMUCRegistry(MUCRegistry* registry);
private:
std::map<JID, String> map_;
boost::shared_ptr<XMPPRoster> xmppRoster_;
+ MUCRegistry* mucRegistry_;
};
}
#endif