Hook up Buddy.add_activity() and Buddy.remove_activity()

This commit is contained in:
Dan Williams 2006-09-26 13:23:12 -04:00
parent fa31b7c0bd
commit 31c69ed167

View File

@ -451,6 +451,16 @@ class PresenceService(object):
if activity:
activity.add_service(service)
# Add the activity to its buddy
# FIXME: use something other than name to attribute to buddy
name = service.get_name()
buddy = None
try:
buddy = self._buddies[name]
buddy.add_activity(activity)
except KeyError:
pass
if not was_valid and activity.is_valid():
self._dbus_helper.ActivityAppeared(activity.object_path())
@ -460,7 +470,19 @@ class PresenceService(object):
return
if not self._activities.has_key(actid):
return
activity = self._activities[actid]
# Remove the activity from its buddy
# FIXME: use something other than name to attribute to buddy
name = service.get_name()
buddy = None
try:
buddy = self._buddies[name]
buddy.remove_activity(activity)
except KeyError:
pass
activity.remove_service(service)
if len(activity.get_services()) == 0:
# Kill the activity