summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/Roster/RosterController.cpp')
-rw-r--r--Swift/Controllers/Roster/RosterController.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp
index 73efa43..751ca32 100644
--- a/Swift/Controllers/Roster/RosterController.cpp
+++ b/Swift/Controllers/Roster/RosterController.cpp
@@ -77,11 +77,10 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata
77 xmppRoster_->onJIDAdded.connect(boost::bind(&RosterController::handleOnJIDAdded, this, _1)); 77 xmppRoster_->onJIDAdded.connect(boost::bind(&RosterController::handleOnJIDAdded, this, _1));
78 xmppRoster_->onJIDUpdated.connect(boost::bind(&RosterController::handleOnJIDUpdated, this, _1, _2, _3)); 78 xmppRoster_->onJIDUpdated.connect(boost::bind(&RosterController::handleOnJIDUpdated, this, _1, _2, _3));
79 xmppRoster_->onJIDRemoved.connect(boost::bind(&RosterController::handleOnJIDRemoved, this, _1)); 79 xmppRoster_->onJIDRemoved.connect(boost::bind(&RosterController::handleOnJIDRemoved, this, _1));
80 xmppRoster_->onRosterCleared.connect(boost::bind(&RosterController::handleRosterCleared, this)); 80 xmppRoster_->onRosterCleared.connect(boost::bind(&RosterController::handleRosterCleared, this));
81 subscriptionManager_->onPresenceSubscriptionRequest.connect(boost::bind(&RosterController::handleSubscriptionRequest, this, _1, _2)); 81 subscriptionManager_->onPresenceSubscriptionRequest.connect(boost::bind(&RosterController::handleSubscriptionRequest, this, _1, _2));
82 presenceOracle_->onPresenceChange.connect(boost::bind(&RosterController::handleIncomingPresence, this, _1));
83 uiEventConnection_ = uiEventStream->onUIEvent.connect(boost::bind(&RosterController::handleUIEvent, this, _1)); 82 uiEventConnection_ = uiEventStream->onUIEvent.connect(boost::bind(&RosterController::handleUIEvent, this, _1));
84 83
85 vcardManager_->onOwnVCardChanged.connect(boost::bind(&RosterController::handleOwnVCardChanged, this, _1)); 84 vcardManager_->onOwnVCardChanged.connect(boost::bind(&RosterController::handleOwnVCardChanged, this, _1));
86 avatarManager_->onAvatarChanged.connect(boost::bind(&RosterController::handleAvatarChanged, this, _1)); 85 avatarManager_->onAvatarChanged.connect(boost::bind(&RosterController::handleAvatarChanged, this, _1));
87 presenceOracle_->onPresenceChange.connect(boost::bind(&RosterController::handlePresenceChanged, this, _1)); 86 presenceOracle_->onPresenceChange.connect(boost::bind(&RosterController::handlePresenceChanged, this, _1));
@@ -332,11 +331,12 @@ void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shar
332 331
333void RosterController::handleIncomingPresence(Presence::ref newPresence) { 332void RosterController::handleIncomingPresence(Presence::ref newPresence) {
334 if (newPresence->getType() == Presence::Error) { 333 if (newPresence->getType() == Presence::Error) {
335 return; 334 return;
336 } 335 }
337 roster_->applyOnItems(SetPresence(newPresence)); 336 Presence::ref accountPresence = presenceOracle_->getAccountPresence(newPresence->getFrom().toBare());
337 roster_->applyOnItems(SetPresence(accountPresence));
338} 338}
339 339
340void RosterController::handleSubscriptionRequest(const JID& jid, const std::string& message) { 340void RosterController::handleSubscriptionRequest(const JID& jid, const std::string& message) {
341 if (xmppRoster_->containsJID(jid) && (xmppRoster_->getSubscriptionStateForJID(jid) == RosterItemPayload::To || xmppRoster_->getSubscriptionStateForJID(jid) == RosterItemPayload::Both)) { 341 if (xmppRoster_->containsJID(jid) && (xmppRoster_->getSubscriptionStateForJID(jid) == RosterItemPayload::To || xmppRoster_->getSubscriptionStateForJID(jid) == RosterItemPayload::Both)) {
342 subscriptionManager_->confirmSubscription(jid); 342 subscriptionManager_->confirmSubscription(jid);
@@ -378,10 +378,13 @@ void RosterController::handleAvatarChanged(const JID& jid) {
378void RosterController::handlePresenceChanged(Presence::ref presence) { 378void RosterController::handlePresenceChanged(Presence::ref presence) {
379 if (presence->getFrom().equals(myJID_, JID::WithResource)) { 379 if (presence->getFrom().equals(myJID_, JID::WithResource)) {
380 ownContact_->applyPresence(std::string(), presence); 380 ownContact_->applyPresence(std::string(), presence);
381 mainWindow_->setMyContactRosterItem(ownContact_); 381 mainWindow_->setMyContactRosterItem(ownContact_);
382 } 382 }
383 else {
384 handleIncomingPresence(presence);
385 }
383} 386}
384 387
385boost::optional<XMPPRosterItem> RosterController::getItem(const JID& jid) const { 388boost::optional<XMPPRosterItem> RosterController::getItem(const JID& jid) const {
386 return xmppRoster_->getItem(jid); 389 return xmppRoster_->getItem(jid);
387} 390}