Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2006-06-05 14:46:41 (GMT)
committer Dan Williams <dcbw@redhat.com>2006-06-05 14:46:41 (GMT)
commita0f7a4abc6051d7b055dcec1ff16d4a0ca5bb47c (patch)
tree40f9382b6b8b446d21098daf3ec2b7aa6b0aad31
parent46a6122d264fe117d986fcc972804949b989bb8b (diff)
Only try for buddy icon 3 times
-rwxr-xr-xsugar/chat/chat.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/sugar/chat/chat.py b/sugar/chat/chat.py
index 3ea596d..0502109 100755
--- a/sugar/chat/chat.py
+++ b/sugar/chat/chat.py
@@ -470,6 +470,7 @@ class GroupChat(Chat):
def __init__(self):
self._act_name = "Chat"
self._chats = {}
+ self._buddy_icon_tries = 0
Chat.__init__(self, self)
@@ -606,9 +607,12 @@ class GroupChat(Chat):
print "Buddy icon for '%s' is size %d" % (buddy.get_nick_name(), len(icon))
buddy.set_icon(icon)
- if result_status == network.RESULT_FAILED or not icon:
- # What the heck, try again!
+ if (result_status == network.RESULT_FAILED or not icon) and self._buddy_icon_tries < 3:
+ self._buddy_icon_tries = self._buddy_icon_tries + 1
+ print "Failed to retrieve buddy icon for '%s' on try %d of %d" % (buddy.get_nick_name(), \
+ self._buddy_icon_tries, 3)
gobject.timeout_add(1000, self._request_buddy_icon, buddy)
+ return False
def _request_buddy_icon(self, buddy):
writer = self.new_buddy_writer(buddy)