Port some stuff to new presence service (not tested, but I need this to at least run).

Comment out some broken code in Owner.py, Dan please take a look at this.
This commit is contained in:
Marco Pesenti Gritti 2006-07-20 10:12:42 +02:00
parent e348de9c7e
commit a06d75bd56
3 changed files with 13 additions and 27 deletions

View File

@ -56,13 +56,8 @@ class BrowserActivity(Activity):
self.add(vbox)
vbox.show()
logging.debug('Start presence service')
self._pservice = PresenceService.get_instance()
self._pservice.start()
logging.debug('Track browser activities')
self._pservice.connect('service-appeared', self._service_appeared_cb)
self._pservice.track_service_type(LocalModel.SERVICE_TYPE)
self._pservice = PresenceService()
self._pservice.connect('ServiceAppeared', self._service_appeared_cb)
# Join the shared activity if we were started from one
if self._initial_service:
@ -85,10 +80,6 @@ class BrowserActivity(Activity):
self._model = RemoteModel(self._model_service, self._notif_service)
self._model.add_listener(self.__shared_location_changed_cb)
def set_default_type(self, default_type):
Activity.set_default_type(self, default_type)
self._pservice.track_service_type(default_type)
def _update_shared_location(self):
address = self.embed.get_address()
self._model.set_value('address', address)

View File

@ -35,10 +35,8 @@ class ActivitiesModel(gobject.GObject):
self._activities = []
self._pservice = PresenceService.get_instance()
self._pservice.connect("activity-announced", self._on_activity_announced_cb)
self._pservice.connect("new-service-adv", self._on_new_service_adv_cb)
self._pservice.start()
self._pservice = PresenceService()
self._pservice.connect("ActivityAppeared", self._on_activity_announced_cb)
def add_activity(self, service):
activity_info = ActivityInfo(service)
@ -48,10 +46,6 @@ class ActivitiesModel(gobject.GObject):
def __iter__(self):
return self._activities.__iter__()
def _on_new_service_adv_cb(self, pservice, activity_id, short_stype):
if activity_id:
self._pservice.track_service_type(short_stype)
def _on_activity_announced_cb(self, pservice, service, buddy):
# FIXME We should not hard code activity types here
if service.get_type() == "_web_olpc._udp":

View File

@ -30,17 +30,18 @@ class ShellOwner(object):
# Our presence service
port = random.randint(40000, 65000)
properties = {}
self._service = Service.Service(nick, Buddy.PRESENCE_SERVICE_TYPE,
domain="", address=None, port=port, properties=properties)
print "Owner '%s' using port %d" % (nick, port)
self._icon_stream = Stream.Stream.new_from_service(self._service)
self._icon_stream.register_reader_handler(self._handle_buddy_icon_request, "get_buddy_icon")
# self._service = Service.Service(nick, Buddy.PRESENCE_SERVICE_TYPE,
# domain="", address=None, port=port, properties=properties)
# print "Owner '%s' using port %d" % (nick, port)
# self._icon_stream = Stream.Stream.new_from_service(self._service)
# self._icon_stream.register_reader_handler(self._handle_buddy_icon_request, "get_buddy_icon")
# Announce ourselves to the world
self._pservice = PresenceService.PresenceService.get_instance()
self._pservice.start()
self._pservice.register_service(self._service)
# self._pservice = PresenceService.PresenceService.get_instance()
# self._pservice.start()
# self._pservice.register_service(self._service)
def _handle_buddy_icon_request(self):
"""XMLRPC method, return the owner's icon encoded with base64."""