diff --git a/src/rostermanager.cpp b/src/rostermanager.cpp index dab6da91b8fea190b8f664fcea48f0722d616b25..77ed09a3bf30eae1680905995ed955814767235b 100644 --- a/src/rostermanager.cpp +++ b/src/rostermanager.cpp @@ -374,6 +374,8 @@ void RosterManager::handleSubscription(Swift::Presence::ref presence) { break; case Swift::Presence::Unsubscribe: onBuddyRemoved(buddy); + removeBuddy(buddy->getName()); + buddy = NULL; response->setType(Swift::Presence::Unsubscribed); break; case Swift::Presence::Subscribed: @@ -405,8 +407,17 @@ void RosterManager::handleSubscription(Swift::Presence::ref presence) { case Swift::Presence::Subscribed: // onBuddyAdded(buddy); return; - // buddy is already there, so nothing to do, just answer + // buddy is not there, so nothing to do, just answer case Swift::Presence::Unsubscribe: + buddyInfo.id = -1; + buddyInfo.alias = ""; + buddyInfo.legacyName = Buddy::JIDToLegacyName(presence->getTo()); + buddyInfo.subscription = "both"; + buddyInfo.flags = Buddy::buddyFlagsFromJID(presence->getTo()); + + buddy = m_component->getFactory()->createBuddy(this, buddyInfo); + onBuddyRemoved(buddy); + delete buddy; response->setType(Swift::Presence::Unsubscribed); break; default: