diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2006-06-15 15:29:00 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2006-06-15 15:29:00 (GMT) |
commit | 27b4f25fade95d829364f2f7b9b893e31ede232d (patch) | |
tree | 04755c0725ec687aed367f3b930a28b4e2088849 /sugar/presence/Service.py | |
parent | f0af49616ca0b51336407b3bfc9ceff677178b7b (diff) |
Merge
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 |