diff options
author | Dan Williams <dcbw@localhost.localdomain> | 2006-09-25 14:56:12 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@localhost.localdomain> | 2006-09-25 14:56:12 (GMT) |
commit | ea5b59dca73596d3ceb4f2fb0e2e86522d451371 (patch) | |
tree | 61e7359c5bad5470c526c8f5c109b45901b65510 /shell/model | |
parent | e31bcc76b3fec3d3311f32ffb4e324693a26db84 (diff) |
Send buddy icon hash in presence service announcement too
Diffstat (limited to 'shell/model')
-rw-r--r-- | shell/model/Owner.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/shell/model/Owner.py b/shell/model/Owner.py index 097d9c2..3bf3a55 100644 --- a/shell/model/Owner.py +++ b/shell/model/Owner.py @@ -8,6 +8,7 @@ from sugar import env import logging from sugar.p2p import Stream from sugar.presence import PresenceService +from sugar import util from model.Invites import Invites import dbus @@ -24,11 +25,17 @@ class ShellOwner(object): user_dir = profile.get_path() self._icon = None + self._icon_hash = "" for fname in os.listdir(user_dir): if not fname.startswith("buddy-icon."): continue fd = open(os.path.join(user_dir, fname), "r") self._icon = fd.read() + if self._icon: + # Get the icon's hash + import md5, binascii + digest = md5.new(self._icon).digest() + self._icon_hash = util.printable_hash(digest) fd.close() break @@ -49,7 +56,7 @@ class ShellOwner(object): def announce(self): # Create and announce our presence color = conf.get_profile().get_color() - props = {'color':color.to_string()} + props = {'color': color.to_string(), 'icon-hash': self._icon_hash} self._service = self._pservice.register_service(self._nick, PRESENCE_SERVICE_TYPE, properties=props) logging.debug("Owner '%s' using port %d" % (self._nick, self._service.get_port())) |