summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-03 15:10:46 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-03 15:10:46 (GMT)
commita719c9898cba1e5a618996ae506256a0c2556cc4 (patch)
treee811aa9a9e8cee0c25adaa608fd9c56001469bc9 /Swiften/Roster
parent0a88cbb890213472c4e780593f4bd3866f7588e4 (diff)
downloadswift-contrib-a719c9898cba1e5a618996ae506256a0c2556cc4.zip
swift-contrib-a719c9898cba1e5a618996ae506256a0c2556cc4.tar.bz2
Show contacts as unavailable after subscription removal.
Resolves: #455
Diffstat (limited to 'Swiften/Roster')
-rw-r--r--Swiften/Roster/ContactRosterItem.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Swiften/Roster/ContactRosterItem.cpp b/Swiften/Roster/ContactRosterItem.cpp
index 1c27395..9251fad 100644
--- a/Swiften/Roster/ContactRosterItem.cpp
+++ b/Swiften/Roster/ContactRosterItem.cpp
@@ -80,8 +80,13 @@ void ContactRosterItem::applyPresence(const String& resource, boost::shared_ptr<
offlinePresence_ = boost::shared_ptr<Presence>();
}
if (presence->getType() == Presence::Unavailable) {
- if (presences_.find(resource) != presences_.end()) {
- presences_.erase(resource);
+ if (resource.isEmpty()) {
+ /* Unavailable from the bare JID means all resources are offline.*/
+ presences_.clear();
+ } else {
+ if (presences_.find(resource) != presences_.end()) {
+ presences_.erase(resource);
+ }
}
if (presences_.size() > 0) {
offlinePresence_ = presence;