Merge
This commit is contained in:
parent
d5ff67caa5
commit
112f067c01
@ -111,3 +111,13 @@ class Owner(Buddy):
|
|||||||
|
|
||||||
def register(self):
|
def register(self):
|
||||||
self._presence_service.register(self._group)
|
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
|
||||||
|
@ -91,6 +91,10 @@ class LocalGroup(Group):
|
|||||||
return self._buddies[name]
|
return self._buddies[name]
|
||||||
return None
|
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):
|
def _add_buddy(self, buddy):
|
||||||
bid = buddy.get_nick_name()
|
bid = buddy.get_nick_name()
|
||||||
if not self._buddies.has_key(bid):
|
if not self._buddies.has_key(bid):
|
||||||
@ -130,7 +134,7 @@ class LocalGroup(Group):
|
|||||||
if key == 'group_address':
|
if key == 'group_address':
|
||||||
service.set_group_address(value)
|
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():
|
if stype in get_recognized_buddy_service_types():
|
||||||
# Service recognized as Buddy services either create a new
|
# Service recognized as Buddy services either create a new
|
||||||
# buddy if one doesn't exist yet, or get added to the existing
|
# buddy if one doesn't exist yet, or get added to the existing
|
||||||
|
@ -42,3 +42,5 @@ class Service(object):
|
|||||||
group_address = self._group_address)
|
group_address = self._group_address)
|
||||||
else:
|
else:
|
||||||
pannounce.register_service(self._name, self._port, self._stype)
|
pannounce.register_service(self._name, self._port, self._stype)
|
||||||
|
# Notify the group that we're registering a new service
|
||||||
|
group.notify_service_registered(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user