summaryrefslogtreecommitdiff
path: root/sunshine
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2010-04-08 07:24:57 +0200
committerKrzysztof Klinikowski <kkszysiu@gmail.com>2010-04-08 07:24:57 +0200
commit87798cb06a277d4719d0039f50e3e3dffa56f8c3 (patch)
treecf84116dd5dbd30229dd64eb6fdd07c1baf108c3 /sunshine
parent41bb8f6643f186e8b2f773bdcd015bd33eb01e56 (diff)
If user from your list change avatar, sunshine will automatically change it on your list.
Diffstat (limited to 'sunshine')
-rw-r--r--sunshine/avatars.py9
-rw-r--r--sunshine/connection.py9
2 files changed, 13 insertions, 5 deletions
diff --git a/sunshine/avatars.py b/sunshine/avatars.py
index 1cfd905..54e557d 100644
--- a/sunshine/avatars.py
+++ b/sunshine/avatars.py
@@ -109,6 +109,15 @@ class SunshineAvatars(telepathy.server.ConnectionInterfaceAvatars):
# self.msn_client.profile.msn_object = None
# self._avatar_known = True
+ def getAvatar(self, sender, url):
+ logger.info("getAvatar: %s %s" % (sender, url))
+ handle_id = self.get_handle_id_by_name(telepathy.constants.HANDLE_TYPE_CONTACT, str(sender))
+
+ if handle_id != 0:
+ d = getPage(str(url), timeout=20)
+ d.addCallback(self.on_fetch_avatars_ok, str(url), handle_id)
+ d.addErrback(self.on_fetch_avatars_failed, str(url), handle_id)
+
def on_fetch_avatars_file_ok(self, result, url, handle_id):
try:
if result:
diff --git a/sunshine/connection.py b/sunshine/connection.py
index 18d119b..11928dc 100644
--- a/sunshine/connection.py
+++ b/sunshine/connection.py
@@ -286,7 +286,7 @@ class SunshineConnection(telepathy.server.Connection,
telepathy.server.Connection.__init__(self, 'gadugadu', account, 'sunshine')
telepathy.server.ConnectionInterfaceRequests.__init__(self)
SunshinePresence.__init__(self)
- SunshineAvatars.__init__(self)
+ self.avatars_interface = SunshineAvatars.__init__(self)
SunshineCapabilities.__init__(self)
SunshineContacts.__init__(self)
@@ -661,7 +661,7 @@ class SunshineConnection(telepathy.server.Connection,
#print 'message: ', message
channel.Received(self._recv_id, timestamp, handle, type, 0, message)
self._recv_id += 1
-
+
def onXmlAction(self, xml):
logger.info("XmlAction: %s" % xml.data)
@@ -684,9 +684,8 @@ class SunshineConnection(telepathy.server.Connection,
if type == '28':
sender = core.find("sender").text
url = core.find("bodyXML/smallAvatar").text
- print type
- print sender
- print url
+ logger.info("XMLAction: Avatar Update")
+ self.getAvatar(sender, url)
except:
pass