|
|
|
@ -151,6 +151,7 @@ class Buddy(object):
|
|
|
|
|
if icon and len(icon):
|
|
|
|
|
icon = base64.b64decode(icon)
|
|
|
|
|
self._set_icon(icon)
|
|
|
|
|
logging.debug("%s: adding retrieved icon to cache." % self._nick_name)
|
|
|
|
|
self._icon_cache.add_icon(icon)
|
|
|
|
|
|
|
|
|
|
if (result_status == network.RESULT_FAILED or not icon) and self._icon_tries < 3:
|
|
|
|
@ -172,8 +173,8 @@ class Buddy(object):
|
|
|
|
|
logging.debug("%s: icon cache hit for %s." % (self._nick_name, icon_hash))
|
|
|
|
|
self._set_icon(icon)
|
|
|
|
|
return False
|
|
|
|
|
logging.debug("%s: icon cache miss, fetching icon from buddy..." % self._nick_name)
|
|
|
|
|
|
|
|
|
|
logging.debug("%s: icon cache miss, adding icon to cache." % self._nick_name)
|
|
|
|
|
from sugar.p2p import Stream
|
|
|
|
|
buddy_stream = Stream.Stream.new_from_service(service, start_reader=False)
|
|
|
|
|
writer = buddy_stream.new_writer(service)
|
|
|
|
|