diff options
author | Dan Williams <dcbw@redhat.com> | 2006-06-15 21:41:26 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2006-06-15 21:41:26 (GMT) |
commit | e4677ee22afdb23f12ebf0cbf714e0ef1e65f263 (patch) | |
tree | 97fcb81ba1d89f39422bf3eed969516bb3e06431 /sugar/presence/PresenceService.py | |
parent | 31e9671190d46ab99aabf0c01bff2bedb504d790 (diff) |
Announce new activities when we resolve them, and add a hook to intercept new service advertisements
Diffstat (limited to 'sugar/presence/PresenceService.py')
-rw-r--r-- | sugar/presence/PresenceService.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sugar/presence/PresenceService.py b/sugar/presence/PresenceService.py index 860e63a..8bbbde7 100644 --- a/sugar/presence/PresenceService.py +++ b/sugar/presence/PresenceService.py @@ -65,9 +65,13 @@ class PresenceService(gobject.GObject): __gsignals__ = { 'buddy-appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - ([gobject.TYPE_PYOBJECT])), + ([gobject.TYPE_PYOBJECT])), 'buddy-disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - ([gobject.TYPE_PYOBJECT])) + ([gobject.TYPE_PYOBJECT])), + 'activity-announced': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])), + 'new-service-adv': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + ([gobject.TYPE_STRING, gobject.TYPE_STRING])) } __lock = threading.Lock() @@ -206,6 +210,7 @@ class PresenceService(gobject.GObject): if not self._activity_services.has_key(uid): self._activity_services[uid] = [] self._activity_services[uid].append((buddy, service)) + self.emit('activity-announced', service, buddy) def _handle_remove_service_for_activity(self, service, buddy): (uid, ignore) = service.get_activity_uid() @@ -279,6 +284,9 @@ class PresenceService(gobject.GObject): # Decompose service type if we can (uid, stype) = Service._decompose_service_type(stype) + # FIXME: find a better way of letting StartPage get all activity advertisements + self.emit('new-service-adv', uid, stype) + # If we care about the service right now, resolve it resolve = False if uid in self._activity_uids: @@ -377,7 +385,6 @@ class PresenceService(gobject.GObject): a certain mDNS service types.""" if not self._started: raise RuntimeError("presence service must be started first.") - print "about to track type %s" % stype if type(stype) != type("") and type(stype) != type(u""): raise ValueError("service type must be a string.") if type(stype) == type(u""): |