diff --git a/shell/Owner.py b/shell/Owner.py index 16310f9f..90f60240 100644 --- a/shell/Owner.py +++ b/shell/Owner.py @@ -29,7 +29,9 @@ class ShellOwner(object): def announce(self): # Create and announce our presence - self._service = self._pservice.register_service(self._nick, PRESENCE_SERVICE_TYPE) + props = { 'color': "#deadbe" } + self._service = self._pservice.register_service(self._nick, + PRESENCE_SERVICE_TYPE, properties=props) print "Owner '%s' using port %d" % (self._nick, self._service.get_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") @@ -39,8 +41,3 @@ class ShellOwner(object): if self._icon: return base64.b64encode(self._icon) return "" - - def set_icon(self, icon): - """Can only set icon in constructor for now.""" - pass - diff --git a/shell/PresenceService/Buddy.py b/shell/PresenceService/Buddy.py index 33eae9dc..fc4d1855 100644 --- a/shell/PresenceService/Buddy.py +++ b/shell/PresenceService/Buddy.py @@ -74,6 +74,7 @@ class BuddyDBusHelper(dbus.service.Object): props['name'] = self._parent.get_name() props['ip4_address'] = self._parent.get_address() props['owner'] = self._parent.is_owner() + props['color'] = self._parent.get_color() return props @@ -94,6 +95,7 @@ class Buddy(object): self._nick_name = service.get_name() self._address = service.get_source_address() + self._color = None self._valid = False self._icon = None self._icon_tries = 0 @@ -159,6 +161,7 @@ class Buddy(object): self._valid = True print 'Requesting buddy icon %s' % self._nick_name self._request_buddy_icon(service) + self._color = service.get_one_property('color') if self._valid: self._dbus_helper.ServiceAppeared(service.object_path()) @@ -243,6 +246,9 @@ class Buddy(object): def get_name(self): return self._nick_name + def get_color(self): + return self._color + def _set_icon(self, icon): """Can only set icon for other buddies. The Owner takes care of setting it's own icon.""" diff --git a/sugar/presence/Buddy.py b/sugar/presence/Buddy.py index 17327908..5ae41f8f 100644 --- a/sugar/presence/Buddy.py +++ b/sugar/presence/Buddy.py @@ -89,6 +89,9 @@ class Buddy(gobject.GObject): def is_owner(self): return self._properties['owner'] + def get_color(self): + return self._properties['color'] + def get_icon(self): return self._buddy.getIcon()