diff options
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/RosterController.cpp | 12 | ||||
-rw-r--r-- | Swift/Controllers/RosterController.h | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp index 242f974..4df8d13 100644 --- a/Swift/Controllers/RosterController.cpp +++ b/Swift/Controllers/RosterController.cpp @@ -115,6 +115,13 @@ void RosterController::handleOnJIDAdded(const JID& jid) { else { roster_->addContact(jid, jid, name, "Contacts", avatarManager_->getAvatarPath(jid).string()); } + applyAllPresenceTo(jid); +} + +void RosterController::applyAllPresenceTo(const JID& jid) { + foreach (Presence::ref presence, presenceOracle_->getAllPresence(jid)) { + roster_->applyOnItems(SetPresence(presence)); + } } void RosterController::handleRosterCleared() { @@ -150,10 +157,7 @@ void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName, roster_->removeContactFromGroup(jid, group); } } - Presence::ref presence(presenceOracle_->getHighestPriorityPresence(jid)); - if (presence) { - roster_->applyOnItems(SetPresence(presence)); - } + applyAllPresenceTo(jid); } void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) { diff --git a/Swift/Controllers/RosterController.h b/Swift/Controllers/RosterController.h index cc51d23..70f1288 100644 --- a/Swift/Controllers/RosterController.h +++ b/Swift/Controllers/RosterController.h @@ -60,6 +60,7 @@ namespace Swift { void handleUIEvent(boost::shared_ptr<UIEvent> event); void handleRosterSetError(boost::optional<ErrorPayload> error, boost::shared_ptr<RosterPayload> rosterPayload); void handleOwnNickChanged(const String& nick); + void applyAllPresenceTo(const JID& jid); JID myJID_; XMPPRoster* xmppRoster_; MainWindowFactory* mainWindowFactory_; |