std::vector<std::string> SubscriberManager::subscriptions_to_remove(const Bindings& orig_bindings, const Subscriptions& orig_subscriptions, const Bindings& bindings_to_update, const std::vector<std::string> binding_ids_to_remove) { std::vector<std::string> subscription_ids_to_remove; std::set<std::string> missing_uris; // Store off the contact URIs of bindings to be removed. Any subscriptions // sharing any of these contact URIs will be removed. for (std::string binding_id : binding_ids_to_remove) { Bindings::const_iterator b = orig_bindings.find(binding_id); if (b != orig_bindings.end()) { missing_uris.insert(b->second->_uri); } } // Store off the original contact URI of bindings where the contact is about // to be changed. Any subscriptions that share any of the original contact // URIs will be removed. for (BindingPair bp : bindings_to_update) { Bindings::const_iterator b = orig_bindings.find(bp.first); if ((b != orig_bindings.end()) && (b->second->_uri != bp.second->_uri)) { missing_uris.insert(b->second->_uri); } } // Loop over the subscriptions. If any have the same contact as one of the // missing URIs, the subscription should be removed. for (SubscriptionPair sp : orig_subscriptions) { if (missing_uris.find(sp.second->_req_uri) != missing_uris.end()) { TRC_DEBUG("Subscription %s is being removed because the binding that shares" " its contact URI %s is being removed or changing contact URI", sp.first.c_str(), sp.second->_req_uri.c_str()); subscription_ids_to_remove.push_back(sp.first); } } return subscription_ids_to_remove; }