summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-08-27 20:19:14 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-08-27 21:52:18 (GMT)
commit7f1bcf974efac0ed87b6f8f639e1fdc16a89eb09 (patch)
tree7fa948375b6cc56f37bd2be400d6d8be9ca97837 /Swift/Controllers/NickResolver.cpp
parentba774f85e77531c7971804cb738c6b434a197258 (diff)
downloadswift-7f1bcf974efac0ed87b6f8f639e1fdc16a89eb09.zip
swift-7f1bcf974efac0ed87b6f8f639e1fdc16a89eb09.tar.bz2
Separate MUCRegistry from ChatsManager.
Diffstat (limited to 'Swift/Controllers/NickResolver.cpp')
-rw-r--r--Swift/Controllers/NickResolver.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/Swift/Controllers/NickResolver.cpp b/Swift/Controllers/NickResolver.cpp
index 1d2a3a0..b6fefe3 100644
--- a/Swift/Controllers/NickResolver.cpp
+++ b/Swift/Controllers/NickResolver.cpp
@@ -15,18 +15,14 @@
namespace Swift {
-NickResolver::NickResolver(const JID& ownJID, boost::shared_ptr<XMPPRoster> xmppRoster, VCardManager* vcardManager) : ownJID_(ownJID) {
+NickResolver::NickResolver(const JID& ownJID, boost::shared_ptr<XMPPRoster> xmppRoster, VCardManager* vcardManager, MUCRegistry* mucRegistry) : ownJID_(ownJID) {
xmppRoster_ = xmppRoster;
vcardManager_ = vcardManager;
if (vcardManager_) {
- vcardManager_->onOwnVCardChanged.connect(boost::bind(&NickResolver::handleOwnVCardReceived, this, _1));
+ vcardManager_->onVCardChanged.connect(boost::bind(&NickResolver::handleVCardReceived, this, _1, _2));
VCard::ref ownVCard = vcardManager_->getVCardAndRequestWhenNeeded(ownJID_);
- handleOwnVCardReceived(ownVCard);
+ handleVCardReceived(ownJID_, ownVCard);
}
- mucRegistry_ = NULL;
-}
-
-void NickResolver::setMUCRegistry(MUCRegistry* mucRegistry) {
mucRegistry_ = mucRegistry;
}
@@ -50,7 +46,10 @@ String NickResolver::jidToNick(const JID& jid) {
return (it == map_.end()) ? jid.toBare() : it->second;
}
-void NickResolver::handleOwnVCardReceived(VCard::ref ownVCard) {
+void NickResolver::handleVCardReceived(const JID& jid, VCard::ref ownVCard) {
+ if (!jid.equals(ownJID_, JID::WithoutResource)) {
+ return;
+ }
String initialNick = ownNick_;
ownNick_ = ownJID_.toString();
if (ownVCard) {