Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDan Williams <dcbw@localhost.localdomain>2006-09-27 15:35:34 (GMT)
committer Dan Williams <dcbw@localhost.localdomain>2006-09-27 15:35:34 (GMT)
commit9ce768ca394551a623ac7e36ea5ae2f9ca57ce8a (patch)
treec1b209b60da2a7d074281d1e59505a1c525342aa /services
parent38e85f3987ed945a46e594cbaae959447b7e16d6 (diff)
Add and remove activities to/from Buddy objects at appropriate times
Diffstat (limited to 'services')
-rw-r--r--services/presence/PresenceService.py34
1 files changed, 15 insertions, 19 deletions
diff --git a/services/presence/PresenceService.py b/services/presence/PresenceService.py
index b43506e..9898b2b 100644
--- a/services/presence/PresenceService.py
+++ b/services/presence/PresenceService.py
@@ -451,15 +451,13 @@ 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
+ # Add the activity to its buddy
+ # FIXME: use something other than name to attribute to buddy
+ try:
+ buddy = self._buddies[service.get_name()]
+ buddy.add_activity(activity)
+ except KeyError:
+ pass
if not was_valid and activity.is_valid():
self._dbus_helper.ActivityAppeared(activity.object_path())
@@ -473,18 +471,16 @@ class PresenceService(object):
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:
+ # Remove the activity from its buddy
+ # FIXME: use something other than name to attribute to buddy
+ try:
+ buddy = self._buddies[service.get_name()]
+ buddy.remove_activity(activity)
+ except KeyError:
+ pass
+
# Kill the activity
self._dbus_helper.ActivityDisappeared(activity.object_path())
del self._activities[actid]