diff options
author | Dan Williams <dcbw@redhat.com> | 2006-06-15 15:20:18 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2006-06-15 15:20:18 (GMT) |
commit | ecf81ba35fbfa91c6b45cf0ef892c1c13d0e2eaf (patch) | |
tree | 686eddf3492933c1005008a74c556b948de97d00 /sugar/presence/Service.py | |
parent | f2ae13241052c94c18131c3db3f255b22f60a5df (diff) |
Generalize activity publishing code for > 1 activity per process
Diffstat (limited to 'sugar/presence/Service.py')
-rw-r--r-- | sugar/presence/Service.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sugar/presence/Service.py b/sugar/presence/Service.py index f79f17a..4ad23aa 100644 --- a/sugar/presence/Service.py +++ b/sugar/presence/Service.py @@ -69,6 +69,8 @@ def is_multicast_address(address): return False +_ACTIVITY_UID_TAG = "ActivityUID" + class Service(object): """Encapsulates information about a specific ZeroConf/mDNS service as advertised on the network.""" @@ -101,7 +103,16 @@ class Service(object): self.set_port(port) self._properties = {} self.set_properties(properties) + + # Ensure that an ActivityUID tag, if given, matches + # what we expect from the service type + if self._properties.has_key(_ACTIVITY_UID_TAG): + prop_uid = self._properties[_ACTIVITY_UID_TAG] + if (prop_uid and not uid) or (prop_uid != uid): + raise ValueError("ActivityUID property specified, but the service type's activity UID didn't match it.") self._activity_uid = uid + if uid and not self._properties.has_key(_ACTIVITY_UID_TAG): + self._properties[_ACTIVITY_UID_TAG] = uid def get_name(self): """Return the service's name, usually that of the @@ -141,6 +152,10 @@ class Service(object): """Return the service's service type.""" return self._stype + def get_network_type(self): + """Return the full service type, including activity UID.""" + return self._real_stype + def get_port(self): return self._port |