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:
parent
e348de9c7e
commit
a06d75bd56
@ -56,13 +56,8 @@ class BrowserActivity(Activity):
|
|||||||
self.add(vbox)
|
self.add(vbox)
|
||||||
vbox.show()
|
vbox.show()
|
||||||
|
|
||||||
logging.debug('Start presence service')
|
self._pservice = PresenceService()
|
||||||
self._pservice = PresenceService.get_instance()
|
self._pservice.connect('ServiceAppeared', self._service_appeared_cb)
|
||||||
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)
|
|
||||||
|
|
||||||
# Join the shared activity if we were started from one
|
# Join the shared activity if we were started from one
|
||||||
if self._initial_service:
|
if self._initial_service:
|
||||||
@ -85,10 +80,6 @@ class BrowserActivity(Activity):
|
|||||||
self._model = RemoteModel(self._model_service, self._notif_service)
|
self._model = RemoteModel(self._model_service, self._notif_service)
|
||||||
self._model.add_listener(self.__shared_location_changed_cb)
|
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):
|
def _update_shared_location(self):
|
||||||
address = self.embed.get_address()
|
address = self.embed.get_address()
|
||||||
self._model.set_value('address', address)
|
self._model.set_value('address', address)
|
||||||
|
@ -35,10 +35,8 @@ class ActivitiesModel(gobject.GObject):
|
|||||||
|
|
||||||
self._activities = []
|
self._activities = []
|
||||||
|
|
||||||
self._pservice = PresenceService.get_instance()
|
self._pservice = PresenceService()
|
||||||
self._pservice.connect("activity-announced", self._on_activity_announced_cb)
|
self._pservice.connect("ActivityAppeared", self._on_activity_announced_cb)
|
||||||
self._pservice.connect("new-service-adv", self._on_new_service_adv_cb)
|
|
||||||
self._pservice.start()
|
|
||||||
|
|
||||||
def add_activity(self, service):
|
def add_activity(self, service):
|
||||||
activity_info = ActivityInfo(service)
|
activity_info = ActivityInfo(service)
|
||||||
@ -48,10 +46,6 @@ class ActivitiesModel(gobject.GObject):
|
|||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self._activities.__iter__()
|
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):
|
def _on_activity_announced_cb(self, pservice, service, buddy):
|
||||||
# FIXME We should not hard code activity types here
|
# FIXME We should not hard code activity types here
|
||||||
if service.get_type() == "_web_olpc._udp":
|
if service.get_type() == "_web_olpc._udp":
|
||||||
|
@ -30,17 +30,18 @@ class ShellOwner(object):
|
|||||||
# Our presence service
|
# Our presence service
|
||||||
port = random.randint(40000, 65000)
|
port = random.randint(40000, 65000)
|
||||||
properties = {}
|
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._service = Service.Service(nick, Buddy.PRESENCE_SERVICE_TYPE,
|
||||||
self._icon_stream.register_reader_handler(self._handle_buddy_icon_request, "get_buddy_icon")
|
# 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
|
# Announce ourselves to the world
|
||||||
self._pservice = PresenceService.PresenceService.get_instance()
|
# self._pservice = PresenceService.PresenceService.get_instance()
|
||||||
self._pservice.start()
|
# self._pservice.start()
|
||||||
self._pservice.register_service(self._service)
|
# self._pservice.register_service(self._service)
|
||||||
|
|
||||||
def _handle_buddy_icon_request(self):
|
def _handle_buddy_icon_request(self):
|
||||||
"""XMLRPC method, return the owner's icon encoded with base64."""
|
"""XMLRPC method, return the owner's icon encoded with base64."""
|
||||||
|
Loading…
Reference in New Issue
Block a user