This commit is contained in:
Marco Pesenti Gritti 2006-05-22 16:36:02 -04:00
parent d5ff67caa5
commit 112f067c01
3 changed files with 18 additions and 2 deletions

View File

@ -111,3 +111,13 @@ class Owner(Buddy):
def register(self):
self._presence_service.register(self._group)
def notify_service_registered(self, service):
"""New services registered in our group are automatically owned
by us."""
self._services[service.get_type()] = service
def add_service(self, service):
"""Do nothing here, since all services we need to know about
are registered with us by our group."""
pass

View File

@ -90,6 +90,10 @@ class LocalGroup(Group):
if self._buddies.has_key(name):
return self._buddies[name]
return None
def notify_service_registered(self, service):
"""A new service is automatically owned by the owner of this group."""
self._owner.notify_service_registered(service)
def _add_buddy(self, buddy):
bid = buddy.get_nick_name()
@ -130,7 +134,7 @@ class LocalGroup(Group):
if key == 'group_address':
service.set_group_address(value)
# print "ServiceResolved: name=%s, stype=%s, port=%s, address=%s" % (name, stype, port, address)
#print "ServiceResolved: name=%s, stype=%s, port=%s, address=%s" % (name, stype, port, address)
if stype in get_recognized_buddy_service_types():
# Service recognized as Buddy services either create a new
# buddy if one doesn't exist yet, or get added to the existing

View File

@ -35,10 +35,12 @@ class Service(object):
def is_multicast(self):
return self._group_address != None
def register(self, group):
def register(self, group):
pannounce = presence.PresenceAnnounce()
if self._group_address:
pannounce.register_service(self._name, self._port, self._stype,
group_address = self._group_address)
else:
pannounce.register_service(self._name, self._port, self._stype)
# Notify the group that we're registering a new service
group.notify_service_registered(self)