r6976 - bigboard/trunk/bigboard
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r6976 - bigboard/trunk/bigboard
- Date: Wed, 5 Dec 2007 15:51:32 -0600 (CST)
Author: hp
Date: 2007-12-05 15:51:31 -0600 (Wed, 05 Dec 2007)
New Revision: 6976
Modified:
bigboard/trunk/bigboard/people_tracker.py
Log:
if a contact has an aim or xmpp buddy, and no icon, use the icon from the im buddy
Modified: bigboard/trunk/bigboard/people_tracker.py
===================================================================
--- bigboard/trunk/bigboard/people_tracker.py 2007-12-05 21:26:23 UTC (rev 6975)
+++ bigboard/trunk/bigboard/people_tracker.py 2007-12-05 21:51:31 UTC (rev 6976)
@@ -148,6 +148,8 @@
else:
self.aim_buddy = None
+ self.__refresh_icon_url() # in case we were using the AIM buddy icon
+
self.emit("aim-buddy-changed")
def __contact_xmpp_buddies_changed(self, resource):
@@ -162,6 +164,8 @@
else:
self.xmpp_buddy = None
+ self.__refresh_icon_url() # in case we were using the XMPP buddy icon
+
self.emit("xmpp-buddy-changed")
def __contact_user_changed(self, resource):
@@ -204,15 +208,39 @@
self.icon_url = new_icon_url
self.emit("icon-url-changed")
- def __user_photo_url_changed(self, user_resource):
+ def __refresh_icon_url(self):
new_icon_url = None
- if user_resource:
+ if self.is_contact:
try:
- new_icon_url = user_resource.photoUrl
+ new_icon_url = self.resource.user.photoUrl
except AttributeError:
pass
+ ## see if we can get an icon from one of our buddies
+ no_photo_url = self.resource.model.global_resource.fallbackUserPhotoUrl
+
+ if not new_icon_url or new_icon_url == no_photo_url:
+ try:
+ new_icon_url = self.xmpp_buddy.icon
+ except AttributeError:
+ pass
+
+ if not new_icon_url or new_icon_url == no_photo_url:
+ try:
+ new_icon_url = self.aim_buddy.icon
+ except AttributeError:
+ pass
+
+ else:
+ try:
+ new_icon_url = self.resource.icon
+ except AttributeError:
+ pass
+
self.__set_icon_url(new_icon_url)
+
+ def __user_photo_url_changed(self, user_resource):
+ self.__refresh_icon_url()
def __buddy_alias_changed(self, resource):
try:
@@ -226,14 +254,8 @@
self.emit("display-name-changed")
def __buddy_icon_changed(self, resource):
- new_icon_url = None
- try:
- new_icon_url = resource.icon
- except AttributeError:
- pass
+ self.__refresh_icon_url()
- self.__set_icon_url(new_icon_url)
-
def __hash__(self):
return hash(self.resource)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]